Lokesh Vutla | 029f921 | 2018-08-27 15:59:06 +0530 | [diff] [blame] | 1 | Introduction: |
| 2 | ------------- |
| 3 | The AM65x family of SoCs is the first device family from K3 Multicore |
| 4 | SoC architecture, targeted for broad market and industrial control with |
| 5 | aim to meet the complex processing needs of modern embedded products. |
| 6 | |
| 7 | The device is built over three domains, each containing specific processing |
| 8 | cores, voltage domains and peripherals: |
| 9 | 1. Wake-up (WKUP) domain: |
| 10 | - Device Management and Security Controller (DMSC) |
| 11 | 2. Microcontroller (MCU) domain: |
| 12 | - Dual Core ARM Cortex-R5F processor |
| 13 | 3. MAIN domain: |
| 14 | - Quad core 64-bit ARM Cortex-A53 |
| 15 | |
| 16 | More info can be found in TRM: http://www.ti.com/lit/pdf/spruid7 |
| 17 | |
| 18 | Boot Flow: |
| 19 | ---------- |
| 20 | On AM65x family devices, ROM supports boot only via MCU(R5). This means that |
| 21 | bootloader has to run on R5 core. In order to meet this constraint, and for |
| 22 | the following reasons the boot flow is designed as mentioned: |
| 23 | 1. Need to move away from R5 asap, so that we want to start *any* |
| 24 | firmware on the r5 cores like.... autosar can be loaded to receive CAN |
| 25 | response and other safety operations to be started. This operation is |
| 26 | very time critical and is applicable for all automotive use cases. |
| 27 | 2. U-Boot on A53 should start other remotecores for various |
| 28 | applications. This should happen before running Linux. |
| 29 | 3. In production boot flow, we might not like to use full u-boot, |
| 30 | instead use Flacon boot flow to reduce boot time. |
| 31 | |
| 32 | +------------------------------------------------------------------------+ |
| 33 | | DMSC | R5 | A53 | |
| 34 | +------------------------------------------------------------------------+ |
| 35 | | +--------+ | | | |
| 36 | | | Reset | | | | |
| 37 | | +--------+ | | | |
| 38 | | : | | | |
| 39 | | +--------+ | +-----------+ | | |
Lokesh Vutla | 60f9c28 | 2018-11-02 19:51:11 +0530 | [diff] [blame] | 40 | | | *ROM* |----------|-->| Reset rls | | | |
Lokesh Vutla | 029f921 | 2018-08-27 15:59:06 +0530 | [diff] [blame] | 41 | | +--------+ | +-----------+ | | |
| 42 | | | | | : | | |
Lokesh Vutla | 60f9c28 | 2018-11-02 19:51:11 +0530 | [diff] [blame] | 43 | | | ROM | | : | | |
Lokesh Vutla | 029f921 | 2018-08-27 15:59:06 +0530 | [diff] [blame] | 44 | | |services| | : | | |
| 45 | | | | | +-------------+ | | |
Lokesh Vutla | 60f9c28 | 2018-11-02 19:51:11 +0530 | [diff] [blame] | 46 | | | | | | *R5 ROM* | | | |
Lokesh Vutla | 029f921 | 2018-08-27 15:59:06 +0530 | [diff] [blame] | 47 | | | | | +-------------+ | | |
| 48 | | | |<---------|---|Load and auth| | | |
| 49 | | | | | | tiboot3.bin | | | |
| 50 | | | | | +-------------+ | | |
| 51 | | | | | : | | |
| 52 | | | | | : | | |
| 53 | | | | | : | | |
| 54 | | | | | +-------------+ | | |
Lokesh Vutla | 60f9c28 | 2018-11-02 19:51:11 +0530 | [diff] [blame] | 55 | | | | | | *R5 SPL* | | | |
| 56 | | | | | +-------------+ | | |
| 57 | | | | | | Load | | | |
| 58 | | | | | | sysfw.itb | | | |
| 59 | | | Start | | +-------------+ | | |
| 60 | | | System |<---------|---| Start | | | |
| 61 | | |Firmware| | | SYSFW | | | |
| 62 | | +--------+ | +-------------+ | | |
| 63 | | : | | | | | |
| 64 | | +---------+ | | Load | | | |
| 65 | | | *SYSFW* | | | system | | | |
| 66 | | +---------+ | | Config data | | | |
| 67 | | | |<--------|---| | | | |
| 68 | | | | | +-------------+ | | |
| 69 | | | | | | | | | |
| 70 | | | | | | DDR | | | |
| 71 | | | | | | config | | | |
Lokesh Vutla | 029f921 | 2018-08-27 15:59:06 +0530 | [diff] [blame] | 72 | | | | | +-------------+ | | |
Lokesh Vutla | 60f9c28 | 2018-11-02 19:51:11 +0530 | [diff] [blame] | 73 | | | | | | | | | |
Lokesh Vutla | 029f921 | 2018-08-27 15:59:06 +0530 | [diff] [blame] | 74 | | | |<--------|---| Start A53 | | | |
| 75 | | | | | | and Reset | | | |
| 76 | | | | | +-------------+ | | |
| 77 | | | | | | +-----------+ | |
| 78 | | | |---------|-----------------------|---->| Reset rls | | |
| 79 | | | | | | +-----------+ | |
| 80 | | | DMSC | | | : | |
| 81 | | |Services | | | +-----------+ | |
| 82 | | | |<--------|-----------------------|---->|*ATF/OPTEE*| | |
| 83 | | | | | | +-----------+ | |
| 84 | | | | | | : | |
| 85 | | | | | | +-----------+ | |
| 86 | | | |<--------|-----------------------|---->| *A53 SPL* | | |
| 87 | | | | | | +-----------+ | |
| 88 | | | | | | | Load | | |
| 89 | | | | | | | u-boot.img| | |
| 90 | | | | | | +-----------+ | |
| 91 | | | | | | : | |
| 92 | | | | | | +-----------+ | |
Lokesh Vutla | 60f9c28 | 2018-11-02 19:51:11 +0530 | [diff] [blame] | 93 | | | |<--------|-----------------------|---->| *U-Boot* | | |
Lokesh Vutla | 029f921 | 2018-08-27 15:59:06 +0530 | [diff] [blame] | 94 | | | | | | +-----------+ | |
| 95 | | | | | | | prompt | | |
| 96 | | | | | | +-----------+ | |
| 97 | | +---------+ | | | |
| 98 | | | | | |
| 99 | +------------------------------------------------------------------------+ |
| 100 | |
| 101 | - Here DMSC acts as master and provides all the critical services. R5/A53 |
| 102 | requests DMSC to get these services done as shown in the above diagram. |
| 103 | |
| 104 | Sources: |
| 105 | -------- |
| 106 | 1. SYSFW: |
Lokesh Vutla | 60f9c28 | 2018-11-02 19:51:11 +0530 | [diff] [blame] | 107 | Tree: git://git.ti.com/processor-firmware/system-firmware-image-gen.git |
| 108 | Branch: master |
Lokesh Vutla | 029f921 | 2018-08-27 15:59:06 +0530 | [diff] [blame] | 109 | |
| 110 | 2. ATF: |
| 111 | Tree: https://github.com/ARM-software/arm-trusted-firmware.git |
| 112 | Branch: master |
| 113 | |
| 114 | 3. OPTEE: |
| 115 | Tree: https://github.com/OP-TEE/optee_os.git |
| 116 | Branch: master |
| 117 | |
| 118 | 4. U-Boot: |
| 119 | Tree: http://git.denx.de/u-boot.git |
| 120 | Branch: master |
| 121 | |
| 122 | Build procedure: |
| 123 | ---------------- |
| 124 | 1. SYSFW: |
Lokesh Vutla | 60f9c28 | 2018-11-02 19:51:11 +0530 | [diff] [blame] | 125 | $ make CROSS_COMPILE=arm-linux-gnueabihf- |
Lokesh Vutla | 029f921 | 2018-08-27 15:59:06 +0530 | [diff] [blame] | 126 | |
| 127 | 2. ATF: |
| 128 | $ make CROSS_COMPILE=aarch64-linux-gnu- ARCH=aarch64 PLAT=k3 TARGET_BOARD=generic SPD=opteed |
| 129 | |
| 130 | 3. OPTEE: |
| 131 | $ make PLATFORM=k3-am65x CFG_ARM64_core=y |
| 132 | |
| 133 | 4. U-Boot: |
| 134 | |
| 135 | 4.1. R5: |
Lokesh Vutla | 60f9c28 | 2018-11-02 19:51:11 +0530 | [diff] [blame] | 136 | $ make ARCH=arm CROSS_COMPILE=arm-linux-gnueabihf- am65x_evm_r5_defconfig O=/tmp/r5 |
| 137 | $ make ARCH=arm CROSS_COMPILE=arm-linux-gnueabihf- O=/tmp/r5 |
Lokesh Vutla | 029f921 | 2018-08-27 15:59:06 +0530 | [diff] [blame] | 138 | |
| 139 | 4.2. A53: |
| 140 | $ make ARCH=arm CROSS_COMPILE=aarch64-linux-gnu- am65x_evm_a53_defconfig O=/tmp/a53 |
Lokesh Vutla | 60f9c28 | 2018-11-02 19:51:11 +0530 | [diff] [blame] | 141 | $ make ARCH=arm CROSS_COMPILE=aarch64-linux-gnu- ATF=<path to ATF dir>/build/k3/generic/release/bl31.bin TEE=<path to OPTEE OS dir>/out/arm-plat-k3/core/tee-pager.bin O=/tmp/a53 |
Lokesh Vutla | 029f921 | 2018-08-27 15:59:06 +0530 | [diff] [blame] | 142 | |
| 143 | Target Images |
| 144 | -------------- |
| 145 | Copy the below images to an SD card and boot: |
Lokesh Vutla | 60f9c28 | 2018-11-02 19:51:11 +0530 | [diff] [blame] | 146 | - sysfw.itb from step 1 |
Lokesh Vutla | 029f921 | 2018-08-27 15:59:06 +0530 | [diff] [blame] | 147 | - tiboot3.bin from step 4.1 |
| 148 | - tispl.bin, u-boot.img from 4.2 |
Lokesh Vutla | 60f9c28 | 2018-11-02 19:51:11 +0530 | [diff] [blame] | 149 | |
| 150 | Image formats: |
| 151 | -------------- |
| 152 | |
| 153 | - tiboot3.bin: |
| 154 | +-----------------------+ |
| 155 | | X.509 | |
| 156 | | Certificate | |
| 157 | | +-------------------+ | |
| 158 | | | | | |
| 159 | | | R5 | | |
| 160 | | | u-boot-spl.bin | | |
| 161 | | | | | |
| 162 | | +-------------------+ | |
| 163 | | | | | |
| 164 | | | FIT header | | |
| 165 | | | +---------------+ | | |
| 166 | | | | | | | |
| 167 | | | | DTB 1...N | | | |
| 168 | | | +---------------+ | | |
| 169 | | +-------------------+ | |
| 170 | +-----------------------+ |
| 171 | |
| 172 | - tispl.bin |
| 173 | +-----------------------+ |
| 174 | | | |
| 175 | | FIT HEADER | |
| 176 | | +-------------------+ | |
| 177 | | | | | |
| 178 | | | A53 ATF | | |
| 179 | | +-------------------+ | |
| 180 | | | | | |
| 181 | | | A53 OPTEE | | |
| 182 | | +-------------------+ | |
| 183 | | | | | |
| 184 | | | A53 SPL | | |
| 185 | | +-------------------+ | |
| 186 | | | | | |
| 187 | | | SPL DTB 1...N | | |
| 188 | | +-------------------+ | |
| 189 | +-----------------------+ |
| 190 | |
| 191 | - sysfw.itb |
| 192 | +-----------------------+ |
| 193 | | | |
| 194 | | FIT HEADER | |
| 195 | | +-------------------+ | |
| 196 | | | | | |
| 197 | | | sysfw.bin | | |
| 198 | | +-------------------+ | |
| 199 | | | | | |
| 200 | | | board config | | |
| 201 | | +-------------------+ | |
| 202 | | | | | |
| 203 | | | PM config | | |
| 204 | | +-------------------+ | |
| 205 | | | | | |
| 206 | | | RM config | | |
| 207 | | +-------------------+ | |
| 208 | | | | | |
| 209 | | | Secure config | | |
| 210 | | +-------------------+ | |
| 211 | +-----------------------+ |