6.3.1 arm-gdb Debug

With debug support enabled you can use arm-none-eabi-gdb (or gdb-multiarch) to debug the code used in the simulator.

Use arm-none-eabi-gdb with the .elf file as the parameter:

 arm-none-eabi-gdb compiled_file.elf
 

and the command below to connect (1234 is the default port):

 target remote localhost:1234
 

Graphic debug mode can be made using eclipse IDE with Eclipse Embedded CDT or using platformIO in VSCode, just add the configuration lines below in the project’s platformio.ini file:

upload_port = com7
;upload_port = /dev/tnt2
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