Last edited 6 months ago

SDK for OpenSTLinux distribution

Applicable for STM32MP13x lines, STM32MP15x lines, STM32MP25x lines

1. Article purpose[edit | edit source]

This article aims to give general information about the software development kit (SDK) for the OpenSTLinux distribution.

Info white.png Information
To install and use efficiently the last release of the OpenSTLinux SDK, please read the Developer Package article relative to the series of your STM32 microprocessor: Category:Developer Package

2. Introduction[edit | edit source]

The software development kit (SDK) for the OpenSTLinux distribution is a customization of the Yocto SDK[1], which provides a stand-alone cross-development toolchain and libraries tailored to the contents of a specific image. The OpenSTLinux SDK is part of the STM32MPU Embedded Software Developer Package.

The SDK might be generated, through the STM32MPU Embedded Software Distribution Package, during the compilation of a software release, which guarantees the alignment of this SDK with the software images (binaries) built for the Starter Package of the STM32MPU Embedded Software: see SDK development cycle model.

It provides a more "traditional" toolchain experience than the full Yocto project (OpenEmbedded) development environment available through the Distribution Package of the STM32MPU Embedded Software.

It simplifies the workflow for application developers: it has no dependency on the Yocto project used for its generation (Distribution Package), and can be installed on any host machine. Note that many SDKs can coexist on the same host machine.

3. Why use the SDK, and how?[edit | edit source]

The OpenSTLinux SDK gives developers an efficient development cycle (compilation, deployment on target, and debug).

Using this SDK, developers take advantage of the Yocto project development environment (to quickly develop, deploy and test applications, or any other piece of software, as part of images running hardware), without having to understand all the Yocto project mechanisms that might seem somewhat complex.

3.1. SDK development cycle model[edit | edit source]

A developer can install the SDK on a machine (host PC), and use it to develop within any piece of software (for example, an application, kernel drivers or kernel modules).

Basically, the developer has to:

When the development is finished (the source code is ready to be shared with other developers), it should be integrated into the whole software. For this, the Distribution Package must be used.

Through the Distribution Package, new images (binaries) and a new SDK are generated (see How to create an SDK for OpenSTLinux distribution).

4. SDK content[edit | edit source]

The OpenSTLinux SDK is based on the standard Yocto project SDK.

A standard SDK consists of the following:

  • a cross-development toolchain: this toolchain contains a compiler, linker, debugger, and various miscellaneous tools
  • libraries, headers, and symbols (target and native sysroots): the libraries, headers, and symbols are specific to the image (that is, they match the image)
  • an environment setup script: this *.sh file, once run, sets up the cross-development environment by defining variables and preparing it for SDK use

4.1. Cross-development toolchain[edit | edit source]

The cross-development toolchain consists of a cross-compiler, a cross-linker and a cross-debugger that are used to:

  • develop user-space applications for targeted hardware
  • modify a software component that already exists in the images, and that is delivered as source code in the Developer Package (for example the Linux kernel or U-Boot)

This cross-development toolchain is created by running a toolchain installer script (see SDK installation).

It works with a matching target sysroot (see below).

4.2. Native and target sysroots[edit | edit source]

The native and target sysroots contain the required headers and libraries for generating binaries that run on the target architecture.

The target sysroot is based on the target root file system image that is built through the Distribution Package of the STM32MPU Embedded Software and uses the same metadata configuration as that used to build the cross-toolchain.

For any software baseline, this process guarantees the alignment between:

  • the content (source code) of the Distribution Package
  • the target root file system image (binary) of the Starter Package
  • the target sysroot (headers and libraries) of the Developer Package
  • the configuration of the cross-toolchain of the Developer Package

5. SDK installation[edit | edit source]

Below information are given as example for STM32MP2 series.
Information provided in this chapter could be easily transposed to others STM32 MPUs.

The OpenSTLinux SDK is installed on the host development machine by running the *.sh installation script.

The tarball file (en.SDK-x86_64-stm32mp2-openstlinux-6.1-yocto-mickledore-mpu-v24.06.26.tar.gz) that contains this script is named as follows:

SDK-<host machine>-<version>.tar.xz
where:

<host machine> Host machine on which the SDK is installed:
  • x86_64 (only 64-bit host machines for x86 are supported)
  • arm64 (only arm 64-bit host machines are supported)
<version> Software release version; example:
  • openstlinux-6.1-yocto-mickledore-mpu-v24.06.26

Example:

  • en.SDK-x86_64-stm32mp2-openstlinux-6.1-yocto-mickledore-mpu-v24.06.26.tar.gz


The steps for the OpenSTLinux SDK installation, are:

  • Download, on the host machine, the SDK tarball file (en.SDK-x86_64-stm32mp2-openstlinux-6.1-yocto-mickledore-mpu-v24.06.26.tar.gz)
  • Decompress the tarball file
 $ tar en.SDK-[...].tar.gz 
  • The installation script is named:
<image>-<distro>-<machine>-<host machine>-toolchain-<Yocto release>-<version>.sh
where:
<image> Image name; example:
  • st-image-weston
<distro> Distribution name; example:
  • openstlinux-weston
<machine> Machine name; example:
  • stm32mp1
  • stm32mp2
