Eclipse Development Environment Setup

Integration with Eclipse simplifies the compilation, remote execution and remote debugging of EGT applications using Buildroot

The typical usage model of our EGT integration with Eclipse would be:

  1. Creating the buildroot system for a particular target board to execute or debug EGT applications or libraries. This involves configure your buildroot system, enable EGT package with their dependencies and Build the buildroot system. Refer section Cross Compiling With Buildroot
  2. Once Buildroot compilation is done. The output/image folder contains all the files to boot Linux on to the target board. To create a sdcard image to boot Linux on to sam9x60EK board refer create sdcard image.
  3. Start Eclipse to develop, execute or debug your own custom EGT applications/libraries, that will rely on EGT library built and installed by Buildroot.

This tutorial will guide you through the installation, usage of Eclipse for developing EGT application using Buildroot.

Eclipse Installation

At the current time, the latest stable version of Eclipse is called 2019-06. Most Linux distributions come either with an Eclipse package or allow it to be easily installed by the package manager in the distribution. However, note that this is frequently an out of date version. You can get hold of the latest version from the central download site at http://www.eclipse.org As an IDE, Eclipse supports many different programming languages including Java, C, C++, Python, and many others. At installation time you need to select the version to support the package(s) that you want. To make this easier there is an installation tool which will guide you through the steps.

Eclipse installer
Download Eclipse IDE for C/C++ Developers and follow below steps for installation.

See also

Extract the eclipse-cpp-2019-06-R-linux-gtk-x86_64.tar.gz to folder /opt

sudo tar -zxvf eclipse-cpp-2019-06-R-linux-gtk-x86_64.tar.gz -C /opt
sudo chown -R root:root /opt/eclipse

Create a desktop file and install it:

gedit eclipse.desktop

copy below lines to the eclipse.desktop file

[Desktop Entry]
Comment=Integrated Development Environment

Set a executable permission and execute following command to install it:

sudo desktop-file-install eclipse.desktop

Create a symlink in /usr/local/bin

sudo ln -s /opt/eclipse/eclipse /usr/local/bin/eclipse

For eclipse icon to be displayed in dash, eclipse icon can be added as

sudo cp /opt/eclipse/icon.xpm /usr/share/pixmaps/eclipse.xpm

Eclipse needs to have either OpenJDK or Sun Java installed to be able to run eclipse and here is a simple example of installing Open JDK 1.8:

sudo apt install openjdk-8-jdk

With Eclipse installed in /opt folder and it can now be accessed by any users.

Start Eclipse and Create EGT project

Start Eclipse from the Ubuntu Applications tray and you will be asked where to place your workspace directory. By default, the location will be under users home directory. i.e. /home/<user>/eclipse-workspace.

Eclipse workspace
With the workspace set and clicking launch, Eclipse will start with a startup screen.

Eclipse startup screen
Now we create a new EGT project that will use a toolchain generated by Buildroot. In the below example we create an EGT project using autotool and it is up to the developer to write the configure.ac file and Makefile.am. This allows the project to be built outside of Eclipse and to use standard Unix tools as your project build system. For more info on autotools, refer GNU Autotools

Click on Create a new C/C++ Project and Select "C++ Managed Build" in New C/C++ Project window then click Next

Select C++ Managed Build
In Create C/C++ Project window:

  1. Set the project name,
  2. In Project type, Expand GNU Autotools and Select Empty project.
  3. In Toolchains, Select GNU Autotools Toolchain
  4. Click on Next.

Create C++ Project
To cross-compile this Project using Buildroot toolchain. we need to set few environments variables and this can be done clicking Advance Setting in Select Configurations window.

C++ Project Select Configurations
In the Properties window, Expand Autotools and select configure settings. Under Configure Settings, select platform specifiers and set "Host platform (--host)" to "arm-buildroot-linux-gnueabi"

C++ Project Properties Autotools
Now select Environment Variables and click New. Under New Environment Variable window set buildroot toolchain path and Click OK.

  1. Name: PATH
  2. Value: buildroot/output/host/bin:$PATH

