ESP8266 debugging tool
ESP8266 debugging tool intended to be used with esp-open-rtos. Based on Espressif/esp-gdbstub.
Configure with premake5 gmake
. The following options are supported:
--with-eor=/path/to/esp-open-rtos
: this option is required. It should point to an actual esp-open-rtos location.--with-threads
: enable RTOS task debugging. As for now, there is very basic support of threads, you will be able
to see multiple tasks when a breakpoint is hit, but GDB will most likely crash shorlty after. This option also has
a performance impact because a lot of data will be transferred through serial connection — consider increasing
the baudrate.
When thread support is enabled, you need to add the following definitions to CFLAGS of your project before compiling
FreeRTOS libs:
EXTRA_CFLAGS+=-DportREMOVE_STATIC_QUALIFIER -DINCLUDE_pcTaskGetTaskName=1
# The line above should go before including common.mk
Run make clean
after switching the state of this flag.
make
Add library to your project:
PROGRAM=blink
# Order is important!
EXTRA_CFLAGS+=-I../../../esp-gdbstub/include
EXTRA_LDFLAGS+=-L../../../esp-gdbstub/lib
include ../../common.mk
LIBS+=esp-gdbstub
PROGRAM_CFLAGS+=-O0
gdbstub_init()
after configuring UART speed.It has been observed that GDB may crash when user requests step over source in a file compiled with optimization turned on. I haven’t figured out why exactly this happens, but it has something to do with stack frame resolving. Turning optimization off for the whole project would impact performance and code size — that’s why only PROGRAM_CFLAGS
is modified.
To use Eclipse CDT for debugging, open Eclipse, create a new project and create a debug configuration for C/C++ Remote Application.
You need to set the following options:
Note that upon launching the debug session gdb will send “continue” command if the target is paused at gdbstub_do_break
. If you want to stop right after debug session launch, place gdbstub_do_break
macro twice in your code.