<host machine> Host machine on which the SDK is installed:
  • x86_64 (only 64-bit host machines for x86 are supported)
  • arm64 (only arm 64-bit host machines are supported)
<Yocto release> Release number of the Yocto Project; example:
  • 4.2.4 (aka Mickledore)
<version> Software release version; example:
  • openstlinux-6.1-yocto-mickledore-mpu-v24.06.26
Example:
  • st-image-weston-openstlinux-weston-stm32mp2-x86_64-toolchain-4.2.4-openstlinux-6.1-yocto-mickledore-mpu-v24.06.26.sh
  • If necessary, change the permissions on the installation script so that it is executable:
$ chmod +x <image>-<distro>-<machine>-<host machine>-toolchain-<Yocto release>-<version>.sh
  • The SDK is self-contained and by default is installed into /opt/st/<machine>/<Yocto release>-<version>
Example:
  • /opt/st/stm32mp2/4.2.4-openstlinux-6.1-yocto-mickledore-mpu-v24.06.26
However, running the installation script with the -d option allows an installation directory to be chosen
Check that the write permissions in the installation directory (either the default one, or the customized one) are granted
Info white.png Information
Recommendation: for an STM32MPU Embedded Software release, install the software image from the Starter Package, the SDK and the source codes from the Developer Package in the same top directory; indeed, these packages are linked
  • Run the installation script
$ ./<image>-<distro>-<machine>-<host machine>-toolchain-<Yocto release>-<version>.sh
Example (with an installation directory /local/SDK/<Yocto release>-<version> different from the default one)
$ ./st-image-weston-openstlinux-weston-stm32mp2-x86_64-toolchain-4.2.4-openstlinux-6.1-yocto-mickledore-mp2-v24.06.26.sh
ST OpenSTLinux - Weston - (A Yocto Project Based Distro) SDK installer version 4.2.4-openstlinux-6.1-yocto-mickledore-mp2-v24.06.26
===================================================================================================================================
Enter target directory for SDK (default: /opt/st/stm32mp2/4.2.4-openstlinux-6.1-yocto-mickledore-mp2-v24.06.26): 
You are about to install the SDK to "/opt/st/stm32mp2/4.2.4-openstlinux-6.1-yocto-mickledore-mp2-v24.06.26". Proceed [Y/n]? 
Extracting SDK............................................................................................................................................................................................................................done
Setting it up...done
SDK has been successfully set up and is ready to be used.
Each time you wish to use the SDK in a new shell session, you need to source the environment setup script e.g.
 $ . /opt/st/stm32mp2/4.2.4-openstlinux-6.1-yocto-mickledore-mp2-v24.06.26/environment-setup-cortexa35-ostl-linux

The OpenSTLinux SDK install is now complete.

Refer to Standard SDK directory structure for details of the resulting directory structure of the installed SDK.

6. SDK startup[edit | edit source]

To use an installed SDK, its environment setup script must be run.

This setup script is located in the SDK installation directory (per default, /opt/st/<machine>/<Yocto release>-<version>).

It must be run once in each new working terminal.

This environment setup script is named:

environment-setup-<target>-<distro>-linux-gnueabi
Where:
<target> Target architecture for cross-toolchain; example:
  • cortexa35
<distro> Distribution name; example:
  • ostl-linux
Example
  • environment-setup-cortexa35-ostl-linux


  • Run the environment setup script
$ source <SDK installation directory path>/environment-setup-<target>-<distro>-linux-gnueabi
Example: here, the SDK installation directory (/local/SDK/<Yocto release>-<version>) is different from the default one
$ source /opt/st/stm32mp2/4.2.4-openstlinux-6.1-yocto-mickledore-mpu-v24.06.26/environment-setup-cortexa35-ostl-linux
  • Many environment variables are then defined:
     SDKTARGETSYSROOT - the path to the sysroot used for cross-compilation
     PKG_CONFIG_PATH - the path to the target pkg-config files
     CONFIG_SITE - a GNU autoconf site file preconfigured for the target
     CC - the minimal command and arguments to run the C compiler
     CXX - the minimal command and arguments to run the C++ compiler
     CPP - the minimal command and arguments to run the C preprocessor
     AS - the minimal command and arguments to run the assembler
     LD - the minimal command and arguments to run the linker
     GDB - the minimal command and arguments to run the GNU Debugger
     STRIP - the minimal command and arguments to run 'strip', which strips symbols
     RANLIB - the minimal command and arguments to run 'ranlib'
     OBJCOPY - the minimal command and arguments to run 'objcopy'
     OBJDUMP - the minimal command and arguments to run 'objdump'
     AR - the minimal command and arguments to run 'ar'
     NM - the minimal command and arguments to run 'nm'
     TARGET_PREFIX - the toolchain binary prefix for the target tools
     CROSS_COMPILE - the toolchain binary prefix for the target tools
     CONFIGURE_FLAGS - the minimal arguments for GNU configure
     CFLAGS - suggested C flags
     CXXFLAGS - suggested C++ flags
     LDFLAGS - suggested linker flags when you use CC to link
     CPPFLAGS - suggested preprocessor flags
     TEEC_EXPORT - 
     TA_DEV_KIT_DIR - 

The OpenSTLinux SDK is started.

7. References[edit | edit source]