- Last edited 7 months ago ago
How to manage OpenSTLinux projects in STM32CubeIDE
This article explains how to import OpenSTLinux projects supporting FIP (TF-A firmware image package) into STM32CubeIDE on a Linux® workstation. Following examples are based on board with STM32MP15x lines but they apply also on board with STM32MP13x lines .
It is possible to import, into an existing STM32MP15x project, some OpenSTLinux projects using STM32CubeIDE, v1.11.0, compatible with ecosystem release ≥ v4.0.0 .
This is done using the Import an OpenSTLinux project... contextual menu of the Cortex®-A hierarchical project, providing access to Linux®, TF-A, U-boot, and OP-TEE.
2 OpenSTLinux project structure
All OpenSTLinux projects follow the same project structure approach with three main parts:
- Eclipse artifact, to make project usage easier
- Build artifact identifying clearly the project output
- Sources, as they appear in the Yocto Project® environment
Device tree sources are generated by STM32CubeMX into the DeviceTree/ directory of the Cortex®-A hierarchical project. They are automatically included inside the corresponding OpenSTLinux projects: Linux®, 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 TF-A, U-boot, or OP-TEE projects.
3 Linux project
Several Build targets are proposed for a Linux® project addressing device trees, module, and kernel.
Double-click on Build target to launch the corresponding compilation with the associated Yocto Project® SDK.
It is then possible to update the running STM32MP15x target with the new build artifacts using the STM32 Cortex-A Linux Deployment > Run Configurations... menu.
In this dedicated Run Configurations... menu, build artifact (such as device tree binary, module, kernel or other) is added using the Add... button and providing:
- Local path, on the Linux® workstation (here build/arch/arm/boot/dts/stm32mp157-dk2f-mx-mx.dtb)
- Remote path, browsing the remote target file system
For a new device tree, it is possible to update the extlinux.conf target file to take it into account at the next target reboot. See the Actions sub-window.
After download of build artifacts to the STM32MP15x board:
- a script can be executed (optional)
- STM32MP15x board is rebooted (default)
4 Bootloader projects
For ecosystem release ≥ v3.0.0 , the boot architecture has been updated, as explained in TF-A overview. Since ecosystem release v3.0.0 , two objects are needed to update the STM32MP15x flash memory device: TF-A BL2 flash memory partition and FIP Image. Both of them are generated inside STM32CubeIDE:
- TF-A BL2 flash memory partition, available from the TF-A project build artifact
- FIP image, located into the fip directory of FIP artifacts
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 generated the 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:
- stm32 (stm32mp157c-mymp157cdk2-mx) for the TF-A project, which must be launched first
- and all (stm32mp157c-mymp157cdk2-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.
From STM32CubeIDE release v1.8.0, it is possible to update bootloader objects (TF-A BL2 & FIP image) directly on a running STM32MP15x target. Before working with STM32CubeIDE, it is recommended to first update the STM32MP15x boot flash memory with STM32CubeProgrammer.
All flash memory devices available on the STM32MP157x-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 integrated STM32CubeMX. Note that trusted image only is supported.
- SD card update with customized trusted image, SD card is also supported on STM32MP157x-DKx Discovery kit and STM32MP135x-DK Discovery kit
- eMMC update with customized trusted image
- NAND update with customized trusted image
- NOR update with customized trusted image