From f64a14b04a9349e2c52ccae4c0e43884ca17552c Mon Sep 17 00:00:00 2001 From: Nav Date: Sun, 18 Dec 2022 19:23:58 +0000 Subject: [PATCH] Corrected memory type used for memory writes with the JTAG config variant, in the EDBG AVR8 driver --- .../EDBG/AVR/EdbgAvr8Interface.cpp | 28 ++++++++++++++----- 1 file changed, 21 insertions(+), 7 deletions(-) diff --git a/src/DebugToolDrivers/Protocols/CMSIS-DAP/VendorSpecific/EDBG/AVR/EdbgAvr8Interface.cpp b/src/DebugToolDrivers/Protocols/CMSIS-DAP/VendorSpecific/EDBG/AVR/EdbgAvr8Interface.cpp index 0bc0be20..fb472435 100644 --- a/src/DebugToolDrivers/Protocols/CMSIS-DAP/VendorSpecific/EDBG/AVR/EdbgAvr8Interface.cpp +++ b/src/DebugToolDrivers/Protocols/CMSIS-DAP/VendorSpecific/EDBG/AVR/EdbgAvr8Interface.cpp @@ -735,14 +735,28 @@ namespace Bloom::DebugToolDrivers::Protocols::CmsisDap::Edbg::Avr break; } case TargetMemoryType::EEPROM: { - avr8MemoryType = - this->configVariant == Avr8ConfigVariant::XMEGA || this->configVariant == Avr8ConfigVariant::UPDI - ? Avr8MemoryType::EEPROM_ATOMIC - : Avr8MemoryType::EEPROM; + switch (this->configVariant) { + case Avr8ConfigVariant::UPDI: + case Avr8ConfigVariant::XMEGA: { + avr8MemoryType = Avr8MemoryType::EEPROM_ATOMIC; - if (this->configVariant == Avr8ConfigVariant::XMEGA) { - // EEPROM addresses should be in relative form, for XMEGA (PDI) targets - startAddress -= this->targetParameters.eepromStartAddress.value(); + if (this->configVariant == Avr8ConfigVariant::XMEGA) { + // EEPROM addresses should be in relative form, for XMEGA (PDI) targets + startAddress -= this->targetParameters.eepromStartAddress.value(); + } + + break; + } + case Avr8ConfigVariant::MEGAJTAG: { + avr8MemoryType = this->programmingModeEnabled + ? Avr8MemoryType::EEPROM_PAGE + : Avr8MemoryType::EEPROM; + break; + } + default: { + avr8MemoryType = Avr8MemoryType::EEPROM; + break; + } } } default: {