Paul Beesley | f3653a6 | 2019-05-22 11:22:44 +0100 | [diff] [blame] | 1 | STMicroelectronics STM32MP1 |
| 2 | =========================== |
Yann Gautier | 7511539 | 2018-07-16 14:49:34 +0200 | [diff] [blame] | 3 | |
| 4 | STM32MP1 is a microprocessor designed by STMicroelectronics |
Sebastien Pasdeloup | 94389ef | 2020-12-18 11:50:40 +0100 | [diff] [blame] | 5 | based on Arm Cortex-A7. |
Yann Gautier | 7511539 | 2018-07-16 14:49:34 +0200 | [diff] [blame] | 6 | It is an Armv7-A platform, using dedicated code from TF-A. |
Yann Gautier | 969be34 | 2019-02-20 17:34:16 +0100 | [diff] [blame] | 7 | More information can be found on `STM32MP1 Series`_ page. |
Yann Gautier | 7511539 | 2018-07-16 14:49:34 +0200 | [diff] [blame] | 8 | |
| 9 | |
Yann Gautier | 26c1067 | 2020-10-13 11:27:05 +0200 | [diff] [blame] | 10 | STM32MP1 Versions |
| 11 | ----------------- |
Sebastien Pasdeloup | 94389ef | 2020-12-18 11:50:40 +0100 | [diff] [blame] | 12 | |
| 13 | There are 2 variants for STM32MP1: STM32MP13 and STM32MP15 |
| 14 | |
| 15 | STM32MP13 Versions |
| 16 | ~~~~~~~~~~~~~~~~~~ |
| 17 | The STM32MP13 series is available in 3 different lines which are pin-to-pin compatible: |
| 18 | |
| 19 | - STM32MP131: Single Cortex-A7 core |
| 20 | - STM32MP133: STM32MP131 + 2*CAN, ETH2(GMAC), ADC1 |
| 21 | - STM32MP135: STM32MP133 + DCMIPP, LTDC |
| 22 | |
| 23 | Each line comes with a security option (cryptography & secure boot) and a Cortex-A frequency option: |
| 24 | |
| 25 | - A Cortex-A7 @ 650 MHz |
| 26 | - C Secure Boot + HW Crypto + Cortex-A7 @ 650 MHz |
| 27 | - D Cortex-A7 @ 900 MHz |
| 28 | - F Secure Boot + HW Crypto + Cortex-A7 @ 900 MHz |
| 29 | |
| 30 | STM32MP15 Versions |
| 31 | ~~~~~~~~~~~~~~~~~~ |
| 32 | The STM32MP15 series is available in 3 different lines which are pin-to-pin compatible: |
Yann Gautier | 26c1067 | 2020-10-13 11:27:05 +0200 | [diff] [blame] | 33 | |
| 34 | - STM32MP157: Dual Cortex-A7 cores, Cortex-M4 core @ 209 MHz, 3D GPU, DSI display interface and CAN FD |
| 35 | - STM32MP153: Dual Cortex-A7 cores, Cortex-M4 core @ 209 MHz and CAN FD |
| 36 | - STM32MP151: Single Cortex-A7 core, Cortex-M4 core @ 209 MHz |
| 37 | |
| 38 | Each line comes with a security option (cryptography & secure boot) and a Cortex-A frequency option: |
| 39 | |
| 40 | - A Basic + Cortex-A7 @ 650 MHz |
| 41 | - C Secure Boot + HW Crypto + Cortex-A7 @ 650 MHz |
| 42 | - D Basic + Cortex-A7 @ 800 MHz |
| 43 | - F Secure Boot + HW Crypto + Cortex-A7 @ 800 MHz |
| 44 | |
| 45 | The `STM32MP1 part number codification`_ page gives more information about part numbers. |
| 46 | |
Yann Gautier | 7511539 | 2018-07-16 14:49:34 +0200 | [diff] [blame] | 47 | Design |
| 48 | ------ |
| 49 | The STM32MP1 resets in the ROM code of the Cortex-A7. |
| 50 | The primary boot core (core 0) executes the boot sequence while |
| 51 | secondary boot core (core 1) is kept in a holding pen loop. |
| 52 | The ROM code boot sequence loads the TF-A binary image from boot device |
| 53 | to embedded SRAM. |
| 54 | |
| 55 | The TF-A image must be properly formatted with a STM32 header structure |
| 56 | for ROM code is able to load this image. |
| 57 | Tool stm32image can be used to prepend this header to the generated TF-A binary. |
| 58 | |
Yann Gautier | 9730da0 | 2021-02-12 18:04:23 +0100 | [diff] [blame] | 59 | Boot with FIP |
| 60 | ~~~~~~~~~~~~~ |
| 61 | The use of FIP is now the recommended way to boot STM32MP1 platform. |
| 62 | Only BL2 (with STM32 header) is loaded by ROM code. The other binaries are |
| 63 | inside the FIP binary: BL32 (SP_min or OP-TEE), U-Boot and their respective |
| 64 | device tree blobs. |
| 65 | |
Yann Gautier | 7511539 | 2018-07-16 14:49:34 +0200 | [diff] [blame] | 66 | |
| 67 | Memory mapping |
| 68 | ~~~~~~~~~~~~~~ |
| 69 | |
| 70 | :: |
| 71 | |
| 72 | 0x00000000 +-----------------+ |
| 73 | | | ROM |
| 74 | 0x00020000 +-----------------+ |
| 75 | | | |
| 76 | | ... | |
| 77 | | | |
| 78 | 0x2FFC0000 +-----------------+ \ |
Yann Gautier | 9730da0 | 2021-02-12 18:04:23 +0100 | [diff] [blame] | 79 | | BL32 DTB | | |
| 80 | 0x2FFC5000 +-----------------+ | |
| 81 | | BL32 | | |
| 82 | 0x2FFDF000 +-----------------+ | |
Yann Gautier | 7511539 | 2018-07-16 14:49:34 +0200 | [diff] [blame] | 83 | | ... | | |
Yann Gautier | 9730da0 | 2021-02-12 18:04:23 +0100 | [diff] [blame] | 84 | 0x2FFE3000 +-----------------+ | |
| 85 | | BL2 DTB | | Embedded SRAM |
| 86 | 0x2FFEA000 +-----------------+ | |
Yann Gautier | 7511539 | 2018-07-16 14:49:34 +0200 | [diff] [blame] | 87 | | BL2 | | |
Yann Gautier | 9730da0 | 2021-02-12 18:04:23 +0100 | [diff] [blame] | 88 | 0x2FFFF000 +-----------------+ | |
| 89 | | SCMI mailbox | | |
Yann Gautier | 7511539 | 2018-07-16 14:49:34 +0200 | [diff] [blame] | 90 | 0x30000000 +-----------------+ / |
| 91 | | | |
| 92 | | ... | |
| 93 | | | |
| 94 | 0x40000000 +-----------------+ |
| 95 | | | |
| 96 | | | Devices |
| 97 | | | |
| 98 | 0xC0000000 +-----------------+ \ |
| 99 | | | | |
| 100 | 0xC0100000 +-----------------+ | |
| 101 | | BL33 | | Non-secure RAM (DDR) |
| 102 | | ... | | |
| 103 | | | | |
| 104 | 0xFFFFFFFF +-----------------+ / |
| 105 | |
| 106 | |
| 107 | Boot sequence |
| 108 | ~~~~~~~~~~~~~ |
| 109 | |
| 110 | ROM code -> BL2 (compiled with BL2_AT_EL3) -> BL32 (SP_min) -> BL33 (U-Boot) |
| 111 | |
Yann Gautier | b3386f7 | 2019-04-19 09:41:01 +0200 | [diff] [blame] | 112 | or if Op-TEE is used: |
| 113 | |
| 114 | ROM code -> BL2 (compiled with BL2_AT_EL3) -> OP-TEE -> BL33 (U-Boot) |
| 115 | |
Yann Gautier | 7511539 | 2018-07-16 14:49:34 +0200 | [diff] [blame] | 116 | |
| 117 | Build Instructions |
| 118 | ------------------ |
Lionel Debieve | 4066c90 | 2019-10-17 15:12:13 +0200 | [diff] [blame] | 119 | Boot media(s) supported by BL2 must be specified in the build command. |
| 120 | Available storage medias are: |
Yann Gautier | 2392913 | 2021-02-15 17:13:23 +0100 | [diff] [blame] | 121 | |
Lionel Debieve | 4066c90 | 2019-10-17 15:12:13 +0200 | [diff] [blame] | 122 | - ``STM32MP_SDMMC`` |
| 123 | - ``STM32MP_EMMC`` |
| 124 | - ``STM32MP_RAW_NAND`` |
| 125 | - ``STM32MP_SPI_NAND`` |
| 126 | - ``STM32MP_SPI_NOR`` |
Yann Gautier | 7511539 | 2018-07-16 14:49:34 +0200 | [diff] [blame] | 127 | |
Yann Gautier | 377fc85 | 2022-03-03 18:22:46 +0100 | [diff] [blame] | 128 | Serial boot devices: |
| 129 | |
| 130 | - ``STM32MP_UART_PROGRAMMER`` |
| 131 | - ``STM32MP_USB_PROGRAMMER`` |
| 132 | |
| 133 | |
| 134 | Other configuration flags: |
| 135 | |
| 136 | - | ``DTB_FILE_NAME``: to precise board device-tree blob to be used. |
| 137 | | Default: stm32mp157c-ev1.dtb |
Patrick Delaunay | 4c66e0a | 2022-03-15 11:20:56 +0100 | [diff] [blame] | 138 | - | ``DWL_BUFFER_BASE``: the 'serial boot' load address of FIP, |
| 139 | | default location (end of the first 128MB) is used when absent |
Yann Gautier | 377fc85 | 2022-03-03 18:22:46 +0100 | [diff] [blame] | 140 | - | ``STM32MP_EARLY_CONSOLE``: to enable early traces before clock driver is setup. |
| 141 | | Default: 0 (disabled) |
Yann Gautier | 312dde0 | 2022-09-13 13:53:41 +0200 | [diff] [blame] | 142 | - | ``STM32MP_RECONFIGURE_CONSOLE``: to re-configure crash console (especially after BL2). |
| 143 | | Default: 0 (disabled) |
Yann Gautier | b02dd49 | 2022-03-02 14:31:55 +0100 | [diff] [blame] | 144 | - | ``STM32MP_UART_BAUDRATE``: to select UART baud rate. |
| 145 | | Default: 115200 |
Yann Gautier | 377fc85 | 2022-03-03 18:22:46 +0100 | [diff] [blame] | 146 | - | ``STM32_TF_VERSION``: to manage BL2 monotonic counter. |
| 147 | | Default: 0 |
Sebastien Pasdeloup | 94389ef | 2020-12-18 11:50:40 +0100 | [diff] [blame] | 148 | - | ``STM32MP13``: to select STM32MP13 variant configuration. |
| 149 | | Default: 0 |
| 150 | - | ``STM32MP15``: to select STM32MP15 variant configuration. |
| 151 | | Default: 1 |
Yann Gautier | 377fc85 | 2022-03-03 18:22:46 +0100 | [diff] [blame] | 152 | |
| 153 | |
Yann Gautier | 9730da0 | 2021-02-12 18:04:23 +0100 | [diff] [blame] | 154 | Boot with FIP |
| 155 | ~~~~~~~~~~~~~ |
| 156 | You need to build BL2, BL32 (SP_min or OP-TEE) and BL33 (U-Boot) before building FIP binary. |
| 157 | |
| 158 | U-Boot |
| 159 | ______ |
Yann Gautier | 7511539 | 2018-07-16 14:49:34 +0200 | [diff] [blame] | 160 | |
| 161 | .. code:: bash |
| 162 | |
Yann Gautier | b4ddd30 | 2018-10-24 10:50:12 +0200 | [diff] [blame] | 163 | cd <u-boot_directory> |
Yann Gautier | b7168ee | 2019-05-20 11:50:18 +0200 | [diff] [blame] | 164 | make stm32mp15_trusted_defconfig |
Yann Gautier | 969be34 | 2019-02-20 17:34:16 +0100 | [diff] [blame] | 165 | make DEVICE_TREE=stm32mp157c-ev1 all |
Yann Gautier | 7511539 | 2018-07-16 14:49:34 +0200 | [diff] [blame] | 166 | |
Yann Gautier | 9730da0 | 2021-02-12 18:04:23 +0100 | [diff] [blame] | 167 | OP-TEE (optional) |
| 168 | _________________ |
Yann Gautier | 2392913 | 2021-02-15 17:13:23 +0100 | [diff] [blame] | 169 | |
Yann Gautier | b3386f7 | 2019-04-19 09:41:01 +0200 | [diff] [blame] | 170 | .. code:: bash |
| 171 | |
Lionel Debieve | 4066c90 | 2019-10-17 15:12:13 +0200 | [diff] [blame] | 172 | cd <optee_directory> |
Yann Gautier | 9730da0 | 2021-02-12 18:04:23 +0100 | [diff] [blame] | 173 | make CROSS_COMPILE=arm-linux-gnueabihf- ARCH=arm PLATFORM=stm32mp1 \ |
| 174 | CFG_EMBED_DTB_SOURCE_FILE=stm32mp157c-ev1.dts |
| 175 | |
| 176 | |
| 177 | TF-A BL32 (SP_min) |
| 178 | __________________ |
| 179 | If you choose not to use OP-TEE, you can use TF-A SP_min. |
| 180 | To build TF-A BL32, and its device tree file: |
| 181 | |
| 182 | .. code:: bash |
| 183 | |
| 184 | make CROSS_COMPILE=arm-none-eabi- PLAT=stm32mp1 ARCH=aarch32 ARM_ARCH_MAJOR=7 \ |
| 185 | AARCH32_SP=sp_min DTB_FILE_NAME=stm32mp157c-ev1.dtb bl32 dtbs |
| 186 | |
| 187 | TF-A BL2 |
| 188 | ________ |
| 189 | To build TF-A BL2 with its STM32 header for SD-card boot: |
| 190 | |
| 191 | .. code:: bash |
| 192 | |
| 193 | make CROSS_COMPILE=arm-none-eabi- PLAT=stm32mp1 ARCH=aarch32 ARM_ARCH_MAJOR=7 \ |
| 194 | DTB_FILE_NAME=stm32mp157c-ev1.dtb STM32MP_SDMMC=1 |
| 195 | |
| 196 | For other boot devices, you have to replace STM32MP_SDMMC in the previous command |
| 197 | with the desired device flag. |
| 198 | |
| 199 | This BL2 is independent of the BL32 used (SP_min or OP-TEE) |
| 200 | |
| 201 | |
| 202 | FIP |
| 203 | ___ |
| 204 | With BL32 SP_min: |
| 205 | |
| 206 | .. code:: bash |
| 207 | |
| 208 | make CROSS_COMPILE=arm-none-eabi- PLAT=stm32mp1 ARCH=aarch32 ARM_ARCH_MAJOR=7 \ |
| 209 | AARCH32_SP=sp_min \ |
| 210 | DTB_FILE_NAME=stm32mp157c-ev1.dtb \ |
| 211 | BL33=<u-boot_directory>/u-boot-nodtb.bin \ |
| 212 | BL33_CFG=<u-boot_directory>/u-boot.dtb \ |
| 213 | fip |
| 214 | |
| 215 | With OP-TEE: |
| 216 | |
| 217 | .. code:: bash |
| 218 | |
| 219 | make CROSS_COMPILE=arm-none-eabi- PLAT=stm32mp1 ARCH=aarch32 ARM_ARCH_MAJOR=7 \ |
Yann Gautier | 39b8219 | 2021-10-21 14:57:52 +0200 | [diff] [blame] | 220 | AARCH32_SP=optee \ |
Yann Gautier | 9730da0 | 2021-02-12 18:04:23 +0100 | [diff] [blame] | 221 | DTB_FILE_NAME=stm32mp157c-ev1.dtb \ |
| 222 | BL33=<u-boot_directory>/u-boot-nodtb.bin \ |
| 223 | BL33_CFG=<u-boot_directory>/u-boot.dtb \ |
| 224 | BL32=<optee_directory>/tee-header_v2.bin \ |
| 225 | BL32_EXTRA1=<optee_directory>/tee-pager_v2.bin |
| 226 | BL32_EXTRA2=<optee_directory>/tee-pageable_v2.bin |
| 227 | fip |
| 228 | |
Lionel Debieve | 045e7f7 | 2022-10-06 09:00:14 +0200 | [diff] [blame] | 229 | Trusted Boot Board |
| 230 | __________________ |
| 231 | |
| 232 | .. code:: shell |
| 233 | |
| 234 | tools/cert_create/cert_create -n --rot-key "build/stm32mp1/debug/rot_key.pem" \ |
| 235 | --tfw-nvctr 0 \ |
| 236 | --ntfw-nvctr 0 \ |
| 237 | --key-alg ecdsa --hash-alg sha256 \ |
| 238 | --trusted-key-cert build/stm32mp1/cert_images/trusted-key-cert.key-crt \ |
| 239 | --tos-fw <optee_directory>/tee-header_v2.bin \ |
| 240 | --tos-fw-extra1 <optee_directory>/tee-pager_v2.bin \ |
| 241 | --tos-fw-extra2 <optee_directory>/tee-pageable_v2.bin \ |
| 242 | --tos-fw-cert build/stm32mp1/cert_images/tee-header_v2.bin.crt \ |
| 243 | --tos-fw-key-cert build/stm32mp1/cert_images/tee-header_v2.bin.key-crt \ |
| 244 | --nt-fw <u-boot_directory>/u-boot-nodtb.bin \ |
| 245 | --nt-fw-cert build/stm32mp1/cert_images/u-boot.bin.crt \ |
| 246 | --nt-fw-key-cert build/stm32mp1/cert_images/u-boot.bin.key-crt \ |
| 247 | --hw-config <u-boot_directory>/u-boot.dtb \ |
| 248 | --fw-config build/stm32mp1/debug/fdts/fw-config.dtb \ |
| 249 | --stm32mp-cfg-cert build/stm32mp1/cert_images/stm32mp_cfg_cert.crt |
| 250 | |
| 251 | tools/fiptool/fiptool create --tos-fw <optee_directory>/tee-header_v2.bin \ |
| 252 | --tos-fw-extra1 <optee_directory>/tee-pager_v2.bin \ |
| 253 | --tos-fw-extra2 <optee_directory>/tee-pageable_v2.bin \ |
| 254 | --nt-fw <u-boot_directory>/u-boot-nodtb.bin \ |
| 255 | --hw-config <u-boot_directory>/u-boot.dtb \ |
| 256 | --fw-config build/stm32mp1/debug/fdts/fw-config.dtb \ |
| 257 | --tos-fw-cert build/stm32mp1/cert_images/tee-header_v2.bin.crt \ |
| 258 | --tos-fw-key-cert build/stm32mp1/cert_images/tee-header_v2.bin.key-crt \ |
| 259 | --nt-fw-cert build/stm32mp1/cert_images/u-boot.bin.crt \ |
| 260 | --nt-fw-key-cert build/stm32mp1/cert_images/u-boot.bin.key-crt \ |
| 261 | --stm32mp-cfg-cert build/stm32mp1/cert_images/stm32mp_cfg_cert.crt stm32mp1.fip |
| 262 | |
Yann Gautier | 9730da0 | 2021-02-12 18:04:23 +0100 | [diff] [blame] | 263 | |
Yann Gautier | b4ddd30 | 2018-10-24 10:50:12 +0200 | [diff] [blame] | 264 | |
| 265 | Populate SD-card |
| 266 | ---------------- |
| 267 | |
Yann Gautier | 9730da0 | 2021-02-12 18:04:23 +0100 | [diff] [blame] | 268 | Boot with FIP |
| 269 | ~~~~~~~~~~~~~ |
| 270 | The SD-card has to be formatted with GPT. |
| 271 | It should contain at least those partitions: |
| 272 | |
| 273 | - fsbl: to copy the tf-a-stm32mp157c-ev1.stm32 binary (BL2) |
| 274 | - fip: which contains the FIP binary |
| 275 | |
| 276 | Usually, two copies of fsbl are used (fsbl1 and fsbl2) instead of one partition fsbl. |
| 277 | |
Yann Gautier | 969be34 | 2019-02-20 17:34:16 +0100 | [diff] [blame] | 278 | |
| 279 | .. _STM32MP1 Series: https://www.st.com/en/microcontrollers-microprocessors/stm32mp1-series.html |
Yann Gautier | 26c1067 | 2020-10-13 11:27:05 +0200 | [diff] [blame] | 280 | .. _STM32MP1 part number codification: https://wiki.st.com/stm32mpu/wiki/STM32MP15_microprocessor#Part_number_codification |