Fixed typo in AVR8 target parameter and introduced "SPMCR" fallback value from part description
This commit is contained in:
@@ -245,9 +245,9 @@ void EdbgAvr8Interface::setTargetParameters(const Avr8Bit::TargetParameters& con
|
||||
this->setParameter(Avr8EdbgParameters::DEVICE_OCD_DATA_REGISTER, config.ocdDataRegister.value());
|
||||
}
|
||||
|
||||
if (config.spmcsRegisterStartAddress.has_value()) {
|
||||
if (config.spmcRegisterStartAddress.has_value()) {
|
||||
Logger::debug("Setting DEVICE_SPMCR_REGISTER AVR8 parameter");
|
||||
this->setParameter(Avr8EdbgParameters::DEVICE_SPMCR_REGISTER, config.spmcsRegisterStartAddress.value());
|
||||
this->setParameter(Avr8EdbgParameters::DEVICE_SPMCR_REGISTER, config.spmcRegisterStartAddress.value());
|
||||
}
|
||||
|
||||
if (config.osccalAddress.has_value()) {
|
||||
|
||||
@@ -313,9 +313,15 @@ TargetParameters& Avr8::getTargetParameters() {
|
||||
}
|
||||
}
|
||||
|
||||
auto spmcsrRegister = this->partDescription->getSpmcsrRegister();
|
||||
if (spmcsrRegister.has_value()) {
|
||||
this->targetParameters->spmcsRegisterStartAddress = spmcsrRegister->offset;
|
||||
auto spmcsRegister = this->partDescription->getSpmcsRegister();
|
||||
if (spmcsRegister.has_value()) {
|
||||
this->targetParameters->spmcRegisterStartAddress = spmcsRegister->offset;
|
||||
|
||||
} else {
|
||||
auto spmcRegister = this->partDescription->getSpmcRegister();
|
||||
if (spmcRegister.has_value()) {
|
||||
this->targetParameters->spmcRegisterStartAddress = spmcRegister->offset;
|
||||
}
|
||||
}
|
||||
|
||||
auto osccalRegister = this->partDescription->getOscillatorCalibrationRegister();
|
||||
|
||||
@@ -624,6 +624,21 @@ std::optional<RegisterGroup> PartDescriptionFile::getCpuRegisterGroup() const {
|
||||
return std::nullopt;
|
||||
}
|
||||
|
||||
std::optional<RegisterGroup> PartDescriptionFile::getBootLoadRegisterGroup() const {
|
||||
auto& modulesByName = this->getModulesMappedByName();
|
||||
|
||||
if (modulesByName.contains("boot_load")) {
|
||||
auto& bootLoadModule = modulesByName.at("boot_load");
|
||||
auto bootLoadRegisterGroupIt = bootLoadModule.registerGroupsMappedByName.find("boot_load");
|
||||
|
||||
if (bootLoadRegisterGroupIt != bootLoadModule.registerGroupsMappedByName.end()) {
|
||||
return bootLoadRegisterGroupIt->second;
|
||||
}
|
||||
}
|
||||
|
||||
return std::nullopt;
|
||||
}
|
||||
|
||||
std::optional<RegisterGroup> PartDescriptionFile::getEepromRegisterGroup() const {
|
||||
auto& modulesByName = this->getModulesMappedByName();
|
||||
|
||||
@@ -709,14 +724,28 @@ std::optional<Register> PartDescriptionFile::getOscillatorCalibrationRegister()
|
||||
return std::nullopt;
|
||||
}
|
||||
|
||||
std::optional<Register> PartDescriptionFile::getSpmcsrRegister() const {
|
||||
std::optional<Register> PartDescriptionFile::getSpmcsRegister() const {
|
||||
auto cpuRegisterGroup = this->getCpuRegisterGroup();
|
||||
|
||||
if (cpuRegisterGroup.has_value()) {
|
||||
auto spmcsrRegisterIt = cpuRegisterGroup->registersMappedByName.find("spmcsr");
|
||||
auto spmcsRegisterIt = cpuRegisterGroup->registersMappedByName.find("spmcsr");
|
||||
|
||||
if (spmcsrRegisterIt != cpuRegisterGroup->registersMappedByName.end()) {
|
||||
return spmcsrRegisterIt->second;
|
||||
if (spmcsRegisterIt != cpuRegisterGroup->registersMappedByName.end()) {
|
||||
return spmcsRegisterIt->second;
|
||||
}
|
||||
}
|
||||
|
||||
return std::nullopt;
|
||||
}
|
||||
|
||||
std::optional<Register> PartDescriptionFile::getSpmcRegister() const {
|
||||
auto bootLoadRegisterGroup = this->getBootLoadRegisterGroup();
|
||||
|
||||
if (bootLoadRegisterGroup.has_value()) {
|
||||
auto spmcRegisterIt = bootLoadRegisterGroup->registersMappedByName.find("spmcr");
|
||||
|
||||
if (spmcRegisterIt != bootLoadRegisterGroup->registersMappedByName.end()) {
|
||||
return spmcRegisterIt->second;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -158,13 +158,15 @@ namespace Bloom::Targets::Microchip::Avr::Avr8Bit::PartDescription
|
||||
std::optional<MemorySegment> getEepromMemorySegment() const;
|
||||
std::optional<MemorySegment> getFirstBootSectionMemorySegment() const;
|
||||
std::optional<RegisterGroup> getCpuRegisterGroup() const;
|
||||
std::optional<RegisterGroup> getBootLoadRegisterGroup() const;
|
||||
std::optional<RegisterGroup> getEepromRegisterGroup() const;
|
||||
std::optional<Register> getStatusRegister() const;
|
||||
std::optional<Register> getStackPointerRegister() const;
|
||||
std::optional<Register> getStackPointerHighRegister() const;
|
||||
std::optional<Register> getStackPointerLowRegister() const;
|
||||
std::optional<Register> getOscillatorCalibrationRegister() const;
|
||||
std::optional<Register> getSpmcsrRegister() const;
|
||||
std::optional<Register> getSpmcsRegister() const;
|
||||
std::optional<Register> getSpmcRegister() const;
|
||||
std::optional<Register> getEepromAddressRegister() const;
|
||||
std::optional<Register> getEepromDataRegister() const;
|
||||
std::optional<Register> getEepromControlRegister() const;
|
||||
|
||||
@@ -33,7 +33,7 @@ namespace Bloom::Targets::Microchip::Avr::Avr8Bit
|
||||
std::optional<std::uint16_t> statusRegisterSize;
|
||||
std::optional<std::uint16_t> stackPointerRegisterStartAddress;
|
||||
std::optional<std::uint16_t> stackPointerRegisterSize;
|
||||
std::optional<std::uint8_t> spmcsRegisterStartAddress;
|
||||
std::optional<std::uint8_t> spmcRegisterStartAddress;
|
||||
std::optional<std::uint8_t> osccalAddress;
|
||||
|
||||
// XMega/PDI specific target params
|
||||
|
||||
Reference in New Issue
Block a user