Last edited one year ago

STM32MP15 U-Boot: Difference between revisions

Registered User
Registered User
mNo edit summary
 
(34 intermediate revisions by 2 users not shown)
Line 1: Line 1:
<noinclude>{{ApplicableFor
<noinclude>{{ApplicableFor
|MPUs list=STM32MP15x
|MPUs list=STM32MP15x
|MPUs checklist=STM32MP13x, STM32MP15x
|MPUs checklist=STM32MP13x, STM32MP15x, STM32MP25x
}}</noinclude>
}}</noinclude>
This article briefly describes the {{MicroprocessorDevice | device=15}} support in [[U-Boot_overview|U-Boot]].
This article briefly describes the {{MicroprocessorDevice | device=15}} support in [[U-Boot_overview|U-Boot]].
Line 7: Line 7:
== {{MicroprocessorDevice | device=15}} support ==
== {{MicroprocessorDevice | device=15}} support ==


For detailed information, please read the file in the delivered U-Boot code = {{CodeSource | U-Boot | doc/board/st/stm32mp1.rst}} or the stm32mp1 documentation generated by <code>make htlmdocs</code><ref>https://u-boot.readthedocs.io/en/stable/board/st/stm32mp1.html</ref>.
For detailed information, read the file in the delivered U-Boot code = {{CodeSource | U-Boot | doc/board/st/stm32mp1.rst}} or the documentation generated by <code>make htlmdocs</code>: {{DocSource | domain=U-Boot | path=board/st/stm32mp1.html}}.
 
Also available in official U-Boot Git.


Code :
Code :
Line 15: Line 13:
** {{CodeSource | U-Boot | arch/arm/mach-stm32mp/Kconfig}}: generic configuration for {{MicroprocessorDevice | device=Class}}
** {{CodeSource | U-Boot | arch/arm/mach-stm32mp/Kconfig}}: generic configuration for {{MicroprocessorDevice | device=Class}}
** {{CodeSource | U-Boot | arch/arm/mach-stm32mp/Kconfig.15x}}: specific configuration for {{MicroprocessorDevice | device=15}}
** {{CodeSource | U-Boot | arch/arm/mach-stm32mp/Kconfig.15x}}: specific configuration for {{MicroprocessorDevice | device=15}}
* {{CodeSource | U-Boot | board/st/common}}: STMicroelectronics common code  
* {{CodeSource | U-Boot | board/st/common}}: STMicroelectronics common code
* {{CodeSource | U-Boot | board/st/stm32mp1}}: generic STMicroelectronics board for {{MicroprocessorDevice | device=1}}
* {{CodeSource | U-Boot | board/st/stm32mp1}}: STMicroelectronics boards support for {{MicroprocessorDevice | device=1}}
* drivers/*/*stm32* : drivers
* drivers/*/*stm32* : drivers


Configuration Files:
Configuration files:
* defconfig file
* defconfig file
** '''{{CodeSource | U-Boot | configs/stm32mp15_trusted_defconfig}}'''
** '''{{CodeSource | U-Boot | configs/stm32mp15_defconfig}}''' when FIP is used in OpenSTLinux
** {{CodeSource | U-Boot | configs/stm32mp15_basic_defconfig}}
* config files
* config files
** {{CodeSource | U-Boot | include/configs/stm32mp1.h}}
** {{CodeSource | U-Boot | include/configs/stm32mp15_common.h}}: generic for {{MicroprocessorDevice | device=15}}
** {{CodeSource | U-Boot | include/configs/stm32mp15_st_common.h}}: STMicroelectronics board for {{MicroprocessorDevice | device=15}}
* [[STM32_MPU_device_tree]] in {{CodeSource | U-Boot | arch/arm/dts }} : stm32mp15*.dts*
* [[STM32_MPU_device_tree]] in {{CodeSource | U-Boot | arch/arm/dts }} : stm32mp15*.dts*
** {{HighlightParam|<Device tree>}}.dts : same as kernel
** {{HighlightParam|<Device tree>}}.dts : same as kernel
** {{HighlightParam|<Device tree>}}-u-boot.dtsi : addition for u-boot automatically included in build process
** {{HighlightParam|<Device tree>}}-u-boot.dtsi : addition for u-boot automatically included in build process
** {{CodeSource | U-Boot | arch/arm/dts/stm32mp15-scmi-u-boot.dtsi |'''stm32mp15-scmi-u-boot.dtsi'''}}: SoC add-on file included in {{HighlightParam|<Device tree>}}-u-boot.dtsi
** {{CodeSource | U-Boot | arch/arm/dts/stm32mp15-u-boot.dtsi |stm32mp15-u-boot.dtsi}}: SoC add-on file for board support without SCMI, only for downstream support {{highlight|not used with OpenSTLinux}}


