It took a long time to use M4 (NXP), but it was annoying to find that the program crashed and could not judge the location of the crash, previously, I saw an article about how to view the stack content by checking the SP LR and other registers. Also look at the address in memory to find the function address, then look at the assembly code. It is very troublesome. The ARM7 kernel is better to judge. (The M3 kernel is not verified. The same knowledge should be the same. M4 has a FPU more ).
Accidentally crashed (array out of bounds ). We found that the name and address of the dead function were directly saved in the call stack. Very convenient, haha. Right-click Calle stack to see where the function is dead. I rarely see articles about location determination on the Internet. I don't know whether your programs will crash? I have known it for a long time. I personally think it is quite good to share it. For more information, see the figure!
Assign a value to address 0 to cause it to crash:
Int * A = 0;
* A = 3;
Figure 1
In the dowork Function
Figure 2Right-click show callee code
Figure 3
The location is here,Arrow at the triangleThe above is where the 0 address is assigned. The Assembly Code displays the error that occurred before the CMD parse function is called.
Cortex-M3/M4 dead location judgment