Programmatically unwind callstack


I've now been looking for a while but haven't yet found anything working to programmatically unwind the call stack when working with the nRF51 or nRF52. Basically what I want to do is to save a stacktrace in the app_error_fault or hard_fault handlers so that I can send this stacktrace back over BLE after my program rebooted. I've tried this ( but it only returns the pointer to the current function, e.g. the HardFaultHandler.

Does anyone have this implemented yet?


  • I managed to get a basic stacktrace by using _Unwind_Backtrace from unwind.h together with -funwind-tables. But sadly, this doesn't seem to be able to unwind the stacktrace past an Interrupt Service Routine. So, when the HardFaultHandler is called, i am not able to get the stacktrace. But this would be one of the most important places in my code where I would want a stacktrace. Any Ideas?

Reply Children