-
Notifications
You must be signed in to change notification settings - Fork 9
Debugging Printer Firmware with MK404
vintagepc edited this page Dec 2, 2021
·
2 revisions
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--gdb
argument. MK404 will pause on startup. - Start
avr-gdb
in a terminal - Load the debug symbols:
(gdb) file Firmware.ino.elf
- Set any breakpoints you wish, e.g.
b file:line
orb <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>
.