AXD assembly debugging experience, use and problems

Source: Internet
Author: User
Tags exception handling reset

AXD Use Experience

1. Debug with Axd:

Axd does not automatically help you configure SDRAM, and configuring SDRAM is the user's thing. Axd simply provides a command line that allows the user to configure a snap-in within the CPU. When the Axd is downloaded, it is assumed that the user is already configured with SDRAM, so it is the user's responsibility to ensure that the downloaded area is writable when downloading. Therefore, in Axd, you should have the Axd run a section of automatic configuration SDRAM instructions before running the program.

The role of Vector catch in Axd, in fact, the principle of vector catch is to set breakpoints in the corresponding position, capturing interrupts. You set a breakpoint at the location where the vector catch is set, and the corresponding bit is set.

The PC can be set up freely in Axd. Download to ram set PC to 0x30000000 (64sdram,s3c2440) If you want the program to start from address 0x0, you can set the value of your PC in Axd, but you have to make sure that you get a valid command from address 0x0.

2, 1. There is nothing special about the Axd debug, which works by download the compiled run-time image to the appropriate arm address.

Then capture arm's PC to force it to the image entry address set by entry point in ads, and then you click on the run,pc to take a finger from the entry address, and then the execution is executed. The actual code of the hardware operating environment is the operating environment of the arm chip.

The first thing to make clear is that the ads (AXD) online debug when the compiled runtime code download to the corresponding address of arm, where this download address is the address of the storage part arm, Must be RAM-type storage features can be download, if this address domain is mapped to flash memory, Axd is not download, although Axd does not error, but can

Check with dissambly under Axd, and if it is flash, you will not see the correct instructions.

3, the correct download is the implementation of the program, the general external expansion of the SDRAM to have its timing configuration, here with the Axd debugging note a little

