stm32mp1.rst 26 KB

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