Commit 1d6e29e42ecfbca2f6f63d9c8231d6f3e4a8dac1
receivedSun, 21. Jul 2024, 07:42:16 (by user sx)
Sun, 21 Jul 2024 05:42:16 +0000 (07:42 +0200)
authorManfred Steiner <sx@htl-kaindorf.at>
Sun, 21 Jul 2024 05:42:10 +0000 (07:42 +0200)
committerManfred Steiner <sx@htl-kaindorf.at>
Sun, 21 Jul 2024 05:42:10 +0000 (07:42 +0200)
2 files changed:
software/gdb-stub/src/gdb.cpp
software/gdb-stub/src/gdb.h

index 66ad7dad06193abc27b55f4b9b0f82b4b919f12a..64b1e13224e9a1d9ac12ef6f42cde591c27b897b 100644 (file)
@@ -38,7 +38,8 @@ namespace gdb {
        // const char gdb_QStartNoAckMode[]    GDBMEM = "QStartNoAckMode+";
        // const char gdb_QXferExecFileRead[]  GDBMEM = "qXfer:exec-file:read+";
 
-       const char gdb_mem[]                GDBMEM = "$l<memory-map><memory type=\"flash\" start=\"0\" length=\"0x10000\"><property name=\"blocksize\">0x100</property></memory><memory type=\"flash\" start=\"0x810000\" length=\"0x800\"><property name=\"blocksize\">0x01</property></memory></memory-map>#";
+       //const char gdb_mem[]                GDBMEM = "$l<memory-map><memory type=\"flash\" start=\"0\" length=\"0x10000\"><property name=\"blocksize\">0x100</property></memory><memory type=\"ram\" start=\"0x800000\" length=\"0x1100\"/>'<memory type=\"flash\" start=\"0x810000\" length=\"0x800\"><property name=\"blocksize\">0x01</property></memory></memory-map>#";
+       const char gdb_mem[]                GDBMEM = "$l<memory-map><memory type=\"flash\" start=\"0\" length=\"0x10000\"><property name=\"blocksize\">0x100</property></memory><memory type=\"ram\" start=\"0x800000\" length=\"0x1100\"/>'<memory type=\"ram\" start=\"0x810000\" length=\"0x800\"/></memory-map>#";
 
        // struct Gdb gdb;
        // struct Buffer buf;
@@ -108,7 +109,7 @@ namespace gdb {
                        "std   Y+36, r27    \n"
                        "ldd   r25, Z+7     \n"  // restore original r25
 
-                       "ldd   r27, Z+10     \n"  // original (PCH/2) -> r27 (XH)
+                       "ldd   r27, Z+10    \n"  // original (PCH/2) -> r27 (XH)
                        "ldd   r26, Z+11    \n"  // original (PCL/2) -> r26 (XL)
                        "adiw  r30, 11      \n"  // restore SP in stop() (4x push + 3x call)
                        "std   Y+32, r30    \n"  // save SPL
@@ -317,7 +318,7 @@ namespace gdb {
                                pgdb->status.isAppStarted = 0;
                        }
 
-               } else if (pgdb->ctrl.notify && pgdb->buffer.state != idle) {
+               } else if (pgdb->ctrl.notify && pgdb->buffer.state == idle) {
                        pgdb->ctrl.notify = 0;
                        pgdb->timer = 20;
                        xputsmem(gdb_StatusStop);
@@ -669,10 +670,10 @@ namespace gdb {
                                        }
 
                                } else  {
-                                       bootloader::putnc(0, c, 1);
-                                       bootloader::putnc(0, ' ', 1); bootloader::putUint8Hex(0, i);
-                                       bootloader::putnc(0, ' ',2); bootloader::putUint8Hex(0, sum);
-                                       bootloader::putln(0);
+                                       // bootloader::putnc(0, c, 1);
+                                       // bootloader::putnc(0, ' ', 1); bootloader::putUint8Hex(0, i);
+                                       // bootloader::putnc(0, ' ',2); bootloader::putUint8Hex(0, sum);
+                                       // bootloader::putln(0);
                                }
 
                        }
