Cortex-M3/M4 dead location judgment

Source: Internet
Author: User

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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.