Patrick Delaunay | 5f6fdcc | 2020-02-25 19:04:14 +0100 | [diff] [blame] | 1 | .. SPDX-License-Identifier: GPL-2.0+ OR BSD-3-Clause |
Patrice Chotard | 90e8278 | 2021-01-04 17:00:56 +0100 | [diff] [blame] | 2 | .. sectionauthor:: Patrick Delaunay <patrick.delaunay@foss.st.com> |
Patrick Delaunay | 5f6fdcc | 2020-02-25 19:04:14 +0100 | [diff] [blame] | 3 | |
Patrick Delaunay | a1d36ed | 2022-05-20 18:24:54 +0200 | [diff] [blame] | 4 | STM32MP1xx boards |
Patrick Delaunay | 5f6fdcc | 2020-02-25 19:04:14 +0100 | [diff] [blame] | 5 | ================= |
| 6 | |
Patrick Delaunay | a1d36ed | 2022-05-20 18:24:54 +0200 | [diff] [blame] | 7 | This is a quick instruction for setup STMicroelectronics STM32MP1xx boards. |
Patrick Delaunay | 5f6fdcc | 2020-02-25 19:04:14 +0100 | [diff] [blame] | 8 | |
Patrick Delaunay | a1d36ed | 2022-05-20 18:24:54 +0200 | [diff] [blame] | 9 | Further information can be found in STMicroelectronics STM32 WIKI_. |
Patrick Delaunay | 3e70d3c | 2021-07-26 11:21:37 +0200 | [diff] [blame] | 10 | |
Patrick Delaunay | 5f6fdcc | 2020-02-25 19:04:14 +0100 | [diff] [blame] | 11 | Supported devices |
| 12 | ----------------- |
| 13 | |
Patrick Delaunay | a1d36ed | 2022-05-20 18:24:54 +0200 | [diff] [blame] | 14 | U-Boot supports all the STMicroelectronics MPU with the associated boards |
Patrick Delaunay | 5f6fdcc | 2020-02-25 19:04:14 +0100 | [diff] [blame] | 15 | |
Patrick Delaunay | a1d36ed | 2022-05-20 18:24:54 +0200 | [diff] [blame] | 16 | - STMP32MP15x SoCs: |
Patrick Delaunay | 5f6fdcc | 2020-02-25 19:04:14 +0100 | [diff] [blame] | 17 | |
Patrick Delaunay | a1d36ed | 2022-05-20 18:24:54 +0200 | [diff] [blame] | 18 | - STM32MP157 |
| 19 | - STM32MP153 |
| 20 | - STM32MP151 |
Patrick Delaunay | 5f6fdcc | 2020-02-25 19:04:14 +0100 | [diff] [blame] | 21 | |
Patrick Delaunay | a1d36ed | 2022-05-20 18:24:54 +0200 | [diff] [blame] | 22 | - STMP32MP13x SoCs: |
Patrick Delaunay | 5f6fdcc | 2020-02-25 19:04:14 +0100 | [diff] [blame] | 23 | |
Patrick Delaunay | a1d36ed | 2022-05-20 18:24:54 +0200 | [diff] [blame] | 24 | - STM32MP135 |
| 25 | - STM32MP133 |
| 26 | - STM32MP131 |
Patrick Delaunay | db33b0e | 2020-02-26 11:26:43 +0100 | [diff] [blame] | 27 | |
Patrick Delaunay | a1d36ed | 2022-05-20 18:24:54 +0200 | [diff] [blame] | 28 | Everything is supported in Linux but U-Boot is limited to the boot device: |
Patrick Delaunay | 5f6fdcc | 2020-02-25 19:04:14 +0100 | [diff] [blame] | 29 | |
| 30 | 1. UART |
| 31 | 2. SD card/MMC controller (SDMMC) |
| 32 | 3. NAND controller (FMC) |
| 33 | 4. NOR controller (QSPI) |
| 34 | 5. USB controller (OTG DWC2) |
| 35 | 6. Ethernet controller |
| 36 | |
| 37 | And the necessary drivers |
| 38 | |
| 39 | 1. I2C |
| 40 | 2. STPMIC1 (PMIC and regulator) |
| 41 | 3. Clock, Reset, Sysreset |
Patrick Delaunay | a1d36ed | 2022-05-20 18:24:54 +0200 | [diff] [blame] | 42 | 4. Fuse (BSEC) |
| 43 | 5. OP-TEE |
| 44 | 6. ETH |
| 45 | 7. USB host |
| 46 | 8. WATCHDOG |
| 47 | 9. RNG |
| 48 | 10. RTC |
| 49 | |
| 50 | STM32MP15x |
| 51 | `````````` |
| 52 | |
| 53 | The STM32MP15x is a Cortex-A7 MPU aimed at various applications. |
| 54 | |
| 55 | It features: |
| 56 | |
| 57 | - Dual core Cortex-A7 application core (Single on STM32MP151) |
| 58 | - 2D/3D image composition with GPU (only on STM32MP157) |
| 59 | - Standard memories interface support |
| 60 | - Standard connectivity, widely inherited from the STM32 MCU family |
| 61 | - Comprehensive security support |
| 62 | - Cortex M4 coprocessor |
| 63 | |
| 64 | Each line comes with a security option (cryptography & secure boot) and |
| 65 | a Cortex-A frequency option: |
| 66 | |
| 67 | - A : Cortex-A7 @ 650 MHz |
| 68 | - C : Secure Boot + HW Crypto + Cortex-A7 @ 650 MHz |
| 69 | - D : Cortex-A7 @ 800 MHz |
| 70 | - F : Secure Boot + HW Crypto + Cortex-A7 @ 800 MHz |
Patrick Delaunay | 5f6fdcc | 2020-02-25 19:04:14 +0100 | [diff] [blame] | 71 | |
| 72 | Currently the following boards are supported: |
| 73 | |
Patrick Delaunay | 5f6fdcc | 2020-02-25 19:04:14 +0100 | [diff] [blame] | 74 | + stm32mp157a-dk1.dts |
| 75 | + stm32mp157c-dk2.dts |
| 76 | + stm32mp157c-ed1.dts |
| 77 | + stm32mp157c-ev1.dts |
Marek Vasut | 526c951 | 2020-03-31 19:51:36 +0200 | [diff] [blame] | 78 | + stm32mp15xx-dhcor-avenger96.dts |
Patrick Delaunay | 5f6fdcc | 2020-02-25 19:04:14 +0100 | [diff] [blame] | 79 | |
Patrick Delaunay | ddba40a | 2022-07-05 16:55:57 +0200 | [diff] [blame] | 80 | The SCMI variant of each board is supported by a specific "scmi" device tree: |
| 81 | + stm32mp157a-dk1-scmi.dts |
| 82 | + stm32mp157c-dk2-scmi.dts |
| 83 | + stm32mp157c-ed1-scmi.dts |
| 84 | + stm32mp157c-ev1-scmi.dts |
| 85 | |
| 86 | SCMI variant is used only with stm32mp15_defconfig, when the resources are |
| 87 | secured with RCC_TZCR.TZEN=1 in OP-TEE. The access to these reset and clock |
| 88 | resources are provided by OP-TEE and the associated SCMI services. |
| 89 | |
Patrick Delaunay | a1d36ed | 2022-05-20 18:24:54 +0200 | [diff] [blame] | 90 | STM32MP13x |
| 91 | `````````` |
| 92 | |
| 93 | The STM32MP13x is a single Cortex-A7 MPU aimed at various applications. |
| 94 | |
| 95 | Currently the following boards are supported: |
| 96 | |
| 97 | + stm32mp135f-dk.dts |
| 98 | |
| 99 | |
Patrick Delaunay | 5f6fdcc | 2020-02-25 19:04:14 +0100 | [diff] [blame] | 100 | Boot Sequences |
| 101 | -------------- |
| 102 | |
Patrick Delaunay | 3e70d3c | 2021-07-26 11:21:37 +0200 | [diff] [blame] | 103 | 2 boot configurations are supported with: |
Patrick Delaunay | 5f6fdcc | 2020-02-25 19:04:14 +0100 | [diff] [blame] | 104 | |
| 105 | +----------+------------------------+-------------------------+--------------+ |
| 106 | | **ROM** | **FSBL** | **SSBL** | **OS** | |
| 107 | + **code** +------------------------+-------------------------+--------------+ |
| 108 | | | First Stage Bootloader | Second Stage Bootloader | Linux Kernel | |
| 109 | + +------------------------+-------------------------+--------------+ |
| 110 | | | embedded RAM | DDR | |
| 111 | +----------+------------------------+-------------------------+--------------+ |
Patrick Delaunay | a1d36ed | 2022-05-20 18:24:54 +0200 | [diff] [blame] | 112 | | TrustZone| secure monitor | |
| 113 | +----------+------------------------+-------------------------+--------------+ |
| 114 | |
| 115 | The trusted boot chain is recommended with: |
| 116 | |
| 117 | - FSBL = **TF-A BL2** |
| 118 | - Secure monitor = **OP-TEE** |
| 119 | - SSBL = **U-Boot** |
| 120 | |
| 121 | It is the only supported boot chain for STM32MP13x family. |
Patrick Delaunay | 5f6fdcc | 2020-02-25 19:04:14 +0100 | [diff] [blame] | 122 | |
Patrick Delaunay | 3e70d3c | 2021-07-26 11:21:37 +0200 | [diff] [blame] | 123 | The **Trusted** boot chain with TF-A_ |
| 124 | ````````````````````````````````````` |
Patrick Delaunay | 5f6fdcc | 2020-02-25 19:04:14 +0100 | [diff] [blame] | 125 | |
Patrick Delaunay | 3e70d3c | 2021-07-26 11:21:37 +0200 | [diff] [blame] | 126 | defconfig_file : |
Patrick Delaunay | a1d36ed | 2022-05-20 18:24:54 +0200 | [diff] [blame] | 127 | + **stm32mp15_defconfig** and **stm32mp13_defconfig** (for TF-A_ with FIP support) |
Patrick Delaunay | 3e70d3c | 2021-07-26 11:21:37 +0200 | [diff] [blame] | 128 | + **stm32mp15_trusted_defconfig** (for TF-A_ without FIP support) |
Patrick Delaunay | 5f6fdcc | 2020-02-25 19:04:14 +0100 | [diff] [blame] | 129 | |
Patrick Delaunay | 3e70d3c | 2021-07-26 11:21:37 +0200 | [diff] [blame] | 130 | +-------------+--------------------------+------------+-------+ |
| 131 | | ROM code | FSBL | SSBL | OS | |
| 132 | + +--------------------------+------------+-------+ |
| 133 | | |Trusted Firmware-A (TF-A_)| U-Boot | Linux | |
| 134 | +-------------+--------------------------+------------+-------+ |
| 135 | | TrustZone |secure monitor = SPMin or OP-TEE_ | |
| 136 | +-------------+--------------------------+------------+-------+ |
Patrick Delaunay | 5f6fdcc | 2020-02-25 19:04:14 +0100 | [diff] [blame] | 137 | |
Patrick Delaunay | 3e70d3c | 2021-07-26 11:21:37 +0200 | [diff] [blame] | 138 | TF-A_ and OP-TEE_ are 2 separate projects, with their git repository; |
| 139 | they are compiled separately. |
Patrick Delaunay | 5f6fdcc | 2020-02-25 19:04:14 +0100 | [diff] [blame] | 140 | |
Patrick Delaunay | 3e70d3c | 2021-07-26 11:21:37 +0200 | [diff] [blame] | 141 | TF-A_ (BL2) initialize the DDR and loads the next stage binaries from a FIP file: |
| 142 | + BL32: a secure monitor BL32 = SPMin provided by TF-A_ or OP-TEE_ : |
| 143 | performs a full initialization of Secure peripherals and provides service |
| 144 | to normal world |
| 145 | + BL33: a non-trusted firmware = U-Boot, running in normal world and uses |
| 146 | the secure monitor to access to secure resources. |
| 147 | + HW_CONFIG: The hardware configuration file = the U-Boot device tree |
Patrick Delaunay | 5f6fdcc | 2020-02-25 19:04:14 +0100 | [diff] [blame] | 148 | |
Patrick Delaunay | ddba40a | 2022-07-05 16:55:57 +0200 | [diff] [blame] | 149 | The scmi variant of each device tree is only support with OP-TEE as secure |
| 150 | monitor, with stm32mp15_defconfig. |
| 151 | |
Patrick Delaunay | a1d36ed | 2022-05-20 18:24:54 +0200 | [diff] [blame] | 152 | The **Basic** boot chain with SPL (for STM32MP15x) |
| 153 | `````````````````````````````````````````````````` |
Patrick Delaunay | 5f6fdcc | 2020-02-25 19:04:14 +0100 | [diff] [blame] | 154 | |
Patrick Delaunay | 3e70d3c | 2021-07-26 11:21:37 +0200 | [diff] [blame] | 155 | defconfig_file : |
| 156 | + **stm32mp15_basic_defconfig** |
Patrick Delaunay | 5f6fdcc | 2020-02-25 19:04:14 +0100 | [diff] [blame] | 157 | |
| 158 | +-------------+------------+------------+-------+ |
| 159 | | ROM code | FSBL | SSBL | OS | |
| 160 | + +------------+------------+-------+ |
| 161 | | |U-Boot SPL | U-Boot | Linux | |
| 162 | +-------------+------------+------------+-------+ |
| 163 | | TrustZone | | PSCI from U-Boot | |
| 164 | +-------------+------------+------------+-------+ |
| 165 | |
Patrick Delaunay | 3e70d3c | 2021-07-26 11:21:37 +0200 | [diff] [blame] | 166 | SPL has limited security initialization. |
Patrick Delaunay | 5f6fdcc | 2020-02-25 19:04:14 +0100 | [diff] [blame] | 167 | |
| 168 | U-Boot is running in secure mode and provide a secure monitor to the kernel |
| 169 | with only PSCI support (Power State Coordination Interface defined by ARM). |
| 170 | |
Patrick Delaunay | a1d36ed | 2022-05-20 18:24:54 +0200 | [diff] [blame] | 171 | .. warning:: This alternate **basic** boot chain with SPL is not supported/promoted by STMicroelectronics to make product. |
| 172 | |
| 173 | Device Tree |
| 174 | ----------- |
Patrick Delaunay | 5f6fdcc | 2020-02-25 19:04:14 +0100 | [diff] [blame] | 175 | |
Patrick Delaunay | a1d36ed | 2022-05-20 18:24:54 +0200 | [diff] [blame] | 176 | All the STM32MP15x and STM32MP13x boards supported by U-Boot use the same generic board |
| 177 | stm32mp1 which supports all the bootable devices. |
Patrick Delaunay | 5f6fdcc | 2020-02-25 19:04:14 +0100 | [diff] [blame] | 178 | |
Patrick Delaunay | a1d36ed | 2022-05-20 18:24:54 +0200 | [diff] [blame] | 179 | Each STMicroelectronics board is only configured with the associated device tree. |
Patrick Delaunay | 5f6fdcc | 2020-02-25 19:04:14 +0100 | [diff] [blame] | 180 | |
Patrick Delaunay | a1d36ed | 2022-05-20 18:24:54 +0200 | [diff] [blame] | 181 | STM32MP15x device Tree Selection |
| 182 | ```````````````````````````````` |
Patrick Delaunay | a60ef16 | 2024-10-11 17:31:50 +0200 | [diff] [blame] | 183 | The supported device trees for STM32MP15x (**stm32mp15_defconfig** for TF-A_ |
| 184 | with FIP support) are: |
Patrick Delaunay | 5f6fdcc | 2020-02-25 19:04:14 +0100 | [diff] [blame] | 185 | |
| 186 | + ev1: eval board with pmic stpmic1 (ev1 = mother board + daughter ed1) |
| 187 | |
Patrick Delaunay | a60ef16 | 2024-10-11 17:31:50 +0200 | [diff] [blame] | 188 | + **stm32mp157c-ev1-scmi** |
Patrick Delaunay | 5f6fdcc | 2020-02-25 19:04:14 +0100 | [diff] [blame] | 189 | + stm32mp157c-ev1 |
| 190 | |
| 191 | + ed1: daughter board with pmic stpmic1 |
| 192 | |
Patrick Delaunay | a60ef16 | 2024-10-11 17:31:50 +0200 | [diff] [blame] | 193 | + **stm32mp157c-ed1-scmi** |
Patrick Delaunay | 5f6fdcc | 2020-02-25 19:04:14 +0100 | [diff] [blame] | 194 | + stm32mp157c-ed1 |
| 195 | |
| 196 | + dk1: Discovery board |
| 197 | |
Patrick Delaunay | a60ef16 | 2024-10-11 17:31:50 +0200 | [diff] [blame] | 198 | + **stm32mp157a-dk1-scmi** |
Patrick Delaunay | 5f6fdcc | 2020-02-25 19:04:14 +0100 | [diff] [blame] | 199 | + stm32mp157a-dk1 |
| 200 | |
| 201 | + dk2: Discovery board = dk1 with a BT/WiFI combo and a DSI panel |
| 202 | |
Patrick Delaunay | a60ef16 | 2024-10-11 17:31:50 +0200 | [diff] [blame] | 203 | + **stm32mp157c-dk2-scmi** |
Patrick Delaunay | 5f6fdcc | 2020-02-25 19:04:14 +0100 | [diff] [blame] | 204 | + stm32mp157c-dk2 |
| 205 | |
Patrick Delaunay | a60ef16 | 2024-10-11 17:31:50 +0200 | [diff] [blame] | 206 | The scmi variant of each device tree is only supported with OP-TEE as secure |
| 207 | monitor and it is the configuration **recommended** by STMicroelectronics for |
| 208 | product, with secured system resources (RCC_TZCR.TZEN=1). |
| 209 | |
| 210 | The supported device trees for STM32MP15x (stm32mp15_trusted_defconfig |
| 211 | TF-A without FIP support and stm32mp15_basic_defconfig with SPL) are: |
| 212 | |
| 213 | + the same STMicroelectronics boards with the no scmi device tree files: |
| 214 | |
| 215 | + stm32mp157c-ev1 |
| 216 | + stm32mp157c-ed1 |
| 217 | + stm32mp157a-dk1 |
| 218 | + stm32mp157c-dk2 |
| 219 | |
Marek Vasut | 526c951 | 2020-03-31 19:51:36 +0200 | [diff] [blame] | 220 | + avenger96: Avenger96 board from Arrow Electronics based on DH Elec. DHCOR SoM |
Patrick Delaunay | 5f6fdcc | 2020-02-25 19:04:14 +0100 | [diff] [blame] | 221 | |
Marek Vasut | 526c951 | 2020-03-31 19:51:36 +0200 | [diff] [blame] | 222 | + stm32mp15xx-dhcor-avenger96 |
Patrick Delaunay | 5f6fdcc | 2020-02-25 19:04:14 +0100 | [diff] [blame] | 223 | |
Patrick Delaunay | a1d36ed | 2022-05-20 18:24:54 +0200 | [diff] [blame] | 224 | STM32MP13x device Tree Selection |
| 225 | ```````````````````````````````` |
Patrick Delaunay | a60ef16 | 2024-10-11 17:31:50 +0200 | [diff] [blame] | 226 | The supported device trees for STM32MP13x (**stm32mp13_defconfig**) are: |
Patrick Delaunay | a1d36ed | 2022-05-20 18:24:54 +0200 | [diff] [blame] | 227 | |
| 228 | + dk: Discovery board |
| 229 | |
Patrick Delaunay | a60ef16 | 2024-10-11 17:31:50 +0200 | [diff] [blame] | 230 | + **stm32mp135f-dk** |
Patrick Delaunay | a1d36ed | 2022-05-20 18:24:54 +0200 | [diff] [blame] | 231 | |
| 232 | |
Patrick Delaunay | 5f6fdcc | 2020-02-25 19:04:14 +0100 | [diff] [blame] | 233 | Build Procedure |
| 234 | --------------- |
| 235 | |
| 236 | 1. Install the required tools for U-Boot |
| 237 | |
| 238 | * install package needed in U-Boot makefile |
| 239 | (libssl-dev, swig, libpython-dev...) |
| 240 | |
| 241 | * install ARMv7 toolchain for 32bit Cortex-A (from Linaro, |
| 242 | from SDK for STM32MP15x, or any crosstoolchains from your distribution) |
| 243 | (you can use any gcc cross compiler compatible with U-Boot) |
| 244 | |
| 245 | 2. Set the cross compiler:: |
| 246 | |
| 247 | # export CROSS_COMPILE=/path/to/toolchain/arm-linux-gnueabi- |
| 248 | |
| 249 | 3. Select the output directory (optional):: |
| 250 | |
| 251 | # export KBUILD_OUTPUT=/path/to/output |
| 252 | |
| 253 | for example: use one output directory for each configuration:: |
| 254 | |
Patrick Delaunay | a1d36ed | 2022-05-20 18:24:54 +0200 | [diff] [blame] | 255 | # export KBUILD_OUTPUT=stm32mp13 |
Patrick Delaunay | 3e70d3c | 2021-07-26 11:21:37 +0200 | [diff] [blame] | 256 | # export KBUILD_OUTPUT=stm32mp15 |
Patrick Delaunay | 5f6fdcc | 2020-02-25 19:04:14 +0100 | [diff] [blame] | 257 | # export KBUILD_OUTPUT=stm32mp15_trusted |
Patrick Delaunay | 5f6fdcc | 2020-02-25 19:04:14 +0100 | [diff] [blame] | 258 | # export KBUILD_OUTPUT=stm32mp15_basic |
| 259 | |
| 260 | you can build outside of code directory:: |
| 261 | |
Patrick Delaunay | 3e70d3c | 2021-07-26 11:21:37 +0200 | [diff] [blame] | 262 | # export KBUILD_OUTPUT=../build/stm32mp15 |
Patrick Delaunay | 5f6fdcc | 2020-02-25 19:04:14 +0100 | [diff] [blame] | 263 | |
| 264 | 4. Configure U-Boot:: |
| 265 | |
| 266 | # make <defconfig_file> |
| 267 | |
| 268 | with <defconfig_file>: |
| 269 | |
Patrick Delaunay | a1d36ed | 2022-05-20 18:24:54 +0200 | [diff] [blame] | 270 | - For **trusted** boot mode : |
| 271 | - For STM32MP13x: **stm32mp13_defconfig** |
| 272 | - For STM32MP15x: **stm32mp15_defconfig** or stm32mp15_trusted_defconfig |
| 273 | - For STM32MP15x basic boot mode: stm32mp15_basic_defconfig |
Patrick Delaunay | 5f6fdcc | 2020-02-25 19:04:14 +0100 | [diff] [blame] | 274 | |
| 275 | 5. Configure the device-tree and build the U-Boot image:: |
| 276 | |
| 277 | # make DEVICE_TREE=<name> all |
| 278 | |
| 279 | Examples: |
| 280 | |
Patrick Delaunay | a1d36ed | 2022-05-20 18:24:54 +0200 | [diff] [blame] | 281 | a) trusted boot with FIP on STM32MP15x ev1:: |
Patrick Delaunay | 5f6fdcc | 2020-02-25 19:04:14 +0100 | [diff] [blame] | 282 | |
Patrick Delaunay | 3e70d3c | 2021-07-26 11:21:37 +0200 | [diff] [blame] | 283 | # export KBUILD_OUTPUT=stm32mp15 |
| 284 | # make stm32mp15_defconfig |
Patrick Delaunay | ddba40a | 2022-07-05 16:55:57 +0200 | [diff] [blame] | 285 | # make DEVICE_TREE=stm32mp157c-ev1-scmi all |
| 286 | |
| 287 | or without SCMI support |
| 288 | |
| 289 | # export KBUILD_OUTPUT=stm32mp15 |
| 290 | # make stm32mp15_defconfig |
Patrick Delaunay | 5f6fdcc | 2020-02-25 19:04:14 +0100 | [diff] [blame] | 291 | # make DEVICE_TREE=stm32mp157c-ev1 all |
| 292 | |
Patrick Delaunay | a1d36ed | 2022-05-20 18:24:54 +0200 | [diff] [blame] | 293 | b) trusted boot on STM32MP13x discovery board:: |
Patrick Delaunay | 5f6fdcc | 2020-02-25 19:04:14 +0100 | [diff] [blame] | 294 | |
Patrick Delaunay | a1d36ed | 2022-05-20 18:24:54 +0200 | [diff] [blame] | 295 | # export KBUILD_OUTPUT=stm32mp13 |
| 296 | # make stm32mp13_defconfig |
| 297 | # make DEVICE_TREE=stm32mp135f-dk all |
Patrick Delaunay | 5f6fdcc | 2020-02-25 19:04:14 +0100 | [diff] [blame] | 298 | |
Patrick Delaunay | a1d36ed | 2022-05-20 18:24:54 +0200 | [diff] [blame] | 299 | DEVICE_TEE selection is optional as stm32mp135f-dk is the default board of the defconfig:: |
| 300 | |
| 301 | # make stm32mp13_defconfig |
| 302 | # make all |
| 303 | |
| 304 | c) basic boot on STM32MP15x ev1:: |
Patrick Delaunay | 5f6fdcc | 2020-02-25 19:04:14 +0100 | [diff] [blame] | 305 | |
| 306 | # export KBUILD_OUTPUT=stm32mp15_basic |
| 307 | # make stm32mp15_basic_defconfig |
| 308 | # make DEVICE_TREE=stm32mp157c-ev1 all |
| 309 | |
Patrick Delaunay | a1d36ed | 2022-05-20 18:24:54 +0200 | [diff] [blame] | 310 | d) basic boot on STM32MP15x ed1:: |
Patrick Delaunay | 5f6fdcc | 2020-02-25 19:04:14 +0100 | [diff] [blame] | 311 | |
| 312 | # export KBUILD_OUTPUT=stm32mp15_basic |
| 313 | # make stm32mp15_basic_defconfig |
| 314 | # make DEVICE_TREE=stm32mp157c-ed1 all |
| 315 | |
Patrick Delaunay | a1d36ed | 2022-05-20 18:24:54 +0200 | [diff] [blame] | 316 | e) basic boot on STM32MP15x dk1:: |
Patrick Delaunay | 5f6fdcc | 2020-02-25 19:04:14 +0100 | [diff] [blame] | 317 | |
| 318 | # export KBUILD_OUTPUT=stm32mp15_basic |
| 319 | # make stm32mp15_basic_defconfig |
| 320 | # make DEVICE_TREE=stm32mp157a-dk1 all |
| 321 | |
Patrick Delaunay | a1d36ed | 2022-05-20 18:24:54 +0200 | [diff] [blame] | 322 | f) basic boot on STM32MP15x avenger96:: |
Patrick Delaunay | 5f6fdcc | 2020-02-25 19:04:14 +0100 | [diff] [blame] | 323 | |
| 324 | # export KBUILD_OUTPUT=stm32mp15_basic |
| 325 | # make stm32mp15_basic_defconfig |
Marek Vasut | 526c951 | 2020-03-31 19:51:36 +0200 | [diff] [blame] | 326 | # make DEVICE_TREE=stm32mp15xx-dhcor-avenger96 all |
Patrick Delaunay | 5f6fdcc | 2020-02-25 19:04:14 +0100 | [diff] [blame] | 327 | |
Patrick Delaunay | 3e70d3c | 2021-07-26 11:21:37 +0200 | [diff] [blame] | 328 | 6. U-Boot Output files |
Patrick Delaunay | 5f6fdcc | 2020-02-25 19:04:14 +0100 | [diff] [blame] | 329 | |
| 330 | So in the output directory (selected by KBUILD_OUTPUT), |
Patrick Delaunay | 3e70d3c | 2021-07-26 11:21:37 +0200 | [diff] [blame] | 331 | you can found the needed U-Boot files: |
| 332 | |
Patrick Delaunay | a1d36ed | 2022-05-20 18:24:54 +0200 | [diff] [blame] | 333 | - stm32mp13_defconfig = **u-boot-nodtb.bin** and **u-boot.dtb** |
Patrick Delaunay | 3e70d3c | 2021-07-26 11:21:37 +0200 | [diff] [blame] | 334 | - stm32mp15_defconfig = **u-boot-nodtb.bin** and **u-boot.dtb** |
| 335 | |
| 336 | - stm32mp15_trusted_defconfig = u-boot.stm32 |
| 337 | |
| 338 | - stm32mp15_basic_defconfig |
| 339 | |
| 340 | - FSBL = spl/u-boot-spl.stm32 |
| 341 | |
| 342 | - SSBL = u-boot.img (without CONFIG_SPL_LOAD_FIT) or |
| 343 | u-boot.itb (with CONFIG_SPL_LOAD_FIT=y) |
| 344 | |
| 345 | 7. TF-A_ compilation |
| 346 | |
| 347 | This step is required only for **Trusted** boot (stm32mp15_defconfig and |
| 348 | stm32mp15_trusted_defconfig); see OP-TEE_ and TF-A_ documentation for build |
| 349 | commands. |
| 350 | |
| 351 | - For TF-A_ with FIP support: **stm32mp15_defconfig** |
| 352 | |
| 353 | - with OP-TEE_ support, compile the OP-TEE to generate the binary included |
| 354 | in FIP |
| 355 | |
| 356 | - after TF-A compilation, the used files are: |
| 357 | |
| 358 | - TF-A_ BL2 => FSBL = **tf-a.stm32** |
| 359 | |
| 360 | - FIP => **fip.bin** |
| 361 | |
| 362 | FIP file includes the 2 files given in arguments of TF-A_ compilation: |
Patrick Delaunay | 5f6fdcc | 2020-02-25 19:04:14 +0100 | [diff] [blame] | 363 | |
Patrick Delaunay | 3e70d3c | 2021-07-26 11:21:37 +0200 | [diff] [blame] | 364 | - BL33=u-boot-nodtb.bin |
| 365 | - BL33_CFG=u-boot.dtb |
Patrick Delaunay | 5f6fdcc | 2020-02-25 19:04:14 +0100 | [diff] [blame] | 366 | |
Michal Simek | 50fa118 | 2023-05-17 09:17:16 +0200 | [diff] [blame] | 367 | You can also update a existing FIP after U-Boot compilation with fiptool, |
Patrick Delaunay | 3e70d3c | 2021-07-26 11:21:37 +0200 | [diff] [blame] | 368 | a tool provided by TF-A_:: |
Patrick Delaunay | 5f6fdcc | 2020-02-25 19:04:14 +0100 | [diff] [blame] | 369 | |
Patrick Delaunay | 3e70d3c | 2021-07-26 11:21:37 +0200 | [diff] [blame] | 370 | # fiptool update --nt-fw u-boot-nodtb.bin --hw-config u-boot.dtb fip-stm32mp157c-ev1.bin |
Patrick Delaunay | 5f6fdcc | 2020-02-25 19:04:14 +0100 | [diff] [blame] | 371 | |
Patrick Delaunay | 3e70d3c | 2021-07-26 11:21:37 +0200 | [diff] [blame] | 372 | - For TF-A_ without FIP support : **stm32mp15_trusted_defconfig** |
| 373 | SPMin is used and the used files are: |
| 374 | |
| 375 | - FSBL = **tf-a.stm32** (provided by TF-A_ compilation, contening BL2 and |
| 376 | BL32 = SPMin) |
| 377 | |
| 378 | - SSBL = **u-boot.stm32** used instead of fip.bin in next chapters |
| 379 | |
| 380 | 8. The bootloaders files |
| 381 | |
| 382 | + The **ROM code** expects FSBL binaries with STM32 image header = |
| 383 | tf-a.stm32 or u-boot-spl.stm32 |
| 384 | |
| 385 | According the FSBL / the boot mode: |
| 386 | |
| 387 | + **TF-A** expect a FIP binary = fip.bin, including the OS monitor (SPMin or |
| 388 | OP-TEE_) and the U-Boot binary + device tree |
| 389 | |
| 390 | or, without FIP support, binaries with STM32 image header: U-Boot |
| 391 | = u-boot.stm32 and eventually OP-TEE files (tee-header.stm32, tee-pageable.stm32, |
| 392 | tee-pager.stm32) |
| 393 | |
| 394 | + **SPL** expects SSBL = U-Boot with uImage header = u-boot.img |
| 395 | or FIT = u-boot.itb. |
| 396 | |
Patrick Delaunay | 5f6fdcc | 2020-02-25 19:04:14 +0100 | [diff] [blame] | 397 | |
| 398 | Switch Setting for Boot Mode |
| 399 | ---------------------------- |
| 400 | |
| 401 | You can select the boot mode, on the board with one switch, to select |
| 402 | the boot pin values = BOOT0, BOOT1, BOOT2 |
| 403 | |
| 404 | +-------------+---------+---------+---------+ |
| 405 | |*Boot Mode* | *BOOT2* | *BOOT1* | *BOOT0* | |
| 406 | +=============+=========+=========+=========+ |
| 407 | | Recovery | 0 | 0 | 0 | |
| 408 | +-------------+---------+---------+---------+ |
| 409 | | NOR | 0 | 0 | 1 | |
| 410 | +-------------+---------+---------+---------+ |
| 411 | | eMMC | 0 | 1 | 0 | |
| 412 | +-------------+---------+---------+---------+ |
| 413 | | NAND | 0 | 1 | 1 | |
| 414 | +-------------+---------+---------+---------+ |
| 415 | | Reserved | 1 | 0 | 0 | |
| 416 | +-------------+---------+---------+---------+ |
| 417 | | SD-Card | 1 | 0 | 1 | |
| 418 | +-------------+---------+---------+---------+ |
| 419 | | Recovery | 1 | 1 | 0 | |
| 420 | +-------------+---------+---------+---------+ |
| 421 | | SPI-NAND | 1 | 1 | 1 | |
| 422 | +-------------+---------+---------+---------+ |
| 423 | |
Patrick Delaunay | a1d36ed | 2022-05-20 18:24:54 +0200 | [diff] [blame] | 424 | - on the STM32MP15x **daughter board ed1 = MB1263** with the switch SW1 |
| 425 | - on STM32MP15x **Avenger96** with switch S3 (NOR and SPI-NAND are not applicable) |
| 426 | - on board STM32MP15x **DK1/DK2** with the switch SW1 = BOOT0, BOOT2 |
Patrick Delaunay | 5f6fdcc | 2020-02-25 19:04:14 +0100 | [diff] [blame] | 427 | with only 2 pins available (BOOT1 is forced to 0 and NOR not supported), |
| 428 | the possible value becomes: |
| 429 | |
| 430 | +-------------+---------+---------+ |
| 431 | |*Boot Mode* | *BOOT2* | *BOOT0* | |
| 432 | +=============+=========+=========+ |
| 433 | | Recovery | 0 | 0 | |
| 434 | +-------------+---------+---------+ |
| 435 | | NOR (NA)| 0 | 1 | |
| 436 | +-------------+---------+---------+ |
| 437 | | Reserved | 1 | 0 | |
| 438 | +-------------+---------+---------+ |
| 439 | | SD-Card | 1 | 1 | |
| 440 | +-------------+---------+---------+ |
| 441 | |
| 442 | Recovery is a boot from serial link (UART/USB) and it is used with |
| 443 | STM32CubeProgrammer tool to load executable in RAM and to update the flash |
| 444 | devices available on the board (NOR/NAND/eMMC/SD card). |
| 445 | |
| 446 | The communication between HOST and board is based on |
| 447 | |
| 448 | - for UARTs : the uart protocol used with all MCU STM32 |
| 449 | - for USB : based on USB DFU 1.1 (without the ST extensions used on MCU STM32) |
| 450 | |
| 451 | Prepare an SD card |
| 452 | ------------------ |
| 453 | |
Patrick Delaunay | a1d36ed | 2022-05-20 18:24:54 +0200 | [diff] [blame] | 454 | The minimal requirements for STMP32MP15x and STM32MP13x boot up to U-Boot are: |
Patrick Delaunay | 5f6fdcc | 2020-02-25 19:04:14 +0100 | [diff] [blame] | 455 | |
| 456 | - GPT partitioning (with gdisk or with sgdisk) |
Patrick Delaunay | 3e70d3c | 2021-07-26 11:21:37 +0200 | [diff] [blame] | 457 | - 2 fsbl partitions, named "fsbl1" and "fsbl2", size at least 256KiB |
| 458 | - one partition named "fip" for FIP or U-Boot (TF-A_ search the "fip" |
| 459 | partition and SPL search the 3th partition, because |
| 460 | CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_PARTITION=3) |
| 461 | |
| 462 | The 2 fsbl partitions have the same content and are present to guarantee a |
| 463 | fail-safe update of FSBL; fsbl2 can be omitted if this ROM code feature is |
| 464 | not required. |
| 465 | |
| 466 | Without FIP support in TF-A_, the 3rd partition "fip" for u-boot.stm32 must |
| 467 | be named "ssbl". |
Patrick Delaunay | 5f6fdcc | 2020-02-25 19:04:14 +0100 | [diff] [blame] | 468 | |
| 469 | Then the minimal GPT partition is: |
| 470 | |
Patrick Delaunay | 3e70d3c | 2021-07-26 11:21:37 +0200 | [diff] [blame] | 471 | For TF-A_ with FIP support: |
| 472 | |
| 473 | +-------+--------+---------+------------------------+ |
| 474 | | *Num* | *Name* | *Size* | *Content* | |
| 475 | +=======+========+=========+========================+ |
| 476 | | 1 | fsbl1 | 256 KiB | TF-A_ BL2 (tf-a.stm32) | |
| 477 | +-------+--------+---------+------------------------+ |
| 478 | | 2 | fsbl2 | 256 KiB | TF-A_ BL2 (tf-a.stm32) | |
| 479 | +-------+--------+---------+------------------------+ |
| 480 | | 3 | fip | 4MB | fip.bin | |
| 481 | +-------+--------+---------+------------------------+ |
| 482 | | 4 | <any> | <any> | Rootfs | |
| 483 | +-------+--------+---------+------------------------+ |
Patrick Delaunay | 5f6fdcc | 2020-02-25 19:04:14 +0100 | [diff] [blame] | 484 | |
Patrick Delaunay | 3e70d3c | 2021-07-26 11:21:37 +0200 | [diff] [blame] | 485 | or: |
| 486 | |
| 487 | +-------+--------+---------+------------------------+------------------------+ |
| 488 | | *Num* | *Name* | *Size* | *Trusted boot content* | *Basic boot content* | |
| 489 | +=======+========+=========+========================+========================+ |
| 490 | | 1 | fsbl1 | 256 KiB | TF-A_ BL2 (tf-a.stm32) | SPL (u-boot-spl.stm32) | |
| 491 | +-------+--------+---------+------------------------+------------------------+ |
| 492 | | 2 | fsbl2 | 256 KiB | TF-A_ BL2 (tf-a.stm32) | SPL (u-boot-spl.stm32) | |
| 493 | +-------+--------+---------+------------------------+------------------------+ |
| 494 | | 3 | ssbl | 2MB | U-Boot (u-boot.stm32) | U-Boot (u-boot.img) | |
| 495 | +-------+--------+---------+------------------------+------------------------+ |
| 496 | | 4 | <any> | <any> | Rootfs | |
| 497 | +-------+--------+---------+------------------------+------------------------+ |
| 498 | |
| 499 | And the 4th partition (Rootfs) is marked bootable with a file extlinux.conf |
Patrick Delaunay | 3281cb6 | 2023-01-24 10:16:02 +0100 | [diff] [blame] | 500 | following the Generic Distribution feature (see :doc:`../../develop/distro` for |
| 501 | use). |
Patrick Delaunay | 5f6fdcc | 2020-02-25 19:04:14 +0100 | [diff] [blame] | 502 | |
Patrick Delaunay | 3e70d3c | 2021-07-26 11:21:37 +0200 | [diff] [blame] | 503 | The size of fip or ssbl partition must be enough for the associated binary file, |
| 504 | 4MB and 2MB are default values. |
Patrick Delaunay | 5f6fdcc | 2020-02-25 19:04:14 +0100 | [diff] [blame] | 505 | |
Patrick Delaunay | 3e70d3c | 2021-07-26 11:21:37 +0200 | [diff] [blame] | 506 | According the used card reader select the correct block device |
| 507 | (for example /dev/sdx or /dev/mmcblk0), in the next example, it is /dev/mmcblk0 |
Patrick Delaunay | 5f6fdcc | 2020-02-25 19:04:14 +0100 | [diff] [blame] | 508 | |
Patrick Delaunay | 3e70d3c | 2021-07-26 11:21:37 +0200 | [diff] [blame] | 509 | For example: |
Patrick Delaunay | 5f6fdcc | 2020-02-25 19:04:14 +0100 | [diff] [blame] | 510 | |
| 511 | a) remove previous formatting:: |
| 512 | |
| 513 | # sgdisk -o /dev/<SD card dev> |
| 514 | |
Patrick Delaunay | 3e70d3c | 2021-07-26 11:21:37 +0200 | [diff] [blame] | 515 | b) create minimal image for FIP |
| 516 | |
| 517 | For FIP support in TF-A_:: |
Patrick Delaunay | 5f6fdcc | 2020-02-25 19:04:14 +0100 | [diff] [blame] | 518 | |
| 519 | # sgdisk --resize-table=128 -a 1 \ |
| 520 | -n 1:34:545 -c 1:fsbl1 \ |
| 521 | -n 2:546:1057 -c 2:fsbl2 \ |
Patrick Delaunay | 3e70d3c | 2021-07-26 11:21:37 +0200 | [diff] [blame] | 522 | -n 3:1058:9249 -c 3:fip \ |
| 523 | -n 4:9250: -c 4:rootfs -A 4:set:2 \ |
Patrick Delaunay | 5f6fdcc | 2020-02-25 19:04:14 +0100 | [diff] [blame] | 524 | -p /dev/<SD card dev> |
| 525 | |
Patrick Delaunay | 3e70d3c | 2021-07-26 11:21:37 +0200 | [diff] [blame] | 526 | With gpt table with 128 entries an the partition 4 marked bootable (bit 2). |
| 527 | |
| 528 | For basic boot mode or without FIP support in TF-A_:: |
| 529 | |
| 530 | # sgdisk --resize-table=128 -a 1 \ |
| 531 | -n 1:34:545 -c 1:fsbl1 \ |
| 532 | -n 2:546:1057 -c 2:fsbl2 \ |
| 533 | -n 3:1058:5153 -c 3:ssbl \ |
| 534 | -n 4:5154: -c 4:rootfs -A 4:set:2 \ |
| 535 | -p /dev/<SD card dev> |
Patrick Delaunay | 5f6fdcc | 2020-02-25 19:04:14 +0100 | [diff] [blame] | 536 | |
| 537 | c) copy the FSBL (2 times) and SSBL file on the correct partition. |
| 538 | in this example in partition 1 to 3 |
| 539 | |
Patrick Delaunay | 3e70d3c | 2021-07-26 11:21:37 +0200 | [diff] [blame] | 540 | for trusted boot: :: |
| 541 | |
| 542 | # dd if=tf-a.stm32 of=/dev/mmcblk0p1 |
| 543 | # dd if=tf-a.stm32 of=/dev/mmcblk0p2 |
| 544 | # dd if=fip.bin of=/dev/mmcblk0p3 |
| 545 | OR |
| 546 | dd if=u-boot.stm32 of=/dev/mmcblk0p3 # Without FIT support |
| 547 | |
Patrick Delaunay | 5f6fdcc | 2020-02-25 19:04:14 +0100 | [diff] [blame] | 548 | for basic boot mode : <SD card dev> = /dev/mmcblk0:: |
| 549 | |
| 550 | # dd if=u-boot-spl.stm32 of=/dev/mmcblk0p1 |
| 551 | # dd if=u-boot-spl.stm32 of=/dev/mmcblk0p2 |
Marek Vasut | db4374f | 2021-03-06 21:44:17 +0100 | [diff] [blame] | 552 | # dd if=u-boot.img of=/dev/mmcblk0p3 # Without CONFIG_SPL_LOAD_FIT |
| 553 | OR |
| 554 | dd if=u-boot.itb of=/dev/mmcblk0p3 # With CONFIG_SPL_LOAD_FIT=y |
Patrick Delaunay | 5f6fdcc | 2020-02-25 19:04:14 +0100 | [diff] [blame] | 555 | |
Patrick Delaunay | 5f6fdcc | 2020-02-25 19:04:14 +0100 | [diff] [blame] | 556 | To boot from SD card, select BootPinMode = 1 0 1 and reset. |
| 557 | |
| 558 | Prepare eMMC |
| 559 | ------------ |
| 560 | |
| 561 | You can use U-Boot to copy binary in eMMC. |
| 562 | |
| 563 | In the next example, you need to boot from SD card and the images |
Patrick Delaunay | 3e70d3c | 2021-07-26 11:21:37 +0200 | [diff] [blame] | 564 | (tf-a.stm32, fip.bin / u-boot-spl.stm32, u-boot.img for systems without |
| 565 | CONFIG_SPL_LOAD_FIT or u-boot.itb for systems with CONFIG_SPL_LOAD_FIT=y) are |
| 566 | presents on SD card (mmc 0) in ext4 partition 4 (bootfs) |
Patrick Delaunay | 5f6fdcc | 2020-02-25 19:04:14 +0100 | [diff] [blame] | 567 | |
| 568 | To boot from SD card, select BootPinMode = 1 0 1 and reset. |
| 569 | |
| 570 | Then you update the eMMC with the next U-Boot command : |
| 571 | |
| 572 | a) prepare GPT on eMMC, |
Patrick Delaunay | 3e70d3c | 2021-07-26 11:21:37 +0200 | [diff] [blame] | 573 | example with 3 partitions, fip, bootfs and roots:: |
Patrick Delaunay | 5f6fdcc | 2020-02-25 19:04:14 +0100 | [diff] [blame] | 574 | |
Patrick Delaunay | 3e70d3c | 2021-07-26 11:21:37 +0200 | [diff] [blame] | 575 | # setenv emmc_part "name=fip,size=4MiB;name=bootfs,type=linux,bootable,size=64MiB;name=rootfs,type=linux,size=512" |
Patrick Delaunay | 5f6fdcc | 2020-02-25 19:04:14 +0100 | [diff] [blame] | 576 | # gpt write mmc 1 ${emmc_part} |
| 577 | |
Patrick Delaunay | 3e70d3c | 2021-07-26 11:21:37 +0200 | [diff] [blame] | 578 | b) copy FSBL, TF-A_ or SPL, on first eMMC boot partition |
Patrick Delaunay | 5f6fdcc | 2020-02-25 19:04:14 +0100 | [diff] [blame] | 579 | (SPL max size is 256kB, with LBA 512, 0x200):: |
| 580 | |
Patrick Delaunay | 3e70d3c | 2021-07-26 11:21:37 +0200 | [diff] [blame] | 581 | # ext4load mmc 0:4 0xC0000000 tf-a.stm32 |
| 582 | or |
Patrick Delaunay | 5f6fdcc | 2020-02-25 19:04:14 +0100 | [diff] [blame] | 583 | # ext4load mmc 0:4 0xC0000000 u-boot-spl.stm32 |
Patrick Delaunay | 3e70d3c | 2021-07-26 11:21:37 +0200 | [diff] [blame] | 584 | |
Patrick Delaunay | 5f6fdcc | 2020-02-25 19:04:14 +0100 | [diff] [blame] | 585 | # mmc dev 1 |
| 586 | # mmc partconf 1 1 1 1 |
| 587 | # mmc write ${fileaddr} 0 200 |
| 588 | # mmc partconf 1 1 1 0 |
| 589 | |
Patrick Delaunay | 3e70d3c | 2021-07-26 11:21:37 +0200 | [diff] [blame] | 590 | c) copy SSBL, FIP or U-Boot binary, in first GPT partition of eMMC:: |
Patrick Delaunay | 5f6fdcc | 2020-02-25 19:04:14 +0100 | [diff] [blame] | 591 | |
Patrick Delaunay | 3e70d3c | 2021-07-26 11:21:37 +0200 | [diff] [blame] | 592 | # ext4load mmc 0:4 0xC0000000 fip.bin |
| 593 | or |
Marek Vasut | db4374f | 2021-03-06 21:44:17 +0100 | [diff] [blame] | 594 | # ext4load mmc 0:4 0xC0000000 u-boot.img # Without CONFIG_SPL_LOAD_FIT |
Patrick Delaunay | 3e70d3c | 2021-07-26 11:21:37 +0200 | [diff] [blame] | 595 | or |
| 596 | # ext4load mmc 0:4 0xC0000000 u-boot.itb # With CONFIG_SPL_LOAD_FIT=y |
| 597 | |
| 598 | |
Patrick Delaunay | 5f6fdcc | 2020-02-25 19:04:14 +0100 | [diff] [blame] | 599 | # mmc dev 1 |
| 600 | # part start mmc 1 1 partstart |
| 601 | # mmc write ${fileaddr} ${partstart} ${filesize} |
| 602 | |
| 603 | To boot from eMMC, select BootPinMode = 0 1 0 and reset. |
| 604 | |
| 605 | MAC Address |
| 606 | ----------- |
| 607 | |
| 608 | Please read doc/README.enetaddr for the implementation guidelines for mac id |
| 609 | usage. Basically, environment has precedence over board specific storage. |
| 610 | |
Patrick Delaunay | a1d36ed | 2022-05-20 18:24:54 +0200 | [diff] [blame] | 611 | For STMicroelectronics board, it is retrieved in: |
| 612 | |
| 613 | - STM32MP15x OTP: |
Patrick Delaunay | 5f6fdcc | 2020-02-25 19:04:14 +0100 | [diff] [blame] | 614 | |
Patrick Delaunay | a1d36ed | 2022-05-20 18:24:54 +0200 | [diff] [blame] | 615 | - OTP_57[31:0] = MAC_ADDR[31:0] |
| 616 | - OTP_58[15:0] = MAC_ADDR[47:32] |
Patrick Delaunay | 5f6fdcc | 2020-02-25 19:04:14 +0100 | [diff] [blame] | 617 | |
Patrick Delaunay | a1d36ed | 2022-05-20 18:24:54 +0200 | [diff] [blame] | 618 | - STM32MP13x OTP: |
| 619 | |
| 620 | - OTP_57[31:0] = MAC_ADDR0[31:0] |
| 621 | - OTP_58[15:0] = MAC_ADDR0[47:32] |
| 622 | - OTP_58[31:16] = MAC_ADDR1[15:0] |
| 623 | - OTP_59[31:0] = MAC_ADDR1[47:16] |
| 624 | |
| 625 | To program a MAC address on virgin STM32MP15x OTP words above, you can use the fuse command |
Patrick Delaunay | b10cddf | 2020-02-12 19:37:38 +0100 | [diff] [blame] | 626 | on bank 0 to access to internal OTP and lock them: |
Patrick Delaunay | 5f6fdcc | 2020-02-25 19:04:14 +0100 | [diff] [blame] | 627 | |
Patrick Delaunay | a1d36ed | 2022-05-20 18:24:54 +0200 | [diff] [blame] | 628 | In the next example we are using the 2 OTPs used on STM32MP15x. |
| 629 | |
Patrick Delaunay | 5f6fdcc | 2020-02-25 19:04:14 +0100 | [diff] [blame] | 630 | Prerequisite: check if a MAC address isn't yet programmed in OTP |
| 631 | |
Patrick Delaunay | b10cddf | 2020-02-12 19:37:38 +0100 | [diff] [blame] | 632 | 1) check OTP: their value must be equal to 0:: |
Patrick Delaunay | 5f6fdcc | 2020-02-25 19:04:14 +0100 | [diff] [blame] | 633 | |
Patrick Delaunay | b10cddf | 2020-02-12 19:37:38 +0100 | [diff] [blame] | 634 | STM32MP> fuse sense 0 57 2 |
| 635 | Sensing bank 0: |
| 636 | Word 0x00000039: 00000000 00000000 |
| 637 | |
| 638 | 2) check environment variable:: |
Patrick Delaunay | 5f6fdcc | 2020-02-25 19:04:14 +0100 | [diff] [blame] | 639 | |
Patrick Delaunay | b10cddf | 2020-02-12 19:37:38 +0100 | [diff] [blame] | 640 | STM32MP> env print ethaddr |
| 641 | ## Error: "ethaddr" not defined |
Patrick Delaunay | 5f6fdcc | 2020-02-25 19:04:14 +0100 | [diff] [blame] | 642 | |
Patrick Delaunay | d538829 | 2023-01-06 13:20:15 +0100 | [diff] [blame] | 643 | 3) check lock status of fuse 57 & 58 (at 0x39, 0=unlocked, 0x40000000=locked):: |
Patrick Delaunay | b10cddf | 2020-02-12 19:37:38 +0100 | [diff] [blame] | 644 | |
| 645 | STM32MP> fuse sense 0 0x10000039 2 |
| 646 | Sensing bank 0: |
| 647 | Word 0x10000039: 00000000 00000000 |
Patrick Delaunay | 5f6fdcc | 2020-02-25 19:04:14 +0100 | [diff] [blame] | 648 | |
| 649 | Example to set mac address "12:34:56:78:9a:bc" |
| 650 | |
| 651 | 1) Write OTP:: |
| 652 | |
| 653 | STM32MP> fuse prog -y 0 57 0x78563412 0x0000bc9a |
| 654 | |
| 655 | 2) Read OTP:: |
| 656 | |
| 657 | STM32MP> fuse sense 0 57 2 |
| 658 | Sensing bank 0: |
| 659 | Word 0x00000039: 78563412 0000bc9a |
| 660 | |
Patrick Delaunay | b10cddf | 2020-02-12 19:37:38 +0100 | [diff] [blame] | 661 | 3) Lock OTP:: |
| 662 | |
Patrick Delaunay | d538829 | 2023-01-06 13:20:15 +0100 | [diff] [blame] | 663 | STM32MP> fuse prog 0 0x10000039 0x40000000 0x40000000 |
Patrick Delaunay | b10cddf | 2020-02-12 19:37:38 +0100 | [diff] [blame] | 664 | |
| 665 | STM32MP> fuse sense 0 0x10000039 2 |
| 666 | Sensing bank 0: |
Patrick Delaunay | d538829 | 2023-01-06 13:20:15 +0100 | [diff] [blame] | 667 | Word 0x10000039: 40000000 40000000 |
Patrick Delaunay | b10cddf | 2020-02-12 19:37:38 +0100 | [diff] [blame] | 668 | |
| 669 | 4) next REBOOT, in the trace:: |
Patrick Delaunay | 5f6fdcc | 2020-02-25 19:04:14 +0100 | [diff] [blame] | 670 | |
| 671 | ### Setting environment from OTP MAC address = "12:34:56:78:9a:bc" |
| 672 | |
Patrick Delaunay | b10cddf | 2020-02-12 19:37:38 +0100 | [diff] [blame] | 673 | 5) check env update:: |
Patrick Delaunay | 5f6fdcc | 2020-02-25 19:04:14 +0100 | [diff] [blame] | 674 | |
| 675 | STM32MP> env print ethaddr |
| 676 | ethaddr=12:34:56:78:9a:bc |
| 677 | |
| 678 | .. warning:: This command can't be executed twice on the same board as |
| 679 | OTP are protected. It is already done for the board |
| 680 | provided by STMicroelectronics. |
| 681 | |
Patrick Delaunay | a1d36ed | 2022-05-20 18:24:54 +0200 | [diff] [blame] | 682 | Coprocessor firmware on STM32MP15x |
| 683 | ---------------------------------- |
Patrick Delaunay | 5f6fdcc | 2020-02-25 19:04:14 +0100 | [diff] [blame] | 684 | |
| 685 | U-Boot can boot the coprocessor before the kernel (coprocessor early boot). |
| 686 | |
| 687 | a) Manuallly by using rproc commands (update the bootcmd) |
| 688 | |
| 689 | Configurations:: |
| 690 | |
| 691 | # env set name_copro "rproc-m4-fw.elf" |
| 692 | # env set dev_copro 0 |
| 693 | # env set loadaddr_copro 0xC1000000 |
| 694 | |
| 695 | Load binary from bootfs partition (number 4) on SD card (mmc 0):: |
| 696 | |
| 697 | # ext4load mmc 0:4 ${loadaddr_copro} ${name_copro} |
| 698 | |
| 699 | => ${filesize} variable is updated with the size of the loaded file. |
| 700 | |
| 701 | Start M4 firmware with remote proc command:: |
| 702 | |
| 703 | # rproc init |
| 704 | # rproc load ${dev_copro} ${loadaddr_copro} ${filesize} |
| 705 | # rproc start ${dev_copro}"00270033 |
| 706 | |
| 707 | b) Automatically by using FIT feature and generic DISTRO bootcmd |
| 708 | |
| 709 | see examples in the board stm32mp1 directory: fit_copro_kernel_dtb.its |
| 710 | |
Patrick Delaunay | 3e70d3c | 2021-07-26 11:21:37 +0200 | [diff] [blame] | 711 | Generate FIT including kernel + device tree + M4 firmware with cfg with M4 |
| 712 | boot:: |
Patrick Delaunay | 5f6fdcc | 2020-02-25 19:04:14 +0100 | [diff] [blame] | 713 | |
| 714 | $> mkimage -f fit_copro_kernel_dtb.its fit_copro_kernel_dtb.itb |
| 715 | |
| 716 | Then using DISTRO configuration file: see extlinux.conf to select the correct |
| 717 | configuration: |
| 718 | |
| 719 | - stm32mp157c-ev1-m4 |
| 720 | - stm32mp157c-dk2-m4 |
| 721 | |
| 722 | DFU support |
| 723 | ----------- |
| 724 | |
| 725 | The DFU is supported on ST board. |
| 726 | |
| 727 | The env variable dfu_alt_info is automatically build, and all |
| 728 | the memory present on the ST boards are exported. |
| 729 | |
| 730 | The dfu mode is started by the command:: |
| 731 | |
| 732 | STM32MP> dfu 0 |
| 733 | |
Patrick Delaunay | 3e70d3c | 2021-07-26 11:21:37 +0200 | [diff] [blame] | 734 | On EV1 board, booting from SD card, without OP-TEE_:: |
Patrick Delaunay | 5f6fdcc | 2020-02-25 19:04:14 +0100 | [diff] [blame] | 735 | |
| 736 | STM32MP> dfu 0 list |
| 737 | DFU alt settings list: |
| 738 | dev: RAM alt: 0 name: uImage layout: RAM_ADDR |
| 739 | dev: RAM alt: 1 name: devicetree.dtb layout: RAM_ADDR |
| 740 | dev: RAM alt: 2 name: uramdisk.image.gz layout: RAM_ADDR |
Patrick Delaunay | ccf64ef | 2020-03-18 09:22:54 +0100 | [diff] [blame] | 741 | dev: eMMC alt: 3 name: mmc0_fsbl1 layout: RAW_ADDR |
| 742 | dev: eMMC alt: 4 name: mmc0_fsbl2 layout: RAW_ADDR |
Patrick Delaunay | 3e70d3c | 2021-07-26 11:21:37 +0200 | [diff] [blame] | 743 | dev: eMMC alt: 5 name: mmc0_fip layout: RAW_ADDR |
Patrick Delaunay | ccf64ef | 2020-03-18 09:22:54 +0100 | [diff] [blame] | 744 | dev: eMMC alt: 6 name: mmc0_bootfs layout: RAW_ADDR |
| 745 | dev: eMMC alt: 7 name: mmc0_vendorfs layout: RAW_ADDR |
| 746 | dev: eMMC alt: 8 name: mmc0_rootfs layout: RAW_ADDR |
| 747 | dev: eMMC alt: 9 name: mmc0_userfs layout: RAW_ADDR |
| 748 | dev: eMMC alt: 10 name: mmc1_boot1 layout: RAW_ADDR |
| 749 | dev: eMMC alt: 11 name: mmc1_boot2 layout: RAW_ADDR |
Patrick Delaunay | 3e70d3c | 2021-07-26 11:21:37 +0200 | [diff] [blame] | 750 | dev: eMMC alt: 12 name: mmc1_fip layout: RAW_ADDR |
Patrick Delaunay | ccf64ef | 2020-03-18 09:22:54 +0100 | [diff] [blame] | 751 | dev: eMMC alt: 13 name: mmc1_bootfs layout: RAW_ADDR |
| 752 | dev: eMMC alt: 14 name: mmc1_vendorfs layout: RAW_ADDR |
| 753 | dev: eMMC alt: 15 name: mmc1_rootfs layout: RAW_ADDR |
| 754 | dev: eMMC alt: 16 name: mmc1_userfs layout: RAW_ADDR |
| 755 | dev: MTD alt: 17 name: nor0 layout: RAW_ADDR |
Patrick Delaunay | b82c97e | 2021-11-25 11:54:53 +0100 | [diff] [blame] | 756 | dev: MTD alt: 18 name: nor1 layout: RAW_ADDR |
| 757 | dev: MTD alt: 19 name: nand0 layout: RAW_ADDR |
| 758 | dev: VIRT alt: 20 name: OTP layout: RAW_ADDR |
| 759 | dev: VIRT alt: 21 name: PMIC layout: RAW_ADDR |
Patrick Delaunay | 5f6fdcc | 2020-02-25 19:04:14 +0100 | [diff] [blame] | 760 | |
| 761 | All the supported device are exported for dfu-util tool:: |
| 762 | |
| 763 | $> dfu-util -l |
Patrick Delaunay | b82c97e | 2021-11-25 11:54:53 +0100 | [diff] [blame] | 764 | Found DFU: [0483:df11] ver=9999, devnum=99, cfg=1, intf=0, alt=21, name="PMIC", serial="002700333338511934383330" |
| 765 | Found DFU: [0483:df11] ver=9999, devnum=99, cfg=1, intf=0, alt=20, name="OTP", serial="002700333338511934383330" |
| 766 | Found DFU: [0483:df11] ver=9999, devnum=99, cfg=1, intf=0, alt=19, name="nand0", serial="002700333338511934383330" |
| 767 | Found DFU: [0483:df11] ver=9999, devnum=99, cfg=1, intf=0, alt=18, name="nor1", serial="002700333338511934383330" |
Patrick Delaunay | ccf64ef | 2020-03-18 09:22:54 +0100 | [diff] [blame] | 768 | Found DFU: [0483:df11] ver=9999, devnum=99, cfg=1, intf=0, alt=17, name="nor0", serial="002700333338511934383330" |
| 769 | Found DFU: [0483:df11] ver=9999, devnum=99, cfg=1, intf=0, alt=16, name="mmc1_userfs", serial="002700333338511934383330" |
| 770 | Found DFU: [0483:df11] ver=9999, devnum=99, cfg=1, intf=0, alt=15, name="mmc1_rootfs", serial="002700333338511934383330" |
| 771 | Found DFU: [0483:df11] ver=9999, devnum=99, cfg=1, intf=0, alt=14, name="mmc1_vendorfs", serial="002700333338511934383330" |
| 772 | Found DFU: [0483:df11] ver=9999, devnum=99, cfg=1, intf=0, alt=13, name="mmc1_bootfs", serial="002700333338511934383330" |
Patrick Delaunay | 3e70d3c | 2021-07-26 11:21:37 +0200 | [diff] [blame] | 773 | Found DFU: [0483:df11] ver=9999, devnum=99, cfg=1, intf=0, alt=12, name="mmc1_fip", serial="002700333338511934383330" |
Patrick Delaunay | ccf64ef | 2020-03-18 09:22:54 +0100 | [diff] [blame] | 774 | Found DFU: [0483:df11] ver=9999, devnum=99, cfg=1, intf=0, alt=11, name="mmc1_boot2", serial="002700333338511934383330" |
| 775 | Found DFU: [0483:df11] ver=9999, devnum=99, cfg=1, intf=0, alt=10, name="mmc1_boot1", serial="002700333338511934383330" |
| 776 | Found DFU: [0483:df11] ver=9999, devnum=99, cfg=1, intf=0, alt=9, name="mmc0_userfs", serial="002700333338511934383330" |
| 777 | Found DFU: [0483:df11] ver=9999, devnum=99, cfg=1, intf=0, alt=8, name="mmc0_rootfs", serial="002700333338511934383330" |
| 778 | Found DFU: [0483:df11] ver=9999, devnum=99, cfg=1, intf=0, alt=7, name="mmc0_vendorfs", serial="002700333338511934383330" |
| 779 | Found DFU: [0483:df11] ver=9999, devnum=99, cfg=1, intf=0, alt=6, name="mmc0_bootfs", serial="002700333338511934383330" |
Patrick Delaunay | 3e70d3c | 2021-07-26 11:21:37 +0200 | [diff] [blame] | 780 | Found DFU: [0483:df11] ver=9999, devnum=99, cfg=1, intf=0, alt=5, name="mmc0_fip", serial="002700333338511934383330" |
Patrick Delaunay | ccf64ef | 2020-03-18 09:22:54 +0100 | [diff] [blame] | 781 | Found DFU: [0483:df11] ver=9999, devnum=99, cfg=1, intf=0, alt=4, name="mmc0_fsbl2", serial="002700333338511934383330" |
| 782 | Found DFU: [0483:df11] ver=9999, devnum=99, cfg=1, intf=0, alt=3, name="mmc0_fsbl1", serial="002700333338511934383330" |
| 783 | Found DFU: [0483:df11] ver=9999, devnum=99, cfg=1, intf=0, alt=2, name="uramdisk.image.gz", serial="002700333338511934383330" |
| 784 | Found DFU: [0483:df11] ver=9999, devnum=99, cfg=1, intf=0, alt=1, name="devicetree.dtb", serial="002700333338511934383330" |
| 785 | Found DFU: [0483:df11] ver=9999, devnum=99, cfg=1, intf=0, alt=0, name="uImage", serial="002700333338511934383330" |
Patrick Delaunay | 5f6fdcc | 2020-02-25 19:04:14 +0100 | [diff] [blame] | 786 | |
| 787 | You can update the boot device: |
| 788 | |
Patrick Delaunay | a1d36ed | 2022-05-20 18:24:54 +0200 | [diff] [blame] | 789 | - SD card (mmc0):: |
Patrick Delaunay | 5f6fdcc | 2020-02-25 19:04:14 +0100 | [diff] [blame] | 790 | |
Patrick Delaunay | 3e70d3c | 2021-07-26 11:21:37 +0200 | [diff] [blame] | 791 | $> dfu-util -d 0483:5720 -a 3 -D tf-a-stm32mp157c-ev1.stm32 |
| 792 | $> dfu-util -d 0483:5720 -a 4 -D tf-a-stm32mp157c-ev1.stm32 |
| 793 | $> dfu-util -d 0483:5720 -a 5 -D fip-stm32mp157c-ev1.bin |
Patrick Delaunay | 5f6fdcc | 2020-02-25 19:04:14 +0100 | [diff] [blame] | 794 | $> dfu-util -d 0483:5720 -a 6 -D st-image-bootfs-openstlinux-weston-stm32mp1.ext4 |
| 795 | $> dfu-util -d 0483:5720 -a 7 -D st-image-vendorfs-openstlinux-weston-stm32mp1.ext4 |
| 796 | $> dfu-util -d 0483:5720 -a 8 -D st-image-weston-openstlinux-weston-stm32mp1.ext4 |
| 797 | $> dfu-util -d 0483:5720 -a 9 -D st-image-userfs-openstlinux-weston-stm32mp1.ext4 |
| 798 | |
| 799 | - EMMC (mmc1):: |
| 800 | |
Patrick Delaunay | 3e70d3c | 2021-07-26 11:21:37 +0200 | [diff] [blame] | 801 | $> dfu-util -d 0483:5720 -a 10 -D tf-a-stm32mp157c-ev1.stm32 |
| 802 | $> dfu-util -d 0483:5720 -a 11 -D tf-a-stm32mp157c-ev1.stm32 |
| 803 | $> dfu-util -d 0483:5720 -a 12 -D fip-stm32mp157c-ev1.bin |
Patrick Delaunay | 5f6fdcc | 2020-02-25 19:04:14 +0100 | [diff] [blame] | 804 | $> dfu-util -d 0483:5720 -a 13 -D st-image-bootfs-openstlinux-weston-stm32mp1.ext4 |
| 805 | $> dfu-util -d 0483:5720 -a 14 -D st-image-vendorfs-openstlinux-weston-stm32mp1.ext4 |
| 806 | $> dfu-util -d 0483:5720 -a 15 -D st-image-weston-openstlinux-weston-stm32mp1.ext4 |
| 807 | $> dfu-util -d 0483:5720 -a 16 -D st-image-userfs-openstlinux-weston-stm32mp1.ext4 |
| 808 | |
Patrick Delaunay | ccf64ef | 2020-03-18 09:22:54 +0100 | [diff] [blame] | 809 | - you can also dump the OTP and the PMIC NVM with:: |
| 810 | |
| 811 | $> dfu-util -d 0483:5720 -a 19 -U otp.bin |
| 812 | $> dfu-util -d 0483:5720 -a 20 -U pmic.bin |
| 813 | |
Patrick Delaunay | 5f6fdcc | 2020-02-25 19:04:14 +0100 | [diff] [blame] | 814 | |
Patrick Delaunay | ccf64ef | 2020-03-18 09:22:54 +0100 | [diff] [blame] | 815 | When the board is booting for nor0 or nand0, |
| 816 | only the MTD partition on the boot devices are available, for example: |
Patrick Delaunay | 5f6fdcc | 2020-02-25 19:04:14 +0100 | [diff] [blame] | 817 | |
Patrick Delaunay | b82c97e | 2021-11-25 11:54:53 +0100 | [diff] [blame] | 818 | - NOR (nor0 = alt 20, nor1 = alt 26) & NAND (nand0 = alt 27) : |
Patrick Delaunay | 5f6fdcc | 2020-02-25 19:04:14 +0100 | [diff] [blame] | 819 | |
Patrick Delaunay | 3e70d3c | 2021-07-26 11:21:37 +0200 | [diff] [blame] | 820 | $> dfu-util -d 0483:5720 -a 21 -D tf-a-stm32mp157c-ev1.stm32 |
| 821 | $> dfu-util -d 0483:5720 -a 22 -D tf-a-stm32mp157c-ev1.stm32 |
| 822 | $> dfu-util -d 0483:5720 -a 23 -D fip-stm32mp157c-ev1.bin |
Patrick Delaunay | b82c97e | 2021-11-25 11:54:53 +0100 | [diff] [blame] | 823 | $> dfu-util -d 0483:5720 -a 28 -D st-image-weston-openstlinux-weston-stm32mp1_nand_4_256_multivolume.ubi |
Patrick Delaunay | 5f6fdcc | 2020-02-25 19:04:14 +0100 | [diff] [blame] | 824 | |
Patrick Delaunay | ccf64ef | 2020-03-18 09:22:54 +0100 | [diff] [blame] | 825 | - NAND (nand0 = alt 21):: |
Patrick Delaunay | 5f6fdcc | 2020-02-25 19:04:14 +0100 | [diff] [blame] | 826 | |
Patrick Delaunay | 3e70d3c | 2021-07-26 11:21:37 +0200 | [diff] [blame] | 827 | $> dfu-util -d 0483:5720 -a 22 -D tf-a-stm32mp157c-ev1.stm32 |
| 828 | $> dfu-util -d 0483:5720 -a 23 -D fip-stm32mp157c-ev1.bin |
| 829 | $> dfu-util -d 0483:5720 -a 24 -D fip-stm32mp157c-ev1.bin |
Patrick Delaunay | ccf64ef | 2020-03-18 09:22:54 +0100 | [diff] [blame] | 830 | $> dfu-util -d 0483:5720 -a 25 -D st-image-weston-openstlinux-weston-stm32mp1_nand_4_256_multivolume.ubi |
Patrick Delaunay | 3e70d3c | 2021-07-26 11:21:37 +0200 | [diff] [blame] | 831 | |
| 832 | References |
| 833 | ---------- |
| 834 | |
| 835 | .. _WIKI: |
| 836 | |
| 837 | STM32 Arm® Cortex®-based MPUs user guide |
| 838 | |
| 839 | + https://wiki.st.com/ |
| 840 | + https://wiki.st.com/stm32mpu/wiki/Main_Page |
| 841 | |
| 842 | .. _TF-A: |
| 843 | |
| 844 | TF-A = The Trusted Firmware-A project provides a reference implementation of |
| 845 | secure world software for Armv7-A and Armv8-A class processors |
| 846 | |
| 847 | + https://www.trustedfirmware.org/projects/tf-a/ |
| 848 | + https://trustedfirmware-a.readthedocs.io/en/latest/ |
| 849 | + https://trustedfirmware-a.readthedocs.io/en/latest/plat/stm32mp1.html |
| 850 | + https://git.trustedfirmware.org/TF-A/trusted-firmware-a.git/ |
| 851 | |
| 852 | .. _OP-TEE: |
| 853 | |
| 854 | OP-TEE = an open source Trusted Execution Environment (TEE) implementing the |
| 855 | Arm TrustZone technology |
| 856 | |
| 857 | + https://www.op-tee.org/ |
| 858 | + https://optee.readthedocs.io/en/latest/ |
| 859 | + https://optee.readthedocs.io/en/latest/building/devices/stm32mp1.html |
| 860 | + https://github.com/OP-TEE/optee_os |