6.2.1 avr-gdb Debug
With debug support enabled you can use avr-gdb to debug the code used in the simulator. Use the configuration window to choose between MDB (MPLABX) or GDB to debug AVR microcontrollers.
Use avr-gdb with the .elf file as the parameter:
avr-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 Sloeber Arduino plugin.
It is also possible to debug using platformIO in VSCode, just add the configuration lines below in the project’s platformio.ini file:
;upload_protocol = arduino ;upload_port = COM7 ;upload_port = /dev/tnt3 ;monitor_port = /dev/tnt3 upload_protocol = custom upload_command = C:\"Program Files"\PicsimLab\picsimlab_tool.exe loadhex "$BUILD_DIR/firmware.hex" ;upload_command = /usr/bin/picsimlab_tool loadhex "$BUILD_DIR/firmware.hex" build_type = debug debug_tool = custom debug_port = localhost:1234 debug_build_flags = -O2 -g debug_init_break = tbreak setup debug_init_cmds = define pio_reset_halt_target end define pio_reset_run_target end target extended-remote $DEBUG_PORT $LOAD_CMDS pio_reset_halt_target $INIT_BREAK