Difference between revisions of "BeagleBoardEclipse"

From eLinux.org
Jump to: navigation, search
m (Add three configuration changes)
m (Add first debugging infos)
 
(3 intermediate revisions by the same user not shown)
Line 188: Line 188:
  
  
tbd.
+
Now, basic configuration is done! But the new project is still empty. We have to import the four downloaded files into our project, now:
 +
 
 +
* Import LEDblink files into the new project:
 +
 
 +
File -> Import...
 +
 
 +
* Select
 +
 
 +
General -> File System
 +
 
 +
 
 +
[[File:Eclipse 12.jpg]]
 +
 
 +
 
 +
* Then click next, browse to the directory where you downloaded the four LEDblink files and select them:
 +
 
 +
 
 +
[[File:Eclipse 13.jpg]]
 +
 
 +
and finish.
 +
 
 +
Now, at the left side, in the Project view, you should see the four files. Double clicking them opens them in the editor. With LEDblink.c opened this should now look like:
 +
 
 +
 
 +
[[File:Eclipse 14.jpg]]
 +
 
 +
 
 +
Before we can now build (compile) our small nice example, let us clean up everything (and configure clean dialog):
 +
 
 +
* Select
 +
 
 +
Project -> Clean ...
 +
 
 +
and configure it as given:
 +
 
 +
 +
[[File:Eclipse 15.jpg]]
 +
 
 +
 
 +
("Clean projects selected below", select LEDblink, and disable "Start a build immediately"). By pressing OK ''make clean'' from Makefile should be called (it might give some errors the first time, because nothing is to be cleaned).
 +
 
 +
* Last step is to build the example.
 +
 
 +
Project -> Build project
 +
 
 +
should call ''make all'' resulting in LEDblink executable:
 +
 
 +
 
 +
[[File:Eclipse 16.jpg]]
 +
 
 +
 
 +
Next step is to debug this.
  
 
==Debugging==
 
==Debugging==
  
tbd.
+
Here, we want to download and debug LEDbink binary on BeagleBoard using OpenOCD JTAG debugger controlled by Eclipse.
 +
 
 +