When using an external SDRAM for the download program, such as the Arm,extern SDRAM, which has just been reset, there is no timing configuration for him, then there may be problems with Axddownload to SDRAM, ( Axd is through the JTAG port through the SDRAM to put code on the SDRAM, if not before the Axd load code to achieve the configuration of the SDRAM timing can not guarantee the correctness of the load, and the correctness of the runtime, the operation will produce what abnormal instructions and other strange phenomenon. Sothat, it is determined to provide the axd with a configuration that is already configured to be available in the SDRAM so that download can be guaranteed.

The correct approach is to execute the menu options/configure interface/session File in the Axd interface, select Run Configuration script, and click Browse to locate the initialization script. Note that the init script " 2440init.txt "must be placed in the English directory. Command line Interface in the Axd interface, you can see if Axd runs the init script, and the content of the initialization script is (micro2440):

Setmem 0x53000000 0x00000000 32
Setmem 0x4a000008 0xFFFFFFFF 32
Setmem 0x4a00001c 0x000007ff 32
Setmem 0x53000000 0x00000000 32
Setmem 0x56000050 0X000055AA 32
Setmem 0x4c000014 0x00000007 32
Setmem 0x4c000000 0X00FFFFFF 32
Setmem 0x4c000004 0x00061012 32
Setmem 0x4c000008 0x00040042 32
Setmem 0x48000000 0x22111120 32
Setmem 0x48000004 0X00002F50 32
Setmem 0x48000008 0x00000700 32
Setmem 0x4800000c 0x00000700 32
Setmem 0x48000010 0x00000700 32
Setmem 0x48000014 0x00000700 32
Setmem 0x48000018 0X0007FFFC 32
Setmem 0x4800001c 0x00018005 32
Setmem 0x48000020 0x00018005 32
Setmem 0x48000024 0x008e0459 32
Setmem 0x48000028 0x00000032 32
Setmem 0x4800002c 0x00000030 32
Setmem 0x48000030 0x00000030 32

You can save this as a. txt format, and then put it in a directory without Chinese, and import it just like that. After clicking Debug in ads, if SDRAM is configured, it will appear in the command line of Axd

4. After the correct axd download, the next step is to execute the code, here also have to pay attention to the matter, that is, the code does not have a time series configuration of the SDRAM instructions appear, this is like, the program has been running in SDRAM, And then in the course of the operation of the SDRAM is configured, this will be something unusual and so strange phenomenon. But running at full speed may be fine.

5. Do not use the Axd "Reload current image" for reload can be set by the PC pointer: Setpc 0x30000000 in command line to get the program from the beginning of the execution

The jump address of the 6.CPU interrupt is always 0x00000000-0x000020.

This is true for several other exceptions, and when these exceptions occur, the CPU's PC pointers are automatically pointed here, where they usually put some jump instructions to jump to a real interrupt program or other exception handler. (for 2440来 says so)

AXD run error;

1.Processor arm720t Raise a exception cause:the Processor was reset

This is the Axd detects that the PC pointer jumps to 0x00000000, which is generated after the execution from 0x00000000, normally the PC will only produce 7 other exceptions (watch dog exception). When the PC jumps to 0x00000000, the execution is intercepted by the Axd intercept as exception handling and pops up the terminating box above. (ex. mov pc, #0x0 Such instructions will cause the above termination at full speed under Axd) in fact, sometimes users just want to be able to enable the PC to simulate the reset condition under the AXD monitoring from the 0x00000000 execution program, so that the axd->option--can be The [R] option for the vector catch option in the >configurate Processor dialog box is removed. This option is the ability of the Axd to monitor the termination of the PC when it is taken from 0x00000000. Remove it so that you can successfully simulate the PC from reset (0x00000000) in the Axd to take the finger and execute it. There are several other options:

Axd Usage Tips

1. How to save the current debug site.
During the debugging process, we often need to set breakpoints, set Watchpoint, or open many source files in different places. But once we close the Axd, all the work is wasted. When we open Axd again, we still get the debug environment with no breakpoints and only one entry file open. Here is a way to automatically save the last debug site (the data for the register is saved).
        options->general tab. Verify that the Save and load default sessions option is selected. Then open the session File and make sure that the rselect target and reload images options are selected.
         After setting save, we will automatically load the last image and restore the register after we close the Axd and start again.
         If you need to save more than one scene, save it by selecting Save Session in the File menu after the settings are saved. Note, however, that there can be no spaces and special characters in the saved path. It's best to keep it on ClearCase. When the site needs to be restored, only the load session will be OK. You've worked hard to set breakpoints, Watchpoint all back.

2. Cannot set breakpoints, what to do.
When I can't set breakpoints, I know only a few solutions, here's a list:
A: Clears the CPU's vector Catch.
In Options->configure Process. Clear the.
B:run a moment, pause immediately.
This approach is appropriate for low-demand breakpoints, such as breakpoints set in the app layer. Convenient.
C: Clears the previous breakpoint.
Generally occurs in the case of Flash debugging. Because if you want to debug in Flash, you can set the number of broken points is limited, first clear the previous breakpoint before you can set a new breakpoint.
D: Command line spp Vector_catch 0
Actually the same as a. If it is written in the boot script, then you can automatically exclude the boot cannot set the breakpoint problem.
E: When you start Axd, use the-debug parameter so that you can add an automatic breakpoint on main ().

3. How to start debugging again from the beginning without reload image.
Most of the time we need to get the code to run and reproduce a bug. But, in general, it's all reload. If the image is small can be tolerated, but think of the 660 kind of 16M or so of the giant image, this price is too big. Here are a few of the methods I know that can be debugged from the beginning:
A: Set the current register.
Click to open the Process register->current group. Set the PC to 0 and CPSR to SVC mode. Turn off thumb mode. At this point F5 can run down.
B: Run the script
This way is faster and easier. The choice.
Sreg CPSR 0xd3
5, how to jump unconditionally.
In general, this is best done in the same function, when one statement unconditionally jumps to another statement. It is best not to use across functions (otherwise there is a stack error, difficult to check)
Set the cursor to the code you want to jump to, and the right-click menu Execute->set Next Statement.
6. Does Axd have any auxiliary tools?
IDA Pro, very good AXF parsing tool. You can count functions, global variables, call relationships, and so on in the Axf file. The interface is very friendly, the code interface can clearly see the function reference relationship, variable initial, variable reference, modified statistics.
It can be said that IDA Pro is a compilation-level source insight. Everyone can download it on the Internet with the latest version of the installation used.
7. How to debug code that needs to be loaded on flash
Here are my experiences:
1. Download a version on the board with JTAG debug port.
2, choose File->load Debug Symbols. Then select the AXF that was generated on the release version of CodeWarrior.
3, now you can debug the program on the Flash. Exactly the same as debug. Note, however, that in this case, you can normally only set 2 breakpoints.
8. Using the Fromelf command
The fromelf command can be used to further manipulate the AXF file that we generate.
Such as:
Extract the binary code from the AXF file: Fromelf–bin–output a.bin A.AXF
Extract the binary code from the AXF file: Fromelf–m32–output a.s32 A.AXF
9. FAQ
Q: Generate the RAM mode of the Redboot image file and what tools should be used to debug the redboot of the compiled RAM mode.
Use the Ads debugging tool to load only. AXF formatted files
A: You can also load bin files with ads (File->load memory from memory ...), you can use the Ads command line or script to initialize SDRAM
The load bin file needs to specify the load address, for s3c44b0x is typically 0x0c040000, which is specified in the corresponding Ldi file.
Section_rom_vectors (RAM, 0x0c040000, LMA_EQ_VMA)
After you load the bin program, change the PC pointer to 0x0c040000

This section is derived from

Better configuration for Axd's blog

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: 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.