Skip to main content
Emmanuel COMBETTE DE RYMON
ST Employee
October 13, 2020

FAQ: STM32MPUs: How to create a device tree adapted to your design with STM32CubeMX

  • October 13, 2020
  • 3 replies
  • 14419 views

1. Purpose

Create device tree files for each component: TF-A, OP-TEE, U-Boot, and the Linux kernel, adapted to the design.

From an STM32CubeMX project that uses the microprocessor unit (MPU) part number of the design, it is possible to create minimal device tree files from scratch and enrich them with the STM32MPx peripherals required by the application.

This article applies to the STM32MP1 and STM32MP2 series.

 

2. Device tree file node


For the driver of each peripheral that the application uses, the device tree file contains a corresponding node that provides the driver configuration parameters. For each peripheral, see the wiki article about the device tree node parameters in the link below. 
ST Wiki: Device tree configuration

These articles provide links to the driver binding files (st.txt files), which give the exact meaning of the node parameters.

To create the device tree file that is adapted to the design, ST recommends using STM32CubeMX and these wiki articles about the device tree.

The device tree files that STM32CubeMX generates are incomplete for booting the component. The files cannot be used as is for correct boot operation. STM32CubeMX generates the device tree for GPIO pin multiplexing, RCC clock settings, DRAM configuration, and the hardware execution context for peripheral isolation. The tool does not generate all driver node parameters. These parameters must be added manually (see the next section)

 

3. Node parameters

The nodes parameter must be added manually under the User sections in the STM32CubeMX-generated device tree file. To identify the parameters that match the design, refer to the wiki device tree article examples and the driver binding files (st.txt). Examples are available in the device tree files for ST reference boards in the OpenSTLinux source files. The node parameters presented on the wiki page might not match the design. Select the parameters that match the printed circuit board (PCB), such as GPIOs, flash, DRAM, power supply tree, and USB.


4. Build minimal device tree for bring-up


This hands-on session show how to configure the device tree of the boot chain (TF-A,POP-TEE,U-Boot) and the Linux kernel on ST Reference board. This hands-on is an illustration. The same method as can be followed for a customer design that uses an STM32 microprocessor unit (MPU) system-on-chip (SoC) part number that differs from the ST reference board and that connects to different devices. The device tree is built with STM32CubeMX and with device tree files from the OpenSTLinux source files.

This hands-on session covers the STM32MP157-DK board, the STM32MP135-DK board, and the STM32MP257-EV1 board, and their associated device tree files.

The device tree node parameters that are used on ST reference boards might not suit the design. Some nodes are generic and system oriented and can be reused but others nodes can depend on the design. For example, if the design includes a level shifter on an SD card, some device tree properties of the SDMMC node must be modified compared with the ST board. As stated previously, these device tree properties are described in the SDMMC driver binding file. Examples of node parameter are available in the wiki device tree articles and in the device tree files of different ST reference boards.

See the hands-on session STM32MPUs_BringUp_Minimal-DeviceTree

 

Note: Use the STM32CubeMX version that comes with the ecosystem and the corresponding OpenSTLinux source code. Across ST ecosystem releases, the OpenSTLinux driver source code and device tree evolves, and STM32CubeMX depends on it. Therefore, when OpenSTLinux is upgraded from ecosystem X.x to X+1.x, the Linux kernel device tree file from ecosystem X.x cannot be reused directly with a Linux kernel from ecosystem X+1.x. Check each node property again to confirm that it remains the same as in ecosystem X.x. see FAQ:Updating-OpenSTLinux

Additional resources

 

This topic has been closed for replies.

3 replies

Gencay
Associate III
August 17, 2022

Hello, thank you for the article but the link that you provided does not working and opens up a permission error. Can you check it out please?

Laurids_PETERSEN
ST Community Manager
August 29, 2023

Hi @Gencay,
Thanks for reaching out and notifying us about this issue.

This article will soon be reworked with more up-to-date information on the topic.

Best regards,
Laurids

debugging
Lead
September 2, 2023

Hello Laurids, the workshop 5.0  material states  that an scmi dtsi must be generated for a board. . The ECO 5.0.0 contains scmi files for ST board and we tried those as we do not know how to configure the nodes, but they fail in the compile  for our custom board. Why does cubemx not generate the scmi files, and how to determine the values of the  parameters to set for scmi for a specific board ? It would be helpful to have that in the workshop. Besides the 4.1 and 5.0 slides show very big differences in the device trees. Could some things have  been forgotten to take from 4.1 into 5.0 or 4.1 settings to avoid panic just do not apply anymore ?