Skip to main content
Version: BSP 7.x.y

Linux SDKs

Introduction

warning

Toradex does not maintain SDKs or provides them in the binary form.

This article explains how to set up, build, and integrate Software Development Kits (SDKs) with common Integrated Development Environments (IDEs) for Yocto Project development.

A standard Yocto Project SDK includes:

  • Cross-development toolchain containing cross-compiler, cross-linker, cross-debugger, etc.
  • Native sysroot containing cross-compiler, linker and other development tools
  • Target sysroot containing libraries, headers, and symbols
  • Environment setup script

This article complies with the Typographic Conventions for Toradex Documentation.

Prerequisites

SDK Creation

Use the following command to generate the SDK installation scripts after building an image:

$ bitbake <image_name> -c populate_sdk

The generated SDK scripts will be located at build/deploy/sdk/.

info

The SDK may not contain all libraries required by the packages included in your image. Similarly, not all libraries provided by the SDK are necessarily present in the image.

Additional SDKs

Depending on your project, you may need to include additional SDKs to the toolchain. The following steps describe how to add commonly used SDKs to the installation script.

Qt5

Follow the steps below to include Qt5 layers in your image and the corresponding Qt5 tools in your SDK:

  1. Update the bblayers.conf file to include the Qt5 layer in your build configuration:

    bblayers.conf
    BBLAYERS += "                \
    ${TOPDIR}/../layers/meta-qt5 \
    "
  2. Update the local.conf file to include Qt5 packages in your image:

    local.conf
    IMAGE_INSTALL:append = " qtbase"
  3. Rebuild the image and generate the SDK using bitbake

Kernel Development

The kernel-devsrc recipe provides the Linux Kernel source code for the target system. This recipe is required for Kernel module development.

Follow the steps below to include it in your SDK:

  1. Update your local.conf file to include the kernel-devsrc recipe in the SDK:
local.conf
TOOLCHAIN_TARGET_TASK:append = " kernel-devsrc"
  1. Rebuild the image and generate the SDK using bitbake

Toolchain Recipes

OpenEmbedded provides a toolchain recipe as an alternative way to build an SDK. This recipe is located at the layers directory and can be built with the following command after building your image:

$ bitbake meta-toolchain

SDK Installation

Execute the generated shell script file in build/deploy/sdk/ to start the installation:

$ ./tdx-xwayland-glibc-x86_64-Reference-Multimedia-Image-cortexa53-verdin-imx8mp-toolchain-6.0.0.sh
info

Please note, the installation script name may be different on your machine.

Choose an installation path for the SDK that best suits your development setup or accept the default instalation path.

Application Development

Source the environment script from the installed SDK to set the required environment variables for cross-development:

$ cd <sdk_installation_path>
$ source environment-setup-cortexa53-tdx-linux
info

It is necessary to source the environment script every time that a new shell is started.

The environment script updates the PATH to include the SDK’s cross-development tools and sets the environment variables required for the cross-development toolchain, such as compiler, linker, assembler, flags, etc.

As an example, the CC variable is set to the path of the SDK's C compiler, allowing the compilation of a C application with the following command:

$ $CC hello.c -o hello
info

The SDK environment script exports several variables used for cross-development. Read the script to review all variables and their values.

IDE Configuration

Integrate the SDK built for your image into your IDE to enable features such as automated builds and language server support. Note that the integration process varies depending on the IDE.

VS Code

To configure VS Code for cross-compilation with the generated SDK, refer to How to set up Visual Studio Code for Yocto Application Development using CMake guide by DESY.

Qt Creator IDE

To configure Qt Creator for cross-compilation with the generated SDK, refer to How to set up Qt Creator to cross compile for embedded Linux article.

Eclipse IDE

tip

The target architecture may differ depending on the target board, thus leading to different toolchain prefix. Read the environment script to confirm target architecture and cross-compiler path.

To configure Eclipse IDE for cross-compilation with the generated SDK, follow the steps below:

  1. Download Eclipse IDE from the Eclipse Foundation website.

  2. Install and launch the IDE.

  3. Create a new C/C++ project:

    • Navigate to File -> New -> C/C++ Project
    • Select Classic C/C++ Project using CDT's managed build system
  4. Configure the project settings:

    • Enter a project name
    • Select the project location
    • Under Project type, expand Executable and select Empty Project
    • Under Toolchains, select Cross GCC
  5. Configure deployment settings if applicable.

  6. Set the cross-compiler:

    • Set the prefix: aarch64-tdx-linux-
    • Click Browse next to the Cross compiler path field
    • Navigate to the SDK installation directory
    • Under sysroots/x86_64-tdxsdk-linux/usr/bin/aarch64-tdx-linux, select the bin directory
  7. Click Finish.

  8. Navigate to Project -> Properties -> C/C++ Build -> Settings

    • Configure the Sysroot: Under Cross GCC Compiler -> Miscellaneous -> Other flags, add:

      --sysroot=${SDKTARGETSYSROOT}
    • Under Cross GCC Compiler -> Includes, add to include paths:

      ${SDKTARGETSYSROOT}/usr/include
    • Under Cross GCC Linker -> Libraries, add to libraries:

      ${SDKTARGETSYSROOT}/usr/lib
    • Under Cross GCC Linker -> Miscellaneous, add to Other options:

      --sysroot=${SDKTARGETSYSROOT}

Eclipse is now configured to build projects and deploy directly to the target sysroot.

Additional Resources

Send Feedback!