HIO Wiki:Set Up Eclipse IDE for Yocto Device
Eclipse is a free and open source integrated development environment. It is written mostly in Java and is used to develop applications. Eclipse contains many plug-ins and can be used to develop application in many other programming languages. This guide will describe how to use Eclipse to develop applications in C/C++ to run on HIB-EMB-1200.
Compile and Install the SDK Toolchain
Change directory to your build directory and verify that your environment settings correct.
$cd /path/to/hio-yocto-bsp $. ./setup-environment build_fb/
$bitbake meta-ide-support $bitbake meta-toolchain adt-installer
Note: the bitbake process might take several hours.
After bitbake has successfully finished. change directory to /path/to/build-fb/tmp/deploy/sdk/ and run the toolchain poky-eglibc-x86_64-meta-toolchain-cortexa9hf-vfp-neon-toolchain-1.6.1.sh
$sudo sh poky-eglibc-x86_64-meta-toolchain-cortexa9hf-vfp-neon-toolchain-1.6.1.sh Enter target directory for SDK (default: /opt/poky/1.6.1): You are about to install the SDK to "/opt/poky/1.6.1". Proceed[Y/n]?Y Extracting SDK...done Setting it up...done SDK has been successfully set up and is ready to be used.
Install JAVA JDK and JRE
$sudo apt-get install openjdk-7-jdk $sudo apt-get install openjdk-7-jre
There are many versions of Eclipse but Yocto Project is currently supporting up to Luna (4.4). However, this tutorial will use Eclipse Kepler (4.3) and Yocto Eclipse Plug-in Version 1.5
Downloads Eclipse Kepler IDE for C/C++ Developers
$cd /path/to/eclipse-cpp-kepler-SR1-linux-gtk-x86_64.tar.gz $tar -xvf /path/to/eclipse-cpp-kepler-SR1-linux-gtk-x86_64.tar.gz
- Start Eclipse IDE.
- In Workbench, Select Help > Install New Software.
- Click on Work with: > Select Kepler - http://download.eclipse.org/releases/Kepler
- Expand Linux Tools > Select LTTng - Linux Tracing Toolkit
- Expand Mobile and Device Development > Select :
- - 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
- Expand Programming Languages > Select C/C++ Autotools Support
- Next to Work with: > Click Add... > Name: Yocto Eclipse Plug In - v1.5 > Location: http://downloads.yoctoproject.org/releases/eclipse-plugin/1.5/kepler > Click Ok
- Select Yocto Project ADT Plug-in, Yocto Project Bitbake Commander Plug-in, and Yocto Project Documentation plug-in.
- Click Next > Next > Accept License > Finish > Restart Eclipse
Configuring the Cross-Compiler Options
To configure the Cross Compiler Options,
- In the Workbench > Select Window > Preferences
- Select Yocto Project ADT
- Select Standalone pre-built toochain
- Browse forToolchain Root Location
- - Default location is /opt/poky/1.6.1
- Browse for Sysroot Location
- - Default location is /opt/poky/1.6.1/sysroots
- The Target Architecture will be selected automatically based on build.
Create the Project
We can create two types of projects: Autotools-based, or Makefile-based. This section describes how to create Autotools-based projects within the Eclipse IDE. To create a project based on a Yocto template and then display the source code, follow these steps:
- In the Workbench > Select File> New> Project
- Expand C/C++ > Select C Project > Next
- Expand Yocto Project ADT Autotools Project > choose Hello World ANSI C Autotools Project (This is an Autotools-based project based on a Yocto template).
- Toolchains should be GNU Autotools Toolchain
- Input Project name > Specify Location if needed > Next
- Input Basic Settings > Finish
- If the "Open Perspective" prompt appears, click "Yes" to get in the C/C++ perspective.
- The left side pane shows the project(s). To display source, double clicking the project's src folder.
Create Remote System Connection
The target system must connect to an internet network.Obtain the target system IP Address by ifconfig
Using the console of your target set a password with "passwd" command. choose a simple one named "root". The target should be connected to the network via Ethernet or WIFI. Use the "ifconfig" command to get the target ip address. From Eclipse
- In Workbench, Select Window > Open Perspective > Other
- Double click on Remote System Explorer
- In Remote System pane, right click > Select New' > Connection...
- Choose SSH Only > Next
- Set Host name to the target IP
- Click Finish
- Right Click on the Target IP > Select Connect
- Input User ID and Password
Launching Terminal and shell command is available upon connected to the target system.
Remote Build and Debug
Many time, we need to test the projects on the target system. Doing this way will transfer the files in the host computer to the target system. The program is executed in the target system and feedback information to the host computer.
- Select the project to run
- Select Run > Run Configurations...
- In the left pane, expand C/C+ Remote Application
- Select Connect to the target system.
- Browse Remote Absolute File Path for C/C++ Applications
- Click Run