Commit f5c92e0ed3ee677d85543a8928b7c42b0cba1c44
receivedMon, 22. Jul 2024, 19:09:06 (by user sx)
Mon, 22 Jul 2024 17:09:06 +0000 (19:09 +0200)
authorManfred Steiner <sx@htl-kaindorf.at>
Mon, 22 Jul 2024 17:09:04 +0000 (19:09 +0200)
committerManfred Steiner <sx@htl-kaindorf.at>
Mon, 22 Jul 2024 17:09:04 +0000 (19:09 +0200)
software/gdb-stub/src/gdb.cpp

index 20ee10c581b270a07dfb6e04c8c8cc16e4ba21ba..5602acc7a26a370e24d23fbd1653702e8504def8 100644 (file)
@@ -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;