Open
Description
For folks developing using picoboot or U2F and debug chatter over ACM CDC, hard faults are pretty painful -- the device stops responding, host side drivers may wedge up, figuring out what blew up is hard.
One could provide in the SDK:
- default fatal exception / unsupported IRQ handlers which pack up essential information somewhere safe (exception, registers, etc) and watchdog reboot.
- startup code that looks for a marker for "hard fault" reboot that then jumps to a debug stub that minimally makes the key fault state (registers, fault registers, etc) readable / printable over UART or ACM CDC
- maximally some more extensive debugging (a little interactive debugger? gdb serial protocol over ACM CDC, etc)
Just a minimal dump like this would probably be insightful in many cases:
Unhandled Exception ### at PC 0x00011eaa
r0 00000000 r4 00000000 r8 00000010 ip 000142cd psr 21000000
r1 20000bb8 r5 40004000 r9 0000002a sp 20007f58 msp 20007f58
r2 0000000d r6 4001f000 10 00000040 lr 00011e87 psp 00000000
r3 e000e100 r7 00000001 11 00000005 pc 00011eaa
20007f58: 40007000 d1000002 20000aac 00000000
20007f68: 00000000 00011f7f 00000000 000110c1
20007f78: 00000054 000000f1 000000d5 00c20117
20007f88: abf9ffcb 00208108 fb73fffb 02720200
20007f98: 6e5a7fef 9a400269 50000000 00000000
20007fa8: 00000000 000005c3 3bdeffbb 00000000
20007fb8: 00000000 00000000 00000000 0001115b
20007fc8: f93eb75f a02d12c9 e5ef75fb dc03a0e1