Registered User mNo edit summary |
Registered User mNo edit summary Tag: 2017 source edit |
||
(12 intermediate revisions by 3 users not shown) | |||
Line 1: | Line 1: | ||
{{ApplicableFor | {{ApplicableFor | ||
|MPUs list=STM32MP13x, STM32MP15x | |MPUs list=STM32MP13x, STM32MP15x, STM32MP25x | ||
|MPUs checklist=STM32MP13x, STM32MP15x | |MPUs checklist=STM32MP13x, STM32MP15x, STM32MP25x | ||
}} | }} | ||
This article describes how the [[Device tree|device tree]] files for STM32MPU are organized for Linux<sup>®</sup>, U-Boot, TF-A and OP-TEE, but also how they are organized when they are generated from STM32CubeMX. | |||
__TOC__ | __TOC__ | ||
== Purpose and scope == | == Purpose and scope == | ||
This article shows the structure of the device tree files as it is implemented in OpenSTLinux for [[STM32 MPU Linux kernel overview|Linux<sup>®</sup> kernel]], [[U-Boot overview|U-Boot]], [[TF-A overview|TF-A]] and [[OP-TEE overview|OP-TEE]]. | This article shows the structure of the device tree files as it is implemented in OpenSTLinux for [[STM32 MPU Linux kernel overview|Linux<sup>®</sup> kernel]], [[U-Boot overview|U-Boot]], [[TF-A overview|TF-A]] and [[STM32 MPU OP-TEE overview|OP-TEE]]. | ||
The purpose of this article is not to explain the [[Device tree|device tree]] concept | The purpose of this article is not to explain the [[Device tree|device tree]] concept but the [[:Category:Device tree configuration|device tree configuration]] supported by the {{MicroprocessorDevice | device=1}} and the {{MicroprocessorDevice | device=2}}. A good knowledge of the concept is a prerequisite before reading this article. The articles regarding the configuration can be read afterwards. | ||
== Device tree structure== | == Device tree structure== | ||
The device tree files are used during [[Boot chain overview|boot time]] by the FSBL (TF-A), the secure OS (OP-TEE), the SSBL (U-Boot) and, at run time, by the Linux kernel. <br /> | The device tree files are used during [[Boot chain overview|boot time]] by the FSBL (TF-A), the secure OS (OP-TEE), the SSBL (U-Boot) and, at run time, by the Linux kernel. <br /> | ||
==={{MicroprocessorDevice | device=1}}=== | |||
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: | 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 {{MicroprocessorDevice | device=1}} are created in the '''Linux''' kernel. | * The initial device tree files supporting {{MicroprocessorDevice | device=1}} are created in the '''Linux''' kernel. | ||
Line 24: | Line 27: | ||
The figure below shows the device tree files structure for Linux, U-Boot, TF-A and OP-TEE: | The figure below shows the device tree files structure for Linux, U-Boot, TF-A and OP-TEE: | ||
[[File:Device_tree_for_Linux_U-Boot_TF-A_OP-TEE.png|center|link=]] | [[File:Device_tree_for_Linux_U-Boot_TF-A_OP-TEE.png|center|link=]] | ||
==={{MicroprocessorDevice | device=2}}=== | |||
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 {{MicroprocessorDevice | device=2}} are created in the '''Linux''' kernel. | |||
** The source code path is {{CodeSource | Linux kernel | arch/arm/boot/dts/ | arch/arm64/boot/dts/st/stm32mp2*}}. | |||
* In '''U-Boot''', Linux files are copied and overloaded with U-Boot properties. | |||
** The source code path is {{CodeSource | U-Boot | arch/arm/dts/ | arch/arm/dts/stm32mp2*}}. | |||
** 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 {{CodeSource | U-Boot | tools/binman/binman.rst | binman.rst}}. | |||
* In '''TF-A''', Linux files are copied, completed with the security configuration (firewalling) and limited clock tree required for boot and the DDR configuration. TF-A BL2 is applying some 'delete-property' on useless nodes, to lighten the final dtb file. TF-A BL3 device tree is a subset from TF-A BL2 one. | |||
** The source code path is {{CodeSource | TF-A | fdts/ | fdts/stm32mp2*}}. | |||
* In '''OP-TEE''', Linux files are reused, completed with clock tree and security configuration required to configure the complete system. | |||
** The source code path is {{CodeSource | OP-TEE_OS | core/arch/arm/dts/ | core/arch/arm/dts/stm32mp2*}}. | |||
The figure below shows the device tree files structure for Linux, U-Boot, TF-A and OP-TEE: | |||
[[File:Device_tree_for_Linux_U-Boot_TF-A_OP-TEE_STM32MP2.png|center|link=]] | |||
{{Info| | {{Info| | ||
* The '''board''' level device tree file completes and/or overloads the default peripherals nodes configuration, defined in the included '''SoC''' dtsi file. | * The '''board''' level device tree file completes and/or overloads the default peripherals nodes configuration, defined in the included '''SoC''' dtsi file. | ||
Line 32: | Line 50: | ||
== STM32CubeMX generated device tree == | == STM32CubeMX generated device tree == | ||
[[STM32CubeMX]] can help to '''generate''' the device tree files for a given project, for the various software components: | [[STM32CubeMX]] can help to '''generate''' the device tree files for a given project, for the various software components: | ||
==={{MicroprocessorDevice | device=1}}=== | |||
* '''TF-A''': STM32CubeMX generates three files: | * '''TF-A''': STM32CubeMX generates three files: | ||
:* 'stm32mp15-mx.dtsi' is equivalent to 'stm32mp1*-<DDR type>.dtsi' in the diagram above, embedding DDR settings | :* 'stm32mp15-mx.dtsi' is equivalent to 'stm32mp1*-<DDR type>.dtsi' in the diagram above, embedding DDR settings | ||
Line 44: | Line 63: | ||
:* 'stm32mp1*-<your_project_name>-mx.dts' is the board device tree file, that includes all dtsi files (directly or not) | :* 'stm32mp1*-<your_project_name>-mx.dts' is the board device tree file, that includes all dtsi files (directly or not) | ||
==={{MicroprocessorDevice | device=2}}=== | |||
[[STM32CubeMX]] can help to '''generate''' the device tree files for a given project, for the various software components: | |||
* '''TF-A''': STM32CubeMX generates three files: | |||
:* 'stm32mp25-mx.dtsi' is equivalent to 'stm32mp1*-<DDR type>.dtsi' in the diagram above, embedding DDR settings | |||
:* 'stm32mp2*-<your_project_name>-mx.dts' is the board device tree file, that includes all dtsi files (directly or not) | |||
:* 'stm32mp2*-<your_project_name>-mx-fw-config.dts' file corresponds to the [[TF-A_BL2_overview#FCONF | TF-A firmware configuration]] and is out of the file structure shown in the previous paragraph | |||
:* 'stm32mp2*-<your_project_name>-mx-rcc.dts' is the TF-A clock tree device tree file. | |||
* '''U-Boot''': | |||
:* 'stm32mp2*-<your_project_name>-mx.dts' is the board device tree file, that includes all dtsi files (directly or not) | |||
:* 'stm32mp2*-<your_project_name>-mx-u-boot.dts' is equivalent to the '<board>-u-boot.dtsi' file in the diagram above | |||
:* 'stm32mp2*-<your_project_name>-mx-resmem.dts' is the U-Boot memory mapping device tree file. | |||
* '''Linux''': | |||
:* 'stm32mp2*-<your_project_name>-mx.dts' is the board device tree file, that includes all dtsi files (directly or not) | |||
:* 'stm32mp2*-<your_project_name>-mx-resmem.dts' is the Linux memory mapping device tree file. | |||
* '''OP-TEE''': | |||
:* 'stm32mp2*-<your_project_name>-mx.dts' is the board device tree file, that includes all dtsi files (directly or not) | |||
:* 'stm32mp2*-<your_project_name>-mx-resmem.dts' is the OP-TEE memory mapping device tree file. | |||
:* 'stm32mp2*-<your_project_name>-mx-rcc.dts' is the OP-TEE clock tree device tree file. | |||
:* 'stm32mp2*-<your_project_name>-mx-rif.dts' is the OP-TEE RIF device tree file. | |||
===Using the generated files=== | |||
The device tree files generated by STM32CubeMX can be '''built''' with the [[Which STM32MPU Embedded Software Package better suits your needs#Developer Package|Developer Package]] or [[Which STM32MPU Embedded Software Package better suits your needs#Distribution_Package|Distribution Package]]: | The device tree files generated by STM32CubeMX can be '''built''' with the [[Which STM32MPU Embedded Software Package better suits your needs#Developer Package|Developer Package]] or [[Which STM32MPU Embedded Software Package better suits your needs#Distribution_Package|Distribution Package]]: | ||
* Use the '''Developer Package''' to store the STM32CubeMX-generated files in the folder of your choice. Then, manually copy or link them into Linux, U-Boot and TF-A device tree folders (see [[#Device tree structure|Device tree structure]]). Do not forget to add your device tree file name in '''../Makefile.sdk''' (for TF-A SDK and U-Boot SDK) and in '''arch/arm/boot/dts/Makefile''' (for Linux kernel SDK), before compiling them as explained in [[How to cross-compile with the Developer Package]]. | * Use the '''Developer Package''' to store the STM32CubeMX-generated files in the folder of your choice. Then, manually copy or link them into Linux, U-Boot and TF-A device tree folders (see [[#Device tree structure|Device tree structure]]). Do not forget to add your device tree file name in '''../Makefile.sdk''' (for TF-A SDK and U-Boot SDK) and in '''arch/arm/boot/dts/Makefile''' (for Linux kernel SDK), before compiling them as explained in [[How to cross-compile with the Developer Package]]. |
Revision as of 14:55, 25 July 2024
This article describes how the device tree files for STM32MPU are organized for Linux®, U-Boot, TF-A and OP-TEE, but also how they are organized when they are generated from STM32CubeMX.
1. Purpose and scope[edit | 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 but the device tree configuration supported by the STM32MP1 Series and the STM32MP2 unknown microprocessor device. 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[edit | 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.
2.1. STM32MP1 Series[edit | edit source]
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.
- The source code path is arch/arm/boot/dts/stm32mp1* .
- 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 binman.rst .
- 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.
- The source code path is fdts/stm32mp1* .
- In OP-TEE, Linux files are reused.
- The source code path is core/arch/arm/dts/stm32mp1* .
The figure below shows the device tree files structure for Linux, U-Boot, TF-A and OP-TEE:
2.2. STM32MP2 unknown microprocessor device[edit | edit source]
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 STM32MP2 unknown microprocessor device are created in the Linux kernel.
- The source code path is arch/arm64/boot/dts/st/stm32mp2* .
- In U-Boot, Linux files are copied and overloaded with U-Boot properties.
- The source code path is arch/arm/dts/stm32mp2* .
- 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 binman.rst .
- In TF-A, Linux files are copied, completed with the security configuration (firewalling) and limited clock tree required for boot and the DDR configuration. TF-A BL2 is applying some 'delete-property' on useless nodes, to lighten the final dtb file. TF-A BL3 device tree is a subset from TF-A BL2 one.
- The source code path is fdts/stm32mp2* .
- In OP-TEE, Linux files are reused, completed with clock tree and security configuration required to configure the complete system.
- The source code path is core/arch/arm/dts/stm32mp2* .
The figure below shows the device tree files structure for Linux, U-Boot, TF-A and OP-TEE:
3. STM32CubeMX generated device tree[edit | edit source]
STM32CubeMX can help to generate the device tree files for a given project, for the various software components:
3.1. STM32MP1 Series[edit | edit source]
- TF-A: STM32CubeMX generates three 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)
- 'stm32mp1*-<your_project_name>-mx-fw-config.dts' file corresponds to the TF-A firmware configuration and is out of the file structure shown in the previous paragraph
- U-Boot:
- 'stm32mp1*-<your_project_name>-mx.dts' is the board device tree file, that includes all dtsi files (directly or not)
- 'stm32mp1*-<your_project_name>-mx-u-boot.dts' is equivalent to the '<board>-u-boot.dtsi' file in the diagram above
- Linux:
- 'stm32mp1*-<your_project_name>-mx.dts' is the board device tree file, that includes all dtsi files (directly or not)
- OP-TEE:
- 'stm32mp1*-<your_project_name>-mx.dts' is the board device tree file, that includes all dtsi files (directly or not)
3.2. STM32MP2 unknown microprocessor device[edit | edit source]
STM32CubeMX can help to generate the device tree files for a given project, for the various software components:
- TF-A: STM32CubeMX generates three files:
- 'stm32mp25-mx.dtsi' is equivalent to 'stm32mp1*-<DDR type>.dtsi' in the diagram above, embedding DDR settings
- 'stm32mp2*-<your_project_name>-mx.dts' is the board device tree file, that includes all dtsi files (directly or not)
- 'stm32mp2*-<your_project_name>-mx-fw-config.dts' file corresponds to the TF-A firmware configuration and is out of the file structure shown in the previous paragraph
- 'stm32mp2*-<your_project_name>-mx-rcc.dts' is the TF-A clock tree device tree file.
- U-Boot:
- 'stm32mp2*-<your_project_name>-mx.dts' is the board device tree file, that includes all dtsi files (directly or not)
- 'stm32mp2*-<your_project_name>-mx-u-boot.dts' is equivalent to the '<board>-u-boot.dtsi' file in the diagram above
- 'stm32mp2*-<your_project_name>-mx-resmem.dts' is the U-Boot memory mapping device tree file.
- Linux:
- 'stm32mp2*-<your_project_name>-mx.dts' is the board device tree file, that includes all dtsi files (directly or not)
- 'stm32mp2*-<your_project_name>-mx-resmem.dts' is the Linux memory mapping device tree file.
- OP-TEE:
- 'stm32mp2*-<your_project_name>-mx.dts' is the board device tree file, that includes all dtsi files (directly or not)
- 'stm32mp2*-<your_project_name>-mx-resmem.dts' is the OP-TEE memory mapping device tree file.
- 'stm32mp2*-<your_project_name>-mx-rcc.dts' is the OP-TEE clock tree device tree file.
- 'stm32mp2*-<your_project_name>-mx-rif.dts' is the OP-TEE RIF device tree file.
3.3. Using the generated files[edit | edit source]
The device tree files generated by STM32CubeMX can be built with the Developer Package or Distribution Package:
- Use the Developer Package to store the STM32CubeMX-generated files in the folder of your choice. Then, manually copy or link them into Linux, U-Boot and TF-A device tree folders (see Device tree structure). Do not forget to add your device tree file name in ../Makefile.sdk (for TF-A SDK and U-Boot SDK) and in arch/arm/boot/dts/Makefile (for Linux kernel SDK), before compiling them as explained in How to cross-compile with the Developer Package.
- Use the Distribution Package to store the STM32CubeMX-generated files in meta-st/meta-st-stm32mp-addons/mx, as explained in the How to create your own machine article. This article also describes how to build the complete image. Examples of Linux (device tree), U-Boot and TF-A individual compiling can be found in the How to cross-compile with the Distribution Package article.