C++ Project Properties Autotools Environment
To enable debug options, Select Advance and check Debug(-g) option and then click Apply.

C++ Project Properties Autotools Advance
Now expand the C/C++ Build. Select Environment and click Add. In New Variable window set buildroot toolchain path with below details. click OK & "Apply and Close" an then Finish.

  1. Name: PATH
  2. Value: buildroot/output/host/bin:$PATH
  3. Check Add to all configurations

C++ Project Properties Build Environment
Create source files in the Project by right Clicking on Project name and Select New -> Source File.

New C++ Source file
In New Source File window, set File name basic.cpp & Click Finish

Enter filename
copy below lines to basic.cpp file

#include <egt/ui>
int main()
egt::Application app;
egt::TopWindow window;
egt::Button button(window, "Press Me");
return app.run();

Create cpp file
Similarly create a new configure.ac file and copy below lines.

AC_INIT(basic, 1.0)
AM_INIT_AUTOMAKE([1.10 foreign])

Create configure.ac file
Now create a new Makefile.am file and copy below lines.

basic_LDFLAGS = $(EGT_LIBS) -lpthread

Create Makefile.am file
save all using file->saveall or press (shift + Ctrl + S)

To Build this Project, first Invoke Autoreconf tool by right-click on the project and select Invoke Autotools->Invoke Autoreconf. This operation will call the autotools to generate configure script & Makefile.in files. This operation has to be done again if you make changes to configure.ac or Makefile.am.

Invoke autoreconf
Set the "-i -v -f" option to autoreconf window and click OK. This tells autoreconf to automatically install some additional scripts and files that are needed for correct operation of configure script.

Set autoreconf arguments
Now we can see in the console that autoreconf command finished successfully and configure and Makefile.in files have generated in the project folder.

Autoreconf success
Now Reconfigure project by right-click on the project and select Reconfigure Project. This will call configure script with argument –host option & set Environment variable values to ensures that your project will be cross-compiled with the Buildroot toolchain. You may define additional options in project properties.

Reconfigure project
In the console, we can see operation finished successfully and Makefile generated in the Project folder.

Reconfigure project finished
Finally to build this project. Select Project-> "Build All" or Press (Ctrl-b).

Build project

Executing EGT application on Target Remotely

Eclipse will execute a EGT application on to target board by transfer the application binary using SSH and SSH server must have installed on target board.

Buildroot offers you two choices:

  1. The Dropbear package can be enabled in Networking applications -> dropbear.
  2. The full-blown SSH implementation, OpenSSH, which can be enabled in Networking applications -> openssh.

Most SSH servers do not allow log in as root with an empty password. To set the root password login on the target board, type below commands:

# passwd
Changing password for root
New password:
Bad password: too short
Retype password:
Password for root changed by root

Type below commands to configure Ethernet interface and make sure host machine and target board are connected.

# ifconfig eth0 up

First step is to create a new run configuration. Right click your EGT project and click on Run As->Run Configurations...

Run as
Double click on "C/C++ Remote Application" to create a Run configurations for a target board.

New launch configuration
To setup a ssh connection with the target, click “New” under connection. select SSH and click on Okay.

SSH connection setup
In New Connection window, Set the below details and click Finish.

  1. Connection Name: Remote Host
  2. Host: IP Address of a target board.
  3. User: root
  4. Check public key based authentication.
  5. passphrase: root password of target board.

Finish launch configuration
Set the Remote Absolute File Path to /root/basic and click Run.

Wait while application is copied to the target using SSH protocols.

Coping application to target
Finally in the Console, see the traces and EGT application running on target board.

Debug EGT Application Remotely

As a preliminary step, you also need to ensure that gdbserver is present on your target. if gdbserver not preset, then enable following options in buildroot menuconfig:

  1. Toolchain -> GDB debugger Version
  2. Toolchain -> Build cross gdb for the host
  3. Target packages -> Debugging, profiling and benchmark -> gdb
  4. Target packages -> Debugging, profiling and benchmark -> gdbserver
  5. Target packages -> Debugging, profiling and benchmark -> full debugger