* For this, open an additional terminal/console, and make sure OpenOCD is started and connected to Beagle running U-Boot. See [[BeagleBoardOpenOCD#Starting_OpenOCD|how to configure OpenOCD for Beagle]]. This should look like:
 +
 
 +
> '''openocd -s lib/openocd/ -f interface/flyswatter.cfg -f board/ti_beagleboard.cfg'''
 +
Open On-Chip Debugger 0.3.0-in-development (2009-09-29-16:28) svn:2771M
 +
$URL: svn://svn.berlios.de/openocd/trunk/src/openocd.c $
 +
For bug reports, read http://svn.berlios.de/svnroot/repos/openocd/trunk/BUGS
 +
RCLK - adaptive
 +
Warn : omap3530.dsp: huge IR length 38
 +
Info : RCLK (adaptive clock speed) not supported - fallback to 6000 kHz
 +
Info : JTAG tap: omap3530.jrc tap/device found: 0x0b7ae02f (mfg: 0x017, part: 0xb7ae, ver: 0x0)
 +
 
 +
With OpenOCD running, back to Eclipse.
 +
 
 +
* Switch to Debug perspective:
 +
 
 +
Window -> Open Perspective -> Debug
 +
 
 +
This results in switching to debug perspective, having an additional ''Debug'' button in the upper right corner:
 +
 
 +
 
 +
[[File:Eclipse 17.jpg]]
 +
 
 +
 
 +
This debug perspective needs some configuration.
 +
 
 +
* Select
 +
 
 +
Run -> Debug configurations...
 +
 
 +
* There, select
 +
 
 +
Zylin Embedded debug (native)
 +
 
 +
* In tab ''Main'' do
 +
 
 +
Search project ...
 +
 
 +
and select LEDblink:
 +
 
 +
 
 +
[[File:Eclipse 18.jpg]]
 +
 
 +
 
 +
* In tab ''Debugger'' add the gdb of your toolchain:
 +
 
 +
 
 +
[[File:Eclipse 19.jpg]]
 +
 
 +
 
 +
* In Tab  ''Commands'' in ''Initialize commands'' add
 +
 
 +
target remote localhost:3333
 +
monitor omap3_dbginit
 +
monitor halt
 +
load LEDblink
 +
symbol-file LEDblink
 +
b main
 +
cont
 +
 
 +
 
 +
[[File:Eclipse 20.jpg]]
 +
 
 +
 
 +
* After all this is done, press
 +
 
 +
Debug
 +
 
 +
button.
 +
 
 +
You should end up with
 +
 
 +
 
 +
[[File:Eclipse 21.jpg]]
 +
 
 +
 
 +
Congratulations! You can now debug, single step, disassemble etc.
  
 
=Reading=
 
=Reading=

Latest revision as of 15:23, 2 October 2009

This page is about using Eclipse IDE for BeagleBoard. It is focused on JTAG debugging with e.g. OpenOCD, but can be extended to additional topics, e.g. C/C++ development. And, while the examples focus on Beagle, stuff shown here will most probably easily apply to other boards.

Installation

Here, installation of Eclipse for C/C++ development and embedded GDB/JTAG debugging will be described. This is done in three steps:

Note: The file names and versions given here are based on October 2009. They may change.

Eclipse Classic

In October 2009 this was version 3.5.1. 32-bit Linux version download resulted in file eclipse-SDK-3.5.1-linux-gtk.tar.gz.

  • Installation is done by extracting downloaded (tar.gz) file (e.g. tar xvfz eclipse-SDK-3.5.1-linux-gtk.tar.gz).
  • Start Eclipse by calling
cd eclipse
./eclipse

You might want to add this to your path and/or add a start icon/shortcut on your desktop/start menue.

Starting Eclipse, you are asked for the directory where you want to have your workspace:


Eclipse 1.jpg


After doing this, Eclipse starts...


Eclipse 2.jpg


... and presents the start screen:


Eclipse 3.jpg

CDT

  • To install CDT, in Eclipse select
Help -> Install new software...
  • There, use
Add...

dialog and enter:

Note: Check CDT download page for up to date link.


Eclipse 4.jpg


Press, OK, select both CDT components ...


Eclipse 5.jpg


... and click Next, accept license agreement and Finish. Then download and installation of CDT and dependencies starts.

  • Wait until CDT installation finished. Then, you are asked to restart. Do this.

Zylin Embedded CDT

  • To install Zylin Embedded CDT, in Eclipse select
Help -> Install new software...
  • There, use
Add...

dialog and enter:

Note: Check Zylin Embedded CDT page for up to date link.


Eclipse 6.jpg


Press, OK, select Zylin Embedded CDT ...


Eclipse 7.jpg


... click Next and Finish. Accept message about unsigned components and restart Eclipse again.

CDT perspective

Now, everything is installed. We can switch to C/C++ mode now. For this:

  • Switch to "Workspace" (clicking Workspace button)
  • Make sure you are in C/C++ mode. In upper right corner, C/C++ perspective has to be enabled. If this isn't enabled (e.g. Java is enabled), do Window -> Open Perspective -> Other ... and select "C/C++":


Eclipse 8.jpg


Usage

To demonstrate usage an example is the best way. Here a small stand alone program is used. It is downloaded to BeagleBoard which is running U-Boot prompt and then debugged using OpenOCD JTAG debugger. So in this example we do:

  • Get a small stand alone program (LEDblink) from internet and create an Eclipse project with it
  • Start OpenOCD and configure Eclipse debug environment
  • Download build example and debug it

Example project

First, we download source code and control files for a small stand alone program we can run on BeagleBoard. For this, we use Magnus' LEDblink program. While Beagle is running at U-Boot prompt, this can be downloaded by OpenOCD JTAG to Beagle and let Beagle's LEDs blink.

Note: You need ARM cross compiler installed for this (e.g. CodeSourcerys' 2009q1-203 version, or newer).

Note: Depending on your tool chain, in Makefile edit "TYPE" variable

  • To be able to run Eclipse default configuration "make all" edit Makefile and add an "all" target. Result should look like
... 
CFLAGS=-g -Os -c -mcpu=cortex-a8 -mfpu=neon -mfloat-abi=hard

all: LEDblink

LEDblink: LEDblink.o Makefile $(LDSCRIPT) crt0.o
...
  • After we have the source now, we can start a new Eclipse C project:
File -> New -> C Project

and there create a new empty Makefile project "LEDblink":


Eclipse 9.jpg


If you click finish now, you have created your first Eclipse project.

In this new project, we have to re-configure three configurations, now.

  • First, disable automatic build:
Disable checkbox before Project -> Build Automatically
  • Second, in Project menu select Properties:
Project -> Properties

There, in Builders configuration disable Scanner Configuration Builder


Eclipse 10.jpg


  • Third, still in Properties window, in
C/C++ Build -> Settings

enable GNU Elf Parser:


Eclipse 11.jpg


Now, basic configuration is done! But the new project is still empty. We have to import the four downloaded files into our project, now:

  • Import LEDblink files into the new project:
File -> Import...
  • Select
General -> File System


Eclipse 12.jpg


  • Then click next, browse to the directory where you downloaded the four LEDblink files and select them:


Eclipse 13.jpg

and finish.

Now, at the left side, in the Project view, you should see the four files. Double clicking them opens them in the editor. With LEDblink.c opened this should now look like:


Eclipse 14.jpg


Before we can now build (compile) our small nice example, let us clean up everything (and configure clean dialog):

  • Select
Project -> Clean ...

and configure it as given:


Eclipse 15.jpg


("Clean projects selected below", select LEDblink, and disable "Start a build immediately"). By pressing OK make clean from Makefile should be called (it might give some errors the first time, because nothing is to be cleaned).

  • Last step is to build the example.
Project -> Build project

should call make all resulting in LEDblink executable:


Eclipse 16.jpg


Next step is to debug this.

Debugging

Here, we want to download and debug LEDbink binary on BeagleBoard using OpenOCD JTAG debugger controlled by Eclipse.

  • For this, open an additional terminal/console, and make sure OpenOCD is started and connected to Beagle running U-Boot. See how to configure OpenOCD for Beagle. This should look like:
> openocd -s lib/openocd/ -f interface/flyswatter.cfg -f board/ti_beagleboard.cfg
Open On-Chip Debugger 0.3.0-in-development (2009-09-29-16:28) svn:2771M
$URL: svn://svn.berlios.de/openocd/trunk/src/openocd.c $
For bug reports, read http://svn.berlios.de/svnroot/repos/openocd/trunk/BUGS
RCLK - adaptive
Warn : omap3530.dsp: huge IR length 38
Info : RCLK (adaptive clock speed) not supported - fallback to 6000 kHz
Info : JTAG tap: omap3530.jrc tap/device found: 0x0b7ae02f (mfg: 0x017, part: 0xb7ae, ver: 0x0)

With OpenOCD running, back to Eclipse.

  • Switch to Debug perspective:
Window -> Open Perspective -> Debug

This results in switching to debug perspective, having an additional Debug button in the upper right corner:


Eclipse 17.jpg


This debug perspective needs some configuration.

  • Select
Run -> Debug configurations...
  • There, select
Zylin Embedded debug (native)
  • In tab Main do
Search project ...

and select LEDblink:


Eclipse 18.jpg


  • In tab Debugger add the gdb of your toolchain:


Eclipse 19.jpg


  • In Tab Commands in Initialize commands add
target remote localhost:3333
monitor omap3_dbginit
monitor halt
load LEDblink
symbol-file LEDblink
b main
cont


Eclipse 20.jpg


  • After all this is done, press
Debug

button.

You should end up with


Eclipse 21.jpg


Congratulations! You can now debug, single step, disassemble etc.

Reading

Additional plug ins

Links