index eb6217596094d64315ab594d2e8f06fda06ba0d3..0a13e41ddf73c3609e45f394a106de47ac8bb4cd 100644 (file)
@@ -16,8 +16,9 @@
 
 
 #define GDB_PTR (gdb::Gdb *)(RAMEND - sizeof(gdb::Gdb) + 1)
-//#define GDB_BREAKPOINT_PTR (struct gdb::Breakpoint *)(RAMEND - 2 - sizeof(gdb::Control) - sizeof(gdb::Status) - sizeof(gdb::Breakpoint) + 1)
+// #define GDB_BREAKPOINT_PTR (struct gdb::Breakpoint *)(RAMEND - 2 - sizeof(gdb::Control) - sizeof(gdb::Status) - sizeof(gdb::Breakpoint))
 #define GDB_BREAKPOINT_PTR (struct gdb::Breakpoint *)(RAMEND - 4 - sizeof(gdb::Breakpoint))
+// #define GDB_BREAKPOINT_PTR (struct gdb::Breakpoint *)(RAMEND - 6 - sizeof(gdb::Breakpoint))
 
 namespace gdb {
 
@@ -26,24 +27,25 @@ namespace gdb {
        enum BufferState { idle = 0, data, esc, chk1, chk2, chk2err, exec, execerr, send, waitack };
 
 
-       struct Status { // (gdb) print *((struct gdb::Status *)0x8010fb)
-               uint8_t errorFlags;               // @0x18fb
-               uint8_t isConnected:1;            // @0x18fc.0x01, address used in bootloader::jmpTableGdbStopApplication()
-               uint8_t isAppStarted:1;           // @0x18fc.0x02
-               uint8_t isStopped:1;              // @0x18fc.0x04
-               uint8_t isBreakpointValid:1;      // @0x18fc.0x08
-               uint8_t isSendingNotification:1;  // @0x18fc.0x10
+       struct Status { // (gdb) print *((struct gdb::Status *)0x8010f9)
+               uint8_t errorFlags;               // @0x10f9
+               // int16_t flashPage;                // @0x10fa
+               uint8_t isConnected:1;            // @0x10fc.0x01, address used in bootloader::jmpTableGdbStopApplication()
+               uint8_t isAppStarted:1;           // @0x10fc.0x02
+               uint8_t isStopped:1;              // @0x10fc.0x04
+               uint8_t isBreakpointValid:1;      // @0x10fc.0x08
+               uint8_t isSendingNotification:1;  // @0x10fc.0x10
        };
 
        struct Control { // (gdb) print *((struct gdb::Control *)0x8010fd)
-               uint8_t clearErrors:1; // @0x18fd.0x01
-               uint8_t interrupt:1;   // @0x18fd.0x02
-               uint8_t stop:1;        // @0x18fd.0x04
-               uint8_t proceed:1;     // @0x18fd.0x08
-               uint8_t kill:1;        // @0x18fd.0x10
-               uint8_t start:1;       // @0x18fd.0x20
-               uint8_t reset:1;       // @0x18fd.0x40
-               uint8_t notify:1;      // @0x18fd.0x80
+               uint8_t clearErrors:1; // @0x10fd.0x01
+               uint8_t interrupt:1;   // @0x10fd.0x02
+               uint8_t stop:1;        // @0x10fd.0x04
+               uint8_t proceed:1;     // @0x10fd.0x08
+               uint8_t kill:1;        // @0x10fd.0x10
+               uint8_t start:1;       // @0x10fd.0x20
+               uint8_t reset:1;       // @0x10fd.0x40
+               uint8_t notify:1;      // @0x10fd.0x80
        };
 
        struct Buffer {