Difference between revisions of "ECE497 Notes on Installing the Eclipse IDE"

From eLinux.org
Jump to: navigation, search
m
m
 
(35 intermediate revisions by 2 users not shown)
Line 1: Line 1:
[[Category:ECE597]]
+
See [[EBC_Exercise_14_gdb_Debugging#Eclipse.2C_gdb_and_remote_debuging]] for remote debugging via Eclispe.
  
= Work in Progress =
+
This was a work in progress that was never finished.
  
[http://www.eclipse.org/ Eclipse] is an open source Integrated Development Environment that's enjoying broad use.
+
[http://www.lvr.com/eclipse5.htm This] may be a better starting place.
  
Here's how to run gdb on Beagle via Eclipse
+
== YouTube Video ==
I'm doing this for Galileo which was released just yesterday (24-June-2009).  apt-get eclipse doesn't get the newest version yet.
+
  
#### Downloading
+
[http://www.youtube.com/watch?v=vFv_-ykLppo&list=UUf_sAmhBw7Tj7-2ujmLFoQg&index=4&feature=plcp Here] is a video that says it will show how to use Eclipse for remote debugging.
Go to http://www.eclipse.org/downloads/ and download
+
"Eclipse IDE for C/C++ Developers (79 MB)"
+
I'm doing this for 32-bit Linux so I used:
+
http://www.eclipse.org/downloads/download.php?file=/technology/epp/downloads/release/galileo/R/eclipse-cpp-galileo-linux-gtk.tar.gz
+
  
Let the archive manager open it.  It takes a minute or so to download.
+
[http://download.eclipse.org/tm/downloads/drops/R-3.4-201205300905/ Here] is where you get the RSE-runtime.
Click Extract and put it in your favorite place.
+
  
#### Java
+
host$ '''sudo apt-get update'''
Before running Eclipse on Ubuntu you need to download java.
+
host$ '''sudo apt-get install eclipse'''
There appears to be several you can download. I picked:
+
  host$ '''sudo apt-get install gcc-arm-linux-gnueabi'''
sudo apt-get install openjdk-6-jre-headless
+
host$ '''sudo apt-get install g++-arm-linux-gnueabi'''
 +
host$ '''sudo apt-get install gdb'''
 +
host$ '''sudo apt-get install gdb-multiarch'''
  
once installed, open eclipse by
+
beagle$ '''opkg update'''
cd eclipse
+
beagle$ '''opkg install gdbserver'''
./eclipse
+
  
I like to put the workspace folder in the eclipse folder.  Put yours whereever you would like it.
+
= Work in Progress =
  
#### gdb-cross debugger
+
[http://www.eclipse.org/ Eclipse] is an open source Integrated Development Environment that's enjoying broad use.
# While we're at it let's install the cross debugger
+
cd ~/oe
+
. beagleboard/beagleboard/profile.sh
+
bitbake gbd-cross
+
  
 +
Here's how to run gdb on Beagle via Eclipse
  
#### Install Remote System Tools
+
== Installing on Host ==
Go to Help:Install New Software...
+
Click the down arrow to the right of "type or select a site" and
+
Select: Galileo - http://download.eclipse.org/releases/galileo
+
Expand: Programming Languages
+
Eclipse C/C++ Development should already be installed, if not, check it.
+
Expand: Modile and Device Development
+
Eclipse C/C++ DSF gdb Debugger should already be installed, if not, check it.
+
Check: Eclipse C/C++ Remote Launch
+
Check: Remote System Explorer End-User Runtime
+
Check: Remote System Explorer User Actions
+
Click: Next >
+
Click: Finish
+
Click "Yes" to restart eclipse
+
Click: "Yes" to use same workspace
+
  
#### Finding the Beagle's IP address
+
Install Eclipse and the gdb tools
#On the BeagleBoard run ifconfig eth0.  Note the IP address
+
<pre>
#On the host edit /etc/hosts and add:
+
$ cd ~/oe
137.112.41.76 Beagle
+
$ sudo  apt-get install eclipse
#(Use your IP address)
+
$ source source-me.txt
#Exit the editor and try:
+
$ bitbake gbd-cross
ping Beagle
+
</pre>
# If you don't get an answer something is messed up.
+
# On the host connect to the Beagle and create a workspace
+
ssh Beagle
+
mkdir workspace/HelloWorld/Debug
+
  
Now back to the host
+
== Install Remote System Tools ==
  
#### Setting up for remote debugging
+
* Start Eclipse (<code>$ eclipse &</code>)
Select: Project:Properties
+
[[File:Eclipse_-_Workspace_Launcher.png|300px]]
Expand: C/C++ Build
+
* Click: OK
Select: Settings
+
[[File:Eclipse - Welcome.png|300px]]
Tab: Tool Settings
+
* Go to Help:Install New Software...
Select: GCC C Compiler
+
[[File:Eclipse_-_Install_New_Software.png|300px]]
Replace "gcc" in "Command:" with "~/oe/tmp/cross/armv7a/bin/arm-angstrom-linux-gnueabi-gcc"
+
* Enter: http://download.eclipse.org/releases/galileo in "type or select a site"
Click: Directories (below GCC C Compiler
+
* Click: Add
Click Add... button and insert
+
[[File:Eclipse_-_Add_Site.png|300px]]
~/oe/tmp/staging/armv7a-angstrom-linux-gnueabi/user/include
+
* Enter: Galileo in the Name field
~/oe/
+
* Click: OK and wait while it fetches from the site.
Click: GCC C Linker (below Directories)
+
* Expand: Mobile and Device Development
Replace "gcc" in "Command:" with "~/oe/tmp/cross/armv7a/bin/arm-angstrom-linux-gnueabi-gcc"
+
[[File:Eclipse - Mobile Devices.png|300px]]
Click: Libraries
+
* Check: Eclipse C/C++ DSF gdb Debugger
Click: Add... to Library search path (-L)  (the bottom one) insert:
+
* Check: Eclipse C/C++ Remote Launch
~/oe/tmp/staging/armv7a-angstrom-linux-gnueabi/lib
+
* Check: Remote System Explorer End-User Runtime
Click OK to close Properties for HelloWorld window
+
* Check: Remote System Explorer User Actions
 +
* Expand: Programming Languages
 +
* Check: Eclipse C/C++ Development Tools
 +
* Click: Next >
 +
* Verify the list and Click Next >
 +
[[File:Eclipse - Install Details.png|300px]]
 +
* Accept the license and Click: Finish
 +
* Click: "Yes" to restart Eclipse
 +
* Click: "Yes" to use same workspace
  
Hit Ctrl-B to build, or click the little hammer
+
== Finding the Beagle's IP address ==
  
Menu: Run:Debug Configurations...
+
* On the BeagleBoard run
Double-Click C/C++ Remote Applcation to create a new configuration
+
<pre>
Name it BeagleBoard
+
$ ifconfig eth0
Project: Click Browse and select HelloWorld
+
</pre>
C/C++ Application: Click Search Project and select HelloWorld
+
Note the IP address
Remote Absolute File Path... Click: Browse...
+
* On the host edit <code>/etc/hosts</code> and add:
Connection: Click New...
+
  137.112.41.76 Beagle (Use your IP address)
Select: SSH Only and Click Next >
+
* Exit the editor and try:
Host name: Beagle
+
<pre>
Click: Finish
+
$ ping Beagle
"Select Remote C/C++" will appear. Connection:  Beagle
+
</pre>
Expand: My Home, workspace, HelloWorld, Debug
+
If you don't get an answer something is messed up. Get help.
Click: OK
+
On the host connect to the Beagle and create a workspace
In the Properties window select Connection: Beagle
+
<pre>
Click: Apply
+
$ ssh Beagle
Tab: Debugger
+
$ mkdir -p workspace/HelloWorld/Debug
GDB debugger:  Click: Browse and look for
+
</pre>
~/oe/tmp/cross/armv7a/bin/arm-angstrom-linux/gnueabi-g
+
In Debugger Options Tab:  Shared Libraries
+
Add...  ~/oe/tmp/staging/armv7a-angstgrom-linux-gnueabi/lib
+
  
Click: Debug (bottom right)
+
== Creating a New Project and Setting up for Remote Debugging ==
It should compile your file (if needed), copy it to the Beagle and start gdb on it.  It will run up to main() and wait for your input.  Try the single step button (F6 step over, F5 step into)
+
  
Be sure to hit Terminal (Ctrl-F2) when done.
+
Now back to the Eclipse
  
Add a for loop and watch the index variable change!
+
* Click:        '''File:New:C Project'''
 +
[[File:Eclipse - New C Project.png|300px]]
 +
* Name the project '''HelloWorld'''
 +
[[File:Eclipse - C Project.png|300px]]
 +
* Click: Finish
 +
* Click: Project:Properties
 +
[[File:Eclipse - Project Properties.png|300px]]
 +
* Expand: C/C++ Build
 +
* Select: Settings
 +
* Tab: Tool Settings
 +
* Select: GCC C Compiler
 +
* Replace "gcc" in "Command:" with "~/oe/angstrom-dev/cross/armv7a/bin/arm-angstrom-linux-gnueabi-gcc"
 +
[[File:Eclipse - gcc.png|300px]]
 +
* Click: Directories (below GCC C Compiler
 +
* Click [[File:Eclipse - Add.png]] (Add...) button and insert "/home/''yoder''/oe/angstrom-dev/staging/armv7a-angstrom-linux-gnueabi/user/include"  (Replace ''yoder'' with your path name.)
 +
* Click: GCC C Linker (below Directories)
 +
* Replace "gcc" in "Command:" with "~/oe/angstrom-dev/cross/armv7a/bin/arm-angstrom-linux-gnueabi-gcc"
 +
* Click: Libraries
 +
* Click: Add... to Library search path (-L)  (the bottom one) insert "~/oe/angstrom-dev/staging/armv7a-angstrom-linux-gnueabi/lib"
 +
* Click OK to close Properties for HelloWorld window
  
 +
== Creating and Compiling a New C File ==
  
##### Other
+
* Copy the '''HelloWorld''' file that we have been using into ~/workspace/HellowWorld.
This is taken from: http://www.ibm.com/developerworks/opensource/library/os-eclipse-stlcdt/index.html
+
* Click File:Refresh. You file should appear in the project.
 +
[[File:Eclipse - Refresh.png|300px]]
 +
[[File:Eclipse - HelloBeagle.png|300px]]
 +
* Hit Ctrl-B to build, or click the little hammer [[File:Eclipse_-_Build_Button.png]].
  
You might be able to do this via apt-get install.  I used the add/remove program app in Red Hat and selected Fedora Eclipse.  It appears to load lots of things.
+
== Running Your Program ==
This load version 3.4.1
+
  
In Ubuntu go to Applications: Add/Remove
+
* Menu: Run:Debug Configurations...
Select Show: All available applications
+
[[File:Eclipse - Debug Config.png|300px]]
Search: eclipse
+
* Double-Click C/C++ Remote Applcation to create a new configuration
Check: Eclipse
+
* Name it BeagleBoard
Click: Apply Changes
+
* Project: Click Browse and select HelloWorld
Wait for some 113 files to download (15 minutes on a fast connection)
+
* C/C++ Application: Click Search Project and select HelloWorld
With this install you need to load a few more things.  Go to
+
* Remote Absolute File Path...  Click: Browse...
Help:Software Updates:Find and Install...
+
* ConnectionClick New...
SelectSearch for new features to install
+
[[File:Eclipse - Select Remote.png|300px]]
Select: Callisto Discovery Site
+
* Select: SSH Only and Click Next >
Click: Finish  (wait a moment)
+
* Host name: Beagle
Select a site near you (wait a moment)
+
* Click: Finish
Expand: Callisto Discovery Site
+
* "Select Remote C/C++" will appear. Connection:  Beagle
Select:  C and C++ Development
+
[[File:Eclipse - Select Remote 001.png|300px]]
Next, Accept, Next, Finish (wait)
+
* Expand: My Home, workspace, HelloWorld, Debug
 +
[[File:Eclipse - Select Remote 002.png|300px]]
 +
* Click: OK
 +
* In the Properties window select Connection: Beagle
 +
* Click: Apply
 +
* Tab: Debugger
 +
* GDB debuggerClick: Browse and look for "~/oe/tmp/cross/armv7a/bin/arm-angstrom-linux/gnueabi-gdb"
 +
[[File:Eclipse - Debugger.png|300px]]
 +
* In Debugger Options Tab:  Shared Libraries
 +
* Add...  "~/oe/angstrom-dev/staging/armv7a-angstgrom-linux-gnueabi/lib"
 +
* Click: Debug (bottom right)
 +
[[File:Eclipse - Debug.png|300px]]
  
This loads version 3.2.2
+
It should compile your file (if needed), copy it to the Beagle and start gdb on it. However I haven't been able to make it work.
  
 +
'''Fix:''' The first time you try to select the Remote Absolute File Path for C/C++ Application you haven't uploaded the binary file to the Beagle. Hence you cannot select it via the dialogue. Once you clicked the "Debug" button you can re-open the dialogue and select the binary or you can manually complete the line to "/home/MyUsername/workspace/HelloWorld/Debug/HelloWorld".
  
#### Install the c/c++ stuff
+
Back when I had this working, it will run up to <code>main()</code> and wait for your input. Try the single step button (F6 step over, F5 step into)
Select:  Help:Software Updates
+
Tab:  Available Software
+
Expand:  Ganymede Update Site
+
Check:  C and C++ Development
+
Click: Install
+
Expand: Remote Access and Device Developement
+
Check: Remote System Explorer C/C++ Remote Debugger Launcher
+
Check: Remote System Explorer End-User Runtime
+
Click: Install
+
Click: Next
+
Click: I accept...
+
Click: Finish
+
  
##### Fedora #####
+
Be sure to hit Terminate (Ctrl-F2) when done.
I did see the Canymede Update Site on Fedora, so I
+
Select: Help:Software Updates
+
Tab: Available Software
+
Click: Add Site
+
Location: http://download.eclipse.org/releases/ganymede
+
Click: OK
+
The Available Software list should update nad "Ganymede Update Site" should appear.  The follow the instructions above.
+
  
#####        #####
+
Add a for loop and watch the index variable change!
 
+
Start Eclipse
+
Select: File:New:Project...
+
Expand: C
+
Select: C Project
+
Click: Next
+
Project Name:  HelloWorld (no spaces)
+
Select: Hello World ANSI C Project
+
Click: Next
+
Fill in to suit, Click:  Next
+
Click: Finish
+
Tab: C/C++ Projects
+
Expand: HelloWorld
+
Expand: src
+
Expand: HelloWorld.c
+
Double-Click: main(void)  The file will open in a window
+
 
+
This will create an executable that runs on the Ubuntu Linux (guest) platform.
+
 
+
##### Beagle Execution
+
Here's how to run it remotely on the Beagle.  This is from:
+
http://www.nabble.com/Solution:-Using-Eclipse-CDT-for-Gusmtix-development-td18251552.html
+
Here's what I did differently:
+
4) Project Properties/Settings
+
* On "GCC C++ Compiler" change "Command" to
+
"~/gumstix/gumstix-oe/tmp/cross/bin/arm-angstrom-linux-gnueabi-g++"
+
(dbg_03.png)
+
* On "GCC C++ Compiler/Directories" add
+
"~/gumstix/gumstix-oe/tmp/staging/arm-angstrom-linux-gnueabi/include" to
+
"Includes paths (-I)"
+
 
+
I used: tmp/staging/arm-angstrom-linux-gnueabi/usr/include
+
 
+
* On "GCC C++ Compiler/Miscellaneous" add "-c -march=armv5te
+
-mtune=xscale -Wa,-mcpu=xscale" to "Other flags"
+
 
+
I didn't change this since the gcc should have all this set.
+
 
+
5) On "Run/Debug Configurations" add "C++ Remote Application"
+
* On "Main" tab
+
 
+
This is in Run:Debug Configurations
+
 
+
 
+
In eclipse,
+
Select: Window:Open Perspective:C/C++
+
Click on the HelloWorld project to select it
+
Select: Project:Properties
+
Expand: C/C++ Build
+
Select: Discovery Options
+
 
+
 
+
 
+
Starting point:
+
http://www.nabble.com/Solution:-Using-Eclipse-CDT-for-Gusmtix-development-td18251552.html
+
 
+
On the Beagle:
+
opkg install openssh openssh-sftp openssh-server
+
opkg install gdbserver
+
 
+
In Eclipse
+
File:New Project
+
Select General:Project
+
I used project name "Remove gdb"
+

Latest revision as of 13:51, 10 September 2012

See EBC_Exercise_14_gdb_Debugging#Eclipse.2C_gdb_and_remote_debuging for remote debugging via Eclispe.

This was a work in progress that was never finished.

This may be a better starting place.

YouTube Video

Here is a video that says it will show how to use Eclipse for remote debugging.

Here is where you get the RSE-runtime.

host$ sudo apt-get update
host$ sudo apt-get install eclipse
host$ sudo apt-get install gcc-arm-linux-gnueabi
host$ sudo apt-get install g++-arm-linux-gnueabi
host$ sudo apt-get install gdb
host$ sudo apt-get install gdb-multiarch
beagle$ opkg update
beagle$ opkg install gdbserver

Work in Progress

Eclipse is an open source Integrated Development Environment that's enjoying broad use.

Here's how to run gdb on Beagle via Eclipse

Installing on Host

Install Eclipse and the gdb tools

$ cd ~/oe
$ sudo  apt-get install eclipse 
$ source source-me.txt
$ bitbake gbd-cross

Install Remote System Tools

  • Start Eclipse ($ eclipse &)

Eclipse - Workspace Launcher.png

  • Click: OK

Eclipse - Welcome.png

  • Go to Help:Install New Software...

Eclipse - Install New Software.png

Eclipse - Add Site.png

  • Enter: Galileo in the Name field
  • Click: OK and wait while it fetches from the site.
  • Expand: Mobile and Device Development

Eclipse - Mobile Devices.png

  • Check: Eclipse C/C++ DSF gdb Debugger
  • Check: Eclipse C/C++ Remote Launch
  • Check: Remote System Explorer End-User Runtime
  • Check: Remote System Explorer User Actions
  • Expand: Programming Languages
  • Check: Eclipse C/C++ Development Tools
  • Click: Next >
  • Verify the list and Click Next >

Eclipse - Install Details.png

  • Accept the license and Click: Finish
  • Click: "Yes" to restart Eclipse
  • Click: "Yes" to use same workspace

Finding the Beagle's IP address

  • On the BeagleBoard run
$ ifconfig eth0

Note the IP address

  • On the host edit /etc/hosts and add:
137.112.41.76	Beagle (Use your IP address)
  • Exit the editor and try:
$ ping Beagle

If you don't get an answer something is messed up. Get help. On the host connect to the Beagle and create a workspace

$ ssh Beagle
$ mkdir -p workspace/HelloWorld/Debug

Creating a New Project and Setting up for Remote Debugging

Now back to the Eclipse

  • Click: File:New:C Project

Eclipse - New C Project.png

  • Name the project HelloWorld

Eclipse - C Project.png

  • Click: Finish
  • Click: Project:Properties

Eclipse - Project Properties.png

  • Expand: C/C++ Build
  • Select: Settings
  • Tab: Tool Settings
  • Select: GCC C Compiler
  • Replace "gcc" in "Command:" with "~/oe/angstrom-dev/cross/armv7a/bin/arm-angstrom-linux-gnueabi-gcc"

Eclipse - gcc.png

  • Click: Directories (below GCC C Compiler
  • Click Eclipse - Add.png (Add...) button and insert "/home/yoder/oe/angstrom-dev/staging/armv7a-angstrom-linux-gnueabi/user/include" (Replace yoder with your path name.)
  • Click: GCC C Linker (below Directories)
  • Replace "gcc" in "Command:" with "~/oe/angstrom-dev/cross/armv7a/bin/arm-angstrom-linux-gnueabi-gcc"
  • Click: Libraries
  • Click: Add... to Library search path (-L) (the bottom one) insert "~/oe/angstrom-dev/staging/armv7a-angstrom-linux-gnueabi/lib"
  • Click OK to close Properties for HelloWorld window

Creating and Compiling a New C File

  • Copy the HelloWorld file that we have been using into ~/workspace/HellowWorld.
  • Click File:Refresh. You file should appear in the project.

Eclipse - Refresh.png Eclipse - HelloBeagle.png

  • Hit Ctrl-B to build, or click the little hammer Eclipse - Build Button.png.

Running Your Program

  • Menu: Run:Debug Configurations...

Eclipse - Debug Config.png

  • Double-Click C/C++ Remote Applcation to create a new configuration
  • Name it BeagleBoard
  • Project: Click Browse and select HelloWorld
  • C/C++ Application: Click Search Project and select HelloWorld
  • Remote Absolute File Path... Click: Browse...
  • Connection: Click New...

Eclipse - Select Remote.png

  • Select: SSH Only and Click Next >
  • Host name: Beagle
  • Click: Finish
  • "Select Remote C/C++" will appear. Connection: Beagle

Eclipse - Select Remote 001.png

  • Expand: My Home, workspace, HelloWorld, Debug

Eclipse - Select Remote 002.png

  • Click: OK
  • In the Properties window select Connection: Beagle
  • Click: Apply
  • Tab: Debugger
  • GDB debugger: Click: Browse and look for "~/oe/tmp/cross/armv7a/bin/arm-angstrom-linux/gnueabi-gdb"

Eclipse - Debugger.png

  • In Debugger Options Tab: Shared Libraries
  • Add... "~/oe/angstrom-dev/staging/armv7a-angstgrom-linux-gnueabi/lib"
  • Click: Debug (bottom right)

Eclipse - Debug.png

It should compile your file (if needed), copy it to the Beagle and start gdb on it. However I haven't been able to make it work.

Fix: The first time you try to select the Remote Absolute File Path for C/C++ Application you haven't uploaded the binary file to the Beagle. Hence you cannot select it via the dialogue. Once you clicked the "Debug" button you can re-open the dialogue and select the binary or you can manually complete the line to "/home/MyUsername/workspace/HelloWorld/Debug/HelloWorld".

Back when I had this working, it will run up to main() and wait for your input. Try the single step button (F6 step over, F5 step into)

Be sure to hit Terminate (Ctrl-F2) when done.

Add a for loop and watch the index variable change!