Search by Tags

C/C++ Application Development With the Yocto Project/OpenEmbedded


Your progress



In the previous lesson from this guide, you have learned the basics of how to build and customize an Embedded Linux image with the Yocto Project/OpenEmbedded, by adding a simple hello-world application to one of Toradex's Reference Images for Yocto Project.

In this lesson, you will learn how to generate and use a custom standard SDK for cross-development. You will:

  • Build a standard SDK with the Yocto Project/OpenEmbedded.
  • Install and setup the SDK on your PC.
  • Configure the Eclipse IDE for cross-compilation and debugging on the target device.

Keep in mind that this is an introductory tutorial and after you finish it we recommend you to refer to the Yocto Project Documentation, especially the section Yocto Project Application Development and the Extensible Software Development Kit (eSDK).

Typographic Conventions


For this Quickstart Guide:

For this lesson:

Step 1

Setup the Yocto Project/OpenEmbedded development environment as described in the previous lesson, if you haven't already done so:

Step 2

Build an SDK:

For instance, if your custom image is named

$ bitbake custom-multimedia-hello-image -c populate_sdk

Step 3

Install the SDK:

Step 4

Build the Hello World from the previous lesson using the command-line. First, go to the directory where the C source-code resides:

$ cd <path to your Yocto Project build>/layers/meta-customer/recipes-customer/hello-world/hello-world

Then build as explained below:

Step 5

From the Linux terminal, find the board IP:

Step 6

Copy the binary to the board, under /home/root, using scp:

Step 7

Execute the binary on the board to confirm that it has been successfully built and deployed:

# /home/root/hello

Step 8

Install the latest Eclipse on your PC. There may be alternative methods, such as downloading from the Eclipse website, or installing a community version from using either your distro package manager or a Snap.

If you download for the official Eclipse website, an installer gives you the option to install the Eclipse IDE for C/C++ Developers and the Eclipse IDE for Embedded C/C++ Developers:

  • Eclipse Installer

    Eclipse Installer

In this guide we don't compare the different setups, you must do it by yourself and choose the one that is most appropriate for you.

Note: the Eclipse IDE for Embedded C/C++ Developers seems to come with most of the required plugins already installed.

Note: there once was an Eclipse Yocto plugin. It has been removed from the Yocto Project since release 2.7.

Step 9

On the terminal with the exported SDK environment, write down the name of the cross GDB. You will need it when configuring Eclipse in the next steps:

$ echo $GDB

In the example above it is aarch64-tdx-linux-gdb.

Step 10

If you have opened Eclipse after installing it, close it.

Warning: you must start Eclipse from the command-line, from the same terminal where you have sourced the SDK environment.

From the same terminal where you have sourced the Yocto Project SDK environment in the previous steps, open Eclipse from the command-line. This will allow you to use most of the environment variables exported by the SDK in the Eclipse configuration:

$ cd <path where Eclipse is installed>
$ ./eclipse

Step 11

Configure a new project:

In summary, you will:

  • Create a new empty project
  • Configure the Cross GCC compiler

Step 12

Copy the hello world source code created in the previous lesson into the project directory and refresh the project configuration.

Build the project. You can use the shortcut Ctrl + B, select Project --> Build All or right-click the project and click Build Project.

Step 13

Create a debug configuration for your project:

You will have to adapt the following steps from the instructions above:

  • You don't need to have the Remote System Explorer configured.
  • In the Main tab of the C/C++ Remote Application debug configuration:
    • Leave the fields Project and C/C++ Application with the default values.
    • Create a new Connection, selecting an SSH connection.
      • As Host, use the previously found board IP
      • The User is root
      • You must select Password based authentication and leave an empty password.
    • On the Remote Absolute File Path for C/C++ Applications, you can click the Browse button and then the Ok button, leaving the default value, which will look like /var/rootdirs/home/root/hello-world depending on your project/binary name.
  • In the Debugger tab of the C/C++ Remote Application debug configuration:
    • On GDB Debugger you can use name found on previous steps when you executed echo ${GDB}. In the example it was aarch64-tdx-linux-gdb.
    • Leave the GDB command file empty, unless of course, you want to use a file.

Step 14

Right-click the printf("Hello world!\n"); line number and select Toggle Breakpoint - or just double-click the line number. A blue dot will indicate that you have successfully added the breakpoint:

  • Add a Breakpoint

    Add a Breakpoint

Step 15

Click the Debug button and the debug will start. Keep in mind that Eclipse will switch to the Debug perspective, but you may switch to other perspectives anytime, including the C/C++ perspective.

If Eclipse throws the error Algorithm negotiation failed, it is most likely because you have skipped a step on the previous lesson from this guide. See How to setup environment for Embedded Linux application development - Eclipse IDE to learn how to fix it.


Development using an IDE is handy and the Yocto Project provides an SDK that makes it easy to use it with the Eclipse IDE. Keep a few things in mind:

  • You have generated an SDK that includes the development packages (headers and shared libraries) for the packages included by default in the Reference Multimedia Image. Your application will possibly require other packages that you will have to include in your custom image and then rebuild your custom SDK.
  • As you might have noticed as you followed the article, the compiler options are setup in the SDK environment file that you must export before opening Eclipse. It is up to you to decide the best options and flags for your project.
  • Once the application development is done, you must integrate your final changes in your Yocto Project recipe. While you can begin with what was presented in the previous lesson, it may involve writing a more complex recipe and you will possibly have to either read the Yocto Project documentation or search for similar existing recipes as a starting point.


Can I use other programming languages?
I need to customize the Linux kernel, how can I do it?
I need to customize the U-Boot bootloader
How to know what environment variables are set by the SDK?
How can I set or modify compiler flags?
How can I directly set the compiler flags in the Eclipse IDE?
Where can I find more information about the Eclipse IDE?
Which version of the Eclipse IDE should I use?
Are there any alternatives to the Eclipse IDE?
Debugging behavior is erroneous