Reputation: 655
We are working on STM32F103(ARM Cortex M3) chip and compile our project with uVersion(ARM-MDK compiler). When crash happened, we saved the PC and LR registers. After that, we'd like to map addresses saved in PC and LR registers to source code lines for human reading by writing certain scripts. I read this What are .axf files?, which says axf contains such information. But I don't know how to utilize it. Thanks a lot.
[update 1]
Today I tried the fromelf.exe which can dump some debug useful information(fromelf.exe --text -g E:\proj_keil\keil_output\test.axf),
for example:
008f5d: SPECIAL(0, 1) : 13 080043cc: ..\init\main.c:23.5
008f5e: DW_LNS_negate_stmt : 06
008f5f: SPECIAL(1, 2) : 1a 080043d0: ..\init\main.c:24.5 [
When I search the crashed PC address(0x080043d0), I can find its corresponding source line, though I did not find the LR address's source line for this crash.
So can I use fromelf.exe to solve my problem?
Upvotes: 0
Views: 1347
Reputation: 93556
The symbol and debug information is used by the debugger. The current code location, and the call-stack are directly displayed in the debugger.
If you want to post-mortem a particular address, you can start up the debugger, on the target or in the simulator, and request a disassembly at said address. Both the disassembly and if available the original source code will be displayed.
If you need to do this post-mortem with no debug information, it can be determined manually using information from the map file to determine the nearest public symbol, and then the .lst files to determine the precise location as an offset from the link map location. Generation of both .map and .lst files are project options in uVision.
Upvotes: 1