How to Establish an eclipse-based ARM development environment in Linux

Source: Internet
Author: User
Tags gdb debugger

This is a reference that I modified and verified after referring to many materials on the Internet. It may not be all-inclusive, because it may seem a bit cool to say more in some places. If you have any questions, leave a message and I will try my best to answer them.

1. Install redhat9 (the speed is good when using thunder). You don't have to install it completely. You can install all the Development kits and install vsftp, this requires about GB of space. Here, the Host IP address is 192.168.0.3, and the development board ip address is 192.168.0.2.

PS: I can't compile the program that can be used on the Development Board on Ubuntu. I have to use redhat9, which is very depressing!

2. Install vmware-tools on Vmware

3. Network neighbors
Mount-T smbfs-O username = Zhangjian, password = "" // swordzjj/nano2410/root/. gnome-desktop/nano/

4. Copy the Nano2410AV2-SDK10.tgz and arm-linux-toolchains.tgz to/tmp.
Tar xvzf Nano2410AV2-SDK10.tgz-C/
Tar xvzf arm-linux-toolchains.tgz-C/
 
5. Install jre1.5.0
/Jre-1_5_10-linux-i586-rpm.bin
 
6. Install eclipse 3.2, CDT, and Chinese package
Tar zxvf eclipse-SDK-3.2.1-linux-gtk.tar.gz-C/OPT
Tar zxvf org.eclipse.cdt-3.1.1-linux.x86.tar.gz-C/OPT
NLpack1-eclipse-SDK-3.2.1-gtk.zip/OPT
 
7. Install firefox-2.0
Tar zxvf firfox-2.0.0.1.tar-C/OPT

8. Install adobereader
Rpm-I AdobeReader_chs-7.0.0-2.i386.rpm

9. Update Environment Variables
VI/etc/profile,
# Path manipulation
If ['id-U' = 0]; then
Pathmunge/sbin
Pathmunge/usr/sbin
Pathmunge/usr/local/sbin
Pathmunge/usr/local/ARM/2.95.3/bin
Pathmunge/usr/Java/jre1.5.0 _ 10/bin
Fi

VI/etc/exports
Add/opt/friendlyarm/nano2410a_v2/root_nfs * (RW, sync, no_root_squash) at the end)
/Opt/friendlyarm/nano2410a_v2/root_nfs indicates the shared directory of the root file system of nano2410a_v2. * indicates that all clients can mount the file system directory; RW indicates that the client uses the read/write permission to mount their root file system. The no_root_squash option allows the client to mount the root file system as the root on the host.
Open the/etc/rc. Local file and add a line "/etc/init. d/nfs start" next to the file to enable automatic
To start the NFS service, run the following command to start, stop, or restart the NFS service:
#/Etc/init. d/nfs start
#/Etc/init. d/nfs stop
#/Etc/init. d/nfs restart
Log out and log on again.

10. create shortcuts

Eclipse shortcuts

Copy eclipse. XPM In the eclipse directory to/usr/share/icons.
[Desktop entry]
Encoding = UTF-8
Name = eclipse 3.2
Genericname [zh_cn] = eclipse
Comment = eclipse
Exec =/opt/Eclipse/eclipse % u
Icon = eclipse. XPM
Terminal = false
Type = Application
Startupwmclass = eclipse
Mimetype = text/html; text/XML; application/XHTML + XML; application/vnd. Mozilla. XUL + XML; text/MML;
Categories = texteditor; development; X-red-hat-base; application;

Firefox shortcuts

Copy Firefox \ icons \ mozicon128.png to/usr/share/icons/firefox.png.
[Desktop entry]
Encoding = UTF-8
Name = Firefox Web browser 2
Genericname [zh_cn] = Firefox
Comment = Firefox Web Browser
Exec =/opt/Firefox % u
Iconw.firefox.png
Terminal = false
Type = Application
Startupwmclass = Firefox-bin
Mimetype = text/html; text/XML; application/XHTML + XML; application/vnd. Mozilla. XUL + XML; text/MML;
Categories = network; X-red-hat-base; application;

There is X-red-hat-base, and the shortcut is in the level-1 menu, not in the level-2 menu
 
11. Install the debugger
Tar jxvf gdb-6.4-tar-bz2
CD gdb-6.4
./Configure -- target = arm-Linux -- prefix =/usr/local/ARM-GDB-V
Make
Make install
Export Path = $ path:/usr/local/ARM-GDB/bin
CD gdbserver
./Configure -- target = arm-Linux-host = arm-Linux
Make cc =/usr/local/ARM/2.95.3/bin/ARM-Linux-gcc

12. Basic eclipse operations
(1) Create-> standard make C-> New C file-> write-> Save
(2) enter/usr/local/ARM/2.95.3/bin/ARM-Linux-GCC in project-> properties-> C/C ++ make project-> "compiler invocation command"
(3) project-> creat make target-> "Target name": Copy --> "make target": Copy
(4) Run-> debug-> C/C ++ local application-> debugger-> "Debugger": gdbserver Debugger
-> "Gdb debugger":/usr/local/ARM-GDB/bin/ARM-Linux-GDB-> "connection"-> "type": TCP, "host name or IP address": 192.168.0.2, "port number": 1000

13. Write makefile
Cc = arm-Linux-gcc
ALL:
$ (CC)-G hello. C-O hello
Clean:
Rm-VF hello *~

Copy: All
CP Hello/var/ftp

Here, copy is used to download to the Development Board through FTP.

14. How to debug
(1) Establish a remote debugging environment first
Tar zxvf lib-for-gdbserver.tgz-C/tmp
Then extract the extracted libthread_db-1.0.so, libthread_db.so, libthread_db.so.1 download to the Development Board/lib
Download can be through FTP, for example to download the libthread_db-1.0.so to the development board, you can do this:
A. Start vsftp on the host (192.168.0.3), then, CP libthread_db-1.0.so/var/ftp
B. Run wget ftp: // 192.168.0.3/libthread_db-1.0.so ON THE DEVELOPMENT BOARD (192.168.0.2)
(2) Add the parameter "-G": Arm-Linux-gcc-G hello. C-O hello during compilation.
(3) Run./gdbserver 192.168.0.2: 1000 hello on the Development Board.
192.168.0.3 is the host machine IP address, and a debugging process is enabled on port 1000 of the target system. Hello is the program to be debugged.
Prompt:
Process/tmp/Hello created: pid = 80
Listening on port 1000
(4) Run arm-Linux-GDB hello on the host or click "debug" on Eclipse"
......
(GDB) target remote 192.168.0.2: 1000
Prompt:
Remote debugging using 192.168.0.2: 1000
[New thread 80]
[Switching to thread 80]
0x40002a90 in ?? ()
At the same time, the following message is displayed under minicom:
Remote debugging from host 192.168.0.3
(GDB)
After successful connection, you can enter various gdb commands such as list, run, next, step, break, and continune to debug the program.
 
OK. You can start writing the 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.