Skip to content

Using Eclipse IDE with Yocto SDK

Adam YH Lee edited this page Jul 30, 2015 · 12 revisions

In the Cross Compile with Yocto SDK tutorial, we installed and used the Yocto SDK to compile and debug a simple Hello World program. In this article, we will extend on the first article to build and debug the spidev-test program using the Eclipse IDE with the Yocto SDK.

Installing Yocto SDK with Gumstix sysroot

If you haven't followed Cross Compile with Yocto SDK, please do so up to the Setting up the Environment section.

Setting up Eclipse IDE for Yocto Development

Install Eclipse Luna - the latest supported version by Yocto Project 1.8.

Install these plugins:

Linux Tools 
- Linux Tracing Toolkit
Mobile and Device Development
- C/C++ Remote Launch 
- Remote System Explorer End-user Runtime
- Remote System Explorer User Actions
- Target Management Terminal
- TCF Remote System Explorer add-in
- TCF Target Explorer
Programming Languages
- C/C++ Autotools Support
- C/C++ Development Tools

Install Eclipse Yocto Plug-in Add http://downloads.yoctoproject.org/releases/eclipse-plugin/1.8/luna and install the followings:

- Yocto Project ADT Plug-in 
- Yocto Project Bitbake Commander Plug-in
- Yocto Project Documentation plug-in

Eclipse Yocto Plugins

Additionally, let's check the Yocto SDK environment variables have been imported. Go to proferences -> C/C++ -> Build. Under Environment, it should look like below:

Eclipse Yocto Environments

Create an Autotools Project

Yocto SDK's Eclipse plugin supports CMake and Autotools Projects. It is possible to use an empty C/C++ project, but extra work to properly configure Eclipse with Yocto SDK is out of scope of this article. To keep things simple, here we will base our project on the Hello World ANSI C Autotools Project under Yocto Project ADT Autotools Project. Be sure to name your project spidev_test.

create-autotools-project

Then you can copy and paste the spidev_test.c code into spidev_test.c in the src directory. Note that the code is including headers such as sys/ioctl.h and linux/spi/spidev.h. You will find these header files within the sysroot of your SDK install directory.

Eclipse Yocto Build

Build!

You can click on the Build button. It should build with no errors.

Debug Remotely with Eclipse

The ability to remotely deploy and debug applications is just as useful as using powerful workstations to cross-compile code.

  1. Go to Run -> Debug Configurations.
  2. Double click on C/C++ Remote Application to create a new configuration.
  3. Under Main, create a new connection with your Gumstix COM's IP address. And fill out Project, C/C++ Application and Remote Absolute File Path for C/C++ Application.

Configure a new connection to the target (COM) in C/C++ Remote Application from Run -> Debug Configurations. Make sure you use SSH as the protocol.

Eclipse Yocto Debug Configuration

Once you click on the Debug button, Eclipse will switch to the debug perspective, and upload a copy of spidev-test binary to the COM to start a remote debugging session.

If you run into an issue such as Could not determine GDB version using command: gdb --version, manually set cross GDB. Change GDB debugger to arm-poky-linux-gnueabi-gdb from gdb:

Eclipse Yocto Debug GDBS

Pro Tip: If you build your own SDK and images, consider including eclipse-debug to use Target Communication Framework instead of SSH.