STM32 MPU device tree

Revision as of 14:31, 24 January 2022 by Registered User
Applicable for STM32MP13x lines, STM32MP15x lines

1. Purpose and scope[edit source]

This article shows the structure of the device tree files as it is implemented in OpenSTLinux for Linux® kernel, U-Boot, TF-A and OP-TEE.

The purpose of this article is not to explain the device tree concept and the device tree configuration supported by STM32MP1 series. A good knowledge of the concept is a prerequisite before reading this article. The articles regarding the configuration can be read afterwards.

2. Device tree structure for Linux, U-Boot, TF-A and OP-TEE[edit source]

2.1. STMicroelectronics software delivery[edit source]

The device tree files are used during boot time by the FSBL (TF-A), the secure OS (OP-TEE), the SSBL (U-Boot) and, at run time, by the Linux kernel.

These files are stored in different github repositories (one for each first level bullet below), but source code reuse is maximized from one repository to another:

  • The initial device tree files supporting STM32MP1 series are created in the Linux kernel.
  • In U-Boot, Linux files are copied and overloaded with U-Boot properties.
    • The source code path is arch/arm/dts/stm32mp1* .
    • The U-Boot add-ons file, "<dts-file-name>-u-boot.dtsi", is automatically included at the end of "<board>.dts" during device tree compilation: this is a generic U-Boot Makefile behavior, see README .
  • In TF-A, Linux files are copied, completed with the security configuration (firewalling) and the DDR configuration. TF-A BL2 is applying some 'delete-property' on useless nodes, to lighten the final dtb file.
  • In OP-TEE, Linux files are reused.

The figure below shows the device tree files structure for Linux, U-Boot, TF-A and OP-TEE:

Device tree for Linux U-Boot TF-A OP-TEE.png
Info white.png Information
The above figure reflects the current implementation on github and may be somehow in advance compare to the upstreamed version for all parts that are still under review.
Info white.png Information
For the sake of simplicity, the figure only shows the dtsi & dts files structure, without showing the h files that are also included.
Info white.png Information
The dtb files, resulting from the compilation with the dtc compiler, may be named differently when the compilation is launched with the Distribution Package.


2.2. STM32CubeMX generated device tree[edit source]

STM32CubeMX can help to generate the device tree files for a given project, for the various software components:

  • TF-A: STM32CubeMX generates two files:
  • 'stm32mp15-mx.dtsi' is equivalent to 'stm32mp1*-<DDR type>.dtsi' in the diagram above, embedding DDR settings
  • 'stm32mp1*-<your_project_name>-mx.dts is the board device tree file, that includes all dtsi files (directly or not)
  • Notice that a 'stm32mp1*-<your_project_name>-mx-fw-config.dts' file is also generated, corresponding to the TF-A firmware configuration
  • U-Boot:
  • Linux:
  • OP-TEE: STM32CubeMX does not generate any device tree source files dedicated to OP-TEE, but these can be derived from the device tree source files generated for TF-A. In OP-TEE github release , OP-TEE files are the very TF-A source files with the DDR dtsi files removed since fully unused. However, one can copy TF-A device tree source files stm32mp1* to OP-TEE dts/   source directory and build OP-TEE with.


The device tree files generated by STM32CubeMX can be built with the Developer Package or Distribution Package: