2 # Copyright (C) 2018 STMicroelectronics - All Rights Reserved
4 # SPDX-License-Identifier: GPL-2.0+ BSD-3-Clause
7 U-Boot on STMicroelectronics STM32MP1
8 ======================================
12 This is a quick instruction for setup stm32mp1 boards.
16 U-Boot supports one STMP32MP1 SoCs: STM32MP157
18 The STM32MP157 is a Cortex-A MPU aimed at various applications.
20 - Dual core Cortex-A7 application core
21 - 2D/3D image composition with GPU
22 - Standard memories interface support
23 - Standard connectivity, widely inherited from the STM32 MCU family
24 - Comprehensive security support
26 Everything is supported in Linux but U-Boot is limited to:
28 2. SDCard/MMC controller (SDMMC)
30 And the necessary drivers
35 Currently the following boards are supported:
41 BootRom => FSBL in SYSRAM => SSBL in DDR => OS (Linux Kernel)
43 with FSBL = First Stage Bootloader
44 SSBL = Second Stage Bootloader
46 One boot configuration is supported:
48 The "Basic" boot chain (defconfig_file : stm32mp15_basic_defconfig)
49 BootRom => FSBL = U-Boot SPL => SSBL = U-Boot
50 SPL has limited security initialisation
51 U-Boot is running in secure mode and provide a secure monitor to the kernel
52 with only PSCI support (Power State Coordination Interface defined by ARM)
54 All the STM32MP1 board supported by U-Boot use the same generic board
55 stm32mp1 which support all the bootable devices.
57 Each board is configurated only with the associated device tree.
59 4. Device Tree Selection
60 ========================
62 You need to select the appropriate device tree for your board,
63 the supported device trees for stm32mp157 are:
65 + ed1: daughter board with pmic stpmu1
71 1. Install required tools for U-Boot
73 + install package needed in U-Boot makefile
74 (libssl-dev, swig, libpython-dev...)
75 + install ARMv7 toolchain for 32bit Cortex-A (from Linaro,
76 from SDK for STM32MP1, or any crosstoolchains from your distribution)
78 2. Set the cross compiler:
80 # export CROSS_COMPILE=/path/to/toolchain/arm-linux-gnueabi-
81 (you can use any gcc cross compiler compatible with U-Boot)
83 3. Select the output directory (optional)
85 # export KBUILD_OUTPUT=/path/to/output
87 for example: use one output directory for each configuration
88 # export KBUILD_OUTPUT=stm32mp15_basic
90 4. Configure the U-Boot:
92 # make <defconfig_file>
94 - For basic boot mode: "stm32mp15_basic_defconfig"
96 5. Configure the device-tree and build the U-Boot image:
98 # make DEVICE_TREE=<name> all
103 # export KBUILD_OUTPUT=stm32mp15_basic
104 # make stm32mp15_basic_defconfig
105 # make DEVICE_TREE=stm32mp157c-ed1 all
109 BootRom and ATF expect binaries with STM32 image header
110 SPL expects file with U-Boot uImage header
112 So in the output directory (selected by KBUILD_OUTPUT),
113 you can found the needed files:
115 + FSBL = spl/u-boot-spl.stm32
121 The minimal requirements for STMP32MP1 boot up to U-Boot are:
122 - GPT partitioning (with gdisk or with sgdisk)
123 - 2 fsbl partitions, named fsbl1 and fsbl2, size at least 256KiB
124 - one ssbl partition for U-Boot
126 Then the minimal GPT partition is:
127 ----- ------- --------- -------------
128 | Num | Name | Size | Content |
129 ----- ------- -------- --------------
130 | 1 | fsbl1 | 256 KiB | ATF or SPL |
131 | 2 | fsbl2 | 256 KiB | ATF or SPL |
132 | 3 | ssbl | enought | U-Boot |
133 | * | - | - | Boot/Rootfs|
134 ----- ------- --------- -------------
136 (*) add bootable partition for extlinux.conf
137 following Generic Distribution
138 (doc/README.distro for use)
140 according the used card reader select the block device
141 (/dev/sdx or /dev/mmcblk0)
142 in the next example I use /dev/mmcblk0
144 for example: with gpt table with 128 entries
146 a) remove previous formatting
147 # sgdisk -o /dev/<SDCard dev>
149 b) create minimal image
150 # sgdisk --resize-table=128 -a 1 \
151 -n 1:34:545 -c 1:fsbl1 \
152 -n 2:546:1057 -c 2:fsbl2 \
153 -n 3:1058:5153 -c 3:ssbl \
156 you can add other partition for kernel (rootfs)
158 c) copy the FSBL (2 times) and SSBL file on the correct partition.
159 in this example in partition 1 to 3
161 for basic boot mode : <SDCard dev> = /dev/mmcblk0
162 # dd if=u-boot-spl.stm32 of=/dev/mmcblk0p1
163 # dd if=u-boot-spl.stm32 of=/dev/mmcblk0p2
164 # dd if=u-boot.img of=/dev/mmcblk0p3
169 You can select the boot mode, on the board ed1 with the switch SW1
171 -----------------------------------
172 Boot Mode BOOT2 BOOT1 BOOT0
173 -----------------------------------
184 To boot from SDCard, select BootPinMode = 1 1 1 and reset.
186 Recovery is a boot from serial link (UART/USB) and it is used with
187 STM32CubeProgrammer tool to load executable in RAM and to update the flash
188 devices available on the board (NOR/NAND/eMMC/SDCARD).
189 The communication between HOST and board is based on
190 - for UARTs : the uart protocol used with all MCU STM32
191 - for USB : based on USB DFU 1.1 (without the ST extensions used on MCU STM32)