6.4.1 ESP32-gdb Debug
With debug support enabled you can use xtensa-esp32-elf-gdb to debug the code used in the simulator.
Use xtensa-esp32-elf-gdb with the .elf file as the parameter:
xtensa-esp32-elf-gdb compiled_file.elf
and the command below to connect (1234 is the default port):
target extended-remote localhost:1234
Graphic debug mode can be made using platformIO in VSCode, just add the configuration lines below in the project’s platformio.ini file:
;upload_protocol = esptool ;upload_port = COM7 ;upload_port = /dev/tnt2 upload_protocol = custom upload_command = C:\"Program Files"\PicsimLab\picsimlab_tool.exe loadbin "$BUILD_DIR/firmware.bin" ;upload_command = /usr/bin/picsimlab_tool loadbin "$BUILD_DIR/firmware.bin" build_type = debug debug_tool = custom debug_port = localhost:1234 debug_build_flags = -O2 -g debug_init_break = tbreak main debug_init_cmds = define pio_reset_halt_target monitor system_reset end define pio_reset_run_target monitor system_reset end target extended-remote $DEBUG_PORT $LOAD_CMDS pio_reset_halt_target $INIT_BREAK
Compile, and upload the code to PICSimLab before starting Debug.