Using Cortex-R5F, I would like to get the contents of the 4-entry call-return stack (i.e. get the addresses). Is this possible through some indirect manner?
The goal here is to have the knowlege of the call tree above the current execution point (backtrace). In my situation, the call tree must be determined by the OS on target and in real-time, it must work when no debugger is attached and the debug symbols are not loaded onto the target. From my understanding, getting the LR saved in the real stack (in RAM) is not possible with ARM architecture since the call tree agent cannot know the size of the stack frame and the offset where LR is saved in that frame. Inspecting the call-return stack embedded in the core itself would be an alternative.
Thanks.
Hmm... ELF indeed contains debug info, but the problem is on our target, only the binary form of the ELF is loaded (no debug info). And dumping the whole stack when an error occurs for offline call stack analysis (on PC) would be too CPU intensive (our system is a real-time system). On PowerPC, it was possible to get the call stack by looking at frame pointers stored in the stack: current stack pointer points to the previous stack frame, so parsing is quick and easy. On ARM, this is not true; rather, the current stack pointer is pointing the last data of the stack. The pointer to the previous frame is NOT stored in the stack itself: the code has to know for each function the size of the stack...