Corrected use of destroyed objects in EDBG param constructors

This commit is contained in:
Nav
2024-06-02 21:33:54 +01:00
parent 1c702227fe
commit 4e837218e5
3 changed files with 10 additions and 11 deletions

View File

@@ -36,8 +36,8 @@ namespace DebugToolDrivers::Microchip::Protocols::Edbg::Avr::Parameters::Avr8Gen
this->ocdRevision = StringService::toUint8(ocdPropertyGroup.getProperty("ocd_revision").value); this->ocdRevision = StringService::toUint8(ocdPropertyGroup.getProperty("ocd_revision").value);
this->ocdDataRegisterAddress = StringService::toUint8(ocdPropertyGroup.getProperty("ocd_datareg").value); this->ocdDataRegisterAddress = StringService::toUint8(ocdPropertyGroup.getProperty("ocd_datareg").value);
const auto& eepromRegisterGroupDescriptor = targetDescriptionFile.getTargetPeripheralDescriptor("eeprom") const auto eepromPeripheralDescriptor = targetDescriptionFile.getTargetPeripheralDescriptor("eeprom");
.getRegisterGroupDescriptor("eeprom"); const auto& eepromRegisterGroupDescriptor = eepromPeripheralDescriptor.getRegisterGroupDescriptor("eeprom");
const auto& eearDescriptor = eepromRegisterGroupDescriptor.tryGetRegisterDescriptor("eear"); const auto& eearDescriptor = eepromRegisterGroupDescriptor.tryGetRegisterDescriptor("eear");
if (eearDescriptor.has_value()) { if (eearDescriptor.has_value()) {
@@ -77,8 +77,8 @@ namespace DebugToolDrivers::Microchip::Protocols::Edbg::Avr::Parameters::Avr8Gen
eepromRegisterGroupDescriptor.getRegisterDescriptor("eecr").startAddress eepromRegisterGroupDescriptor.getRegisterDescriptor("eecr").startAddress
); );
const auto& cpuRegisterGroupDescriptor = targetDescriptionFile.getTargetPeripheralDescriptor("cpu") const auto cpuPeripheralDescriptor = targetDescriptionFile.getTargetPeripheralDescriptor("cpu");
.getRegisterGroupDescriptor("cpu"); const auto& cpuRegisterGroupDescriptor = cpuPeripheralDescriptor.getRegisterGroupDescriptor("cpu");
const auto spmcsrDescriptor = cpuRegisterGroupDescriptor.tryGetRegisterDescriptor("spmcsr") const auto spmcsrDescriptor = cpuRegisterGroupDescriptor.tryGetRegisterDescriptor("spmcsr")
?: cpuRegisterGroupDescriptor.tryGetRegisterDescriptor("spmcr"); ?: cpuRegisterGroupDescriptor.tryGetRegisterDescriptor("spmcr");
@@ -87,9 +87,8 @@ namespace DebugToolDrivers::Microchip::Protocols::Edbg::Avr::Parameters::Avr8Gen
this->spmcrAddress = static_cast<std::uint8_t>(spmcsrDescriptor->get().startAddress); this->spmcrAddress = static_cast<std::uint8_t>(spmcsrDescriptor->get().startAddress);
} else { } else {
const auto& bootLoaderRegisterGroupDescriptor = targetDescriptionFile.getTargetPeripheralDescriptor( const auto bootLoadPeripheral = targetDescriptionFile.getTargetPeripheralDescriptor("boot_load");
"boot_load" const auto& bootLoaderRegisterGroupDescriptor = bootLoadPeripheral.getRegisterGroupDescriptor("boot_load");
).getRegisterGroupDescriptor("boot_load");
const auto spmcsrDescriptor = bootLoaderRegisterGroupDescriptor.tryGetRegisterDescriptor("spmcsr") const auto spmcsrDescriptor = bootLoaderRegisterGroupDescriptor.tryGetRegisterDescriptor("spmcsr")
?: bootLoaderRegisterGroupDescriptor.tryGetRegisterDescriptor("spmcr"); ?: bootLoaderRegisterGroupDescriptor.tryGetRegisterDescriptor("spmcr");

View File

@@ -30,8 +30,9 @@ namespace DebugToolDrivers::Microchip::Protocols::Edbg::Avr::Parameters::Avr8Gen
this->eepromSize = static_cast<std::uint16_t>(eepromMemorySegment.size); this->eepromSize = static_cast<std::uint16_t>(eepromMemorySegment.size);
this->eepromPageSize = static_cast<std::uint8_t>(eepromMemorySegment.pageSize.value()); this->eepromPageSize = static_cast<std::uint8_t>(eepromMemorySegment.pageSize.value());
const auto nvmPeripheralDescriptor = targetDescriptionFile.getTargetPeripheralDescriptor("nvm");
this->nvmModuleBaseAddress = static_cast<std::uint16_t>( this->nvmModuleBaseAddress = static_cast<std::uint16_t>(
targetDescriptionFile.getTargetPeripheralDescriptor("nvm").getRegisterGroupDescriptor("nvm").startAddress() nvmPeripheralDescriptor.getRegisterGroupDescriptor("nvm").startAddress()
); );
} }
} }

View File

@@ -30,10 +30,9 @@ namespace DebugToolDrivers::Microchip::Protocols::Edbg::Avr::Parameters::Avr8Gen
this->fuseSegmentStartAddress = static_cast<std::uint16_t>(fuseMemorySegment.startAddress); this->fuseSegmentStartAddress = static_cast<std::uint16_t>(fuseMemorySegment.startAddress);
this->lockbitSegmentStartAddress = static_cast<std::uint16_t>(lockbitMemorySegment.startAddress); this->lockbitSegmentStartAddress = static_cast<std::uint16_t>(lockbitMemorySegment.startAddress);
const auto nvmCtrlPeripheralDescriptor = targetDescriptionFile.getTargetPeripheralDescriptor("nvmctrl");
this->nvmModuleBaseAddress = static_cast<std::uint16_t>( this->nvmModuleBaseAddress = static_cast<std::uint16_t>(
targetDescriptionFile.getTargetPeripheralDescriptor("nvmctrl").getRegisterGroupDescriptor( nvmCtrlPeripheralDescriptor.getRegisterGroupDescriptor("nvmctrl").startAddress()
"nvmctrl"
).startAddress()
); );
} }
} }