cancel
Showing results for 
Search instead for 
Did you mean: 

FAQ: STM32MP1 - How to create a device tree adapted to your design with STM32CubeMX?

How to create your own device tree files for TF-A, OPTEE, U-boot, Kernel binaries for your custom PCB design?

1. Purpose

The objective is to create TF-A, OPTEE, U-boot, or kernel device tree files adapted to your design.
From a STM32CubeMX project with the STM32MP1 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. Check the link below for each peripheral point on the device tree node parameters.
https://wiki.st.com/stm32mpu/wiki/Category: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 the wiki device tree articles.

The device tree files generated by STM32CubeMX are incomplete. 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 additional STMicroelectronics reference boards device tree files in OpenSTlinux source files corresponding their schematics. 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.

To access this lab:
1. Go to 
https://drive.google.com/drive/folders/1eHO37VljVpbTt-TBJFZ2-Yack5fZPj-v
2. Navigate to the folder OpenSTLinux_x_x_Update
3. Download WorkshopUpdates_x_x_x.zip
4. Open STM32MP1_WORKSHOP_USB_KEY/ExtraHandson/Lab-MP1x_FromPartNumber_To_BasicDeviceTree_with_CubeMx.zip 


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

Starting a 'bring up' device tree from the STM32CubeMX MCU selector with the DK2 STM32MP157C (DK13 STM32MP135F) part number. The lab shows which nodes to pick from a DK STM32CubeMX project device tree files and to paste in the "bring up" device tree.
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. The lab also shows how to complete the device tree manually.


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. 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 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. Therefore, when upgrading the OpenSTlinux release, 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 the node properties if they remain the same in the 2.x. For more information, see the article FAQ STM32MP1 OpenSTLinux release update.

Additional resources:

Information about getting started with the STM32MP1 SoC
FAQ: STM32MP1 How to bring up STM32MP1 
FAQ: STM32MP1 OpenSTLinux release update

 

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
Senior III

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:
‎2023-11-14 03:59 AM
Updated by: