alias _reset = set *((uint8_t *)0x8010fd) = 0x40
alias _startapp = set *((uint8_t *)0x8010fd) = 0x20
alias _killapp = set *((uint8_t *)0x8010fd) = 0x10
-#alias _status = print ((gdb::Gdb *)0x801039)->status
-#alias _ctrl = print ((gdb::Gdb *)0x801039)->ctrl
-#alias _breakpoint = print ((gdb::Gdb *)0x801039)->breakpoint
-#alias _buffer = print ((gdb::Gdb *)0x801039)->buffer
-#alias _gdb = print *((gdb::Gdb *)0x801039)
-alias _status = print ((gdb::Gdb *)0x800f8c)->status
-alias _ctrl = print ((gdb::Gdb *)0x800f8c)->ctrl
-alias _breakpoint = print ((gdb::Gdb *)0x800f8c)->breakpoint
-alias _buffer = print ((gdb::Gdb *)0x800f8c)->buffer
-alias __gdb = print ((gdb::Gdb *)0x800f8c)
-alias _gdb = print *((gdb::Gdb *)0x800f8c)
+alias _status = print ((gdb::Gdb *)0x80104a)->status
+alias _ctrl = print ((gdb::Gdb *)0x80104a)->ctrl
+alias _breakpoint = print ((gdb::Gdb *)0x80104a)->breakpoint
+alias _buffer = print ((gdb::Gdb *)0x80104a)->buffer
+alias __gdb = print ((gdb::Gdb *)0x80104a)
+alias _gdb = print *((gdb::Gdb *)0x80104a)
set print pretty
set history save on
#define GDB_PTR ((gdb::Gdb *)(RAMEND - sizeof(gdb::Gdb) + 1))
#define GDB_BREAKPOINT_PTR &((GDB_PTR)->breakpoint)
-// #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 - 6 - sizeof(gdb::Breakpoint))
namespace gdb {
- //const uint8_t BUFFER_SIZE = 13 + 5 + 128 + 3; // "$vFlashWrite:" + "ffff:" + 128 Bytes + "#00"
- const uint16_t BUFFER_SIZE = 13 + 5 + 300 + 3; // "$vFlashWrite:" + "ffff:" + 128 Bytes + "#00"
+ const uint8_t BUFFER_SIZE = 128; // vFlashWrite packet data (>256 bytes) handled via SRAM 0x500
+ // const uint8_t BUFFER_SIZE = 13 + 5 + 128 + 3; // "$vFlashWrite:" + "ffff:" + 128 Bytes + "#00"
enum BufferSubState { idle = 0, data, esc, chk1, chk2, chk2err, exec, execerr, send, waitack };
- struct Status { // (gdb) print ((gdb::Gdb *)0x801039)->status
+ struct Status { // (gdb) print ((gdb::Gdb *)0x80104a)->status
uint8_t errorFlags; // @0x10f9
int16_t flashPage; // @0x10fa
uint8_t isConnected:1; // @0x10fc Bit 0, address used in bootloader::jmpTableGdbStopApplication()
uint8_t isSendingNotification:1; // @0x10fc Bit 4
};
- struct Control { // (gdb) print ((gdb::Gdb *)0x801039)->ctrl
+ struct Control { // (gdb) print ((gdb::Gdb *)0x80104a)->ctrl
uint8_t clearErrors:1; // Bit 0
uint8_t interrupt:1; // Bit 1
uint8_t stop:1; // Bit 2
struct BufferState {
uint8_t binpack:1; // Bit 0
- uint8_t dbg1:1; // Bit 1 (for debugging)
- uint8_t dbg2:1; // Bit 2 (for debugging)
+ uint8_t dbg1:1; // Bit 1 (for debugging, not used by normal code)
+ uint8_t dbg2:1; // Bit 2 (for debugging, not used by normal code)
+ uint8_t dbg3:1; // Bit 3 (for debugging, not used by normal code)
+ uint8_t dbg4:1; // Bit 4 (for debugging, not used by normal code)
+ uint8_t dbg5:1; // Bit 5 (for debugging, not used by normal code)
+ uint8_t dbg6:1; // Bit 6 (for debugging, not used by normal code)
+ uint8_t dbg7:1; // Bit 7 (for debugging, not used by normal code)
+
enum BufferSubState substate;
};
- struct Buffer { // (gdb) print ((gdb::Gdb *)0x801039)->buffer
+ struct Buffer { // (gdb) print ((gdb::Gdb *)0x80104a)->buffer
// enum BufferState state;
struct BufferState state;
uint16_t rpos;
char buffer[BUFFER_SIZE];
};
- struct Breakpoint { // (gdb) print ((gdb::Gdb *)0x801039)->breakpoint
+ struct Breakpoint { // (gdb) print ((gdb::Gdb *)0x80104a)->breakpoint
uint8_t regs[32];
uint16_t sp;
uint16_t pc;
uint8_t sfr;
};
- struct Gdb { // (gdb) set print pretty (gdb) print *((gdb::Gdb *)0x801039)
- uint8_t timer;
- struct Buffer buffer;
- struct Breakpoint breakpoint;
- struct Status status;
- struct Control ctrl;
- uint8_t version;
- uint8_t magic;
+ // size: 182 = 0xb6 bytes, located on stack at the end of SRAM -> 0x1100 - 0xb6 = 0x104a (-> 0x104a..0x10ff)
+ struct Gdb { // (gdb) set print pretty (gdb) print *((gdb::Gdb *)0x80104a)
+ uint8_t timer; // 1 byte
+ struct Buffer buffer; // 137 bytes
+ struct Breakpoint breakpoint; // 37 bytes
+ struct Status status; // 4 bytes
+ struct Control ctrl; // 1 byte
+ uint8_t version; // 1 byte
+ uint8_t magic; // 1 byte
};
// --------------------------------------------------------------------------------------------------------
void serve500msTimer () ATT_OPTIMIZE_GDB ATT_SECTION_GDB;
void reset () ATT_OPTIMIZE_GDB ATT_SECTION_GDB;
- // void restart () ATT_OPTIMIZE_GDB ATT_SECTION_GDB;
void saveBreakpointRegs (struct Breakpoint *p) ATT_OPTIMIZE_GDB ATT_SECTION_GDB;
void checkByteFromGdb () ATT_OPTIMIZE_GDB ATT_SECTION_GDB;
- //void writeFlashOld (uint8_t *from, uint8_t size, uint16_t toPage) ATT_OPTIMIZE_GDB ATT_SECTION_GDB;
void flashErase (uint16_t addressStart, int32_t length) ATT_OPTIMIZE_GDB ATT_SECTION_GDB;
void flashFill (uint8_t *from, uint16_t size, uint16_t address) ATT_OPTIMIZE_GDB ATT_SECTION_GDB;
void flashWrite () ATT_OPTIMIZE_GDB ATT_SECTION_GDB;