Using FLASH_PAGE memory type in the AVR8 EDBG driver, for flash memory access in UPDI targets
This commit is contained in:
@@ -627,16 +627,29 @@ namespace Bloom::DebugToolDrivers::Protocols::CmsisDap::Edbg::Avr
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case TargetMemoryType::FLASH: {
|
case TargetMemoryType::FLASH: {
|
||||||
if (this->configVariant == Avr8ConfigVariant::DEBUG_WIRE) {
|
if (
|
||||||
|
this->configVariant == Avr8ConfigVariant::DEBUG_WIRE
|
||||||
|
|| this->configVariant == Avr8ConfigVariant::UPDI
|
||||||
|
) {
|
||||||
avr8MemoryType = Avr8MemoryType::FLASH_PAGE;
|
avr8MemoryType = Avr8MemoryType::FLASH_PAGE;
|
||||||
|
|
||||||
} else if (this->configVariant == Avr8ConfigVariant::MEGAJTAG) {
|
} else if (this->configVariant == Avr8ConfigVariant::MEGAJTAG) {
|
||||||
avr8MemoryType = this->programmingModeEnabled ? Avr8MemoryType::FLASH_PAGE : Avr8MemoryType::SPM;
|
avr8MemoryType = this->programmingModeEnabled ? Avr8MemoryType::FLASH_PAGE : Avr8MemoryType::SPM;
|
||||||
|
|
||||||
} else if (
|
} else if (this->configVariant == Avr8ConfigVariant::XMEGA) {
|
||||||
this->configVariant == Avr8ConfigVariant::XMEGA || this->configVariant == Avr8ConfigVariant::UPDI
|
const auto bootSectionStartAddress = this->targetParameters.bootSectionStartAddress.value();
|
||||||
) {
|
if (startAddress >= bootSectionStartAddress) {
|
||||||
avr8MemoryType = Avr8MemoryType::APPL_FLASH;
|
avr8MemoryType = Avr8MemoryType::BOOT_FLASH;
|
||||||
|
|
||||||
|
/*
|
||||||
|
* When using the BOOT_FLASH memory type, the address should be relative to the start of the
|
||||||
|
* boot section.
|
||||||
|
*/
|
||||||
|
startAddress -= bootSectionStartAddress;
|
||||||
|
|
||||||
|
} else {
|
||||||
|
avr8MemoryType = Avr8MemoryType::APPL_FLASH;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@@ -684,15 +697,16 @@ namespace Bloom::DebugToolDrivers::Protocols::CmsisDap::Edbg::Avr
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case TargetMemoryType::FLASH: {
|
case TargetMemoryType::FLASH: {
|
||||||
if (this->configVariant == Avr8ConfigVariant::DEBUG_WIRE) {
|
if (
|
||||||
|
this->configVariant == Avr8ConfigVariant::DEBUG_WIRE
|
||||||
|
|| this->configVariant == Avr8ConfigVariant::UPDI
|
||||||
|
) {
|
||||||
avr8MemoryType = Avr8MemoryType::FLASH_PAGE;
|
avr8MemoryType = Avr8MemoryType::FLASH_PAGE;
|
||||||
|
|
||||||
} else if (this->configVariant == Avr8ConfigVariant::MEGAJTAG) {
|
} else if (this->configVariant == Avr8ConfigVariant::MEGAJTAG) {
|
||||||
avr8MemoryType = this->programmingModeEnabled ? Avr8MemoryType::FLASH_PAGE : Avr8MemoryType::SPM;
|
avr8MemoryType = this->programmingModeEnabled ? Avr8MemoryType::FLASH_PAGE : Avr8MemoryType::SPM;
|
||||||
|
|
||||||
} else if (
|
} else if (this->configVariant == Avr8ConfigVariant::XMEGA) {
|
||||||
this->configVariant == Avr8ConfigVariant::XMEGA || this->configVariant == Avr8ConfigVariant::UPDI
|
|
||||||
) {
|
|
||||||
const auto bootSectionStartAddress = this->targetParameters.bootSectionStartAddress.value();
|
const auto bootSectionStartAddress = this->targetParameters.bootSectionStartAddress.value();
|
||||||
if (startAddress >= bootSectionStartAddress) {
|
if (startAddress >= bootSectionStartAddress) {
|
||||||
avr8MemoryType = Avr8MemoryType::BOOT_FLASH;
|
avr8MemoryType = Avr8MemoryType::BOOT_FLASH;
|
||||||
|
|||||||
Reference in New Issue
Block a user