blob: cefc21f12ebb247c43b207f932fa7331f9ccb042 [file] [log] [blame]
Paul Beesley24dba2b2019-05-22 11:22:44 +01001STMicroelectronics STM32MP1
2===========================
Yann Gautierf0958d82018-07-16 14:49:34 +02003
4STM32MP1 is a microprocessor designed by STMicroelectronics
5based on a dual Arm Cortex-A7.
6It is an Armv7-A platform, using dedicated code from TF-A.
Yann Gautier774b4a82019-02-20 17:34:16 +01007The STM32MP1 chip also embeds a Cortex-M4.
8More information can be found on `STM32MP1 Series`_ page.
Yann Gautierf0958d82018-07-16 14:49:34 +02009
10
Yann Gautier63544012020-10-13 11:27:05 +020011STM32MP1 Versions
12-----------------
13The STM32MP1 series is available in 3 different lines which are pin-to-pin compatible:
14
15- STM32MP157: Dual Cortex-A7 cores, Cortex-M4 core @ 209 MHz, 3D GPU, DSI display interface and CAN FD
16- STM32MP153: Dual Cortex-A7 cores, Cortex-M4 core @ 209 MHz and CAN FD
17- STM32MP151: Single Cortex-A7 core, Cortex-M4 core @ 209 MHz
18
19Each line comes with a security option (cryptography & secure boot) and a Cortex-A frequency option:
20
21- A Basic + Cortex-A7 @ 650 MHz
22- C Secure Boot + HW Crypto + Cortex-A7 @ 650 MHz
23- D Basic + Cortex-A7 @ 800 MHz
24- F Secure Boot + HW Crypto + Cortex-A7 @ 800 MHz
25
26The `STM32MP1 part number codification`_ page gives more information about part numbers.
27
Yann Gautierf0958d82018-07-16 14:49:34 +020028Design
29------
30The STM32MP1 resets in the ROM code of the Cortex-A7.
31The primary boot core (core 0) executes the boot sequence while
32secondary boot core (core 1) is kept in a holding pen loop.
33The ROM code boot sequence loads the TF-A binary image from boot device
34to embedded SRAM.
35
36The TF-A image must be properly formatted with a STM32 header structure
37for ROM code is able to load this image.
38Tool stm32image can be used to prepend this header to the generated TF-A binary.
39
Yann Gautier07f81622021-02-12 18:04:23 +010040Boot with FIP
41~~~~~~~~~~~~~
42The use of FIP is now the recommended way to boot STM32MP1 platform.
43Only BL2 (with STM32 header) is loaded by ROM code. The other binaries are
44inside the FIP binary: BL32 (SP_min or OP-TEE), U-Boot and their respective
45device tree blobs.
46
47STM32IMAGE bootchain
48~~~~~~~~~~~~~~~~~~~~
49Although still supported, this way of booting is not recommended.
50Pease use FIP instead.
Yann Gautierf0958d82018-07-16 14:49:34 +020051At compilation step, BL2, BL32 and DTB file are linked together in a single
52binary. The stm32image tool is also generated and the header is added to TF-A
53binary. This binary file with header is named tf-a-stm32mp157c-ev1.stm32.
54It can then be copied in the first partition of the boot device.
55
56
57Memory mapping
58~~~~~~~~~~~~~~
59
60::
61
62 0x00000000 +-----------------+
63 | | ROM
64 0x00020000 +-----------------+
65 | |
66 | ... |
67 | |
68 0x2FFC0000 +-----------------+ \
Yann Gautier07f81622021-02-12 18:04:23 +010069 | BL32 DTB | |
70 0x2FFC5000 +-----------------+ |
Yann Gautierf0958d82018-07-16 14:49:34 +020071 | BL32 | |
Yann Gautier07f81622021-02-12 18:04:23 +010072 0x2FFDF000 +-----------------+ |
73 | ... | |
74 0x2FFE3000 +-----------------+ |
75 | BL2 DTB | | Embedded SRAM
76 0x2FFEA000 +-----------------+ |
77 | BL2 | |
78 0x2FFFF000 +-----------------+ |
79 | SCMI mailbox | |
Yann Gautierf0958d82018-07-16 14:49:34 +020080 0x30000000 +-----------------+ /
81 | |
82 | ... |
83 | |
84 0x40000000 +-----------------+
85 | |
86 | | Devices
87 | |
88 0xC0000000 +-----------------+ \
89 | | |
90 0xC0100000 +-----------------+ |
91 | BL33 | | Non-secure RAM (DDR)
92 | ... | |
93 | | |
94 0xFFFFFFFF +-----------------+ /
95
96
97Boot sequence
98~~~~~~~~~~~~~
99
100ROM code -> BL2 (compiled with BL2_AT_EL3) -> BL32 (SP_min) -> BL33 (U-Boot)
101
Yann Gautier1989a192019-04-19 09:41:01 +0200102or if Op-TEE is used:
103
104ROM code -> BL2 (compiled with BL2_AT_EL3) -> OP-TEE -> BL33 (U-Boot)
105
Yann Gautierf0958d82018-07-16 14:49:34 +0200106
107Build Instructions
108------------------
Lionel Debieveac7764b2019-10-17 15:12:13 +0200109Boot media(s) supported by BL2 must be specified in the build command.
110Available storage medias are:
Yann Gautierf1127922021-02-15 17:13:23 +0100111
Lionel Debieveac7764b2019-10-17 15:12:13 +0200112- ``STM32MP_SDMMC``
113- ``STM32MP_EMMC``
114- ``STM32MP_RAW_NAND``
115- ``STM32MP_SPI_NAND``
116- ``STM32MP_SPI_NOR``
Yann Gautierf0958d82018-07-16 14:49:34 +0200117
Yann Gautier975cf6f2022-03-03 18:22:46 +0100118Serial boot devices:
119
120- ``STM32MP_UART_PROGRAMMER``
121- ``STM32MP_USB_PROGRAMMER``
122
123
124Other configuration flags:
125
126- | ``DTB_FILE_NAME``: to precise board device-tree blob to be used.
127 | Default: stm32mp157c-ev1.dtb
128- | ``STM32MP_EARLY_CONSOLE``: to enable early traces before clock driver is setup.
129 | Default: 0 (disabled)
Yann Gautier99887cb2022-03-02 14:31:55 +0100130- | ``STM32MP_UART_BAUDRATE``: to select UART baud rate.
131 | Default: 115200
Yann Gautier975cf6f2022-03-03 18:22:46 +0100132- | ``STM32_TF_VERSION``: to manage BL2 monotonic counter.
133 | Default: 0
134
135
Yann Gautier07f81622021-02-12 18:04:23 +0100136Boot with FIP
137~~~~~~~~~~~~~
138You need to build BL2, BL32 (SP_min or OP-TEE) and BL33 (U-Boot) before building FIP binary.
139
140U-Boot
141______
Yann Gautierf0958d82018-07-16 14:49:34 +0200142
143.. code:: bash
144
Yann Gautier1ebb9152018-10-24 10:50:12 +0200145 cd <u-boot_directory>
Yann Gautier196fa6c2019-05-20 11:50:18 +0200146 make stm32mp15_trusted_defconfig
Yann Gautier774b4a82019-02-20 17:34:16 +0100147 make DEVICE_TREE=stm32mp157c-ev1 all
Yann Gautierf0958d82018-07-16 14:49:34 +0200148
Yann Gautier07f81622021-02-12 18:04:23 +0100149OP-TEE (optional)
150_________________
Yann Gautierf1127922021-02-15 17:13:23 +0100151
Yann Gautier1989a192019-04-19 09:41:01 +0200152.. code:: bash
153
Lionel Debieveac7764b2019-10-17 15:12:13 +0200154 cd <optee_directory>
Yann Gautier07f81622021-02-12 18:04:23 +0100155 make CROSS_COMPILE=arm-linux-gnueabihf- ARCH=arm PLATFORM=stm32mp1 \
156 CFG_EMBED_DTB_SOURCE_FILE=stm32mp157c-ev1.dts
157
158
159TF-A BL32 (SP_min)
160__________________
161If you choose not to use OP-TEE, you can use TF-A SP_min.
162To build TF-A BL32, and its device tree file:
163
164.. code:: bash
165
166 make CROSS_COMPILE=arm-none-eabi- PLAT=stm32mp1 ARCH=aarch32 ARM_ARCH_MAJOR=7 \
167 AARCH32_SP=sp_min DTB_FILE_NAME=stm32mp157c-ev1.dtb bl32 dtbs
168
169TF-A BL2
170________
171To build TF-A BL2 with its STM32 header for SD-card boot:
172
173.. code:: bash
174
175 make CROSS_COMPILE=arm-none-eabi- PLAT=stm32mp1 ARCH=aarch32 ARM_ARCH_MAJOR=7 \
176 DTB_FILE_NAME=stm32mp157c-ev1.dtb STM32MP_SDMMC=1
177
178For other boot devices, you have to replace STM32MP_SDMMC in the previous command
179with the desired device flag.
180
181This BL2 is independent of the BL32 used (SP_min or OP-TEE)
182
183
184FIP
185___
186With BL32 SP_min:
187
188.. code:: bash
189
190 make CROSS_COMPILE=arm-none-eabi- PLAT=stm32mp1 ARCH=aarch32 ARM_ARCH_MAJOR=7 \
191 AARCH32_SP=sp_min \
192 DTB_FILE_NAME=stm32mp157c-ev1.dtb \
193 BL33=<u-boot_directory>/u-boot-nodtb.bin \
194 BL33_CFG=<u-boot_directory>/u-boot.dtb \
195 fip
196
197With OP-TEE:
198
199.. code:: bash
200
201 make CROSS_COMPILE=arm-none-eabi- PLAT=stm32mp1 ARCH=aarch32 ARM_ARCH_MAJOR=7 \
Yann Gautier50088852021-10-21 14:57:52 +0200202 AARCH32_SP=optee \
Yann Gautier07f81622021-02-12 18:04:23 +0100203 DTB_FILE_NAME=stm32mp157c-ev1.dtb \
204 BL33=<u-boot_directory>/u-boot-nodtb.bin \
205 BL33_CFG=<u-boot_directory>/u-boot.dtb \
206 BL32=<optee_directory>/tee-header_v2.bin \
207 BL32_EXTRA1=<optee_directory>/tee-pager_v2.bin
208 BL32_EXTRA2=<optee_directory>/tee-pageable_v2.bin
209 fip
210
211
212STM32IMAGE bootchain
213~~~~~~~~~~~~~~~~~~~~
214You need to add the following flag to the make command:
215``STM32MP_USE_STM32IMAGE=1``
216
217To build with SP_min and support for SD-card boot:
218
219.. code:: bash
220
221 make CROSS_COMPILE=arm-linux-gnueabihf- PLAT=stm32mp1 ARCH=aarch32 ARM_ARCH_MAJOR=7 \
222 AARCH32_SP=sp_min STM32MP_SDMMC=1 DTB_FILE_NAME=stm32mp157c-ev1.dtb \
223 STM32MP_USE_STM32IMAGE=1
224
225 cd <u-boot_directory>
226 make stm32mp15_trusted_defconfig
227 make DEVICE_TREE=stm32mp157c-ev1 all
228
229To build TF-A with OP-TEE support for SD-card boot:
230
231.. code:: bash
232
233 make CROSS_COMPILE=arm-linux-gnueabihf- PLAT=stm32mp1 ARCH=aarch32 ARM_ARCH_MAJOR=7 \
234 AARCH32_SP=optee STM32MP_SDMMC=1 DTB_FILE_NAME=stm32mp157c-ev1.dtb \
235 STM32MP_USE_STM32IMAGE=1
236
237 cd <optee_directory>
238 make CROSS_COMPILE=arm-linux-gnueabihf- ARCH=arm PLATFORM=stm32mp1 \
239 CFG_EMBED_DTB_SOURCE_FILE=stm32mp157c-ev1.dts
240
Lionel Debieveac7764b2019-10-17 15:12:13 +0200241 cd <u-boot_directory>
Jan Kiszka219e45c2020-10-02 10:07:00 +0200242 make stm32mp15_trusted_defconfig
Lionel Debieveac7764b2019-10-17 15:12:13 +0200243 make DEVICE_TREE=stm32mp157c-ev1 all
244
Yann Gautier1989a192019-04-19 09:41:01 +0200245
Yann Gautierf0958d82018-07-16 14:49:34 +0200246The following build options are supported:
247
248- ``ENABLE_STACK_PROTECTOR``: To enable the stack protection.
Yann Gautier1ebb9152018-10-24 10:50:12 +0200249
250
251Populate SD-card
252----------------
253
Yann Gautier07f81622021-02-12 18:04:23 +0100254Boot with FIP
255~~~~~~~~~~~~~
256The SD-card has to be formatted with GPT.
257It should contain at least those partitions:
258
259- fsbl: to copy the tf-a-stm32mp157c-ev1.stm32 binary (BL2)
260- fip: which contains the FIP binary
261
262Usually, two copies of fsbl are used (fsbl1 and fsbl2) instead of one partition fsbl.
263
264STM32IMAGE bootchain
265~~~~~~~~~~~~~~~~~~~~
266The SD-card has to be formatted with GPT.
Yann Gautier1ebb9152018-10-24 10:50:12 +0200267It should contain at least those partitions:
268
269- fsbl: to copy the tf-a-stm32mp157c-ev1.stm32 binary
270- ssbl: to copy the u-boot.stm32 binary
271
272Usually, two copies of fsbl are used (fsbl1 and fsbl2) instead of one partition fsbl.
Yann Gautier774b4a82019-02-20 17:34:16 +0100273
Jan Kiszka219e45c2020-10-02 10:07:00 +0200274OP-TEE artifacts go into separate partitions as follows:
275
276- teeh: tee-header_v2.stm32
277- teed: tee-pageable_v2.stm32
278- teex: tee-pager_v2.stm32
279
Yann Gautier774b4a82019-02-20 17:34:16 +0100280
281.. _STM32MP1 Series: https://www.st.com/en/microcontrollers-microprocessors/stm32mp1-series.html
Yann Gautier63544012020-10-13 11:27:05 +0200282.. _STM32MP1 part number codification: https://wiki.st.com/stm32mpu/wiki/STM32MP15_microprocessor#Part_number_codification