The jlink plug-in used in this article is here
Http://download.csdn.net/detail/king_bingge/5879179
Two prerequisites:
1. eclipse has been successfully installed. Considering version compatibility issues, it is not applicable to the eclipse that comes with redhat6. The previous blog post has mentioned how to install the tool;
2. The arm-linux-gdb debugging tool has been installed successfully.
Next, set up the debugging environment.
Considering that sometimes bugs in programs are inevitable, We Have To debug the program. For more convenient development, we use the linux environment to debug the program.
I. Hardware connection
1. Connect the power cord, JTAG line, and serial line of the OK6410 target board respectively;
2. After the virtual machine is enabled, connect the USB port and serial port in the lower right corner;
3. Set the Development Board to SD and then use the mmc boot program in our SD card to erase the nand flash;
4. Set the Development Board to start with nand flash.
The first part is completed here.
Ii. jlink Software Installation
1. Execute the command tar zxvf JLink_Linux_V434a.tgz and enter the directory;
2. Run the command cp-d libjlinkarm. so.4 */usr/lib-f to copy the library to lib, as shown in:
3. Execute./JLinkGDBServer. The jlink prompt is displayed and the ID and ARM11 words are displayed.
At this point, the JLINK part has been completed. Always maintain the jlink connection to facilitate subsequent debugging.
4. Install the plug-in (this step is critical)
Start eclipse and enter the following interface
Enter the next step and set it in the following order
Finally, finish. Note that this step requires the virtual machine to be able to access the Internet. This must be ensured. Install plug-ins online.
Iii. eclipse tool Configuration
1. Start eclipse and enter the following interface.
2. After the project is created, the following interface will appear:
3. After the project is established, the configuration is completed,
4. Enter the configuration page in the order shown in the figure.
A double-click the red font '1' and the LED Default option is displayed.
B. Click the red font '2' and set it on the right.
C select the file to be debugged in the following browse. Remember that it must be in elf format.
D. Change the GDB Debugger under debugger to arm-linux-gdb.
The 'initial' command in E command is about to input the code for initializing the target board. The Code of OK6410 is as follows:
# tiny6410_config# connect to the J-Link gdb servertarget remote localhost:2331# Set JTAG speed to 30 kHzmonitor endian littlemonitor speed 30# Reset the targetmonitor resetmonitor sleep 10## CPU core initialization (to be done by user)## Set the processor modemonitor reg cpsr = 0xd3#config MMU#flush v3/v4 cachemonitor cp15 7, 7, 0, 0 = 0x0#/* flush v4 TLB */monitor cp15 8, 7, 0, 0 = 0x0#disable MMU stuff and cachesmonitor cp15 1, 0, 0, 0 =0x1002#Peri port setupmonitor cp15 15, 2, 0, 4 = 0x70000013#disable watchdogmonitor MemU32 0x7e004000 = 0x00000000monitor sleep 10#disable interruptmonitor MemU32 0x71200014 = 0x00000000monitor MemU32 0x71300014 = 0x00000000monitor MemU32 0x7120000C = 0x00000000monitor MemU32 0x7130000C = 0x00000000monitor MemU32 0x71200F00 = 0x00000000monitor MemU32 0x71300F00 = 0x00000000#set clock monitor MemU32 0x7e00f900 = 0x0000801emonitor MemU32 0x7e00f000 = 0x0000ffffmonitor MemU32 0x7e00f004 = 0x0000ffffmonitor MemU32 0x7e00f020 = 0x01043310monitor MemU32 0x7e00f00C = 0xc2150601monitor MemU32 0x7e00f010 = 0xc2150601monitor MemU32 0x7e00f024 = 0x00000003monitor MemU32 0x7e00f014 = 0x00200102monitor MemU32 0x7e00f018 = 0x00000000monitor MemU32 0x7e00f01C = 0x14000007#config sdrammonitor MemU32 0x7e00f120 = 0x00000008monitor MemU32 0x7e001004 = 0x00000004monitor MemU32 0x7e001010 = 0x0000040fmonitor MemU32 0x7e001014 = 0x00000006monitor MemU32 0x7e001018 = 0x00000001monitor MemU32 0x7e00101c = 0x00000002monitor MemU32 0x7e001020 = 0x00000006monitor MemU32 0x7e001024 = 0x0000000amonitor MemU32 0x7e001028 = 0x0000000cmonitor MemU32 0x7e00102c = 0x0000018fmonitor MemU32 0x7e001030 = 0x0000000cmonitor MemU32 0x7e001034 = 0x00000002monitor MemU32 0x7e001038 = 0x00000002monitor MemU32 0x7e00103c = 0x00000002monitor MemU32 0x7e001040 = 0x00000002monitor MemU32 0x7e001044 = 0x00000013monitor MemU32 0x7e001048 = 0x00000013monitor MemU32 0x7e00100C = 0x00010012monitor MemU32 0x7e00104C = 0x00000b45monitor MemU32 0x7e001200 = 0x000150f8monitor MemU32 0x7e001304 = 0x00000000monitor MemU32 0x7e001008 = 0x000c0000monitor MemU32 0x7e001008 = 0x00000000monitor MemU32 0x7e001008 = 0x00040000monitor MemU32 0x7e001008 = 0x00040000monitor MemU32 0x7e001008 = 0x000a0000monitor MemU32 0x7e001008 = 0x00080032monitor MemU32 0x7e001004 = 0x00000000# Setup GDB for faster downloads#set remote memory-write-packet-size 1024set remote memory-write-packet-size 4096set remote memory-write-packet-size fixedmonitor speed 12000break _startload
I don't know the meaning of the specific code yet. Use it first.
After the configuration is complete, select debug.
4. debugging
Next, you can debug it. Next, let's take full advantage of it ~~~ If you do not understand it, you can discuss it in detail ....