From 158a32a25912b42d56ecf3be0de97eeb30e168fa Mon Sep 17 00:00:00 2001 From: Nav Date: Sat, 14 May 2022 22:36:19 +0100 Subject: [PATCH] Fixed bug where we were incorrectly offsetting flash reads (see https://github.com/navnavnav/Bloom/issues/40) --- .../VendorSpecific/EDBG/AVR/EdbgAvr8Interface.cpp | 8 ++++++-- 1 file changed, 6 insertions(+), 2 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 f490f5d3..fe226f5a 100644 --- a/src/DebugToolDrivers/Protocols/CMSIS-DAP/VendorSpecific/EDBG/AVR/EdbgAvr8Interface.cpp +++ b/src/DebugToolDrivers/Protocols/CMSIS-DAP/VendorSpecific/EDBG/AVR/EdbgAvr8Interface.cpp @@ -1376,8 +1376,12 @@ namespace Bloom::DebugToolDrivers::Protocols::CmsisDap::Edbg::Avr int pagesRequired = static_cast(bytes / pageSize); TargetMemoryBuffer memoryBuffer; - for (auto i = 1; i <= pagesRequired; i++) { - auto pageBuffer = this->readMemory(type, startAddress + (pageSize * i), pageSize); + for (auto i = 0; i < pagesRequired; i++) { + auto pageBuffer = this->readMemory( + type, + startAddress + static_cast(pageSize * i), + pageSize + ); memoryBuffer.insert(memoryBuffer.end(), pageBuffer.begin(), pageBuffer.end()); }