Using Eclipse IDE with Yocto SDK
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.
If you haven't followed Cross Compile with Yocto SDK, please do so up to the Setting up the Environment
section.
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
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:
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
.
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.
You can click on the Build
button. It should build with no errors.
The ability to remotely deploy and debug applications is just as useful as using powerful workstations to cross-compile code.
- Go to Run -> Debug Configurations.
- Double click on
C/C++ Remote Application
to create a new configuration. - 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.
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
:
Pro Tip: If you build your own SDK and images, consider including eclipse-debug to use Target Communication Framework instead of SSH.