Search by Tags

Linux SDKs

 

Compare with Revision

Subscribe for this article updates

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.

SDK Creation

Whether building an SDK for the standard evaluation Toradex image or for your own custom Toradex image, the method of generating the SDK is the same. After building the image as described in the OpenEmbedded-core article, you can use bitbake to generate the SDK:

bitbake <image_name> -c populate_sdk

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

SDK Installation

Execute the generated SDK script file to initiate installation:

./angstrom-glibc-x86_64-armv7at2hf-neon-v2016.12-toolchain.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 /usr/local/oecore-x86_64
. environment-setup-armv7at2hf-neon-angstrom-linux-gnueabi

Note: Source the environment script in every shell session 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

IDE Configuration

Eclipse Configuration

Create a new C or C++ project. Select Empty Project and Cross GCC toolchain.

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 OK