I am using the Watch dog in my system. If it is not reloaded within 5 sec it will be triggered. I would like to see the list of code that is done prior to watchdog reset. With out the debugger connected can ) log the list of instruction in my code.
Asked
Active
Viewed 118 times
-1
-
What operating system are you on? Why don't you try `ptrace` ? Also you will still need the debug symbols to identify the functions on the stack frame. If you don't want the debugger always connected, you can attach it *after* the watchdog triggers. – Ajay Brahmakshatriya May 05 '17 at 10:52
-
1Welcome to Stack Overflow! Please [edit] your question to show [the code you have so far](http://whathaveyoutried.com). You should include at least an outline (but preferably a [mcve]) of the code that you are having problems with, then we can try to help with the specific problem. You should also read [ask]. – Toby Speight May 05 '17 at 11:19
-
You can still add displays, like `print("Flag");` to know until where your code went before being stopped. – Badda May 05 '17 at 11:22
-
@Likhitha: This part has an early wake-up interrupt feature for the watchdog. You can use this to preserve a stack trace, along with other core state of intereset, in non-volatile memory prior to resetting. This is usually most easily performed grabbing the stack pointer and copying the next N bytes to an area of RAM marked not to be initialized across a reset. Then printing this through whatever channel is available after reset. Interpretation is the tricky bit and benefits from familiarity with machine code, comparing plausible return addresses against the map file is a good start though. – doynax May 05 '17 at 18:55
2 Answers
0
There are couple of ways of doing it:
- Use serial debug output and grab the data using usart (another micro)
- Buy USB->Serial converter and use one of the UARTs to output the data.
- In extreme circumstances :) (eg when you do not have access to the pins) use (if avaiable) led(s) to flash out required information.

0___________
- 60,014
- 4
- 34
- 74
0
There is one simple, yet little bit expensive solution, to your problem. Cortex M4 core has support for tracing instructions. Therefore you need to check if the tracing signals are routed to the pins (needs to be large package > 100 pins), after startup enable tracing and just connect HW tracer, which will log every instuction the core has executed.

phodina
- 1,341
- 1
- 12
- 25