This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

Saving the location of Watchdog timeout

I am trying to save the address of program counter when a watchdog reset occurs. In order to do that I use gcc's __builtin_return_address(0) from within the SDK's nrf_drv_wdt.c:WDT_IRQHandler().

What this returns is 0xfffffff9. If I interpret the ARM spec correctly, this address is in the area reserved for the chip vendor.

  • What is at that address?

  • Can I extract the PC before WD reset using the gcc builtin? Another function?

  • What is the recommended way of getting the address when the watchdog timed out? I've seen people manually unpacking the stack, I'd be glad if I could do it in a less hacky way.

Related