Updated lookup for OSCCAL_ADDR value from TDFs.

Included OSCCAL0, OSCCAL1, FOSCCAL0, SOSCCALA register lookups
This commit is contained in:
Nav
2021-06-06 00:43:18 +01:00
parent b78fef4efe
commit e9929927cb
3 changed files with 22 additions and 7 deletions

View File

@@ -218,8 +218,13 @@ class Avr8TargetDescriptionFile extends TargetDescriptionFile
}
}
if (isset($cpuRegisterGroup->registersMappedByName['osccal'])) {
$osccalRegister = $cpuRegisterGroup->registersMappedByName['osccal'];
$osccalRegister = $cpuRegisterGroup->registersMappedByName['osccal']
?? $cpuRegisterGroup->registersMappedByName['osccal0']
?? $cpuRegisterGroup->registersMappedByName['osccal1']
?? $cpuRegisterGroup->registersMappedByName['fosccal']
?? $cpuRegisterGroup->registersMappedByName['sosccala'] ?? null;
if (!is_null($osccalRegister)) {
$this->osccalAddress = $osccalRegister->offset;
}
}

View File

@@ -584,10 +584,22 @@ std::optional<Register> TargetDescriptionFile::getOscillatorCalibrationRegister(
auto cpuRegisterGroup = this->getCpuRegisterGroup();
if (cpuRegisterGroup.has_value()) {
auto osccalRegisterIt = cpuRegisterGroup->registersMappedByName.find("osccal");
auto& cpuRegisters = cpuRegisterGroup->registersMappedByName;
if (osccalRegisterIt != cpuRegisterGroup->registersMappedByName.end()) {
return osccalRegisterIt->second;
if (cpuRegisters.contains("oscall")) {
return cpuRegisters.at("oscall");
} else if (cpuRegisters.contains("osccal0")) {
return cpuRegisters.at("osccal0");
} else if (cpuRegisters.contains("osccal1")) {
return cpuRegisters.at("osccal1");
} else if (cpuRegisters.contains("fosccal")) {
return cpuRegisters.at("fosccal");
} else if (cpuRegisters.contains("sosccala")) {
return cpuRegisters.at("sosccala");
}
}

View File

@@ -162,8 +162,6 @@
</instance>
</module>
</peripherals>
<interrupts>
<interrupt index="0" name="RESET"
caption="External Pin, Power-on Reset, Brown-out Reset and Watchdog Reset"/>