cancel
Showing results for 
Search instead for 
Did you mean: 

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

1. Purpose

The objective is to create the device tree files for each component: TF-A, OPTEE, U-boot, kernel - adapted to your design.
From a STM32CubeMX project with the STM32MPU part number of your design, it is possible to create minimal device tree files from scratch and enrich them with the STM32MP1 peripherals of your application.

2. Device tree file node

For the driver of each peripheral used in your application, there is a relative node in the device tree file that provides the driver configuration parameters. Check the link below, for each peripheral there is one wiki article about the device tree node parameters.
ST Wiki: Device tree configuration
These articles provide links to the driver "binding files" (st.txt files) that gives the exact meaning of the node parameters. 

To elaborate the device tree file adapted to your design, it is recommended to use STM32CubeMX and theses wiki device tree articles.

The device tree files generated by STM32CubeMX are incomplete to get the component booting. The files cannot be used "as is" to boot correctly. STM32CubeMX partially generates the device tree. The tool handles the GPIO pin multiplexing, the RCC clock settings, the DRAM configuration, and hardware execution context for peripheral isolation. The tool does not generate all the driver node's parameters. They have to be added manually (how, see next section). 

3. Node parameters

These nodes must be added manually under the user sections. To find the adapted parameters to your design, refer to the wiki device tree articles example and the driver "binding files" (st.txt files). There are examples with the STMicroelectronics reference boards device tree files in OpenSTlinux source files. Note, the node parameters presented in the wiki page may not be adapted to your design. Select the right parameters adapted to your PCB (GPIOs, flash, DRAM, power supplies tree, USB, etc.).

For concrete guidance, here is a lab example to get used with this device tree creation process.

This lab deals with the STM32MP157-DK board or STM32MP135-DK board or STM32MP257-EV1 board and their associated device tree files.

To access this lab:

1. Open Board_Bring_Up 


The purpose of this lab is to create a minimal device tree for TF-A, OPTEE, U-Boot, kernel that boots correctly from sdmmc1/SD card. This minimal device also allows using U-boot from a USB OTG port that is useful for the very first bring-up as detailed in FAQ: How to bring up STM32MP1.

The lab is starting a 'bring up' device tree from the STM32CubeMX MCU selector with the DK2 STM32MP157C,DK13 STM32MP135F,EV1 STM32MP257F part number. The lab shows how to configure with STM32CubeMX menus the clock tree (RCC), the STPMIC, the DDR controller, the UART for the console, USB for DFU, etc. 

Then, the lab also shows how to complete the device tree manually: It shows which nodes to pick from the device tree files generated by the DK STM32CubeMX project and to paste into the "bring up" device tree.


This lab can be used as a method to create T-A, U-boot, kernel device tree files adapted to your STM32MP1 part number and to your design from STM32CubeMX. Recall here the STMicroelectronics reference DK boards device tree node parameters used may not suit your design. Some nodes are generic and can be reused from DK. Nodes can also depend on the design. For example, if the design embeds a level shifter on an SD card, some device tree properties of the sdmmc node that should be modified compare to DK2. As written previously, these device tree properties are described in the sdmmc driver binding file. There are examples in the wiki device tree articles or in the device tree files of the different STMicroelectronics reference boards.

Note: Over the different ecosystem ST releases, the OpenSTLinux drivers source code have evolutions and the STM32CubeMX depends on it. Use the STM32CubeMX version that is coming in your ecosystem along with your OpenSTLinux sources. Therefore, when upgrading the OpenSTlinux from ecosystem 2.x->3.x, you cannot directly reuse the Linux kernel device tree file from ecosystem 2.x with a Linux kernel from the ecosystem 3.x. You have to recheck every node property whether they remain the same as in the 2.x. For more information, see the article FAQ STM32MPUs OpenSTLinux release update.

Additional resources

 

Comments
Gencay
Associate III

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
Community manager
Community manager

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

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 ?

Version history
Last update:
‎2024-10-21 07:52 AM
Updated by: