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 bcd609c5..ddf3d830 100644 --- a/src/DebugToolDrivers/Protocols/CMSIS-DAP/VendorSpecific/EDBG/AVR/EdbgAvr8Interface.cpp +++ b/src/DebugToolDrivers/Protocols/CMSIS-DAP/VendorSpecific/EDBG/AVR/EdbgAvr8Interface.cpp @@ -1215,8 +1215,11 @@ TargetRegisters EdbgAvr8Interface::readRegisters(const TargetRegisterDescriptors * See CommandFrames::Avr8Generic::ReadMemory(); and the Microchip EDBG documentation for more. */ auto excludedAddresses = std::set(); - if (this->targetParameters.ocdDataRegister.has_value()) { - excludedAddresses.insert(this->targetParameters.ocdDataRegister.value()); + if (memoryType == Avr8MemoryType::SRAM && this->targetParameters.ocdDataRegister.has_value()) { + excludedAddresses.insert( + this->targetParameters.ocdDataRegister.value() + + this->targetParameters.mappedIoSegmentStartAddress.value_or(0) + ); } auto flatMemoryBuffer = this->readMemory(