Last edited 6 days ago

How to import and build STM32MPU OpenSTLinux projects in STM32CubeIDE

(Redirected from How to manage STM32MP1 OpenSTLinux projects in STM32CubeIDE)
Applicable for STM32MP13x lines, STM32MP15x lines, STM32MP21x lines, STM32MP23x lines, STM32MP25x lines

Warning DB.png Important
In this article, the STM32MP257F-EV1 Evaluation board More info green.png is taken as example. Nevertheless, it is also applicable to any STM32 Arm® Cortex® MPUs More info.png listed in the "applicability field" available on top of the article.
Info white.png Information
In this article, explanations are applicable to any version of Yocto-based OpenSTLinux embedded software.
Info white.png Trusted domain applicability
This article is not applicable to M33-TD flavor More info green.png of STM32MP2 series

This article explains

  • how to import and build OpenSTLinux projects supporting FIP (TF-A firmware image package) into STM32CubeIDE on a Linux® workstation (Windows® environment is not supported).
  • how to rebuild the OpenSTLinux projects after device tree changes
  • how to upload the storage device

1. Prerequisites[edit | edit source]

Linux® environment is mandatory.

STM32CubeIDE must be installed.

1.1. set up network[edit | edit source]

Network setup is needed, for that follow instruction given in How to set up proxy and P2P Ethernet connection with STM32CubeIDE.

1.2. Install OpenSTLinux SDK in STM32CubeIDE[edit | edit source]

How to install the SDK in STM32CubeIDE is explained in How to install the Yocto Project SDK in STM32CubeIDE#Install OpenSTLinux SDK in STM32CubeIDE.

1.3. Import the STM32MPU Projects generated by STM32CubeMX[edit | edit source]

STM32MPU projects should have been previously generated thank to STM32CubeMX . To know how to generate project via STM32CubeMX , refer to How to create STM32MPU projects with STM32CubeMX.

To import the project generated by STM32CubeMX into STM32CubeIDE, refer to How to create STM32MPU projects with STM32CubeMX#Import generated project in STM32CubeIDE.

1.4. Install OpenSTLinux plugin sources[edit | edit source]

How to install the OpenSTLinux plugin is explained in How to install the Yocto Project SDK in STM32CubeIDE#Install OpenSTLinux plugin sources.

2. Import OpenSTLinux project sources[edit | edit source]

OpenSTLinux project sources (Linux, OP-TEE, TF-A, U-Boot) must be installed on local disk following STM32MPU Developer Package. They can be fully controlled with an STM32CubeIDE independent source control tool. For using them inside STM32CubeIDE, they are imported inside STM32MPU project giving source paths.

Note that OpenSTLinux projects need only to be installed on your local disk ; no need to build them in command line.

It is possible to import into an existing STM32CubeIDE STM32MPU project, some OpenSTLinux project sources (Linux, OP-TEE, TF-A, U-Boot). It's recommended to import OpenSTLinux projects following the order: Linux, optee, tf-a then uboot.

This is done by clicking on Import an OpenSTLinux project... in contextual menu of the Cortex®-A hierarchical project...

OpenSTLinux project import

...and giving source paths.

OpenSTLinux project sources import wizard


Warning white.png Warning
Yocto SDK is needed at this step of OpenSTLinux project import. In case of setup issue, you will get the following pop-up. You need then to check the Yocto SDK has been correctly installed visiting How to install the Yocto Project SDK in STM32CubeIDE
Yocto SDK set-up issue.

3. Description of imported OpenSTLinux project structure[edit | edit source]

All OpenSTLinux projects follow the same project structure approach with three main parts:

  • Eclipse artifact, to make project usage easier,
  • Build artifact, to identify clearly the project output,
  • Sources, appearing in the Yocto Project® environment.
OpenSTLinux Linux Project Structure

Device tree sources, generated by STM32CubeMX, are set into the DeviceTree/ directory of the Cortex®-A hierarchical project.

They are automatically included inside the corresponding OpenSTLinux projects: Linux®, OPTEE ,TF-A and U-boot, with:

  • source file links,
  • dedicated Build target.

STM32CubeIDE supports FIP. The FIP_artifacts/ directory of the Arm®-Cortex®-A hierarchical project hosts all the deployment objects needed to build the FIP image. Those objects are generated by the , or OP-TEE ,TF-A and U-boot projects.

Warning white.png Warning
It is recommended to refresh the project explorer with the Refresh contextual menu of the Cortex®-A hierarchical project to get an update on FIP artifacts.

4. Build an OpenSTLinux project[edit | edit source]

Several Build targets are proposed for a Linux® project addressing device trees, module, and kernel.

OpenSTLinux Linux Project Structure

Double-click on Build target to launch the corresponding compilation with the associated Yocto Project® SDK.

OpenSTLinux Linux Device Tree MX Build


5. Generate Bootloader projects[edit | edit source]


The boot architecture is explained in TF-A overview. Two objects (Bootloader projects) are needed to update the board's flash memory device:

  • TF-A BL2 flash memory partition
  • FIP Image.

Both of them are generated inside STM32CubeIDE. Binary generated inside FIP artifacts directory :

  • TF-A BL2 flash memory partition, available from the TF-A project build artifact
  • FIP image, located into the fip directory of FIP artifacts
  • FIP_artifacts/
    • arm-trusted-firmware/ contains generated binaries for tf-a
    • optee/ contains generated binaries for optee
    • u-boot/ contains generated binaries for u-boot
    • fip/ contains generated binaries for fip

Since the FIP image relies on three projects, there are dependencies between TF-A, U-boot, and OP-TEE. The all build target in those projects launches the fiptool, which builds the FIP image. This succeeds only if all the objects are generated.


A build target using the generated device tree sources is also proposed inside STM32CubeIDE.
These generated device trees target only the trusted mode. As a result, there is no support inside the OP-TEE project.
As depicted in the figure below, the generated device tree sources for TF-A and U-boot are inside the DeviceTree/ directory. They are linked into the projects TF-A and U-boot, and specific build targets are generated:

  • For STM32MP15x lines More info.png
  • stm32 (stm32mp157c-mymp157cdk2-mx) for the TF-A project, which must be launched first,
  • and all (stm32mp157c-mymp157cdk2-mx) for the U-boot project.
  • For STM32MP25x lines More info.png
  • stm32 (stm32mp257f-mp257f-ev1-mx) for the TF-A project, which must be launched first
  • and all (stm32mp257f-mp257f-ev1-mx) for the U-boot project

The FIP image for the generated device tree is then available from the fip directory of the FIP artifact.

OpenSTLinux FIP Project Structure

6. Update bootloader objects on STM32MPU target[edit | edit source]

It is possible to update bootloader objects (TF-A BL2 & FIP image) directly on a running STM32MP25x target.

Before working with STM32CubeIDE, it is recommended to first update the board's boot flash memory with STM32CubeProgrammer.

All flash memory devices available on the STM32MP157F-EV1 (SD™ card, eMMC, NAND, and NOR) are supported by STM32CubeIDE. It is possible to update them, typically with a customized device tree, by means of the STM32CubeMX.

Info white.png Information
Only trusted image is supported

Following article explains how to update the boot flash memory with generated bootloaders