Paul Beesley | f3653a6 | 2019-05-22 11:22:44 +0100 | [diff] [blame] | 1 | STMicroelectronics STM32MP1 |
| 2 | =========================== |
Yann Gautier | 7511539 | 2018-07-16 14:49:34 +0200 | [diff] [blame] | 3 | |
| 4 | STM32MP1 is a microprocessor designed by STMicroelectronics |
| 5 | based on a dual Arm Cortex-A7. |
| 6 | It is an Armv7-A platform, using dedicated code from TF-A. |
Yann Gautier | 969be34 | 2019-02-20 17:34:16 +0100 | [diff] [blame] | 7 | The STM32MP1 chip also embeds a Cortex-M4. |
| 8 | More information can be found on `STM32MP1 Series`_ page. |
Yann Gautier | 7511539 | 2018-07-16 14:49:34 +0200 | [diff] [blame] | 9 | |
| 10 | |
| 11 | Design |
| 12 | ------ |
| 13 | The STM32MP1 resets in the ROM code of the Cortex-A7. |
| 14 | The primary boot core (core 0) executes the boot sequence while |
| 15 | secondary boot core (core 1) is kept in a holding pen loop. |
| 16 | The ROM code boot sequence loads the TF-A binary image from boot device |
| 17 | to embedded SRAM. |
| 18 | |
| 19 | The TF-A image must be properly formatted with a STM32 header structure |
| 20 | for ROM code is able to load this image. |
| 21 | Tool stm32image can be used to prepend this header to the generated TF-A binary. |
| 22 | |
| 23 | At compilation step, BL2, BL32 and DTB file are linked together in a single |
| 24 | binary. The stm32image tool is also generated and the header is added to TF-A |
| 25 | binary. This binary file with header is named tf-a-stm32mp157c-ev1.stm32. |
| 26 | It can then be copied in the first partition of the boot device. |
| 27 | |
| 28 | |
| 29 | Memory mapping |
| 30 | ~~~~~~~~~~~~~~ |
| 31 | |
| 32 | :: |
| 33 | |
| 34 | 0x00000000 +-----------------+ |
| 35 | | | ROM |
| 36 | 0x00020000 +-----------------+ |
| 37 | | | |
| 38 | | ... | |
| 39 | | | |
| 40 | 0x2FFC0000 +-----------------+ \ |
| 41 | | | | |
| 42 | | ... | | |
| 43 | | | | |
| 44 | 0x2FFD8000 +-----------------+ | |
| 45 | | TF-A DTB | | Embedded SRAM |
| 46 | 0x2FFDC000 +-----------------+ | |
| 47 | | BL2 | | |
| 48 | 0x2FFEF000 +-----------------+ | |
| 49 | | BL32 | | |
| 50 | 0x30000000 +-----------------+ / |
| 51 | | | |
| 52 | | ... | |
| 53 | | | |
| 54 | 0x40000000 +-----------------+ |
| 55 | | | |
| 56 | | | Devices |
| 57 | | | |
| 58 | 0xC0000000 +-----------------+ \ |
| 59 | | | | |
| 60 | 0xC0100000 +-----------------+ | |
| 61 | | BL33 | | Non-secure RAM (DDR) |
| 62 | | ... | | |
| 63 | | | | |
| 64 | 0xFFFFFFFF +-----------------+ / |
| 65 | |
| 66 | |
| 67 | Boot sequence |
| 68 | ~~~~~~~~~~~~~ |
| 69 | |
| 70 | ROM code -> BL2 (compiled with BL2_AT_EL3) -> BL32 (SP_min) -> BL33 (U-Boot) |
| 71 | |
Yann Gautier | b3386f7 | 2019-04-19 09:41:01 +0200 | [diff] [blame] | 72 | or if Op-TEE is used: |
| 73 | |
| 74 | ROM code -> BL2 (compiled with BL2_AT_EL3) -> OP-TEE -> BL33 (U-Boot) |
| 75 | |
Yann Gautier | 7511539 | 2018-07-16 14:49:34 +0200 | [diff] [blame] | 76 | |
| 77 | Build Instructions |
| 78 | ------------------ |
Lionel Debieve | 4066c90 | 2019-10-17 15:12:13 +0200 | [diff] [blame] | 79 | Boot media(s) supported by BL2 must be specified in the build command. |
| 80 | Available storage medias are: |
| 81 | - ``STM32MP_SDMMC`` |
| 82 | - ``STM32MP_EMMC`` |
| 83 | - ``STM32MP_RAW_NAND`` |
| 84 | - ``STM32MP_SPI_NAND`` |
| 85 | - ``STM32MP_SPI_NOR`` |
Yann Gautier | 7511539 | 2018-07-16 14:49:34 +0200 | [diff] [blame] | 86 | |
Lionel Debieve | 4066c90 | 2019-10-17 15:12:13 +0200 | [diff] [blame] | 87 | To build with SP_min and support for all bootable devices: |
Yann Gautier | 7511539 | 2018-07-16 14:49:34 +0200 | [diff] [blame] | 88 | |
| 89 | .. code:: bash |
| 90 | |
Lionel Debieve | 4066c90 | 2019-10-17 15:12:13 +0200 | [diff] [blame] | 91 | make CROSS_COMPILE=arm-linux-gnueabihf- PLAT=stm32mp1 ARCH=aarch32 ARM_ARCH_MAJOR=7 AARCH32_SP=sp_min STM32MP_SDMMC=1 STM32MP_EMMC=1 STM32MP_RAW_NAND=1 STM32MP_SPI_NAND=1 |
| 92 | STM32MP_SPI_NOR=1 DTB_FILE_NAME=stm32mp157c-ev1.dtb |
Yann Gautier | b4ddd30 | 2018-10-24 10:50:12 +0200 | [diff] [blame] | 93 | cd <u-boot_directory> |
Yann Gautier | b7168ee | 2019-05-20 11:50:18 +0200 | [diff] [blame] | 94 | make stm32mp15_trusted_defconfig |
Yann Gautier | 969be34 | 2019-02-20 17:34:16 +0100 | [diff] [blame] | 95 | make DEVICE_TREE=stm32mp157c-ev1 all |
Yann Gautier | 7511539 | 2018-07-16 14:49:34 +0200 | [diff] [blame] | 96 | |
Lionel Debieve | 4066c90 | 2019-10-17 15:12:13 +0200 | [diff] [blame] | 97 | To build TF-A with OP-TEE support for all bootable devices: |
Yann Gautier | b3386f7 | 2019-04-19 09:41:01 +0200 | [diff] [blame] | 98 | .. code:: bash |
| 99 | |
Lionel Debieve | 4066c90 | 2019-10-17 15:12:13 +0200 | [diff] [blame] | 100 | make CROSS_COMPILE=arm-linux-gnueabihf- PLAT=stm32mp1 ARCH=aarch32 ARM_ARCH_MAJOR=7 AARCH32_SP=optee STM32MP_SDMMC=1 STM32MP_EMMC=1 STM32MP_RAW_NAND=1 STM32MP_SPI_NAND=1 STM32MP_SPI_NOR=1 DTB_FILE_NAME=stm32mp157c-ev1.dtb |
| 101 | cd <optee_directory> |
| 102 | make CROSS_COMPILE=arm-linux-gnueabihf- ARCH=arm PLATFORM=stm32mp1 CFG_EMBED_DTB_SOURCE_FILE=stm32mp157c-ev1.dts |
| 103 | cd <u-boot_directory> |
| 104 | make stm32mp15_optee_defconfig |
| 105 | make DEVICE_TREE=stm32mp157c-ev1 all |
| 106 | |
Yann Gautier | b3386f7 | 2019-04-19 09:41:01 +0200 | [diff] [blame] | 107 | |
Yann Gautier | 7511539 | 2018-07-16 14:49:34 +0200 | [diff] [blame] | 108 | The following build options are supported: |
| 109 | |
| 110 | - ``ENABLE_STACK_PROTECTOR``: To enable the stack protection. |
Yann Gautier | b4ddd30 | 2018-10-24 10:50:12 +0200 | [diff] [blame] | 111 | |
| 112 | |
| 113 | Populate SD-card |
| 114 | ---------------- |
| 115 | |
| 116 | The SD-card has to be formated with GPT. |
| 117 | It should contain at least those partitions: |
| 118 | |
| 119 | - fsbl: to copy the tf-a-stm32mp157c-ev1.stm32 binary |
| 120 | - ssbl: to copy the u-boot.stm32 binary |
| 121 | |
| 122 | Usually, two copies of fsbl are used (fsbl1 and fsbl2) instead of one partition fsbl. |
Yann Gautier | 969be34 | 2019-02-20 17:34:16 +0100 | [diff] [blame] | 123 | |
| 124 | |
| 125 | .. _STM32MP1 Series: https://www.st.com/en/microcontrollers-microprocessors/stm32mp1-series.html |