Tool/software: TI C/C++ Compiler
Dear experts,
My embedded firmware currently has a case of the program "running into the weeds". My suspicion is that a function pointer or the stack itself somehow gets corrupted, but its at best a guess.
My goal is therefore to first establish what the last actual piece of legitimate code the processor was busy with, before things go wrong.
Firstly, I can confirm that I am definitely not getting a stack overflow. I checked that by writing the stack with known values at the beginning of main() and then checking the stack after the crash.
After a crash, the PC always points to the value 0x2B12, which is definitely not a valid program memory location (should be above 0x8000 for this MSP430). This location is in fact a location in the stack itself.
When the program crashes, I do not see the call trace in CCS (v7.4.0) with the debugger. At this point the SP's value is 0x2B26, which is still within the stack boundaries.
I have tried the special breakpoints that CCS provides in the debug perspective, e.g. "Break in program range" (below 0x8000), "Break before Program Address" (0x2B12) "Watchpoint on write" (the specific stack address). However, none of these approaches worked. I am not sure if the HW actually supports this or I am just using it wrong.
Can you please advise how I can analyze the stack to determine that last function that was being executed? Maybe so specific tips and tricks?
Thanks in advance!