stm32mp1.rst 9.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280
  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. Memory mapping
  50. ~~~~~~~~~~~~~~
  51. ::
  52. 0x00000000 +-----------------+
  53. | | ROM
  54. 0x00020000 +-----------------+
  55. | |
  56. | ... |
  57. | |
  58. 0x2FFC0000 +-----------------+ \
  59. | BL32 DTB | |
  60. 0x2FFC5000 +-----------------+ |
  61. | BL32 | |
  62. 0x2FFDF000 +-----------------+ |
  63. | ... | |
  64. 0x2FFE3000 +-----------------+ |
  65. | BL2 DTB | | Embedded SRAM
  66. 0x2FFEA000 +-----------------+ |
  67. | BL2 | |
  68. 0x2FFFF000 +-----------------+ |
  69. | SCMI mailbox | |
  70. 0x30000000 +-----------------+ /
  71. | |
  72. | ... |
  73. | |
  74. 0x40000000 +-----------------+
  75. | |
  76. | | Devices
  77. | |
  78. 0xC0000000 +-----------------+ \
  79. | | |
  80. 0xC0100000 +-----------------+ |
  81. | BL33 | | Non-secure RAM (DDR)
  82. | ... | |
  83. | | |
  84. 0xFFFFFFFF +-----------------+ /
  85. Boot sequence
  86. ~~~~~~~~~~~~~
  87. ROM code -> BL2(compiled with RESET_TO_BL2) -> BL32(SP_min)-> BL33(U-Boot)
  88. or if Op-TEE is used:
  89. ROM code -> BL2 (compiled with RESET_TO_BL2) -> OP-TEE -> BL33 (U-Boot)
  90. Build Instructions
  91. ------------------
  92. Boot media(s) supported by BL2 must be specified in the build command.
  93. Available storage medias are:
  94. - ``STM32MP_SDMMC``
  95. - ``STM32MP_EMMC``
  96. - ``STM32MP_RAW_NAND``
  97. - ``STM32MP_SPI_NAND``
  98. - ``STM32MP_SPI_NOR``
  99. Serial boot devices:
  100. - ``STM32MP_UART_PROGRAMMER``
  101. - ``STM32MP_USB_PROGRAMMER``
  102. Other configuration flags:
  103. - | ``DTB_FILE_NAME``: to precise board device-tree blob to be used.
  104. | Default: stm32mp157c-ev1.dtb
  105. - | ``DWL_BUFFER_BASE``: the 'serial boot' load address of FIP,
  106. | default location (end of the first 128MB) is used when absent
  107. - | ``STM32MP_EARLY_CONSOLE``: to enable early traces before clock driver is setup.
  108. | Default: 0 (disabled)
  109. - | ``STM32MP_RECONFIGURE_CONSOLE``: to re-configure crash console (especially after BL2).
  110. | Default: 0 (disabled)
  111. - | ``STM32MP_UART_BAUDRATE``: to select UART baud rate.
  112. | Default: 115200
  113. - | ``STM32_TF_VERSION``: to manage BL2 monotonic counter.
  114. | Default: 0
  115. - | ``STM32MP13``: to select STM32MP13 variant configuration.
  116. | Default: 0
  117. - | ``STM32MP15``: to select STM32MP15 variant configuration.
  118. | Default: 1
  119. Boot with FIP
  120. ~~~~~~~~~~~~~
  121. You need to build BL2, BL32 (SP_min or OP-TEE) and BL33 (U-Boot) before building FIP binary.
  122. U-Boot
  123. ______
  124. .. code:: bash
  125. cd <u-boot_directory>
  126. make stm32mp15_trusted_defconfig
  127. make DEVICE_TREE=stm32mp157c-ev1 all
  128. OP-TEE (optional)
  129. _________________
  130. .. code:: bash
  131. cd <optee_directory>
  132. make CROSS_COMPILE=arm-linux-gnueabihf- ARCH=arm PLATFORM=stm32mp1 \
  133. CFG_EMBED_DTB_SOURCE_FILE=stm32mp157c-ev1.dts
  134. TF-A BL32 (SP_min)
  135. __________________
  136. If you choose not to use OP-TEE, you can use TF-A SP_min.
  137. To build TF-A BL32, and its device tree file:
  138. .. code:: bash
  139. make CROSS_COMPILE=arm-none-eabi- PLAT=stm32mp1 ARCH=aarch32 ARM_ARCH_MAJOR=7 \
  140. AARCH32_SP=sp_min DTB_FILE_NAME=stm32mp157c-ev1.dtb bl32 dtbs
  141. TF-A BL2
  142. ________
  143. To build TF-A BL2 with its STM32 header for SD-card boot:
  144. .. code:: bash
  145. make CROSS_COMPILE=arm-none-eabi- PLAT=stm32mp1 ARCH=aarch32 ARM_ARCH_MAJOR=7 \
  146. DTB_FILE_NAME=stm32mp157c-ev1.dtb STM32MP_SDMMC=1
  147. For other boot devices, you have to replace STM32MP_SDMMC in the previous command
  148. with the desired device flag.
  149. This BL2 is independent of the BL32 used (SP_min or OP-TEE)
  150. FIP
  151. ___
  152. With BL32 SP_min:
  153. .. code:: bash
  154. make CROSS_COMPILE=arm-none-eabi- PLAT=stm32mp1 ARCH=aarch32 ARM_ARCH_MAJOR=7 \
  155. AARCH32_SP=sp_min \
  156. DTB_FILE_NAME=stm32mp157c-ev1.dtb \
  157. BL33=<u-boot_directory>/u-boot-nodtb.bin \
  158. BL33_CFG=<u-boot_directory>/u-boot.dtb \
  159. fip
  160. With OP-TEE:
  161. .. code:: bash
  162. make CROSS_COMPILE=arm-none-eabi- PLAT=stm32mp1 ARCH=aarch32 ARM_ARCH_MAJOR=7 \
  163. AARCH32_SP=optee \
  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. BL32=<optee_directory>/tee-header_v2.bin \
  168. BL32_EXTRA1=<optee_directory>/tee-pager_v2.bin
  169. BL32_EXTRA2=<optee_directory>/tee-pageable_v2.bin
  170. fip
  171. Trusted Boot Board
  172. __________________
  173. .. code:: shell
  174. tools/cert_create/cert_create -n --rot-key "build/stm32mp1/debug/rot_key.pem" \
  175. --tfw-nvctr 0 \
  176. --ntfw-nvctr 0 \
  177. --key-alg ecdsa --hash-alg sha256 \
  178. --trusted-key-cert build/stm32mp1/cert_images/trusted-key-cert.key-crt \
  179. --tos-fw <optee_directory>/tee-header_v2.bin \
  180. --tos-fw-extra1 <optee_directory>/tee-pager_v2.bin \
  181. --tos-fw-extra2 <optee_directory>/tee-pageable_v2.bin \
  182. --tos-fw-cert build/stm32mp1/cert_images/tee-header_v2.bin.crt \
  183. --tos-fw-key-cert build/stm32mp1/cert_images/tee-header_v2.bin.key-crt \
  184. --nt-fw <u-boot_directory>/u-boot-nodtb.bin \
  185. --nt-fw-cert build/stm32mp1/cert_images/u-boot.bin.crt \
  186. --nt-fw-key-cert build/stm32mp1/cert_images/u-boot.bin.key-crt \
  187. --hw-config <u-boot_directory>/u-boot.dtb \
  188. --fw-config build/stm32mp1/debug/fdts/fw-config.dtb \
  189. --stm32mp-cfg-cert build/stm32mp1/cert_images/stm32mp_cfg_cert.crt
  190. tools/fiptool/fiptool create --tos-fw <optee_directory>/tee-header_v2.bin \
  191. --tos-fw-extra1 <optee_directory>/tee-pager_v2.bin \
  192. --tos-fw-extra2 <optee_directory>/tee-pageable_v2.bin \
  193. --nt-fw <u-boot_directory>/u-boot-nodtb.bin \
  194. --hw-config <u-boot_directory>/u-boot.dtb \
  195. --fw-config build/stm32mp1/debug/fdts/fw-config.dtb \
  196. --tos-fw-cert build/stm32mp1/cert_images/tee-header_v2.bin.crt \
  197. --tos-fw-key-cert build/stm32mp1/cert_images/tee-header_v2.bin.key-crt \
  198. --nt-fw-cert build/stm32mp1/cert_images/u-boot.bin.crt \
  199. --nt-fw-key-cert build/stm32mp1/cert_images/u-boot.bin.key-crt \
  200. --stm32mp-cfg-cert build/stm32mp1/cert_images/stm32mp_cfg_cert.crt stm32mp1.fip
  201. Populate SD-card
  202. ----------------
  203. Boot with FIP
  204. ~~~~~~~~~~~~~
  205. The SD-card has to be formatted with GPT.
  206. It should contain at least those partitions:
  207. - fsbl: to copy the tf-a-stm32mp157c-ev1.stm32 binary (BL2)
  208. - fip: which contains the FIP binary
  209. Usually, two copies of fsbl are used (fsbl1 and fsbl2) instead of one partition fsbl.
  210. .. _STM32MP1 Series: https://www.st.com/en/microcontrollers-microprocessors/stm32mp1-series.html
  211. .. _STM32MP1 part number codification: https://wiki.st.com/stm32mpu/wiki/STM32MP15_microprocessor#Part_number_codification