"Reprint" Eclipse debug arm Bare Metal Program

Source: Internet
Author: User
Tags gtk jlink gdb debugger

First, integrated development environment

Software section: Eclipse, GDB Server, Jlink software

Hardware section: Jlink Hardware

Getting Started 1: Starting from Sd/nor Flash, formatting NAND flash

Preparing for Work 2: Hardware connection

1. Jlink Connection

2. Serial Connection

3. NAND boot

ii. installation of gdb Server

Decompression: Tar xvzf arm-linux-gdb-7.5.tar.gz

Access directory: CD arm-linux-gdb-7.5

Compile and install:./build-all

Once done, the GDB tool is installed and installed on the/OPT/ARM-LINUX-GDB

For ease of use, you need to add an environment variable: VIM/ROOT/.BASHRC

Add the GDB environment variable before the cross-compilation chain:

Export path= $PATH:/opt/arm-linux-gdb/bin/

Export path= $PATH:/usr/local/arm/4.3.2/bin/

After saving, exit. This allows you to run arm-linux-gdb directly, and if not, you may be adding an error, or you need to log out.

Q: Why do I have to add it to the cross-compilation chain?

A: Because in the cross-compilation chain also contains the Arm-linux-gdb,linux system will be based on the PATH environment variable order to find, we need to find the above installed, not here (because the version may not be correct), so when adding environment variables, Be sure to add the front of the cross-compilation chain.

Third, install Jlink software

Decompression: Tar xvzf jlink_linux_v434a.tgz

Access directory: CD jlink_linux_v434a

Copy library: cp-d libjlinkarm.so*/usr/lib-f

Copy: CP 45-jlink.rules/etc/udev/rules.d/

After the above four commands are executed, detects if the Jlink connection is detected:

Under the virtual machine, click the USB icon that appears to be jlink related to the connection.

Execute command:./jlinkgdbserver

If it goes well, it will show that the arm core on the connection is ARM11:

Iv. Installation of Eclipse software

Eclipse is installed by default in Red Hat Enterprise Edition 6.3

Execution: Which eclipse can see in which directory

This version does not fit, we can not use, so first we have to uninstall this, in fact, we put the query into the eclipse to modify a name, in the query to the directory execution: MV Eclipse eclipse-back.

to install your own eclipse:

Decompression: Tar zxvf eclipse-cpp-helios-sr2-linux-gtk.tar.gz

Access directory: CD ECLIPSE-CPP-HELIOS-SR2-LINUX-GTK

Run the program:./eclipse

This is the start of Eclipse.

Then choose your own project directory:

To configure eclipse:

First you have to install a plug-in, which is to be installed through the network, so Linux must be able to surf the Internet.

Install plugin: Click on the menu bar help, install new software

in work with input plug-in location: HTTP://OPENSOURCE.ZYLIN.COM/ZYLINCDT , click Add

After a while, in the box below to display the found plug-in, click to select:

Click Next;

Follow the prompts later.

Then restart:

use eclipse for development

New project, select a new project that already has a source file in existence:

Note: Here the source file directory must be in the working directory of another directory, such as the working directory is "/home/s3-arm/part1/lesson1", then "Existing Code Location" directory is not the same as the working directory, must be another directory, Or a subdirectory under the working directory, such as "/home/s3-arm/part1/lesson1/led/" or "/opt/led/"

Click Finish.

Compiling project: "Project", "Build All"

Note: Cancel the auto-compile "build automatically" inside "Project"

Configuration debugger: "Beetle icon", "Debug Configurations"

Double-click "Zylin Embedded Debug" and the following interface appears:

Check tab "Main"

Select the project you want to debug in the C + + application, and note that the "xxx.elf" File is selected:

Check tab "Debugger"

Remove the "Stop on startup at:" option

Modify "GDB debugger:" To "Arm-linux-gdb"

Check tab "Commands"

In "' Initialize ' Commands", fill in the following initialization instructions:

The following is an initialization script that initializes the S3C6410 processor