== Selecting targets : choose defconfig and Device Tree ==
{{Warning | The U-Boot defconfig to use for {{EcosystemRelease | revision=4.0.0 | | range=and after}} change to '''stm32mp15_defconfig'''.}}


The [[Boot_chain_overview|STM32 MPU boot chain]] is supported by one [[U-Boot_overview#Kbuild|U-Boot configuration with defconfig]] = {{HighlightParam|stm32mp15_trusted_defconfig}}
The two next defconfig are kept only for compatibility with upstream, don't use them:
* {{CodeSource | U-Boot | configs/stm32mp15_trusted_defconfig}} with stm32 image header support (CONFIG_STM32MP15x_STM32IMAGE)
* {{CodeSource | U-Boot | configs/stm32mp15_basic_defconfig}} when SPL is used


Several [[STM32MP15_boards|boards]] are supported with the associated device-tree (same name as kernel):
== Selecting targets : choose defconfig and device tree ==
 
The [[Boot_chain_overview|STM32 MPU boot chain]] is supported by one [[U-Boot_overview#Kbuild|U-Boot configuration with defconfig]] = {{HighlightParam|stm32mp15_defconfig}}
 
Several [[:Category:STM32_MPU_boards#More_about_STM32MP15_boards|boards]] are supported with the associated device-tree (same name as kernel):


{| class="st-table"
{| class="st-table"
Line 59: Line 65:


== Compilation ==
== Compilation ==
see [[U-Boot_overview#U-Boot_build]]
See [[U-Boot_overview#U-Boot_build]] with the defconfig file: {{HighlightParam|stm32mp15_defconfig}}


With the defconfig file: {{HighlightParam|stm32mp15_trusted_defconfig}}
   {{PC$}} make {{HighlightParam|stm32mp15_defconfig}}
 
   {{PC$}} make {{HighlightParam|stm32mp15_trusted_defconfig}}
   {{PC$}} make DEVICE_TREE={{HighlightParam|<Device tree>}} all
   {{PC$}} make DEVICE_TREE={{HighlightParam|<Device tree>}} all


Line 73: Line 77:
The output files {{Highlight|'''u-boot.dtb'''}} and {{Highlight|'''u-boot-nodtb.bin'''}} are integrated in [[#U-Boot integration in FIP|FIP]].
The output files {{Highlight|'''u-boot.dtb'''}} and {{Highlight|'''u-boot-nodtb.bin'''}} are integrated in [[#U-Boot integration in FIP|FIP]].


Nota: All the compiled device tree are available in $KBUILD_OUTPUT/arch/arm/dts/*.dtb.<br/>You can select them instead of {{Highlight|u-boot.dtb}} without U-Boot recompilation.
Note: All the compiled device trees are available in $KBUILD_OUTPUT/arch/arm/dts/*.dtb.<br/>You can select them instead of {{Highlight|u-boot.dtb}} without U-Boot recompilation.
 
The ouput file is {{Highlight|'''u-boot.stm32'''}} for {{EcosystemRelease | revision=2.1.0 | range=and before}} or if you activate {{HighlightParam|CONFIG_STM32MP15x_STM32IMAGE}} in your defconfig for {{EcosystemRelease | revision=3.0.0 | | range=and after}} (this temporary option is only introduced to facilitate the FIP migration but it will be removed in the next EcosystemRelease).
 
With FIP support for {{EcosystemRelease | revision=3.0.0 | range=and after}} , the offset on [[STM32CubeProgrammer_flashlayout#NOR_Flash_memory_and_SD_card_with_FIP|U-Boot environment in NOR]] are defined in the defconfig with:
  CONFIG_ENV_OFFSET=0x480000
  CONFIG_ENV_OFFSET_REDUND=0x4C0000
 
Without FIP support [[STM32CubeProgrammer_flashlayout#Typical_FlashLayout_file_without_FIP|these MTD partition offsets in NOR for default flashlayout]] change and to reuse the {{EcosystemRelease | revision=2.1.0 | range=and before}}  flashlayout  the defconfig options become:
  CONFIG_STM32MP15x_STM32IMAGE=y
  CONFIG_ENV_OFFSET=0x280000
  CONFIG_ENV_OFFSET_REDUND=0x2C0000


== U-Boot integration in FIP ==
== U-Boot integration in FIP ==
Line 94: Line 87:
* {{HighlightParam|--nt-fw}} {{Highlight|'''u-boot-nodtb.bin'''}}
* {{HighlightParam|--nt-fw}} {{Highlight|'''u-boot-nodtb.bin'''}}


Example for FIP upddate of {{Board | type=157C-EV1}}:
Example for FIP update :


    {{PC$}} fiptool {{HighlightParam|--verbose}} {{Highlight|update}} {{HighlightParam|--nt-fw}} {{Highlight|u-boot-nodtb.bin}} \
  {{PC$}} fiptool {{HighlightParam|--verbose}} {{Highlight|update}} {{HighlightParam|--nt-fw}} {{Highlight|u-boot-nodtb.bin}} \
               {{HighlightParam|--hw-config}}  {{Highlight|u-boot.dtb}} \
               {{HighlightParam|--hw-config}}  {{Highlight|u-boot.dtb}} \
               '''tf-a-fip-stm32mp157c-ev1.bin'''
               '''fip-<board>.bin'''
    
    
   DEBUG: Replacing nt-fw with.../u-boot-nodtb.bin
   DEBUG: Replacing nt-fw with.../u-boot-nodtb.bin
Line 105: Line 98:
   DEBUG: Payload size: ... bytes
   DEBUG: Payload size: ... bytes


<div class="mw-collapsible mw-collapsed">
See [[How_to_configure_TF-A_FIP]] for details.
 
== SPL compilation ==
<div class="mw-collapsible-content">
The alternate boot chain with SPL is also supported by ''"stm32mp15_basic_defconfig"'' but only for [[U-Boot_SPL:_DDR_interactive_mode]]
 
With the defconfig file: {{HighlightParam|stm32mp15_basic_defconfig}}
 
  {{PC$}} make {{HighlightParam|stm32mp15_basic_defconfig}}
  {{PC$}} make DEVICE_TREE={{HighlightParam|<Device tree>}} all
 
The resulting U-Boot files are located in your build directory:
* '''u-boot-spl.stm32''' : FSBL = SPL binary with STM32 image header, loaded by ROM code
* '''u-boot.img''' : SSBL = U-Boot binary with U-Boot image header (uImage), loaded by SPL
 
{{Warning | This alternate boot chain with SPL is not supported/promoted by STMicroelectronics to make product.}}
</div></div>


== Examples ==
== Examples ==


=== {{Board | type=157F-EV1}} ===
=== {{Board | type=157F-EV1}} ===
   {{PC$}} make {{HighlightParam|stm32mp15_trusted_defconfig}}
   {{PC$}} make {{HighlightParam|stm32mp15_defconfig}}
   {{PC$}} make DEVICE_TREE={{HighlightParam|stm32mp157f-ev1}} all
   {{PC$}} make DEVICE_TREE={{HighlightParam|stm32mp157f-ev1}} all
An existing FIP file is updated with:
  {{PC$}} fiptool --verbose update --nt-fw {{Highlight|u-boot-nodtb.bin}} --hw-config {{Highlight|u-boot.dtb}} \
              fip-{{HighlightParam|stm32mp157f-ev1}}.bin


=== {{Board | type=157C-EV1}} ===
=== {{Board | type=157C-EV1}} ===
   {{PC$}} make {{HighlightParam|stm32mp15_trusted_defconfig}}
   {{PC$}} make {{HighlightParam|stm32mp15_defconfig}}
   {{PC$}} make DEVICE_TREE={{HighlightParam|stm32mp157c-ev1}} all
   {{PC$}} make DEVICE_TREE={{HighlightParam|stm32mp157c-ev1}} all
An existing FIP file is updated with:
  {{PC$}} fiptool --verbose update --nt-fw {{Highlight|u-boot-nodtb.bin}} --hw-config {{Highlight|u-boot.dtb}} \
              fip-{{HighlightParam|stm32mp157c-ev1}}.bin


=== {{Board | type=157D-DK1}} ===
=== {{Board | type=157D-DK1}} ===
   {{PC$}} make {{HighlightParam|stm32mp15_trusted_defconfig}}
   {{PC$}} make {{HighlightParam|stm32mp15_defconfig}}
   {{PC$}} make DEVICE_TREE={{HighlightParam|stm32mp157d-dk1}} all
   {{PC$}} make DEVICE_TREE={{HighlightParam|stm32mp157d-dk1}} all
An existing FIP file is updated with:
  {{PC$}} fiptool --verbose update --nt-fw {{Highlight|u-boot-nodtb.bin}} --hw-config {{Highlight|u-boot.dtb}} \
              fip-{{HighlightParam|stm32mp157d-dk1}}.bin


=== {{Board | type=157C-DK2}} ===
=== {{Board | type=157C-DK2}} ===
Using export to select the device tree
Using export to select the device tree
   {{PC$}} export KBUILD_OUTPUT=../build/stm32mp15_trusted
   {{PC$}} export KBUILD_OUTPUT=../build/stm32mp15
   {{PC$}} export DEVICE_TREE={{HighlightParam|stm32mp157c-dk2}}
   {{PC$}} export DEVICE_TREE={{HighlightParam|stm32mp157c-dk2}}
   {{PC$}} make {{HighlightParam|stm32mp15_trusted_defconfig}}
   {{PC$}} make {{HighlightParam|stm32mp15_defconfig}}
   {{PC$}} make all
   {{PC$}} make all
An existing FIP file is updated with:
  {{PC$}} fiptool --verbose update --nt-fw {{Highlight|$KBUILD_OUTPUT/u-boot-nodtb.bin}} \
              --hw-config  {{Highlight|$KBUILD_OUTPUT/u-boot.dtb}} \
              fip-{{HighlightParam|stm32mp157c-dk2}}.bin


=== Custom board with external device tree ===
=== Custom board with external device tree ===
   {{PC$}} make {{HighlightParam|stm32mp15_trusted_defconfig}}
   {{PC$}} make {{HighlightParam|stm32mp15_defconfig}}
   {{PC$}} make EXT_DTB={{HighlightParam|stm32mp151a-myboard.dtb}} all
   {{PC$}} make EXT_DTB={{HighlightParam|stm32mp151a-myboard.dtb}} all


<div class="mw-collapsible mw-collapsed">
Then you can create or update the FIP
=== SPL for {{Board | type=157F-EV1}} ===
<div class="mw-collapsible-content">
  {{PC$}} make stm32mp15_basic_defconfig
  {{PC$}} make DEVICE_TREE={{HighlightParam|stm32mp157f-ev1}} all
</div></div>


<noinclude>
<noinclude>
[[Category:U-Boot|U-Boot - 0 STM32MP15]]
[[Category:U-Boot|U-Boot - 3 STM32MP15]]
{{PublicationRequestId | 12895 | 2019-08-01}}
{{PublicationRequestId | 12895 | 2019-08-01}}
</noinclude>
</noinclude>

Latest revision as of 08:13, 29 September 2023

Applicable for STM32MP15x lines

This article briefly describes the STM32MP15x lines More info.png support in U-Boot.

1. STM32MP15x lines More info.png support

For detailed information, read the file in the delivered U-Boot code = doc/board/st/stm32mp1.rst or the documentation generated by make htlmdocs: board/st/stm32mp1.html.

Code :

Configuration files:

Warning white.png Warning
The U-Boot defconfig to use for ecosystem release ≥ unknown revision 4.0.0 Warning.png change to stm32mp15_defconfig.

The two next defconfig are kept only for compatibility with upstream, don't use them:

2. Selecting targets : choose defconfig and device tree

The STM32 MPU boot chain is supported by one U-Boot configuration with defconfig = stm32mp15_defconfig

Several boards are supported with the associated device-tree (same name as kernel):

Board part number Device tree Description
STM32MP157A-EV1 Evaluation board More info green.png stm32mp157a-ev1 MB1262+MB1263
STM32MP157C-EV1 Evaluation board More info green.png stm32mp157c-ev1
STM32MP157D-EV1 Evaluation board More info green.png stm32mp157d-ev1
STM32MP157F-EV1 Evaluation board More info green.png stm32mp157f-ev1
STM32MP157A-DK1 Discovery kit More info green.png stm32mp157a-dk1 MB1272
STM32MP157D-DK1 Discovery kit More info green.png stm32mp157d-dk1
STM32MP157C-DK2 Discovery kit More info green.png stm32mp157c-dk2 MB1272+MB1407
STM32MP157F-DK2 Discovery kit More info green.png stm32mp157f-dk2

For information the 'Evaluation' daughter-board only (MB1263 without MB1262) is also supported by stm32mp15*-ed1.dts device tree files.

3. Compilation

See U-Boot_overview#U-Boot_build with the defconfig file: stm32mp15_defconfig

 PC $> make stm32mp15_defconfig
 PC $> make DEVICE_TREE=<Device tree> all

The supported variables are:

  • DEVICE_TREE: select in arch/arm/dts the device tree that is used
  • KBUILD_OUTPUT: change the destination directory for the build
  • EXT_DTB: select external device tree

The output files u-boot.dtb and u-boot-nodtb.bin are integrated in FIP.

Note: All the compiled device trees are available in $KBUILD_OUTPUT/arch/arm/dts/*.dtb.
You can select them instead of u-boot.dtb without U-Boot recompilation.

4. U-Boot integration in FIP

U-Boot binary and its associated device tree are part of the FIP binary, created with TF-A Makefile option :

  • BL33_CFG = u-boot.dtb
  • BL33 = u-boot-nodtb.bin

or updated with fiptools:

  • --hw-config u-boot.dtb
  • --nt-fw u-boot-nodtb.bin

Example for FIP update :

 PC $> fiptool --verbose update --nt-fw u-boot-nodtb.bin \
             --hw-config  u-boot.dtb \
             fip-<board>.bin
 
 DEBUG: Replacing nt-fw with.../u-boot-nodtb.bin
 DEBUG: Replacing hw-config with .../u-boot.dtb
 DEBUG: Metadata size: ... bytes
 DEBUG: Payload size: ... bytes

See How_to_configure_TF-A_FIP for details.

5. Examples

5.1. STM32MP157F-EV1 Evaluation board More info green.png

 PC $> make stm32mp15_defconfig
 PC $> make DEVICE_TREE=stm32mp157f-ev1 all

An existing FIP file is updated with:

 PC $> fiptool --verbose update --nt-fw u-boot-nodtb.bin --hw-config u-boot.dtb \
              fip-stm32mp157f-ev1.bin

5.2. STM32MP157C-EV1 Evaluation board More info green.png

 PC $> make stm32mp15_defconfig
 PC $> make DEVICE_TREE=stm32mp157c-ev1 all

An existing FIP file is updated with:

 PC $> fiptool --verbose update --nt-fw u-boot-nodtb.bin --hw-config u-boot.dtb \
              fip-stm32mp157c-ev1.bin

5.3. STM32MP157D-DK1 Discovery kit More info green.png

 PC $> make stm32mp15_defconfig
 PC $> make DEVICE_TREE=stm32mp157d-dk1 all

An existing FIP file is updated with:

 PC $> fiptool --verbose update --nt-fw u-boot-nodtb.bin --hw-config u-boot.dtb \
              fip-stm32mp157d-dk1.bin

5.4. STM32MP157C-DK2 Discovery kit More info green.png

Using export to select the device tree

 PC $> export KBUILD_OUTPUT=../build/stm32mp15
 PC $> export DEVICE_TREE=stm32mp157c-dk2
 PC $> make stm32mp15_defconfig
 PC $> make all

An existing FIP file is updated with:

 PC $> fiptool --verbose update --nt-fw $KBUILD_OUTPUT/u-boot-nodtb.bin \
              --hw-config  $KBUILD_OUTPUT/u-boot.dtb \
              fip-stm32mp157c-dk2.bin

5.5. Custom board with external device tree

 PC $> make stm32mp15_defconfig
 PC $> make EXT_DTB=stm32mp151a-myboard.dtb all

Then you can create or update the FIP