Search by Tags

Linux SDKs

 

Article updated at 20 Mar 2021
Compare with Revision




Introduction

Attention: Toradex does not maintain SDKs, nor provides them in the binary form! The only exception was the old Quickstart Guide for BSP 2.8 when we provided binary SDKs as-is, validated solely for the Hello World application from the Quickstart Guide and nothing more.

Toradex Linux images are built using the Yocto Project/OpenEmbedded-core. The same build system can be used to generate SDKs specific to these images. 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 & symbols
  • Environment setup script

For more information, refer to the Yocto Project documentation. You may also want to check the article How to setup environment for Embedded Linux application development and the Quickstart Guide for alternative sources of information about development environment and cross-toolchain setup.

SDK Creation

Whether building an SDK for the standard Toradex demo image or for your own custom image, the method of generating the SDK is the same. After building the image as described in the Build a Reference Image with Yocto Project article, you can use bitbake to generate the SDK:

bitbake <image_name> -c populate_sdk

The generated SDK will be located at oe-core/deploy/sdk/.

If you need Qt5 tools deployed in your SDK add the following to your image recipe:

inherit populate_sdk populate_sdk_qt5

If you want to build kernel modules for the kernel used on the target system full kernel sources are needed. The kernel-devsrc recipe packs the kernel sources of the kernel chosen by virtual/kernel.

TOOLCHAIN_TARGET_TASK_append = " kernel-devsrc"

Note: In earlier build system configurations, the deploy directory was here: 'oe-core/build/out-glibc/deploy/sdk/'. Note: There are a number of recipes (meta-toolchain-xxx.bb) which are alternative ways to build an SDK. Among them meta-toolchain.bb, meta-toolchain-qte, and meta-toolchain-qt5 targeting use on command line, Qt4e, and Qt5 targets. They can be built as follows: 'bitbake meta-toolchain-xxx'. Note that these SDKs do not necessarily include all libraries and headers for the packages deployed in your image nor are all libraries for which the SDK does contain stuff necessarily installed in your image. Note: In earlier build system configurations, the SDK filename didn't change when you built for a different image_name or a different machine leading to errors like this: 'The recipe meta-toolchain-qt5 is trying to install files into a shared area when those files already exist. ...' Delete the existing file from an earlier run and restart bitbake to get around the issue.

SDK Installation

Execute the generated SDK script file to initiate installation:

./tdx-xwayland-glibc-x86_64-Reference-Multimedia-Image-aarch64-verdin-imx8mp-toolchain-5.2.0.sh

When prompted, accept the default installation path (or enter an alternate path) for the SDK.

Application Development

Begin by changing into the SDK's installation directory and sourcing the environment script:

cd /opt/tdx-xwayland/5.2.0
. environment-setup-aarch64-tdx-linux

Warning: Source the environment script in every shell session in which you work with the SDK.

The newly exported environment variables expand the PATH variable with the bin directory of the native sysroots (containing cross compiler etc.) and define the SDK's associated cross-development tools and flags. To make use of this environment in development, use the environment variables. For example, to compile a C hello world application, use the C compiler variable CC:

$CC hello.c -o hello

You can read the environment script to learn what variables are exported.

IDE Configuration

Eclipse Configuration

Create a new C or C++ project. Select Empty Project and Cross GCC toolchain. Skip Configure the Cross GCC path and prefix.

Then, in the toolbar, click Project and select Properties from the drop down menu.

Navigate to C/C++ Build --> Settings

Within the Tool Settings tab, select [All configurations] from the configurations list.

Select Cross GCC Compiler from the Tool Settings menu.

For Command, enter:

${CC}

Under Cross GCC Compiler, select Miscellaneous.

For Other flags, enter:

${CFLAGS} -c

Select Cross G++ Compiler from the Tool Settings menu.

For Command, enter:

${CXX}

Under Cross G++ Compiler, select Miscellaneous.

For Other flags, enter:

${CXXFLAGS} -c

Select Cross G++ Linker from the Tool Settings menu.

For Command, enter:

${CXX}

Under Cross G++ Linker, select Miscellaneous.

For Linker flags, enter:

${LDFLAGS}

Select Cross GCC Assembler from the Tool Settings menu.

For Command, enter:

${AS}

Press Apply and Close.

Qt Creator Configuration

Qt Creator has its own page.