1 # tiny6410_config 2 # Connect to the J-link GDB server 3 Target remote localhost:2331 4 # Set JTAG speed to kHz 5 Mon Itor endian Little 6 monitor Speed 7 # Reset the target 8 monitor reset 9 monitor Sleep ten # one # CPU core Initializ ation (to being done by user) # Set the processor mode monitor reg CPSR = 0xd3 #config MMU #flush v3/v4 Cach E-Monitor CP15 7, 7, 0, 0 = 0x0 #/* Flush v4 TLB */Monitor CP15 8, 7, 0, 0 = 0x0 #disable MMU stuff and cache s monitor CP15 1, 0, 0, 0 =0x1002 #Peri Port Setup Monitor CP15, 2, 0, 4 = 0x70000013 #disable watchdog 25 Monitor MemU32 0x7e004000 = 0x00000000 All monitor sleep #disable interrupt monitor MemU32 0x71200014 = 0x00000000 Monitor MemU32 0x71300014 = 0x00000000 Monitor MemU32 0x7120000c = 0x00000000 to monitor MemU32 0x7130000c = 0x0000 0000 monitor MemU32 0X71200F00 = 0x00000000 Monitor MemU32 0x71300f00 = 0x00000000 #set Clock monitor MemU32 0 x7e00f900 = 0x0000801e 36 monitor MemU32 0x7e00f000 = 0x0000ffff PNS monitor MemU32 0x7e00f004 = 0x0000ffff monitor MemU32 0x7e00f020 = 0x010433 Monitor MemU32 0x7e00f00c = 0xc2150601 monitor MemU32 0x7e00f010 = 0xc2150601 monitor MemU32 0x7e00f024 = 0x00 000003 monitor MemU32 0x7e00f014 = 0x00200102 monitor MemU32 0x7e00f018 = 0x00000000, monitor MemU32 0x7e00f01c = 0X14000007 #config SDRAM monitor MemU32 0x7e00f120 = 0x00000008 monitor MemU32 0x7e001004 = 0x00000004 Monitor MemU32 0x7e001010 = 0x0000040f monitor MemU32 0x7e001014 = 0x00000006 Monitor MemU32 0x7e001018 = 0x00000001 Mon Itor MemU32 0x7e00101c = 0x00000002-Monitor MemU32 0x7e001020 = 0x00000006-Monitor MemU32 0x7e001024 = 0x0000000a 54 Monitor MemU32 0x7e001028 = 0x0000000c monitor MemU32 0x7e00102c = 0x0000018f monitor MemU32 0x7e001030 = 0x0000000 C, monitor MemU32 0x7e001034 = 0x00000002 monitor MemU32 0x7e001038 = 0x00000002 monitor MemU32 0x7e00103c = 0x000 00002 Monitor MemU320x7e001040 = 0x00000002 Monitor MemU32 0x7e001044 = 0x00000013 monitor MemU32 0x7e001048 = 0x00000013 Monitor Mem U32 0x7e00100c = 0x00010012 monitor MemU32 0x7e00104c = 0x00000b45 monitor MemU32 0x7e001200 = 0x000150f8 Monitor MemU32 0x7e001304 = 0x00000000 0x000c0000 monitor MemU32 0x7e001008 = MemU32 0x7e001008 Itor MemU32 0x7e001008 = 0x00040000 monitor MemU32 0x7e001008 = 0x00040000 monitor MemU32 0x7e001008 = 0x000a0000 72 Monitor MemU32 0x7e001008 = 0x00080032 monitor MemU32 0x7e001004 = 0x00000000 # Setup GDB for faster downloads 75 # Set remote memory-write-packet-size 1024x768 set remote memory-write-packet-size 4096 set remote Memory-write-packet-siz E Fixed monitor speed 12000 _start load

The script content of initialization 2440 is as follows:

1 # Connect to the J-link GDB server 2 target remote localhost:2331 3 # Set JTAG speed to kHz 4 monitor endian little 5 Monitor Speed 6 # Reset the target 7 monitor reset 8 monitor Sleep 9 # Ten # CPU core initialization User) # # Set the processor mode monitor reg CPSR = 0xd3 #config mmu config MMU #flush v3/v4 cache monitor CP 7, 7, 0, 0 = 0x0 #/* Flush v4 TLB coprocessor */Monitor CP15 8, 7, 0, 0 = 0x0 #disable MMU stuff and caches Monito R CP15 1, 0, 0, 0 =0x1002 #Peri Port Setup Monitor CP15, 2, 0, 4 = 0x70000013 #disable watchdog kangear off watchdog Monitor MemU32 0x53000000 = 0x00000000 Monitor sleep #disable interrupt kangear off interrupt monitor MemU32 0x4a000 008 = 0xFFFFFFFF Monitor MemU32 0x4a00001c = 0x7fff #set clock #initialize system clocks---locktime Register 31 Monitor MemU32 0x4c000000 = 0xff000000 #initialize System Clocks---CLOCK-DIVN Register monitor MemU32 0x4c000014 = 0x5 #CLKDVIN_400_148 34 #initialize System Clocks---MPLL register monitor MemU32 0x4c000004 = 0x7f021 #default clock #config SDRAM Notoginseng mo Nitor MemU32 0x53000000 0x00000000 0x4a000008 monitor MemU32 MemU32 0xFFFFFFFF monitor 0x4a00001c 0x000007ff Moni Tor MemU32 0x53000000 0x00000000 MemU32 monitor 0X000055AA MemU32 0x4c000014 0x56000050 0x00000007 R MemU32 0x4c000000 0x00ffffff monitor MemU32 0x4c000004 0x00061012 monitor MemU32 0x4c000008 0x00040042 MemU32 0x48000000 0x22111120 Monitor MemU32 0x48000004 0x00002f50 monitor MemU32 0x48000008 0x00000700 Monitor Me mU32 0x4800000c 0x00000700 Monitor MemU32 0x48000010 0x00000700 Wuyi Monitor MemU32 0x48000014 0x00000700 0x48000018 0X0007FFFC-Monitor MemU32 0x4800001c 0x00018005 monitor MemU32 0x48000020 0x00018005 Monitor MemU32 0x48000024 0x008e0459, monitor MemU32 0x48000028 0x00000032, monitor MemU32 0x4800002c 0x00000030, monitor MemU32 0 x48000030 0x00000030 59# Setup GDB for faster downloads #set remote memory-write-packet-size 1024x768 monitor speed auto loa break _start D

The script content of initialization 210 is as follows:

1 # Connect to the J-link GDB server 2 target remote localhost:2331 3 # Set JTAG speed to kHz 4 monitor endian little 5 Monitor Speed 6 # Reset the target 7 monitor reset 8 monitor Sleep 9 # Setup GDB for faster downloads #set Remot E memory-write-packet-size 1024x768 monitor speed auto break main load

After the above settings, you can start debugging

Five, start debugging

Note: When debugging with Eclipse, you must ensure that Jlinkgdbserver is running at the same time

Otherwise, an error similar to the following will appear:

Make sure the jlinkgdbserver is up and running, then click on the "Little Beetle" project name

Ready to enter the Debug interface

Select "Yes"

The debugging interface is as follows:

Click "F5" is "Step into"

"F6" is "Step over"

Wait, here you can see the value of the register, the value that is not stored, and so on.

Step by step you can see that the LEDs on the board are lit up.

Transferred from: http://my.oschina.net/u/914989/blog/153333

"Reprint" Eclipse debug arm Bare Metal Program

Related Article

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.