To get a nice debugging experience, you may want Buildroot to build the libraries with debugging symbols. To do so, enable the Build options -> build packages with debugging symbols option.

Create remote debug configuration

The create remote debug configuration will connect to the target board and it will automatically download the compiled binary, start a gdb-server session and connect to it from within the Eclipse IDE.

Create remote debug configuration by right click on Project and select "Debug As" -> "Debug Configurations…"

Select Debug Configurations
In the Debug Configurations window, Double Click "C/C++ Remote Application"

Select C/C++ Remote Application
To set up the remote debugging connection. Select New under Connection and Choose a connection type of SSH and configure the New Connection as follows:

setup SSH Connection
Set Remote Absolute File Path to /root/basic.

To configure the gdb connection over ssh. Go to Debugger tab and in the Debugger tab, the GDB debugger: gdb setting currently points to the default debugger on the host system. This is a x86_64 debugger and it does not understand the symbols and messages from the gdb-server on the target. You must change this to point to the ARM specific gdb that is created by Buildroot, change it to:


To prevent some spurious SIGNALS and to help the GDB debugger we have provided an initialization script. Create a gdbinit file in your project folder and copy below line and Set gdbinit file path to GDB command file:

handle SIGILL nostop
set sysroot buildroot/output/target

setup GDB Debugger
click on Apply and Debug button.

Now Eclipse you should be able to select the new Debug Configuration and if a pop up appears, then clicking on Yes in confirm perspective switch window. If you get a authentication Message dialog box. Select Yes to accept it or else Eclipse will change to the debug perspective and the application will halt at main(). Press Resume (F8) to continue execution and the application should to running the target. You can view variables & disassembly code.

Enjoying the enhanced debug experience.

Eclipse debug window

Build libegt on Host Machine

This sections describes how to build a standalone EGT library and its examples on host machine in Eclipse using Autotools. To fetch the Source from Git repository refer section Fetching Source

Create a new CPP Project using File-> New -> Project. In New Project window, Expand C/C++ and Select C/C++ Project then Click Next

Create new cpp project
In the New C/C++ Project window, Select C++ Managed Builds and Click Next.

Select C++ Managed Builds
In C++ Project window,

  1. Set the project name.
  2. Uncheck default location
  3. Browse to git clone location of a EGT directory
  4. Select "GNU Autotools Empty project" type
  5. Select "GNU Autotools Toolchain" and Click on Finish button.

Eclipse create new cpp project
Now we can see in the console Tab:

  1. The autoreconf command finished successfully and generated configure and Makefile.in files in Project folder.
  2. Executed a configure scripts and generated Makefile's in the project folder

Eclipse reconfigure done
To build the libegt project (Ctrl-b) or select Project->"build all" option and observe build messages in Console.

Eclipse build libegt project

Execute EGT application on Host Machine.

Before we start execute/debug a application, we need to set environment variable LD_LIBRARY_PATH pointing to libegt.so folder (i.e. src/.libs/)

Go to Project properties by right clicking project and select Properties or Press (Alt + Enter). In Project properties window, Expand "C/C++ Build" and Select "Environment" and then Click ADD.

Add Project Environment Variables
In a New Environment variable window set below details and click OK and again OK to close the Project properties window.

  2. PATH: project/src/.libs/:$LD_LIBRARY_PATH.
  3. check Add to all Configurations.

Eclipse set environment variable
We can start executing EGT examples application by right Clicking on libegt Project and Select Run As -> "2.Local C/C++ Application".

Select Local C/C++ Application
In "C Local Application" window, Select basic under Binaries and click OK.

Select basic Application under Binaries
A new EGT window will pop up running EGT Basic example application.

Eclipse basic example demo

Debug EGT application on Host Machine

To debug EGT example applications, right Click on libegt Project and Select "Debug As" -> "2.Local C/C++ Application"

Select Local C/C++ Application
In "C Local Application" window, Select basic under Binaries and click OK.

Select basic Application under Binaries

Eclipse will switch automatically to Debug perspective window and debugger stops on the main function of the application and you can see disassembly code. Press Resume (F8) to continue execution and the application should to running the Host Machine.

Eclipse debug window