Registered User mNo edit summary |
Registered User No edit summary |
||
(12 intermediate revisions by 3 users not shown) | |||
Line 1: | Line 1: | ||
{{ApplicableFor | |||
|MPUs list=STM32MP13x, STM32MP15x | |MPUs list=STM32MP13x, STM32MP15x, STM32MP21x, STM32MP23x, STM32MP25x | ||
|MPUs checklist=STM32MP13x,STM32MP15x | |MPUs checklist=STM32MP13x, STM32MP15x, STM32MP21x, STM32MP23x, STM32MP25x | ||
}}</noinclude> | }} | ||
<noinclude></noinclude> | |||
==Article purpose== | ==Article purpose== | ||
This article aims to give '''general information''' about the software development kit (SDK) for the OpenSTLinux distribution. | This article aims to give '''general information''' about the software development kit (SDK) for the OpenSTLinux distribution. | ||
Line 26: | Line 27: | ||
Basically, the developer has to: | Basically, the developer has to: | ||
* get the software images (binaries) of the software release associated with the SDK (see [[:category:Starter Package|Starter Package]]) | * get the software images (binaries) of the software release associated with the SDK (see [[:category:Starter Package|Starter Package]]) | ||
* [[ | * [[STM32MPU_Developer_Package#Installing_the_SDK|download the SDK]] | ||
* install the SDK for the targeted hardware (see [[#SDK installation|SDK installation]]) | * install the SDK for the targeted hardware (see [[#SDK installation|SDK installation]]) | ||
* run the SDK environment setup script (see [[#SDK startup|SDK startup]]) | * run the SDK environment setup script (see [[#SDK startup|SDK startup]]) | ||
Line 64: | Line 65: | ||
==SDK installation == | ==SDK installation == | ||
Below information are given '''as example''' for {{MicroprocessorDevice | device= | Below information are given '''as example''' for {{MicroprocessorDevice | device=2}}. <br> | ||
Information provided in this chapter could be easily transposed to others STM32 MPUs. | 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 OpenSTLinux SDK is installed on the host development machine by running the *.sh installation script. | ||
The tarball file (''{{EcosystemRelease/Package | revision=5. | The tarball file (''{{EcosystemRelease/Package | revision=5.1.0 | device=MP2 | package=SDK package | request=name}}'') that contains this script is named as follows: | ||
'''SDK-'''''{{HighlightParam|'''<host machine>-<version>'''''}}.tar.xz''' <br> | '''SDK-'''''{{HighlightParam|'''<host machine>-<version>'''''}}.tar.xz''' <br> | ||
where: | where: | ||
Line 79: | Line 80: | ||
|- | |- | ||
| <version> || Software release version; example: | | <version> || Software release version; example: | ||
* {{EcosystemRelease/Package | revision=5. | * {{EcosystemRelease/Package | revision=5.1.0 | package=OpenSTLinux distribution | request=name}} | ||
|} | |} | ||
Example: | Example: | ||
* {{EcosystemRelease/Package | revision=5. | * {{EcosystemRelease/Package | revision=5.1.0 | package=SDK-x86 package | request=name | device=MP2}} | ||
The steps for the OpenSTLinux SDK installation, are: | The steps for the OpenSTLinux SDK installation, are: | ||
* Download, on the host machine, the SDK tarball file (''{{EcosystemRelease/Package | revision=5. | * Download, on the host machine, the SDK tarball file (''{{EcosystemRelease/Package | revision=5.1.0 | package=SDK-x86 package | request=name | device=MP2}}'') | ||
* Decompress the tarball file | * Decompress the tarball file | ||
Line 103: | Line 104: | ||
| <machine> ||Machine name; example: | | <machine> ||Machine name; example: | ||
* stm32mp1 | * stm32mp1 | ||
* stm32mp2 | |||
|- | |- | ||
| <host machine> || Host machine on which the SDK is installed: | | <host machine> || Host machine on which the SDK is installed: | ||
Line 109: | Line 111: | ||
|- | |- | ||
| <Yocto release> || Release number of the Yocto Project; example: | | <Yocto release> || Release number of the Yocto Project; example: | ||
* {{EcosystemRelease/Component | revision=5. | * {{EcosystemRelease/Component | revision=5.1.0 | component=OpenEmbedded | name=tag}} (aka {{EcosystemRelease/Component | revision=5.1.0 | component=OpenEmbedded | name=release}}) | ||
|- | |- | ||
| <version> || Software release version; example: | | <version> || Software release version; example: | ||
* {{EcosystemRelease/Package | revision=5. | * {{EcosystemRelease/Package | revision=5.1.0 | package=OpenSTLinux distribution | request=name}} | ||
|} | |} | ||
: Example: | : Example: | ||
:* {{EcosystemRelease/Package | revision=5. | :* {{EcosystemRelease/Package | revision=5.1.0| package=SDK-x86 installation script | request=name | device=MP2}} | ||
* If necessary, change the permissions on the installation script so that it is executable: | * If necessary, change the permissions on the installation script so that it is executable: | ||
Line 122: | Line 124: | ||
* The SDK is self-contained and by default is installed into ''/opt/st/<machine>/<Yocto release>-<version>'' | * The SDK is self-contained and by default is installed into ''/opt/st/<machine>/<Yocto release>-<version>'' | ||
: Example: | : Example: | ||
:* /opt/st/ | :* /opt/st/stm32mp2/{{EcosystemRelease/Component | revision=5.1.0 | component=OpenEmbedded | name=tag}}-{{EcosystemRelease/Package | revision=5.1.0 | package=OpenSTLinux distribution | request=name}} | ||
: However, running the installation script with the ''-d'' option allows an installation directory to be chosen | : 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 | : Check that the write permissions in the installation directory (either the default one, or the customized one) are granted | ||
Line 132: | Line 134: | ||
: Example (with an installation directory ''/local/SDK/<Yocto release>-<version>'' different from the default one) | : Example (with an installation directory ''/local/SDK/<Yocto release>-<version>'' different from the default one) | ||
<pre> | <pre> | ||
$ ./st-image-weston-openstlinux-weston- | $ ./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. | 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/ | 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/ | 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 | Extracting SDK............................................................................................................................................................................................................................done | ||
Setting it up...done | Setting it up...done | ||
SDK has been successfully set up and is ready to be used. | 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. | 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/ | $ . /opt/st/stm32mp2/4.2.4-openstlinux-6.1-yocto-mickledore-mp2-v24.06.26/environment-setup-cortexa35-ostl-linux | ||
</pre> | </pre> | ||
Line 160: | Line 162: | ||
:{| | :{| | ||
| <target> || Target architecture for cross-toolchain; example: | | <target> || Target architecture for cross-toolchain; example: | ||
* | * cortexa35 | ||
|- | |- | ||
| <distro> || Distribution name; example: | | <distro> || Distribution name; example: | ||
* ostl-linux | * ostl-linux | ||
|} | |} | ||
:Example | :Example | ||
:* {{EcosystemRelease/Package | revision=5. | :* {{EcosystemRelease/Package | revision=5.1.0 | package=SDK-arm64 setup script | request=name |device=MP2}} | ||
Line 173: | Line 175: | ||
: Example: here, the SDK installation directory (''/local/SDK/''{{HighlightParam|''<Yocto release>-<version>''}}) is different from the default one | : Example: here, the SDK installation directory (''/local/SDK/''{{HighlightParam|''<Yocto release>-<version>''}}) is different from the default one | ||
$ source /opt/st/ | $ source /opt/st/stm32mp2/{{EcosystemRelease/Component | revision=5.1.0 | component=OpenEmbedded | name=tag | device=MP2}}-{{EcosystemRelease/Package | revision=5.1.0 | device=MP2 | package=OpenSTLinux distribution | request=name}}/{{EcosystemRelease/Package | revision=5.1.0 | device=MP2 | package=SDK setup script | request=name}} | ||
* Many environment variables are then defined: | * Many environment variables are then defined: |
Latest revision as of 18:08, 5 November 2024
1. Article purpose[edit | edit source]
This article aims to give general information about the software development kit (SDK) for the OpenSTLinux distribution.
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:
- get the software images (binaries) of the software release associated with the SDK (see Starter Package)
- download the SDK
- install the SDK for the targeted hardware (see SDK installation)
- run the SDK environment setup script (see SDK startup)
- develop and test the piece of software
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 unknown microprocessor device.
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 (unknown revision ) 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:
|
<version> | Software release version; example:
|
Example:
- unknown revision
The steps for the OpenSTLinux SDK installation, are:
- Download, on the host machine, the SDK tarball file (unknown revision )
- Decompress the tarball file
SDK-[...].tar.gz
$ tar en.
- 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: - unknown revision (aka unknown revision )
<version> Software release version; example: - unknown revision
- Example:
- unknown revision
- If necessary, change the permissions on the installation script so that it is executable:
<image>-<distro>-<machine>-<host machine>-toolchain-<Yocto release>-<version>.sh$ chmod +x
- The SDK is self-contained and by default is installed into /opt/st/<machine>/<Yocto release>-<version>
- Example:
- /opt/st/stm32mp2/unknown revision -unknown revision
- 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
- 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)
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$ ./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
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
- unknown revision
- Run the environment setup script
<SDK installation directory path>/environment-setup-<target>-<distro>-linux-gnueabi$ source
- Example: here, the SDK installation directory (/local/SDK/<Yocto release>-<version>) is different from the default one
unknown revision -unknown revision /unknown revision$ source /opt/st/stm32mp2/
- Many environment variables are then defined:
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 -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
The OpenSTLinux SDK is started.
7. References[edit | edit source]