xref: /openbmc/u-boot/board/st/stm32mp1/README (revision f8598d9815c7f89aed28e3f880b489260bd50a49)
1*f8598d98SPatrick Delaunay#
2*f8598d98SPatrick Delaunay# Copyright (C) 2018 STMicroelectronics - All Rights Reserved
3*f8598d98SPatrick Delaunay#
4*f8598d98SPatrick Delaunay# SPDX-License-Identifier:	GPL-2.0+	BSD-3-Clause
5*f8598d98SPatrick Delaunay#
6*f8598d98SPatrick Delaunay
7*f8598d98SPatrick DelaunayU-Boot on STMicroelectronics STM32MP1
8*f8598d98SPatrick Delaunay======================================
9*f8598d98SPatrick Delaunay
10*f8598d98SPatrick Delaunay1. Summary
11*f8598d98SPatrick Delaunay==========
12*f8598d98SPatrick DelaunayThis is a quick instruction for setup stm32mp1 boards.
13*f8598d98SPatrick Delaunay
14*f8598d98SPatrick Delaunay2. Supported devices
15*f8598d98SPatrick Delaunay====================
16*f8598d98SPatrick DelaunayU-Boot supports one STMP32MP1 SoCs: STM32MP157
17*f8598d98SPatrick Delaunay
18*f8598d98SPatrick DelaunayThe STM32MP157 is a Cortex-A MPU aimed at various applications.
19*f8598d98SPatrick DelaunayIt features:
20*f8598d98SPatrick Delaunay- Dual core Cortex-A7 application core
21*f8598d98SPatrick Delaunay- 2D/3D image composition with GPU
22*f8598d98SPatrick Delaunay- Standard memories interface support
23*f8598d98SPatrick Delaunay- Standard connectivity, widely inherited from the STM32 MCU family
24*f8598d98SPatrick Delaunay- Comprehensive security support
25*f8598d98SPatrick Delaunay
26*f8598d98SPatrick DelaunayEverything is supported in Linux but U-Boot is limited to:
27*f8598d98SPatrick Delaunay1. UART
28*f8598d98SPatrick Delaunay2. SDCard/MMC controller (SDMMC)
29*f8598d98SPatrick Delaunay
30*f8598d98SPatrick DelaunayAnd the necessary drivers
31*f8598d98SPatrick Delaunay1. I2C
32*f8598d98SPatrick Delaunay2. STPMU1
33*f8598d98SPatrick Delaunay3. Clock, Reset
34*f8598d98SPatrick Delaunay
35*f8598d98SPatrick DelaunayCurrently the following boards are supported:
36*f8598d98SPatrick Delaunay+ stm32mp157c-ed1
37*f8598d98SPatrick Delaunay
38*f8598d98SPatrick Delaunay3. Boot Sequences
39*f8598d98SPatrick Delaunay=================
40*f8598d98SPatrick Delaunay
41*f8598d98SPatrick DelaunayBootRom => FSBL in SYSRAM => SSBL in DDR => OS (Linux Kernel)
42*f8598d98SPatrick Delaunay
43*f8598d98SPatrick Delaunaywith FSBL = First Stage Bootloader
44*f8598d98SPatrick Delaunay     SSBL = Second Stage Bootloader
45*f8598d98SPatrick Delaunay
46*f8598d98SPatrick DelaunayOne boot configuration is supported:
47*f8598d98SPatrick Delaunay
48*f8598d98SPatrick Delaunay   The "Basic" boot chain (defconfig_file : stm32mp15_basic_defconfig)
49*f8598d98SPatrick Delaunay   BootRom => FSBL = U-Boot SPL => SSBL = U-Boot
50*f8598d98SPatrick Delaunay   SPL has limited security initialisation
51*f8598d98SPatrick Delaunay   U-Boot is running in secure mode and provide a secure monitor to the kernel
52*f8598d98SPatrick Delaunay   with only PSCI support (Power State Coordination Interface defined by ARM)
53*f8598d98SPatrick Delaunay
54*f8598d98SPatrick DelaunayAll the STM32MP1 board supported by U-Boot use the same generic board
55*f8598d98SPatrick Delaunaystm32mp1 which support all the bootable devices.
56*f8598d98SPatrick Delaunay
57*f8598d98SPatrick DelaunayEach board is configurated only with the associated device tree.
58*f8598d98SPatrick Delaunay
59*f8598d98SPatrick Delaunay4. Device Tree Selection
60*f8598d98SPatrick Delaunay========================
61*f8598d98SPatrick Delaunay
62*f8598d98SPatrick DelaunayYou need to select the appropriate device tree for your board,
63*f8598d98SPatrick Delaunaythe supported device trees for stm32mp157 are:
64*f8598d98SPatrick Delaunay
65*f8598d98SPatrick Delaunay+ ed1: daughter board with pmic stpmu1
66*f8598d98SPatrick Delaunay  dts: stm32mp157c-ed1
67*f8598d98SPatrick Delaunay
68*f8598d98SPatrick Delaunay5. Build Procedure
69*f8598d98SPatrick Delaunay==================
70*f8598d98SPatrick Delaunay
71*f8598d98SPatrick Delaunay1. Install required tools for U-Boot
72*f8598d98SPatrick Delaunay
73*f8598d98SPatrick Delaunay   + install package needed in U-Boot makefile
74*f8598d98SPatrick Delaunay     (libssl-dev, swig, libpython-dev...)
75*f8598d98SPatrick Delaunay   + install ARMv7 toolchain for 32bit Cortex-A (from Linaro,
76*f8598d98SPatrick Delaunay     from SDK for STM32MP1, or any crosstoolchains from your distribution)
77*f8598d98SPatrick Delaunay
78*f8598d98SPatrick Delaunay2. Set the cross compiler:
79*f8598d98SPatrick Delaunay
80*f8598d98SPatrick Delaunay	# export CROSS_COMPILE=/path/to/toolchain/arm-linux-gnueabi-
81*f8598d98SPatrick Delaunay	(you can use any gcc cross compiler compatible with U-Boot)
82*f8598d98SPatrick Delaunay
83*f8598d98SPatrick Delaunay3. Select the output directory (optional)
84*f8598d98SPatrick Delaunay
85*f8598d98SPatrick Delaunay	# export KBUILD_OUTPUT=/path/to/output
86*f8598d98SPatrick Delaunay
87*f8598d98SPatrick Delaunay	for example: use one output directory for each configuration
88*f8598d98SPatrick Delaunay	# export KBUILD_OUTPUT=stm32mp15_basic
89*f8598d98SPatrick Delaunay
90*f8598d98SPatrick Delaunay4. Configure the U-Boot:
91*f8598d98SPatrick Delaunay
92*f8598d98SPatrick Delaunay	# make <defconfig_file>
93*f8598d98SPatrick Delaunay
94*f8598d98SPatrick Delaunay	- For basic boot mode: "stm32mp15_basic_defconfig"
95*f8598d98SPatrick Delaunay
96*f8598d98SPatrick Delaunay5. Configure the device-tree and build the U-Boot image:
97*f8598d98SPatrick Delaunay
98*f8598d98SPatrick Delaunay	# make DEVICE_TREE=<name> all
99*f8598d98SPatrick Delaunay
100*f8598d98SPatrick Delaunay
101*f8598d98SPatrick Delaunay  example:
102*f8598d98SPatrick Delaunay     basic boot on ed1
103*f8598d98SPatrick Delaunay	# export KBUILD_OUTPUT=stm32mp15_basic
104*f8598d98SPatrick Delaunay	# make stm32mp15_basic_defconfig
105*f8598d98SPatrick Delaunay	# make DEVICE_TREE=stm32mp157c-ed1 all
106*f8598d98SPatrick Delaunay
107*f8598d98SPatrick Delaunay6. Output files
108*f8598d98SPatrick Delaunay
109*f8598d98SPatrick Delaunay  BootRom and ATF expect binaries with STM32 image header
110*f8598d98SPatrick Delaunay  SPL expects file with U-Boot uImage header
111*f8598d98SPatrick Delaunay
112*f8598d98SPatrick Delaunay  So in the output directory (selected by KBUILD_OUTPUT),
113*f8598d98SPatrick Delaunay  you can found the needed files:
114*f8598d98SPatrick Delaunay
115*f8598d98SPatrick Delaunay   + FSBL = spl/u-boot-spl.stm32
116*f8598d98SPatrick Delaunay   + SSBL = u-boot.img
117*f8598d98SPatrick Delaunay
118*f8598d98SPatrick Delaunay6. Prepare an SDCard
119*f8598d98SPatrick Delaunay===================
120*f8598d98SPatrick Delaunay
121*f8598d98SPatrick DelaunayThe minimal requirements for STMP32MP1 boot up to U-Boot are:
122*f8598d98SPatrick Delaunay- GPT partitioning (with gdisk or with sgdisk)
123*f8598d98SPatrick Delaunay- 2 fsbl partitions, named fsbl1 and fsbl2, size at least 256KiB
124*f8598d98SPatrick Delaunay- one ssbl partition for U-Boot
125*f8598d98SPatrick Delaunay
126*f8598d98SPatrick DelaunayThen the minimal GPT partition is:
127*f8598d98SPatrick Delaunay   ----- ------- --------- -------------
128*f8598d98SPatrick Delaunay  | Num | Name  | Size    |  Content    |
129*f8598d98SPatrick Delaunay   ----- ------- -------- --------------
130*f8598d98SPatrick Delaunay  |  1  | fsbl1 | 256 KiB |  ATF or SPL |
131*f8598d98SPatrick Delaunay  |  2  | fsbl2 | 256 KiB |  ATF or SPL |
132*f8598d98SPatrick Delaunay  |  3  | ssbl  | enought |  U-Boot     |
133*f8598d98SPatrick Delaunay  |  *  |  -    |  -      |  Boot/Rootfs|
134*f8598d98SPatrick Delaunay   ----- ------- --------- -------------
135*f8598d98SPatrick Delaunay
136*f8598d98SPatrick Delaunay(*) add bootable partition for extlinux.conf
137*f8598d98SPatrick Delaunay    following Generic Distribution
138*f8598d98SPatrick Delaunay    (doc/README.distro for use)
139*f8598d98SPatrick Delaunay
140*f8598d98SPatrick Delaunay  according the used card reader select the block device
141*f8598d98SPatrick Delaunay  (/dev/sdx or /dev/mmcblk0)
142*f8598d98SPatrick Delaunay  in the next example I use /dev/mmcblk0
143*f8598d98SPatrick Delaunay
144*f8598d98SPatrick Delaunayfor example: with gpt table with 128 entries
145*f8598d98SPatrick Delaunay
146*f8598d98SPatrick Delaunay  a) remove previous formatting
147*f8598d98SPatrick Delaunay	# sgdisk -o /dev/<SDCard dev>
148*f8598d98SPatrick Delaunay
149*f8598d98SPatrick Delaunay  b) create minimal image
150*f8598d98SPatrick Delaunay	# sgdisk	--resize-table=128 -a 1 \
151*f8598d98SPatrick Delaunay		-n 1:34:545		-c 1:fsbl1 \
152*f8598d98SPatrick Delaunay		-n 2:546:1057		-c 2:fsbl2 \
153*f8598d98SPatrick Delaunay		-n 3:1058:5153		-c 3:ssbl \
154*f8598d98SPatrick Delaunay		-p /dev/<SDCard dev>
155*f8598d98SPatrick Delaunay
156*f8598d98SPatrick Delaunay	you can add other partition for kernel (rootfs)
157*f8598d98SPatrick Delaunay
158*f8598d98SPatrick Delaunay  c) copy the FSBL (2 times) and SSBL file on the correct partition.
159*f8598d98SPatrick Delaunay     in this example in partition 1 to 3
160*f8598d98SPatrick Delaunay
161*f8598d98SPatrick Delaunay     for basic boot mode : <SDCard dev> = /dev/mmcblk0
162*f8598d98SPatrick Delaunay	# dd if=u-boot-spl.stm32 of=/dev/mmcblk0p1
163*f8598d98SPatrick Delaunay	# dd if=u-boot-spl.stm32 of=/dev/mmcblk0p2
164*f8598d98SPatrick Delaunay	# dd if=u-boot.img of=/dev/mmcblk0p3
165*f8598d98SPatrick Delaunay
166*f8598d98SPatrick Delaunay7. Switch Setting
167*f8598d98SPatrick Delaunay==================
168*f8598d98SPatrick Delaunay
169*f8598d98SPatrick DelaunayYou can select the boot mode, on the board ed1 with the switch SW1
170*f8598d98SPatrick Delaunay
171*f8598d98SPatrick Delaunay -----------------------------------
172*f8598d98SPatrick Delaunay  Boot Mode   BOOT2   BOOT1   BOOT0
173*f8598d98SPatrick Delaunay -----------------------------------
174*f8598d98SPatrick Delaunay  Reserved	0	0	0
175*f8598d98SPatrick Delaunay  NOR		0	0	1
176*f8598d98SPatrick Delaunay  SD-Card	1	1	1
177*f8598d98SPatrick Delaunay  SD-Card	1	0	1
178*f8598d98SPatrick Delaunay  eMMC		0	1	0
179*f8598d98SPatrick Delaunay  NAND		0	1	1
180*f8598d98SPatrick Delaunay  Recovery	1	1	0
181*f8598d98SPatrick Delaunay  Recovery	0	0	0
182*f8598d98SPatrick Delaunay
183*f8598d98SPatrick Delaunay
184*f8598d98SPatrick DelaunayTo boot from SDCard, select BootPinMode = 1 1 1 and reset.
185*f8598d98SPatrick Delaunay
186*f8598d98SPatrick DelaunayRecovery is a boot from serial link (UART/USB) and it is used with
187*f8598d98SPatrick DelaunaySTM32CubeProgrammer tool to load executable in RAM and to update the flash
188*f8598d98SPatrick Delaunaydevices available on the board (NOR/NAND/eMMC/SDCARD).
189*f8598d98SPatrick DelaunayThe communication between HOST and board is based on
190*f8598d98SPatrick Delaunay- for UARTs : the uart protocol used with all MCU STM32
191*f8598d98SPatrick Delaunay- for USB : based on USB DFU 1.1 (without the ST extensions used on MCU STM32)
192