Contents |
Eclipse for embedded development

The Eclipse IDE has been used for embedded development for many years now, but it has always been a painful process to setup and use. In a couple of weeks version 3.5 of the Eclipse framework codenamed 'Galileo' will be released. At the same time the CDT team are planing to release version 6.0 of the C/C++ Development Tooling plugin. What makes this interesting to the embedded development community is that the Debugger Services Framework (DSF) has been integrated into this CDT release. The DSF provides an alternative to the Standard Debug Model API of the Eclipse platform and has been designed to help achieve better performance when debugging applications on slow or remote targets.
The rest of the page describes how to install, configure and use Eclipse to develop and debug a simple "hello world" application on the QSK9260.
Installation
- Install Java Runtime
- Install Cross Compiling Toolchain
- Install Eclipse
As Eclipse is Java based it will not run without an installed Java runtime. The latest version of the runtime can be downloaded from http://java.sun.com/javase/downloads/index.jsp. If you are not needed to do any Java development then the "runtime only" download is fine (JRE). Version 6 or greater should be installed. The JRE comes with a self installer and automatically configures the environment.
To be able to develop applications for an embedded device, you will also need to install the GCC cross compiler for your platform. We recommend the 2007:Q3 release from CodeSourcey for this. Once your environment paths are setup, you should be able to run arm-none-linux-gnueabi-gcc from the command line.
Eclipse can be downloaded from http://www.eclipse.org/downloads/. Version 3.5 ("Galileo") or greater should be installed to ensure Embedded Debugging is supported. There are several different packages available to download. If you are only planning on doing C/C++ development then the "Eclipse IDE for C/C++ Developers" is a lot smaller to download. We normally use the "Eclipse Classic" package and install the C/C++ plugins from Eclipse itself.
The Eclipse installation process requires the simple extraction of the archive to your PC's hard disk (usually c:\eclipse on windows or /usr/local/opt/eclipse on Linux). Eclipse is run by running the eclipse executable in the root folder of the installation.
Configuration
- Update eclipse.ini
- Install required plugins
- Disable auto-building and indexer
Depending on the size of the application you are working on (e.g. Linux Kernel) you may need to increase the amount of virtual memory that Eclipse will use. This is set in the Eclipse.ini file in the root directory of the installation. Change the "-Xmx256m" parameter to "-Xmx512m" to provide 512MB rather than the default 256MB. When you first start Eclipse it will request you to choose a workspace folder. This is used to store IDE configuration (specific to that workspace) as well as the default location for newly created projects. We tend to keep our projects outside the workspace folder, and hence it is only used as a home for workspace specific configuration.
To use Eclipse for C/C++ embedded development, you must install several plugins. The C/C++ Development Tooling (CDT) project has generated several plugins aimed at C/C++ development and more recently integrated the Debugger Services Framework (DSF) that has been developed to make Eclipse more "Embedded Device friendly". If you downloaded the C/C++ installation package, then most of these plugins will already be installed. Even then, there are some extra packages that are worth installing to make embedded development easier. Select "Help->Install New Software" to open the "Install" dialog. If the default Galileo update site is not already listed you will need to add it by clicking the "Add" button and setting "http://download.eclipse.org/releases/galileo" as the location. Once this is added Eclipse will download the available plugin list from the Eclipse website. Plugins are installed by selecting the appropriate check box and stepping through the installation wizard. We recommend the following plugins;
- Eclipse C/C++ Development Tools - for C/C++ development
- Eclipse C/C++ Remote Launch - for embedded device control and debugging
- Remote System Explorer End-User Runtime - for remote connections using SSH, FTP etc.
- Subversive SVN Team Provider - for source control
Before loading any projects, or doing any development it is also worth disabling "auto-building" by un-checking "Project->Build Automatically". While this is useful for a small project, it can get annoying when making large edits to bigger projects. The second, but more important, configuration to change is to disable the C/C++ indexer. This is a great feature for small applications, but when working on the Linux Kernel tree, your PC will most likely be off parsing the entire source tree from now until the end of time. Select "Window->Preferences" and on the "C/C++->Indexer" tab select "No indexer".
Projects
When you first run Eclipse you will be asked to specify a workspace folder. This is where your configuration data and projects will be stored. To begin working in Eclipse close the Welcome tab to get to the main development window. The Welcome tab will only be shown the first time you run Eclipse. Switch to the C/C++ perspective if it is not already active by selecting "Window->Open Perspective->Other..." and choose "C/C++".
Creating a new project
To create a new project select "File->New->C Project". Set the project name to be a unique name for your project, and set the project type to "Executable->Empty Project". You may click "Next" for further options, or "Finish" to create the project. Your project will now be shown in the Project Explorer side pane.
You can create a new file for your project with "File->New->Source File". The new file will be created in the current project directory under your workspace folder. For example, if you workspace folder is /home/ryan/workspace, and your project name is Hello, then files will be created in /home/ryan/workspace/Hello/. To build your project select "Project->Build All". The project will be built with the native gcc compiler so it can be run directly on your desktop machine. Once the project is successfully built, it can be run with "Run->Run".
Setting up the toolchain
To build your project to be run on the ARM you need to change the toolchain for your project. The easiest method for doing this is to select "Project->Properties" and then select "C/C++ Build->Settings" in the properties window. Under the "Tool Settings" tab, Select "GCC C Compiler" and change "command" from gcc to arm-none-linux-gnueabi-gcc. You also need to add the arm-none-linux-gnueabi- prefix to the commands under "GCC C Linker" and "GCC Assembler". Click "Ok" to apply the changes.
Rebuild your project to build the ARM binary. Under Linux, you can verify that the executable is an ARM binary using the file command. For example:
file ~/workspace/Hello/Debug/Hello Hello: ELF 32-bit LSB executable, ARM, version 1 (SYSV), for GNU/Linux 2.6.14, dynamically linked (uses shared libs), not stripped
Device Connection
- Install SSH server on device
- Create connection to device
- Test connection
Before we can debug an application on the embedded device, a "connection" must be made to the device. The most reliable method we have found to do this is to use SSH over an Ethernet link.
Note: Make sure your Snapper module has the latest kernel and root file system installed and your QSK has internet access.
To install the packages for ssh and gdb on the QSK enter the following commands on the embedded device:
ipkg-cl update ipkg-cl install openssh openssh-sftp-server gdbserver
Edit the file /etc/sshd/sshd_config and make sure the following options are set:
UsePrivilegeSeparation no PermitEmptyPasswords yes
Start the ssh daemon with the following command:
/etc/init.d/sshd start
If it works correctly you should see the following:
Starting OpenBSD Secure Shell server: sshd done.
In Eclipse activate the Remote System Explorer perspective by selecting "Window->Open Perspective->Other..." and selecting "Remote System Explorer". Create a new connection by selecting "File->New->Other..." and choosing "Remote System Explorer->Connection". Choose a Linux connection and click "Next". In the "Host name" field enter the IP address of your embedded device and click next. Choose "ssh.file" as the configuration and click "Next". Choose "processes.shell.linux" and click next. Choose "ssh.shells" and click next. Click "Finish'.
Now if the connection is working properly you should be able to browse the embedded devices file system in the "Remote System" view. When you first connect it will ask you for your login to the device. You can also open a terminal connection to the device by right clicking "Ssh Terminal" in the "Remote System" view and selecting "Launch Terminal".
Debugging
- Create a debug configuration (connection, path and GDB command)
- Debug the application
Switch back to the C/C++ perspective, make sure the example application you created earlier is selected and select "Run->Debug Configurations...". Select "C/C++ Remote Application" and press the "New" button to create a new configuration. Make sure the connection you created earlier is selected. Set the path and executable name for the application when it is running on the remote device (i.e. /home/Test). On the "Debugger" tab, make sure you set the GDB debugger to the cross compiled version (e.g. arm-none-linux-gnueabi-gdb). Click "Debug" to start debugging!



