From: Manfred Steiner Date: Mon, 22 Jul 2024 17:09:04 +0000 (+0200) Subject: bugfix flashWrite X-Git-Url: https://git.htl-mechatronik.at/public/?a=commitdiff_plain;h=f5c92e0ed3ee677d85543a8928b7c42b0cba1c44;p=nano-x.git bugfix flashWrite --- diff --git a/software/gdb-stub/src/gdb.cpp b/software/gdb-stub/src/gdb.cpp index 20ee10c..5602acc 100644 --- a/software/gdb-stub/src/gdb.cpp +++ b/software/gdb-stub/src/gdb.cpp @@ -308,15 +308,15 @@ namespace gdb { bootloader::putUint8Hex(GDB_DEBUG_UART, (uint8_t)size); #endif - uint8_t *p = (uint8_t *)RAMSTART; uint16_t address = startAddress; + uint8_t *p = (uint8_t *)(RAMSTART + (address % SPM_PAGESIZE)); for (uint16_t i = 0; i < size; i++, address++) { uint16_t page = address / SPM_PAGESIZE; if (pgdb->status.flashPage >= 0 && page != (uint16_t)pgdb->status.flashPage) { flashWrite(); - p = (uint8_t *)RAMSTART; } if (pgdb->status.flashPage < 0) { + p = (uint8_t *)RAMSTART; pgdb->status.flashPage = address / SPM_PAGESIZE; for (uint16_t j = 0; j < SPM_PAGESIZE; j++) { p[j] = 0xff;