Debug the axf file with MDK

Source: Internet
Author: User

// ================================================ ====================================
// Title:
// Use MDK to debug the axf File
// Author:
// Norains
// Date:
// February 21-September-2010
// Environment:
// Keil MDK 4.0
// ================================================ ====================================

 

Axf is the file format used by the ARM chip. It contains the bin code and debugging information. Both rvds and MDK can generate the file.

 

If the development tool you are using is MDK, You can debug it based on the generated axf and source files. It may seem strange to some friends that if the source code is available, why not simply create a project and add these source files to generate axf directly? This method is also possible, but the premise is that you know the corresponding compilation parameters and have all the source code. For example, there is an axf file, which is composed of. CPP and B. CPP generation, but others only gave you B. the source code of CPP allows you to debug a function, so this method of creating a new project for axf file compilation won't work.

 

However, this is hard for us. As long as an axf file is available, the incomplete source code can be debugged. Believe it? Keep reading it!

 

First, create a new project in the MDK. Everyone knows this,


 

Then select the same CPU type as the axf to be debugged ,:


 

Next, you will be prompted whether to add the startup code. Here, we mainly want to select "no ",


 

Click project> options for target, and then select the output tag,


 

Next, click "select folder for objects ..." Select the directory where the axf file is stored. There is a problem here, that is, the path cannot be copied directly and then click OK. Instead, you need to select the path step by step through the buttons in the dialog box. Maybe this is the bug of my MDK version. If the MDK used by all of your friends does not have this problem, simply copy the corresponding directory. Select this dialog box:


 

We also need to manually set the axf file to be debugged. Enter the corresponding file name in the "Name of execute" box ,:


 

After everything is ready, you can click the debug button to start debugging. If the afx file has no errors, the following interface will appear during debugging:


 

However, the Assembly-level code is displayed here. It may be a bit difficult for friends who are used to C/C ++. Is there any way to associate the axf file with the CPP file? The association method is very simple. If you want to associate any file, click File> open to open it. At this time, when debugging is started, we can find the blank space below the original assembly. At this time, the corresponding CPP file has been opened ,:


 

At this time, we can perform debugging to a certain extent based on the information of the Left register and the source code.

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.