Debugging Printer Firmware with MK404 - vintagepc/MK404 GitHub Wiki
You will need a few things to debug firmware with MK404:
- An intermediate ELF binary with debug symbols. You can recover this from the Arduino temp build directory (
Firmware.ino.elf) or configure avr-gcc to build one. - avr-gdb
- Mad GDB skillz (or read a good tutorial).
- Launch MK404 with any options required (SD filenames,
-f, etc), AND the--gdbargument. MK404 will pause on startup. - Start
avr-gdbin a terminal - Load the debug symbols:
(gdb) file Firmware.ino.elf - Set any breakpoints you wish, e.g.
b file:lineorb <function> - Connect to the target:
target extended-remote :1234 - GDB will halt execution and you'll see:
0x00000000 in __vectors () - Resume execution:
(gdb) cont - When you hit your breakpoint, go to town - you can examine variables with
p, or registers withx (uint8_t*)<addr>.