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 (communities.mentor.com/.../16468) 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?
I am facing the same problem and was wondering if you were able to figure it out.
Hi, sadly no. I gave up getting only the address right before the hard fault handler. at least that gives some indication. If you search for fruity mesh on git hub and go to the beta branch, you wil find my last version of that code, I think. If you manage to get it to work I am still interested ️