stm32mp1.rst 9.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309
  1. STMicroelectronics STM32MP1
  2. ===========================
  3. STM32MP1 is a microprocessor designed by STMicroelectronics
  4. based on Arm Cortex-A7.
  5. It is an Armv7-A platform, using dedicated code from TF-A.
  6. More information can be found on `STM32MP1 Series`_ page.
  7. STM32MP1 Versions
  8. -----------------
  9. There are 2 variants for STM32MP1: STM32MP13 and STM32MP15
  10. STM32MP13 Versions
  11. ~~~~~~~~~~~~~~~~~~
  12. The STM32MP13 series is available in 3 different lines which are pin-to-pin compatible:
  13. - STM32MP131: Single Cortex-A7 core
  14. - STM32MP133: STM32MP131 + 2*CAN, ETH2(GMAC), ADC1
  15. - STM32MP135: STM32MP133 + DCMIPP, LTDC
  16. Each line comes with a security option (cryptography & secure boot) and a Cortex-A frequency option:
  17. - A Cortex-A7 @ 650 MHz
  18. - C Secure Boot + HW Crypto + Cortex-A7 @ 650 MHz
  19. - D Cortex-A7 @ 900 MHz
  20. - F Secure Boot + HW Crypto + Cortex-A7 @ 900 MHz
  21. STM32MP15 Versions
  22. ~~~~~~~~~~~~~~~~~~
  23. The STM32MP15 series is available in 3 different lines which are pin-to-pin compatible:
  24. - STM32MP157: Dual Cortex-A7 cores, Cortex-M4 core @ 209 MHz, 3D GPU, DSI display interface and CAN FD
  25. - STM32MP153: Dual Cortex-A7 cores, Cortex-M4 core @ 209 MHz and CAN FD
  26. - STM32MP151: Single Cortex-A7 core, Cortex-M4 core @ 209 MHz
  27. Each line comes with a security option (cryptography & secure boot) and a Cortex-A frequency option:
  28. - A Basic + Cortex-A7 @ 650 MHz
  29. - C Secure Boot + HW Crypto + Cortex-A7 @ 650 MHz
  30. - D Basic + Cortex-A7 @ 800 MHz
  31. - F Secure Boot + HW Crypto + Cortex-A7 @ 800 MHz
  32. The `STM32MP1 part number codification`_ page gives more information about part numbers.
  33. Design
  34. ------
  35. The STM32MP1 resets in the ROM code of the Cortex-A7.
  36. The primary boot core (core 0) executes the boot sequence while
  37. secondary boot core (core 1) is kept in a holding pen loop.
  38. The ROM code boot sequence loads the TF-A binary image from boot device
  39. to embedded SRAM.
  40. The TF-A image must be properly formatted with a STM32 header structure
  41. for ROM code is able to load this image.
  42. Tool stm32image can be used to prepend this header to the generated TF-A binary.
  43. Boot with FIP
  44. ~~~~~~~~~~~~~
  45. The use of FIP is now the recommended way to boot STM32MP1 platform.
  46. Only BL2 (with STM32 header) is loaded by ROM code. The other binaries are
  47. inside the FIP binary: BL32 (SP_min or OP-TEE), U-Boot and their respective
  48. device tree blobs.
  49. STM32IMAGE bootchain
  50. ~~~~~~~~~~~~~~~~~~~~
  51. Although still supported, this way of booting is not recommended.
  52. Pease use FIP instead.
  53. At compilation step, BL2, BL32 and DTB file are linked together in a single
  54. binary. The stm32image tool is also generated and the header is added to TF-A
  55. binary. This binary file with header is named tf-a-stm32mp157c-ev1.stm32.
  56. It can then be copied in the first partition of the boot device.
  57. Memory mapping
  58. ~~~~~~~~~~~~~~
  59. ::
  60. 0x00000000 +-----------------+
  61. | | ROM
  62. 0x00020000 +-----------------+
  63. | |
  64. | ... |
  65. | |
  66. 0x2FFC0000 +-----------------+ \
  67. | BL32 DTB | |
  68. 0x2FFC5000 +-----------------+ |
  69. | BL32 | |
  70. 0x2FFDF000 +-----------------+ |
  71. | ... | |
  72. 0x2FFE3000 +-----------------+ |
  73. | BL2 DTB | | Embedded SRAM
  74. 0x2FFEA000 +-----------------+ |
  75. | BL2 | |
  76. 0x2FFFF000 +-----------------+ |
  77. | SCMI mailbox | |
  78. 0x30000000 +-----------------+ /
  79. | |
  80. | ... |
  81. | |
  82. 0x40000000 +-----------------+
  83. | |
  84. | | Devices
  85. | |
  86. 0xC0000000 +-----------------+ \
  87. | | |
  88. 0xC0100000 +-----------------+ |
  89. | BL33 | | Non-secure RAM (DDR)
  90. | ... | |
  91. | | |
  92. 0xFFFFFFFF +-----------------+ /
  93. Boot sequence
  94. ~~~~~~~~~~~~~
  95. ROM code -> BL2 (compiled with BL2_AT_EL3) -> BL32 (SP_min) -> BL33 (U-Boot)
  96. or if Op-TEE is used:
  97. ROM code -> BL2 (compiled with BL2_AT_EL3) -> OP-TEE -> BL33 (U-Boot)
  98. Build Instructions
  99. ------------------
  100. Boot media(s) supported by BL2 must be specified in the build command.
  101. Available storage medias are:
  102. - ``STM32MP_SDMMC``
  103. - ``STM32MP_EMMC``
  104. - ``STM32MP_RAW_NAND``
  105. - ``STM32MP_SPI_NAND``
  106. - ``STM32MP_SPI_NOR``
  107. Serial boot devices:
  108. - ``STM32MP_UART_PROGRAMMER``
  109. - ``STM32MP_USB_PROGRAMMER``
  110. Other configuration flags:
  111. - | ``DTB_FILE_NAME``: to precise board device-tree blob to be used.
  112. | Default: stm32mp157c-ev1.dtb
  113. - | ``DWL_BUFFER_BASE``: the 'serial boot' load address of FIP,
  114. | default location (end of the first 128MB) is used when absent
  115. - | ``STM32MP_EARLY_CONSOLE``: to enable early traces before clock driver is setup.
  116. | Default: 0 (disabled)
  117. - | ``STM32MP_RECONFIGURE_CONSOLE``: to re-configure crash console (especially after BL2).
  118. | Default: 0 (disabled)
  119. - | ``STM32MP_UART_BAUDRATE``: to select UART baud rate.
  120. | Default: 115200
  121. - | ``STM32_TF_VERSION``: to manage BL2 monotonic counter.
  122. | Default: 0
  123. - | ``STM32MP13``: to select STM32MP13 variant configuration.
  124. | Default: 0
  125. - | ``STM32MP15``: to select STM32MP15 variant configuration.
  126. | Default: 1
  127. Boot with FIP
  128. ~~~~~~~~~~~~~
  129. You need to build BL2, BL32 (SP_min or OP-TEE) and BL33 (U-Boot) before building FIP binary.
  130. U-Boot
  131. ______
  132. .. code:: bash
  133. cd <u-boot_directory>
  134. make stm32mp15_trusted_defconfig
  135. make DEVICE_TREE=stm32mp157c-ev1 all
  136. OP-TEE (optional)
  137. _________________
  138. .. code:: bash
  139. cd <optee_directory>
  140. make CROSS_COMPILE=arm-linux-gnueabihf- ARCH=arm PLATFORM=stm32mp1 \
  141. CFG_EMBED_DTB_SOURCE_FILE=stm32mp157c-ev1.dts
  142. TF-A BL32 (SP_min)
  143. __________________
  144. If you choose not to use OP-TEE, you can use TF-A SP_min.
  145. To build TF-A BL32, and its device tree file:
  146. .. code:: bash
  147. make CROSS_COMPILE=arm-none-eabi- PLAT=stm32mp1 ARCH=aarch32 ARM_ARCH_MAJOR=7 \
  148. AARCH32_SP=sp_min DTB_FILE_NAME=stm32mp157c-ev1.dtb bl32 dtbs
  149. TF-A BL2
  150. ________
  151. To build TF-A BL2 with its STM32 header for SD-card boot:
  152. .. code:: bash
  153. make CROSS_COMPILE=arm-none-eabi- PLAT=stm32mp1 ARCH=aarch32 ARM_ARCH_MAJOR=7 \
  154. DTB_FILE_NAME=stm32mp157c-ev1.dtb STM32MP_SDMMC=1
  155. For other boot devices, you have to replace STM32MP_SDMMC in the previous command
  156. with the desired device flag.
  157. This BL2 is independent of the BL32 used (SP_min or OP-TEE)
  158. FIP
  159. ___
  160. With BL32 SP_min:
  161. .. code:: bash
  162. make CROSS_COMPILE=arm-none-eabi- PLAT=stm32mp1 ARCH=aarch32 ARM_ARCH_MAJOR=7 \
  163. AARCH32_SP=sp_min \
  164. DTB_FILE_NAME=stm32mp157c-ev1.dtb \
  165. BL33=<u-boot_directory>/u-boot-nodtb.bin \
  166. BL33_CFG=<u-boot_directory>/u-boot.dtb \
  167. fip
  168. With OP-TEE:
  169. .. code:: bash
  170. make CROSS_COMPILE=arm-none-eabi- PLAT=stm32mp1 ARCH=aarch32 ARM_ARCH_MAJOR=7 \
  171. AARCH32_SP=optee \
  172. DTB_FILE_NAME=stm32mp157c-ev1.dtb \
  173. BL33=<u-boot_directory>/u-boot-nodtb.bin \
  174. BL33_CFG=<u-boot_directory>/u-boot.dtb \
  175. BL32=<optee_directory>/tee-header_v2.bin \
  176. BL32_EXTRA1=<optee_directory>/tee-pager_v2.bin
  177. BL32_EXTRA2=<optee_directory>/tee-pageable_v2.bin
  178. fip
  179. STM32IMAGE bootchain
  180. ~~~~~~~~~~~~~~~~~~~~
  181. You need to add the following flag to the make command:
  182. ``STM32MP_USE_STM32IMAGE=1``
  183. To build with SP_min and support for SD-card boot:
  184. .. code:: bash
  185. make CROSS_COMPILE=arm-linux-gnueabihf- PLAT=stm32mp1 ARCH=aarch32 ARM_ARCH_MAJOR=7 \
  186. AARCH32_SP=sp_min STM32MP_SDMMC=1 DTB_FILE_NAME=stm32mp157c-ev1.dtb \
  187. STM32MP_USE_STM32IMAGE=1
  188. cd <u-boot_directory>
  189. make stm32mp15_trusted_defconfig
  190. make DEVICE_TREE=stm32mp157c-ev1 all
  191. To build TF-A with OP-TEE support for SD-card boot:
  192. .. code:: bash
  193. make CROSS_COMPILE=arm-linux-gnueabihf- PLAT=stm32mp1 ARCH=aarch32 ARM_ARCH_MAJOR=7 \
  194. AARCH32_SP=optee STM32MP_SDMMC=1 DTB_FILE_NAME=stm32mp157c-ev1.dtb \
  195. STM32MP_USE_STM32IMAGE=1
  196. cd <optee_directory>
  197. make CROSS_COMPILE=arm-linux-gnueabihf- ARCH=arm PLATFORM=stm32mp1 \
  198. CFG_EMBED_DTB_SOURCE_FILE=stm32mp157c-ev1.dts
  199. cd <u-boot_directory>
  200. make stm32mp15_trusted_defconfig
  201. make DEVICE_TREE=stm32mp157c-ev1 all
  202. The following build options are supported:
  203. - ``ENABLE_STACK_PROTECTOR``: To enable the stack protection.
  204. Populate SD-card
  205. ----------------
  206. Boot with FIP
  207. ~~~~~~~~~~~~~
  208. The SD-card has to be formatted with GPT.
  209. It should contain at least those partitions:
  210. - fsbl: to copy the tf-a-stm32mp157c-ev1.stm32 binary (BL2)
  211. - fip: which contains the FIP binary
  212. Usually, two copies of fsbl are used (fsbl1 and fsbl2) instead of one partition fsbl.
  213. STM32IMAGE bootchain
  214. ~~~~~~~~~~~~~~~~~~~~
  215. The SD-card has to be formatted with GPT.
  216. It should contain at least those partitions:
  217. - fsbl: to copy the tf-a-stm32mp157c-ev1.stm32 binary
  218. - ssbl: to copy the u-boot.stm32 binary
  219. Usually, two copies of fsbl are used (fsbl1 and fsbl2) instead of one partition fsbl.
  220. OP-TEE artifacts go into separate partitions as follows:
  221. - teeh: tee-header_v2.stm32
  222. - teed: tee-pageable_v2.stm32
  223. - teex: tee-pager_v2.stm32
  224. .. _STM32MP1 Series: https://www.st.com/en/microcontrollers-microprocessors/stm32mp1-series.html
  225. .. _STM32MP1 part number codification: https://wiki.st.com/stm32mpu/wiki/STM32MP15_microprocessor#Part_number_codification