Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

GDB support w/new toolchain and UART driver #5559

Merged
merged 21 commits into from
Jan 23, 2019
Merged
Show file tree
Hide file tree
Changes from 9 commits
Commits
Show all changes
21 commits
Select commit Hold shift + click to select a range
073299b
Add full gdb support with uart/Serial integration
kylefleming Mar 13, 2018
e618125
Merge branch 'master' into gdb
earlephilhower Dec 26, 2018
c3890bd
Fix GDB merge errors
earlephilhower Dec 26, 2018
211c2f3
Merge branch 'master' of https://github.com/esp8266/Arduino into gdb
earlephilhower Dec 27, 2018
6a714f3
Update to unpatched GDB protocol specification
earlephilhower Dec 27, 2018
a4c8ea4
Fix .iram.literal to come before .iram.text for GDB
earlephilhower Dec 27, 2018
b1d47e6
Move functions to flash, call using wrappers
earlephilhower Dec 27, 2018
b341c07
Remove LWIP2 builder commit
earlephilhower Dec 27, 2018
cc03543
Add documentation and gdbstub_init header
earlephilhower Dec 27, 2018
bb37b27
Merge branch 'master' into gdb
devyte Dec 28, 2018
0e2adcb
Clean up GDB include and library dir
earlephilhower Dec 30, 2018
fc7012f
Undo much of UART refactoring, set fifo IRQ to 16
earlephilhower Dec 31, 2018
33a21cd
Add architecture comments, cleanup uart.c code
earlephilhower Jan 1, 2019
e72291a
Also set the UART flags for HW error in GDB
Jan 2, 2019
bffd385
Merge branch 'master' into gdb
earlephilhower Jan 2, 2019
aef060b
Merge branch 'master' into gdb
earlephilhower Jan 8, 2019
a71d705
Merge branch 'master' into gdb
earlephilhower Jan 9, 2019
99da578
Merge branch 'master' into gdb
earlephilhower Jan 14, 2019
11a338c
Merge branch 'master' into gdb
earlephilhower Jan 17, 2019
06a28bd
Merge branch 'master' into gdb
earlephilhower Jan 18, 2019
a3ed4b4
Merge branch 'master' into gdb
earlephilhower Jan 23, 2019
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 10 additions & 4 deletions cores/esp8266/gdb_hooks.c
Original file line number Diff line number Diff line change
Expand Up @@ -25,12 +25,18 @@
value is in register, it doesn't hurt to return a bool, so that the
same stub can be used for gdb_present. */

bool ICACHE_RAM_ATTR __gdb_no_op()
static bool ICACHE_RAM_ATTR __gdb_no_op()
{
return false;
}

extern void gdb_init(void) __attribute__ ((weak, alias("__gdb_no_op")));
extern void gdb_do_break(void) __attribute__ ((weak, alias("__gdb_no_op")));
extern bool gdb_present(void) __attribute__ ((weak, alias("__gdb_no_op")));
void gdb_init(void) __attribute__ ((weak, alias("__gdb_no_op")));
void gdb_do_break(void) __attribute__ ((weak, alias("__gdb_no_op")));
bool gdb_present(void) __attribute__ ((weak, alias("__gdb_no_op")));
bool gdbstub_has_putc1_control(void) __attribute__ ((weak, alias("__gdb_no_op")));
void gdbstub_set_putc1_callback(void (*func)(char)) __attribute__ ((weak, alias("__gdb_no_op")));
bool gdbstub_has_uart_isr_control(void) __attribute__ ((weak, alias("__gdb_no_op")));
void gdbstub_set_uart_isr_callback(void (*func)(void*, uint8_t), void* arg) __attribute__ ((weak, alias("__gdb_no_op")));
void gdbstub_write_char(char c) __attribute__ ((weak, alias("__gdb_no_op")));
void gdbstub_write(const char* buf, size_t size) __attribute__ ((weak, alias("__gdb_no_op")));

65 changes: 65 additions & 0 deletions cores/esp8266/gdb_hooks.h
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,71 @@ void gdb_do_break(void);
*/
bool gdb_present(void);

// If gdbstub has these set true, then we will disable our own
// usage of them, but use gdbstub's callbacks for them instead
/**
* @brief Check if GDB is installing a putc1 callback.
*
* By default, this function returns false. When GDBStub library is linked,
* this function is overriden and returns true.
*
* @return true if GDB is installing a putc1 callback
*/
bool gdbstub_has_putc1_control(void);

/**
* @brief Register a putc1 callback with GDB.
* @param func function GDB will proxy putc1 data to
*
* By default, this function is a no-op. When GDBStub library is linked,
* this function is overriden and sets GDB stub's secondary putc1 callback to
* func. When GDB stub is linked, but a GDB session is not current attached,
* then GDB stub will pass putc1 chars directly to this function.
*/
void gdbstub_set_putc1_callback(void (*func)(char));

/**
* @brief Check if GDB is installing a uart0 isr callback.
*
* By default, this function returns false. When GDBStub library is linked,
* this function is overriden and returns true.
*
* @return true if GDB is installing a uart0 isr callback
*/
bool gdbstub_has_uart_isr_control(void);

/**
* @brief Register a uart0 isr callback with GDB.
* @param func function GDB will proxy uart0 isr data to
*
* By default, this function is a no-op. When GDBStub library is linked,
* this function is overriden and sets GDB stub's secondary uart0 isr callback
* to func. When GDB stub is linked, but a GDB session is not current attached,
* then GDB stub will pass uart0 isr data back to this function.
*/
void gdbstub_set_uart_isr_callback(void (*func)(void*, uint8_t), void* arg);

/**
* @brief Write a character for output to a GDB session on uart0.
* @param c character to write
*
* By default, this function is a no-op. When GDBStub library is linked,
* this function is overriden and writes a char to either the GDB session on
* uart0 or directly to uart0 if not GDB session is attached.
*/
void gdbstub_write_char(char c);

/**
* @brief Write a char buffer for output to a GDB session on uart0.
* @param buf buffer of data to write
* @param size length of buffer
*
* By default, this function is a no-op. When GDBStub library is linked,
* this function is overriden and writes a buffer to either the GDB session on
* uart0 or directly to uart0 if not GDB session is attached.
*/
void gdbstub_write(const char* buf, size_t size);

#ifdef __cplusplus
}
#endif
Loading