Debugging options on Duet 2 for firmware development
-
Hello,
I'm would like to know, how can be firmware debugged on Duet 2 Ethernet Board. SAM4E8E chip has JTAG and Serial Wire interfaces, but on Duet 2 board are those port not accessible, because some of their pins are wired somewhere. I'm curious, how debugging was done, when official RepRap Firmware was ported for this board. I don't think, that Duet developer are hyper-inteligent creatures, that can always write code, that works on first time as it should work, so I'm pretty sure, that Duet developers has to have some debugging options. But I wasn't able to find much about debugging.
There is debugPrintf() method implemented, which prints debug message via USB serial interface, but this way I can't print messages right before firmware crash, because this way is somehow asynchronous. It would be really useful, if there was a way, to stepping trough code lide by line, just like JTAG can. Or at least, if there would be some way, to ensure all debug messages are sent before firmware crash.
Thank you for some hints. -
@Thugmek we've never used debuggers with Duet 2. Older version Duet 2 boards do expose the JTAG/SWD pins but newer ones don't. All Duet 3 boards expose the SWD pins.
If the firmware crashes, the crash details are written to flash memory and can be retrieved using M122. We use the linker map file and assembler files generated by the compiler to identify the exact point at which it crashed. We usually find that sufficient to identify the bug.