Content originally posted in LPCWare by Brutte on Fri Aug 24 04:30:14 MST 2012
That is a very interesting functionality.
The reports I use are asserts that present errors verified at compile-time or run-time. I did not need to know the call stack, usually the __FILE__ __LINE__ would do. But I agree - unwinding could be very useful.
For unwinding the stack it would require a lot of debugging information. Function names, arguments, files, lines... :eek:
But how to unwind the stack at run-time, in C? Perhaps you could printf not only lr, but the whole stack and then to paste it to some Eclipse Plug-In so that it showed you what went wrong? A kind of BSOD full of hexes!
Alternatively, halt the core in the HardFaultHandler, blink error led, and gently connect it to the dongle without resetting application!
Quote:
if you use C++ exceptions, then the compiler can place this necessary information into unwind tables built into the executable, for use by the exception handler(s) to unwind the stack. However this significantly increases the size of the image.
That is the third path. I do not think the size is a problem, because this looks like for DEBUG purposes. Neither is speed - the application will eventually run slower, it will be bigger but when it crashes, you will know exactly what went wrong in no time.