AVR8 EDBG memory types for programming mode

This commit is contained in:
Nav
2022-05-23 23:48:44 +01:00
parent 644724a529
commit 046eefb6e4

View File

@@ -570,6 +570,13 @@ namespace Bloom::DebugToolDrivers::Protocols::CmsisDap::Edbg::Avr
std::uint32_t bytes,
const std::set<Targets::TargetMemoryAddressRange>& excludedAddressRanges
) {
if (
this->programmingModeEnabled
&& (memoryType == TargetMemoryType::RAM || memoryType == TargetMemoryType::EEPROM)
) {
throw Exception("Cannot access RAM or EEPROM when programming mode is enabled");
}
auto avr8MemoryType = Avr8MemoryType::SRAM;
switch (memoryType) {
@@ -581,14 +588,14 @@ namespace Bloom::DebugToolDrivers::Protocols::CmsisDap::Edbg::Avr
if (this->configVariant == Avr8ConfigVariant::DEBUG_WIRE) {
avr8MemoryType = Avr8MemoryType::FLASH_PAGE;
} else if (this->configVariant == Avr8ConfigVariant::MEGAJTAG) {
avr8MemoryType = this->programmingModeEnabled ? Avr8MemoryType::FLASH_PAGE : Avr8MemoryType::SPM;
} else if (
this->configVariant == Avr8ConfigVariant::XMEGA
|| this->configVariant == Avr8ConfigVariant::UPDI
) {
avr8MemoryType = Avr8MemoryType::APPL_FLASH;
} else {
avr8MemoryType = Avr8MemoryType::SPM;
}
break;
}