Patrick Delaunay | efa667d | 2020-02-25 19:04:14 +0100 | [diff] [blame] | 1 | .. SPDX-License-Identifier: GPL-2.0+ OR BSD-3-Clause |
Patrice Chotard | 7ccaa31 | 2021-01-04 17:00:56 +0100 | [diff] [blame] | 2 | .. sectionauthor:: Patrick Delaunay <patrick.delaunay@foss.st.com> |
Patrick Delaunay | efa667d | 2020-02-25 19:04:14 +0100 | [diff] [blame] | 3 | |
| 4 | STM32MP15x boards |
| 5 | ================= |
| 6 | |
| 7 | This is a quick instruction for setup STM32MP15x boards. |
| 8 | |
| 9 | Supported devices |
| 10 | ----------------- |
| 11 | |
| 12 | U-Boot supports STMP32MP15x SoCs: |
| 13 | |
| 14 | - STM32MP157 |
| 15 | - STM32MP153 |
| 16 | - STM32MP151 |
| 17 | |
| 18 | The STM32MP15x is a Cortex-A MPU aimed at various applications. |
| 19 | |
| 20 | It features: |
| 21 | |
| 22 | - Dual core Cortex-A7 application core (Single on STM32MP151) |
| 23 | - 2D/3D image composition with GPU (only on STM32MP157) |
| 24 | - Standard memories interface support |
| 25 | - Standard connectivity, widely inherited from the STM32 MCU family |
| 26 | - Comprehensive security support |
| 27 | |
Patrick Delaunay | 050fed8 | 2020-02-26 11:26:43 +0100 | [diff] [blame] | 28 | Each line comes with a security option (cryptography & secure boot) and |
| 29 | a Cortex-A frequency option: |
| 30 | |
| 31 | - A : Cortex-A7 @ 650 MHz |
| 32 | - C : Secure Boot + HW Crypto + Cortex-A7 @ 650 MHz |
| 33 | - D : Cortex-A7 @ 800 MHz |
| 34 | - F : Secure Boot + HW Crypto + Cortex-A7 @ 800 MHz |
| 35 | |
Patrick Delaunay | efa667d | 2020-02-25 19:04:14 +0100 | [diff] [blame] | 36 | Everything is supported in Linux but U-Boot is limited to: |
| 37 | |
| 38 | 1. UART |
| 39 | 2. SD card/MMC controller (SDMMC) |
| 40 | 3. NAND controller (FMC) |
| 41 | 4. NOR controller (QSPI) |
| 42 | 5. USB controller (OTG DWC2) |
| 43 | 6. Ethernet controller |
| 44 | |
| 45 | And the necessary drivers |
| 46 | |
| 47 | 1. I2C |
| 48 | 2. STPMIC1 (PMIC and regulator) |
| 49 | 3. Clock, Reset, Sysreset |
| 50 | 4. Fuse |
| 51 | |
| 52 | Currently the following boards are supported: |
| 53 | |
Patrick Delaunay | efa667d | 2020-02-25 19:04:14 +0100 | [diff] [blame] | 54 | + stm32mp157a-dk1.dts |
| 55 | + stm32mp157c-dk2.dts |
| 56 | + stm32mp157c-ed1.dts |
| 57 | + stm32mp157c-ev1.dts |
Marek Vasut | 132e5b6 | 2020-03-31 19:51:36 +0200 | [diff] [blame] | 58 | + stm32mp15xx-dhcor-avenger96.dts |
Patrick Delaunay | efa667d | 2020-02-25 19:04:14 +0100 | [diff] [blame] | 59 | |
| 60 | Boot Sequences |
| 61 | -------------- |
| 62 | |
| 63 | 3 boot configurations are supported with: |
| 64 | |
| 65 | +----------+------------------------+-------------------------+--------------+ |
| 66 | | **ROM** | **FSBL** | **SSBL** | **OS** | |
| 67 | + **code** +------------------------+-------------------------+--------------+ |
| 68 | | | First Stage Bootloader | Second Stage Bootloader | Linux Kernel | |
| 69 | + +------------------------+-------------------------+--------------+ |
| 70 | | | embedded RAM | DDR | |
| 71 | +----------+------------------------+-------------------------+--------------+ |
| 72 | |
| 73 | The **Trusted** boot chain |
| 74 | `````````````````````````` |
| 75 | |
| 76 | defconfig_file : stm32mp15_trusted_defconfig |
| 77 | |
| 78 | +-------------+-------------------------+------------+-------+ |
| 79 | | ROM code | FSBL | SSBL | OS | |
| 80 | + +-------------------------+------------+-------+ |
| 81 | | |Trusted Firmware-A (TF-A)| U-Boot | Linux | |
| 82 | +-------------+-------------------------+------------+-------+ |
Patrick Delaunay | ccf6e9f | 2020-03-18 09:22:51 +0100 | [diff] [blame] | 83 | | TrustZone |secure monitor | |
Patrick Delaunay | efa667d | 2020-02-25 19:04:14 +0100 | [diff] [blame] | 84 | +-------------+-------------------------+------------+-------+ |
| 85 | |
| 86 | TF-A performs a full initialization of Secure peripherals and installs a |
Patrick Delaunay | ccf6e9f | 2020-03-18 09:22:51 +0100 | [diff] [blame] | 87 | secure monitor, BL32: |
Patrick Delaunay | efa667d | 2020-02-25 19:04:14 +0100 | [diff] [blame] | 88 | |
Patrick Delaunay | ccf6e9f | 2020-03-18 09:22:51 +0100 | [diff] [blame] | 89 | * SPMin provided by TF-A or |
| 90 | * OP-TEE from specific partitions (teeh, teed, teex). |
Patrick Delaunay | efa667d | 2020-02-25 19:04:14 +0100 | [diff] [blame] | 91 | |
Patrick Delaunay | ccf6e9f | 2020-03-18 09:22:51 +0100 | [diff] [blame] | 92 | U-Boot is running in normal world and uses the secure monitor to access |
Patrick Delaunay | efa667d | 2020-02-25 19:04:14 +0100 | [diff] [blame] | 93 | to secure resources. |
| 94 | |
| 95 | The **Basic** boot chain |
| 96 | ```````````````````````` |
| 97 | |
| 98 | defconfig_file : stm32mp15_basic_defconfig |
| 99 | |
| 100 | +-------------+------------+------------+-------+ |
| 101 | | ROM code | FSBL | SSBL | OS | |
| 102 | + +------------+------------+-------+ |
| 103 | | |U-Boot SPL | U-Boot | Linux | |
| 104 | +-------------+------------+------------+-------+ |
| 105 | | TrustZone | | PSCI from U-Boot | |
| 106 | +-------------+------------+------------+-------+ |
| 107 | |
| 108 | SPL has limited security initialization |
| 109 | |
| 110 | U-Boot is running in secure mode and provide a secure monitor to the kernel |
| 111 | with only PSCI support (Power State Coordination Interface defined by ARM). |
| 112 | |
| 113 | All the STM32MP15x boards supported by U-Boot use the same generic board |
| 114 | stm32mp1 which support all the bootable devices. |
| 115 | |
| 116 | Each board is configured only with the associated device tree. |
| 117 | |
| 118 | Device Tree Selection |
| 119 | --------------------- |
| 120 | |
| 121 | You need to select the appropriate device tree for your board, |
| 122 | the supported device trees for STM32MP15x are: |
| 123 | |
| 124 | + ev1: eval board with pmic stpmic1 (ev1 = mother board + daughter ed1) |
| 125 | |
| 126 | + stm32mp157c-ev1 |
| 127 | |
| 128 | + ed1: daughter board with pmic stpmic1 |
| 129 | |
| 130 | + stm32mp157c-ed1 |
| 131 | |
| 132 | + dk1: Discovery board |
| 133 | |
| 134 | + stm32mp157a-dk1 |
| 135 | |
| 136 | + dk2: Discovery board = dk1 with a BT/WiFI combo and a DSI panel |
| 137 | |
| 138 | + stm32mp157c-dk2 |
| 139 | |
Marek Vasut | 132e5b6 | 2020-03-31 19:51:36 +0200 | [diff] [blame] | 140 | + avenger96: Avenger96 board from Arrow Electronics based on DH Elec. DHCOR SoM |
Patrick Delaunay | efa667d | 2020-02-25 19:04:14 +0100 | [diff] [blame] | 141 | |
Marek Vasut | 132e5b6 | 2020-03-31 19:51:36 +0200 | [diff] [blame] | 142 | + stm32mp15xx-dhcor-avenger96 |
Patrick Delaunay | efa667d | 2020-02-25 19:04:14 +0100 | [diff] [blame] | 143 | |
| 144 | Build Procedure |
| 145 | --------------- |
| 146 | |
| 147 | 1. Install the required tools for U-Boot |
| 148 | |
| 149 | * install package needed in U-Boot makefile |
| 150 | (libssl-dev, swig, libpython-dev...) |
| 151 | |
| 152 | * install ARMv7 toolchain for 32bit Cortex-A (from Linaro, |
| 153 | from SDK for STM32MP15x, or any crosstoolchains from your distribution) |
| 154 | (you can use any gcc cross compiler compatible with U-Boot) |
| 155 | |
| 156 | 2. Set the cross compiler:: |
| 157 | |
| 158 | # export CROSS_COMPILE=/path/to/toolchain/arm-linux-gnueabi- |
| 159 | |
| 160 | 3. Select the output directory (optional):: |
| 161 | |
| 162 | # export KBUILD_OUTPUT=/path/to/output |
| 163 | |
| 164 | for example: use one output directory for each configuration:: |
| 165 | |
| 166 | # export KBUILD_OUTPUT=stm32mp15_trusted |
Patrick Delaunay | efa667d | 2020-02-25 19:04:14 +0100 | [diff] [blame] | 167 | # export KBUILD_OUTPUT=stm32mp15_basic |
| 168 | |
| 169 | you can build outside of code directory:: |
| 170 | |
| 171 | # export KBUILD_OUTPUT=../build/stm32mp15_trusted |
| 172 | |
| 173 | 4. Configure U-Boot:: |
| 174 | |
| 175 | # make <defconfig_file> |
| 176 | |
| 177 | with <defconfig_file>: |
| 178 | |
| 179 | - For **trusted** boot mode : **stm32mp15_trusted_defconfig** |
Patrick Delaunay | efa667d | 2020-02-25 19:04:14 +0100 | [diff] [blame] | 180 | - For basic boot mode: stm32mp15_basic_defconfig |
| 181 | |
| 182 | 5. Configure the device-tree and build the U-Boot image:: |
| 183 | |
| 184 | # make DEVICE_TREE=<name> all |
| 185 | |
| 186 | Examples: |
| 187 | |
| 188 | a) trusted boot on ev1:: |
| 189 | |
| 190 | # export KBUILD_OUTPUT=stm32mp15_trusted |
| 191 | # make stm32mp15_trusted_defconfig |
| 192 | # make DEVICE_TREE=stm32mp157c-ev1 all |
| 193 | |
| 194 | b) trusted with OP-TEE boot on dk2:: |
| 195 | |
Patrick Delaunay | ccf6e9f | 2020-03-18 09:22:51 +0100 | [diff] [blame] | 196 | # export KBUILD_OUTPUT=stm32mp15_trusted |
| 197 | # make stm32mp15_trusted_defconfig |
Patrick Delaunay | efa667d | 2020-02-25 19:04:14 +0100 | [diff] [blame] | 198 | # make DEVICE_TREE=stm32mp157c-dk2 all |
| 199 | |
| 200 | c) basic boot on ev1:: |
| 201 | |
| 202 | # export KBUILD_OUTPUT=stm32mp15_basic |
| 203 | # make stm32mp15_basic_defconfig |
| 204 | # make DEVICE_TREE=stm32mp157c-ev1 all |
| 205 | |
| 206 | d) basic boot on ed1:: |
| 207 | |
| 208 | # export KBUILD_OUTPUT=stm32mp15_basic |
| 209 | # make stm32mp15_basic_defconfig |
| 210 | # make DEVICE_TREE=stm32mp157c-ed1 all |
| 211 | |
| 212 | e) basic boot on dk1:: |
| 213 | |
| 214 | # export KBUILD_OUTPUT=stm32mp15_basic |
| 215 | # make stm32mp15_basic_defconfig |
| 216 | # make DEVICE_TREE=stm32mp157a-dk1 all |
| 217 | |
| 218 | f) basic boot on avenger96:: |
| 219 | |
| 220 | # export KBUILD_OUTPUT=stm32mp15_basic |
| 221 | # make stm32mp15_basic_defconfig |
Marek Vasut | 132e5b6 | 2020-03-31 19:51:36 +0200 | [diff] [blame] | 222 | # make DEVICE_TREE=stm32mp15xx-dhcor-avenger96 all |
Patrick Delaunay | efa667d | 2020-02-25 19:04:14 +0100 | [diff] [blame] | 223 | |
| 224 | 6. Output files |
| 225 | |
| 226 | BootRom and TF-A expect binaries with STM32 image header |
| 227 | SPL expects file with U-Boot uImage header |
| 228 | |
| 229 | So in the output directory (selected by KBUILD_OUTPUT), |
| 230 | you can found the needed files: |
| 231 | |
| 232 | - For **Trusted** boot (with or without OP-TEE) |
| 233 | |
| 234 | - FSBL = **tf-a.stm32** (provided by TF-A compilation) |
| 235 | - SSBL = **u-boot.stm32** |
| 236 | |
| 237 | - For Basic boot |
| 238 | |
| 239 | - FSBL = spl/u-boot-spl.stm32 |
Marek Vasut | b076cbe | 2021-03-06 21:44:17 +0100 | [diff] [blame] | 240 | - SSBL = u-boot.img (without CONFIG_SPL_LOAD_FIT) or |
| 241 | u-boot.itb (with CONFIG_SPL_LOAD_FIT=y) |
Patrick Delaunay | efa667d | 2020-02-25 19:04:14 +0100 | [diff] [blame] | 242 | |
| 243 | Switch Setting for Boot Mode |
| 244 | ---------------------------- |
| 245 | |
| 246 | You can select the boot mode, on the board with one switch, to select |
| 247 | the boot pin values = BOOT0, BOOT1, BOOT2 |
| 248 | |
| 249 | +-------------+---------+---------+---------+ |
| 250 | |*Boot Mode* | *BOOT2* | *BOOT1* | *BOOT0* | |
| 251 | +=============+=========+=========+=========+ |
| 252 | | Recovery | 0 | 0 | 0 | |
| 253 | +-------------+---------+---------+---------+ |
| 254 | | NOR | 0 | 0 | 1 | |
| 255 | +-------------+---------+---------+---------+ |
| 256 | | eMMC | 0 | 1 | 0 | |
| 257 | +-------------+---------+---------+---------+ |
| 258 | | NAND | 0 | 1 | 1 | |
| 259 | +-------------+---------+---------+---------+ |
| 260 | | Reserved | 1 | 0 | 0 | |
| 261 | +-------------+---------+---------+---------+ |
| 262 | | SD-Card | 1 | 0 | 1 | |
| 263 | +-------------+---------+---------+---------+ |
| 264 | | Recovery | 1 | 1 | 0 | |
| 265 | +-------------+---------+---------+---------+ |
| 266 | | SPI-NAND | 1 | 1 | 1 | |
| 267 | +-------------+---------+---------+---------+ |
| 268 | |
| 269 | - on the **daugther board ed1 = MB1263** with the switch SW1 |
| 270 | - on **Avenger96** with switch S3 (NOR and SPI-NAND are not applicable) |
| 271 | - on board **DK1/DK2** with the switch SW1 = BOOT0, BOOT2 |
| 272 | with only 2 pins available (BOOT1 is forced to 0 and NOR not supported), |
| 273 | the possible value becomes: |
| 274 | |
| 275 | +-------------+---------+---------+ |
| 276 | |*Boot Mode* | *BOOT2* | *BOOT0* | |
| 277 | +=============+=========+=========+ |
| 278 | | Recovery | 0 | 0 | |
| 279 | +-------------+---------+---------+ |
| 280 | | NOR (NA)| 0 | 1 | |
| 281 | +-------------+---------+---------+ |
| 282 | | Reserved | 1 | 0 | |
| 283 | +-------------+---------+---------+ |
| 284 | | SD-Card | 1 | 1 | |
| 285 | +-------------+---------+---------+ |
| 286 | |
| 287 | Recovery is a boot from serial link (UART/USB) and it is used with |
| 288 | STM32CubeProgrammer tool to load executable in RAM and to update the flash |
| 289 | devices available on the board (NOR/NAND/eMMC/SD card). |
| 290 | |
| 291 | The communication between HOST and board is based on |
| 292 | |
| 293 | - for UARTs : the uart protocol used with all MCU STM32 |
| 294 | - for USB : based on USB DFU 1.1 (without the ST extensions used on MCU STM32) |
| 295 | |
| 296 | Prepare an SD card |
| 297 | ------------------ |
| 298 | |
| 299 | The minimal requirements for STMP32MP15x boot up to U-Boot are: |
| 300 | |
| 301 | - GPT partitioning (with gdisk or with sgdisk) |
| 302 | - 2 fsbl partitions, named fsbl1 and fsbl2, size at least 256KiB |
| 303 | - one ssbl partition for U-Boot |
| 304 | |
| 305 | Then the minimal GPT partition is: |
| 306 | |
| 307 | +-------+--------+---------+-------------+ |
| 308 | | *Num* | *Name* | *Size* | *Content* | |
| 309 | +=======+========+=========+=============+ |
| 310 | | 1 | fsbl1 | 256 KiB | TF-A or SPL | |
| 311 | +-------+--------+---------+-------------+ |
| 312 | | 2 | fsbl2 | 256 KiB | TF-A or SPL | |
| 313 | +-------+--------+---------+-------------+ |
| 314 | | 3 | ssbl | enought | U-Boot | |
| 315 | +-------+--------+---------+-------------+ |
| 316 | | 4 | <any> | <any> | Rootfs | |
| 317 | +-------+--------+---------+-------------+ |
| 318 | |
| 319 | Add a 4th partition (Rootfs) marked bootable with a file extlinux.conf |
| 320 | following the Generic Distribution feature (doc/README.distro for use). |
| 321 | |
| 322 | According the used card reader select the correct block device |
| 323 | (for example /dev/sdx or /dev/mmcblk0). |
| 324 | |
| 325 | In the next example, it is /dev/mmcblk0 |
| 326 | |
| 327 | For example: with gpt table with 128 entries |
| 328 | |
| 329 | a) remove previous formatting:: |
| 330 | |
| 331 | # sgdisk -o /dev/<SD card dev> |
| 332 | |
| 333 | b) create minimal image:: |
| 334 | |
| 335 | # sgdisk --resize-table=128 -a 1 \ |
| 336 | -n 1:34:545 -c 1:fsbl1 \ |
| 337 | -n 2:546:1057 -c 2:fsbl2 \ |
| 338 | -n 3:1058:5153 -c 3:ssbl \ |
| 339 | -n 4:5154: -c 4:rootfs \ |
| 340 | -p /dev/<SD card dev> |
| 341 | |
| 342 | With other partition for kernel one partition rootfs for kernel. |
| 343 | |
| 344 | c) copy the FSBL (2 times) and SSBL file on the correct partition. |
| 345 | in this example in partition 1 to 3 |
| 346 | |
| 347 | for basic boot mode : <SD card dev> = /dev/mmcblk0:: |
| 348 | |
| 349 | # dd if=u-boot-spl.stm32 of=/dev/mmcblk0p1 |
| 350 | # dd if=u-boot-spl.stm32 of=/dev/mmcblk0p2 |
Marek Vasut | b076cbe | 2021-03-06 21:44:17 +0100 | [diff] [blame] | 351 | # dd if=u-boot.img of=/dev/mmcblk0p3 # Without CONFIG_SPL_LOAD_FIT |
| 352 | OR |
| 353 | dd if=u-boot.itb of=/dev/mmcblk0p3 # With CONFIG_SPL_LOAD_FIT=y |
Patrick Delaunay | efa667d | 2020-02-25 19:04:14 +0100 | [diff] [blame] | 354 | |
| 355 | for trusted boot mode: :: |
| 356 | |
| 357 | # dd if=tf-a.stm32 of=/dev/mmcblk0p1 |
| 358 | # dd if=tf-a.stm32 of=/dev/mmcblk0p2 |
| 359 | # dd if=u-boot.stm32 of=/dev/mmcblk0p3 |
| 360 | |
| 361 | To boot from SD card, select BootPinMode = 1 0 1 and reset. |
| 362 | |
| 363 | Prepare eMMC |
| 364 | ------------ |
| 365 | |
| 366 | You can use U-Boot to copy binary in eMMC. |
| 367 | |
| 368 | In the next example, you need to boot from SD card and the images |
Marek Vasut | b076cbe | 2021-03-06 21:44:17 +0100 | [diff] [blame] | 369 | (u-boot-spl.stm32, u-boot.img for systems without CONFIG_SPL_LOAD_FIT |
| 370 | or u-boot.itb for systems with CONFIG_SPL_LOAD_FIT=y) are presents on |
| 371 | SD card (mmc 0) in ext4 partition 4 (bootfs). |
Patrick Delaunay | efa667d | 2020-02-25 19:04:14 +0100 | [diff] [blame] | 372 | |
| 373 | To boot from SD card, select BootPinMode = 1 0 1 and reset. |
| 374 | |
| 375 | Then you update the eMMC with the next U-Boot command : |
| 376 | |
| 377 | a) prepare GPT on eMMC, |
| 378 | example with 2 partitions, bootfs and roots:: |
| 379 | |
| 380 | # setenv emmc_part "name=ssbl,size=2MiB;name=bootfs,type=linux,bootable,size=64MiB;name=rootfs,type=linux,size=512" |
| 381 | # gpt write mmc 1 ${emmc_part} |
| 382 | |
| 383 | b) copy SPL on eMMC on firts boot partition |
| 384 | (SPL max size is 256kB, with LBA 512, 0x200):: |
| 385 | |
| 386 | # ext4load mmc 0:4 0xC0000000 u-boot-spl.stm32 |
| 387 | # mmc dev 1 |
| 388 | # mmc partconf 1 1 1 1 |
| 389 | # mmc write ${fileaddr} 0 200 |
| 390 | # mmc partconf 1 1 1 0 |
| 391 | |
| 392 | c) copy U-Boot in first GPT partition of eMMC:: |
| 393 | |
Marek Vasut | b076cbe | 2021-03-06 21:44:17 +0100 | [diff] [blame] | 394 | # ext4load mmc 0:4 0xC0000000 u-boot.img # Without CONFIG_SPL_LOAD_FIT |
| 395 | OR |
| 396 | ext4load mmc 0:4 0xC0000000 u-boot.itb # With CONFIG_SPL_LOAD_FIT=y |
Patrick Delaunay | efa667d | 2020-02-25 19:04:14 +0100 | [diff] [blame] | 397 | # mmc dev 1 |
| 398 | # part start mmc 1 1 partstart |
| 399 | # mmc write ${fileaddr} ${partstart} ${filesize} |
| 400 | |
| 401 | To boot from eMMC, select BootPinMode = 0 1 0 and reset. |
| 402 | |
| 403 | MAC Address |
| 404 | ----------- |
| 405 | |
| 406 | Please read doc/README.enetaddr for the implementation guidelines for mac id |
| 407 | usage. Basically, environment has precedence over board specific storage. |
| 408 | |
| 409 | For STMicroelectonics board, it is retrieved in STM32MP15x OTP : |
| 410 | |
| 411 | - OTP_57[31:0] = MAC_ADDR[31:0] |
| 412 | - OTP_58[15:0] = MAC_ADDR[47:32] |
| 413 | |
| 414 | To program a MAC address on virgin OTP words above, you can use the fuse command |
Patrick Delaunay | 7ae22d7 | 2020-02-12 19:37:38 +0100 | [diff] [blame] | 415 | on bank 0 to access to internal OTP and lock them: |
Patrick Delaunay | efa667d | 2020-02-25 19:04:14 +0100 | [diff] [blame] | 416 | |
| 417 | Prerequisite: check if a MAC address isn't yet programmed in OTP |
| 418 | |
Patrick Delaunay | 7ae22d7 | 2020-02-12 19:37:38 +0100 | [diff] [blame] | 419 | 1) check OTP: their value must be equal to 0:: |
Patrick Delaunay | efa667d | 2020-02-25 19:04:14 +0100 | [diff] [blame] | 420 | |
Patrick Delaunay | 7ae22d7 | 2020-02-12 19:37:38 +0100 | [diff] [blame] | 421 | STM32MP> fuse sense 0 57 2 |
| 422 | Sensing bank 0: |
| 423 | Word 0x00000039: 00000000 00000000 |
Patrick Delaunay | efa667d | 2020-02-25 19:04:14 +0100 | [diff] [blame] | 424 | |
Patrick Delaunay | 7ae22d7 | 2020-02-12 19:37:38 +0100 | [diff] [blame] | 425 | 2) check environment variable:: |
Patrick Delaunay | efa667d | 2020-02-25 19:04:14 +0100 | [diff] [blame] | 426 | |
Patrick Delaunay | 7ae22d7 | 2020-02-12 19:37:38 +0100 | [diff] [blame] | 427 | STM32MP> env print ethaddr |
| 428 | ## Error: "ethaddr" not defined |
| 429 | |
| 430 | 3) check lock status of fuse 57 & 58 (at 0x39, 0=unlocked, 1=locked):: |
| 431 | |
| 432 | STM32MP> fuse sense 0 0x10000039 2 |
| 433 | Sensing bank 0: |
| 434 | Word 0x10000039: 00000000 00000000 |
Patrick Delaunay | efa667d | 2020-02-25 19:04:14 +0100 | [diff] [blame] | 435 | |
| 436 | Example to set mac address "12:34:56:78:9a:bc" |
| 437 | |
| 438 | 1) Write OTP:: |
| 439 | |
| 440 | STM32MP> fuse prog -y 0 57 0x78563412 0x0000bc9a |
| 441 | |
| 442 | 2) Read OTP:: |
| 443 | |
| 444 | STM32MP> fuse sense 0 57 2 |
| 445 | Sensing bank 0: |
| 446 | Word 0x00000039: 78563412 0000bc9a |
| 447 | |
Patrick Delaunay | 7ae22d7 | 2020-02-12 19:37:38 +0100 | [diff] [blame] | 448 | 3) Lock OTP:: |
| 449 | |
| 450 | STM32MP> fuse prog 0 0x10000039 1 1 |
| 451 | |
| 452 | STM32MP> fuse sense 0 0x10000039 2 |
| 453 | Sensing bank 0: |
| 454 | Word 0x10000039: 00000001 00000001 |
| 455 | |
| 456 | 4) next REBOOT, in the trace:: |
Patrick Delaunay | efa667d | 2020-02-25 19:04:14 +0100 | [diff] [blame] | 457 | |
| 458 | ### Setting environment from OTP MAC address = "12:34:56:78:9a:bc" |
| 459 | |
Patrick Delaunay | 7ae22d7 | 2020-02-12 19:37:38 +0100 | [diff] [blame] | 460 | 5) check env update:: |
Patrick Delaunay | efa667d | 2020-02-25 19:04:14 +0100 | [diff] [blame] | 461 | |
| 462 | STM32MP> env print ethaddr |
| 463 | ethaddr=12:34:56:78:9a:bc |
| 464 | |
| 465 | .. warning:: This command can't be executed twice on the same board as |
| 466 | OTP are protected. It is already done for the board |
| 467 | provided by STMicroelectronics. |
| 468 | |
| 469 | Coprocessor firmware |
| 470 | -------------------- |
| 471 | |
| 472 | U-Boot can boot the coprocessor before the kernel (coprocessor early boot). |
| 473 | |
| 474 | a) Manuallly by using rproc commands (update the bootcmd) |
| 475 | |
| 476 | Configurations:: |
| 477 | |
| 478 | # env set name_copro "rproc-m4-fw.elf" |
| 479 | # env set dev_copro 0 |
| 480 | # env set loadaddr_copro 0xC1000000 |
| 481 | |
| 482 | Load binary from bootfs partition (number 4) on SD card (mmc 0):: |
| 483 | |
| 484 | # ext4load mmc 0:4 ${loadaddr_copro} ${name_copro} |
| 485 | |
| 486 | => ${filesize} variable is updated with the size of the loaded file. |
| 487 | |
| 488 | Start M4 firmware with remote proc command:: |
| 489 | |
| 490 | # rproc init |
| 491 | # rproc load ${dev_copro} ${loadaddr_copro} ${filesize} |
| 492 | # rproc start ${dev_copro}"00270033 |
| 493 | |
| 494 | b) Automatically by using FIT feature and generic DISTRO bootcmd |
| 495 | |
| 496 | see examples in the board stm32mp1 directory: fit_copro_kernel_dtb.its |
| 497 | |
| 498 | Generate FIT including kernel + device tree + M4 firmware with cfg with M4 boot:: |
| 499 | |
| 500 | $> mkimage -f fit_copro_kernel_dtb.its fit_copro_kernel_dtb.itb |
| 501 | |
| 502 | Then using DISTRO configuration file: see extlinux.conf to select the correct |
| 503 | configuration: |
| 504 | |
| 505 | - stm32mp157c-ev1-m4 |
| 506 | - stm32mp157c-dk2-m4 |
| 507 | |
| 508 | DFU support |
| 509 | ----------- |
| 510 | |
| 511 | The DFU is supported on ST board. |
| 512 | |
| 513 | The env variable dfu_alt_info is automatically build, and all |
| 514 | the memory present on the ST boards are exported. |
| 515 | |
| 516 | The dfu mode is started by the command:: |
| 517 | |
| 518 | STM32MP> dfu 0 |
| 519 | |
| 520 | On EV1 board, booting from SD card, without OP-TEE:: |
| 521 | |
| 522 | STM32MP> dfu 0 list |
| 523 | DFU alt settings list: |
| 524 | dev: RAM alt: 0 name: uImage layout: RAM_ADDR |
| 525 | dev: RAM alt: 1 name: devicetree.dtb layout: RAM_ADDR |
| 526 | dev: RAM alt: 2 name: uramdisk.image.gz layout: RAM_ADDR |
Patrick Delaunay | 1a803f6 | 2020-03-18 09:22:54 +0100 | [diff] [blame] | 527 | dev: eMMC alt: 3 name: mmc0_fsbl1 layout: RAW_ADDR |
| 528 | dev: eMMC alt: 4 name: mmc0_fsbl2 layout: RAW_ADDR |
| 529 | dev: eMMC alt: 5 name: mmc0_ssbl layout: RAW_ADDR |
| 530 | dev: eMMC alt: 6 name: mmc0_bootfs layout: RAW_ADDR |
| 531 | dev: eMMC alt: 7 name: mmc0_vendorfs layout: RAW_ADDR |
| 532 | dev: eMMC alt: 8 name: mmc0_rootfs layout: RAW_ADDR |
| 533 | dev: eMMC alt: 9 name: mmc0_userfs layout: RAW_ADDR |
| 534 | dev: eMMC alt: 10 name: mmc1_boot1 layout: RAW_ADDR |
| 535 | dev: eMMC alt: 11 name: mmc1_boot2 layout: RAW_ADDR |
| 536 | dev: eMMC alt: 12 name: mmc1_ssbl layout: RAW_ADDR |
| 537 | dev: eMMC alt: 13 name: mmc1_bootfs layout: RAW_ADDR |
| 538 | dev: eMMC alt: 14 name: mmc1_vendorfs layout: RAW_ADDR |
| 539 | dev: eMMC alt: 15 name: mmc1_rootfs layout: RAW_ADDR |
| 540 | dev: eMMC alt: 16 name: mmc1_userfs layout: RAW_ADDR |
| 541 | dev: MTD alt: 17 name: nor0 layout: RAW_ADDR |
| 542 | dev: MTD alt: 18 name: nand0 layout: RAW_ADDR |
| 543 | dev: VIRT alt: 19 name: OTP layout: RAW_ADDR |
| 544 | dev: VIRT alt: 20 name: PMIC layout: RAW_ADDR |
Patrick Delaunay | efa667d | 2020-02-25 19:04:14 +0100 | [diff] [blame] | 545 | |
| 546 | All the supported device are exported for dfu-util tool:: |
| 547 | |
| 548 | $> dfu-util -l |
Patrick Delaunay | 1a803f6 | 2020-03-18 09:22:54 +0100 | [diff] [blame] | 549 | Found DFU: [0483:df11] ver=9999, devnum=99, cfg=1, intf=0, alt=20, name="PMIC", serial="002700333338511934383330" |
| 550 | Found DFU: [0483:df11] ver=9999, devnum=99, cfg=1, intf=0, alt=19, name="OTP", serial="002700333338511934383330" |
| 551 | Found DFU: [0483:df11] ver=9999, devnum=99, cfg=1, intf=0, alt=18, name="nand0", serial="002700333338511934383330" |
| 552 | Found DFU: [0483:df11] ver=9999, devnum=99, cfg=1, intf=0, alt=17, name="nor0", serial="002700333338511934383330" |
| 553 | Found DFU: [0483:df11] ver=9999, devnum=99, cfg=1, intf=0, alt=16, name="mmc1_userfs", serial="002700333338511934383330" |
| 554 | Found DFU: [0483:df11] ver=9999, devnum=99, cfg=1, intf=0, alt=15, name="mmc1_rootfs", serial="002700333338511934383330" |
| 555 | Found DFU: [0483:df11] ver=9999, devnum=99, cfg=1, intf=0, alt=14, name="mmc1_vendorfs", serial="002700333338511934383330" |
| 556 | Found DFU: [0483:df11] ver=9999, devnum=99, cfg=1, intf=0, alt=13, name="mmc1_bootfs", serial="002700333338511934383330" |
| 557 | Found DFU: [0483:df11] ver=9999, devnum=99, cfg=1, intf=0, alt=12, name="mmc1_ssbl", serial="002700333338511934383330" |
| 558 | Found DFU: [0483:df11] ver=9999, devnum=99, cfg=1, intf=0, alt=11, name="mmc1_boot2", serial="002700333338511934383330" |
| 559 | Found DFU: [0483:df11] ver=9999, devnum=99, cfg=1, intf=0, alt=10, name="mmc1_boot1", serial="002700333338511934383330" |
| 560 | Found DFU: [0483:df11] ver=9999, devnum=99, cfg=1, intf=0, alt=9, name="mmc0_userfs", serial="002700333338511934383330" |
| 561 | Found DFU: [0483:df11] ver=9999, devnum=99, cfg=1, intf=0, alt=8, name="mmc0_rootfs", serial="002700333338511934383330" |
| 562 | Found DFU: [0483:df11] ver=9999, devnum=99, cfg=1, intf=0, alt=7, name="mmc0_vendorfs", serial="002700333338511934383330" |
| 563 | Found DFU: [0483:df11] ver=9999, devnum=99, cfg=1, intf=0, alt=6, name="mmc0_bootfs", serial="002700333338511934383330" |
| 564 | Found DFU: [0483:df11] ver=9999, devnum=99, cfg=1, intf=0, alt=5, name="mmc0_ssbl", serial="002700333338511934383330" |
| 565 | Found DFU: [0483:df11] ver=9999, devnum=99, cfg=1, intf=0, alt=4, name="mmc0_fsbl2", serial="002700333338511934383330" |
| 566 | Found DFU: [0483:df11] ver=9999, devnum=99, cfg=1, intf=0, alt=3, name="mmc0_fsbl1", serial="002700333338511934383330" |
| 567 | Found DFU: [0483:df11] ver=9999, devnum=99, cfg=1, intf=0, alt=2, name="uramdisk.image.gz", serial="002700333338511934383330" |
| 568 | Found DFU: [0483:df11] ver=9999, devnum=99, cfg=1, intf=0, alt=1, name="devicetree.dtb", serial="002700333338511934383330" |
| 569 | Found DFU: [0483:df11] ver=9999, devnum=99, cfg=1, intf=0, alt=0, name="uImage", serial="002700333338511934383330" |
Patrick Delaunay | efa667d | 2020-02-25 19:04:14 +0100 | [diff] [blame] | 570 | |
| 571 | You can update the boot device: |
| 572 | |
| 573 | - SD card (mmc0) :: |
| 574 | |
| 575 | $> dfu-util -d 0483:5720 -a 3 -D tf-a-stm32mp157c-ev1-trusted.stm32 |
| 576 | $> dfu-util -d 0483:5720 -a 4 -D tf-a-stm32mp157c-ev1-trusted.stm32 |
| 577 | $> dfu-util -d 0483:5720 -a 5 -D u-boot-stm32mp157c-ev1-trusted.img |
| 578 | $> dfu-util -d 0483:5720 -a 6 -D st-image-bootfs-openstlinux-weston-stm32mp1.ext4 |
| 579 | $> dfu-util -d 0483:5720 -a 7 -D st-image-vendorfs-openstlinux-weston-stm32mp1.ext4 |
| 580 | $> dfu-util -d 0483:5720 -a 8 -D st-image-weston-openstlinux-weston-stm32mp1.ext4 |
| 581 | $> dfu-util -d 0483:5720 -a 9 -D st-image-userfs-openstlinux-weston-stm32mp1.ext4 |
| 582 | |
| 583 | - EMMC (mmc1):: |
| 584 | |
| 585 | $> dfu-util -d 0483:5720 -a 10 -D tf-a-stm32mp157c-ev1-trusted.stm32 |
| 586 | $> dfu-util -d 0483:5720 -a 11 -D tf-a-stm32mp157c-ev1-trusted.stm32 |
| 587 | $> dfu-util -d 0483:5720 -a 12 -D u-boot-stm32mp157c-ev1-trusted.img |
| 588 | $> dfu-util -d 0483:5720 -a 13 -D st-image-bootfs-openstlinux-weston-stm32mp1.ext4 |
| 589 | $> dfu-util -d 0483:5720 -a 14 -D st-image-vendorfs-openstlinux-weston-stm32mp1.ext4 |
| 590 | $> dfu-util -d 0483:5720 -a 15 -D st-image-weston-openstlinux-weston-stm32mp1.ext4 |
| 591 | $> dfu-util -d 0483:5720 -a 16 -D st-image-userfs-openstlinux-weston-stm32mp1.ext4 |
| 592 | |
Patrick Delaunay | efa667d | 2020-02-25 19:04:14 +0100 | [diff] [blame] | 593 | - you can also dump the OTP and the PMIC NVM with:: |
| 594 | |
Patrick Delaunay | 1a803f6 | 2020-03-18 09:22:54 +0100 | [diff] [blame] | 595 | $> dfu-util -d 0483:5720 -a 19 -U otp.bin |
| 596 | $> dfu-util -d 0483:5720 -a 20 -U pmic.bin |
| 597 | |
| 598 | |
| 599 | When the board is booting for nor0 or nand0, |
| 600 | only the MTD partition on the boot devices are available, for example: |
| 601 | |
| 602 | - NOR (nor0 = alt 20) & NAND (nand0 = alt 26) :: |
| 603 | |
| 604 | $> dfu-util -d 0483:5720 -a 21 -D tf-a-stm32mp157c-ev1-trusted.stm32 |
| 605 | $> dfu-util -d 0483:5720 -a 22 -D tf-a-stm32mp157c-ev1-trusted.stm32 |
| 606 | $> dfu-util -d 0483:5720 -a 23 -D u-boot-stm32mp157c-ev1-trusted.img |
| 607 | $> dfu-util -d 0483:5720 -a 27 -D st-image-weston-openstlinux-weston-stm32mp1_nand_4_256_multivolume.ubi |
| 608 | |
| 609 | - NAND (nand0 = alt 21):: |
| 610 | |
| 611 | $> dfu-util -d 0483:5720 -a 22 -D tf-a-stm32mp157c-ev1-trusted.stm32 |
| 612 | $> dfu-util -d 0483:5720 -a 23 -D u-boot-stm32mp157c-ev1-trusted.img |
| 613 | $> dfu-util -d 0483:5720 -a 24 -D u-boot-stm32mp157c-ev1-trusted.img |
| 614 | $> dfu-util -d 0483:5720 -a 25 -D st-image-weston-openstlinux-weston-stm32mp1_nand_4_256_multivolume.ubi |