ECE497 Notes on Installing the Eclipse IDE

From eLinux.org
Revision as of 13:49, 10 September 2012 by Yoder (Talk | contribs)

Jump to: navigation, search

thumb‎ Embedded Linux Class by Mark A. Yoder


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!