Neha Malcom Francis | 507be12 | 2023-07-22 00:14:43 +0530 | [diff] [blame] | 1 | .. SPDX-License-Identifier: GPL-2.0+ OR BSD-3-Clause |
| 2 | .. sectionauthor:: Neha Francis <n-francis@ti.com> |
| 3 | |
| 4 | AM65x Platforms |
| 5 | =============== |
| 6 | |
| 7 | Introduction: |
| 8 | ------------- |
| 9 | The AM65x family of SoCs is the first device family from K3 Multicore |
| 10 | SoC architecture, targeted for broad market and industrial control with |
| 11 | aim to meet the complex processing needs of modern embedded products. |
| 12 | |
| 13 | The device is built over three domains, each containing specific processing |
| 14 | cores, voltage domains and peripherals: |
| 15 | |
| 16 | 1. Wake-up (WKUP) domain: |
| 17 | * Device Management and Security Controller (DMSC) |
| 18 | |
| 19 | 2. Microcontroller (MCU) domain: |
| 20 | * Dual Core ARM Cortex-R5F processor |
| 21 | |
| 22 | 3. MAIN domain: |
| 23 | * Quad core 64-bit ARM Cortex-A53 |
| 24 | |
| 25 | More info can be found in TRM: http://www.ti.com/lit/pdf/spruid7 |
| 26 | |
Nishanth Menon | 4981d9a | 2023-07-27 13:59:00 -0500 | [diff] [blame] | 27 | Platform information: |
| 28 | |
| 29 | * https://www.ti.com/tool/TMDX654GPEVM |
| 30 | |
Neha Malcom Francis | 507be12 | 2023-07-22 00:14:43 +0530 | [diff] [blame] | 31 | Boot Flow: |
| 32 | ---------- |
| 33 | On AM65x family devices, ROM supports boot only via MCU(R5). This means that |
| 34 | bootloader has to run on R5 core. In order to meet this constraint, and for |
| 35 | the following reasons the boot flow is designed as mentioned: |
| 36 | |
| 37 | 1. Need to move away from R5 asap, so that we want to start *any* |
| 38 | firmware on the R5 cores for example autosar can be loaded to receive CAN |
| 39 | response and other safety operations to be started. This operation is |
| 40 | very time critical and is applicable for all automotive use cases. |
| 41 | |
| 42 | 2. U-Boot on A53 should start other remotecores for various |
| 43 | applications. This should happen before running Linux. |
| 44 | |
| 45 | 3. In production boot flow, we might not like to use full U-Boot, |
| 46 | instead use Falcon boot flow to reduce boot time. |
| 47 | |
Nishanth Menon | d683f50 | 2023-07-27 13:58:46 -0500 | [diff] [blame] | 48 | .. image:: img/boot_diagram_am65.svg |
Neha Malcom Francis | 507be12 | 2023-07-22 00:14:43 +0530 | [diff] [blame] | 49 | |
| 50 | - Here DMSC acts as master and provides all the critical services. R5/A53 |
| 51 | requests DMSC to get these services done as shown in the above diagram. |
| 52 | |
| 53 | Sources: |
| 54 | -------- |
Neha Malcom Francis | 507be12 | 2023-07-22 00:14:43 +0530 | [diff] [blame] | 55 | |
Nishanth Menon | ee91e48 | 2023-07-27 13:58:44 -0500 | [diff] [blame] | 56 | .. include:: k3.rst |
| 57 | :start-after: .. k3_rst_include_start_boot_sources |
| 58 | :end-before: .. k3_rst_include_end_boot_sources |
Neha Malcom Francis | 507be12 | 2023-07-22 00:14:43 +0530 | [diff] [blame] | 59 | |
| 60 | Build procedure: |
| 61 | ---------------- |
Nishanth Menon | b7ee22f | 2023-07-27 13:58:48 -0500 | [diff] [blame] | 62 | 0. Setup the environment variables: |
Neha Malcom Francis | 507be12 | 2023-07-22 00:14:43 +0530 | [diff] [blame] | 63 | |
Nishanth Menon | b7ee22f | 2023-07-27 13:58:48 -0500 | [diff] [blame] | 64 | .. include:: k3.rst |
| 65 | :start-after: .. k3_rst_include_start_common_env_vars_desc |
| 66 | :end-before: .. k3_rst_include_end_common_env_vars_desc |
Neha Malcom Francis | 507be12 | 2023-07-22 00:14:43 +0530 | [diff] [blame] | 67 | |
Nishanth Menon | b7ee22f | 2023-07-27 13:58:48 -0500 | [diff] [blame] | 68 | .. include:: k3.rst |
| 69 | :start-after: .. k3_rst_include_start_board_env_vars_desc |
| 70 | :end-before: .. k3_rst_include_end_board_env_vars_desc |
Neha Malcom Francis | 507be12 | 2023-07-22 00:14:43 +0530 | [diff] [blame] | 71 | |
Nishanth Menon | b7ee22f | 2023-07-27 13:58:48 -0500 | [diff] [blame] | 72 | Set the variables corresponding to this platform: |
Neha Malcom Francis | 507be12 | 2023-07-22 00:14:43 +0530 | [diff] [blame] | 73 | |
Nishanth Menon | b7ee22f | 2023-07-27 13:58:48 -0500 | [diff] [blame] | 74 | .. include:: k3.rst |
| 75 | :start-after: .. k3_rst_include_start_common_env_vars_defn |
| 76 | :end-before: .. k3_rst_include_end_common_env_vars_defn |
Neha Malcom Francis | 507be12 | 2023-07-22 00:14:43 +0530 | [diff] [blame] | 77 | .. code-block:: bash |
| 78 | |
Nishanth Menon | b7ee22f | 2023-07-27 13:58:48 -0500 | [diff] [blame] | 79 | $ export UBOOT_CFG_CORTEXR=am65x_evm_r5_defconfig |
| 80 | $ export UBOOT_CFG_CORTEXA=am65x_evm_a53_defconfig |
| 81 | $ export TFA_BOARD=generic |
| 82 | $ # we dont use any extra TFA parameters |
| 83 | $ unset TFA_EXTRA_ARGS |
| 84 | $ export OPTEE_PLATFORM=k3-am65x |
| 85 | $ # we dont use any extra OP-TEE parameters |
| 86 | $ unset OPTEE_EXTRA_ARGS |
| 87 | |
| 88 | .. am65x_evm_rst_include_start_build_steps |
| 89 | |
| 90 | 1. Trusted Firmware-A: |
| 91 | |
| 92 | .. include:: k3.rst |
| 93 | :start-after: .. k3_rst_include_start_build_steps_tfa |
| 94 | :end-before: .. k3_rst_include_end_build_steps_tfa |
| 95 | |
| 96 | |
| 97 | 2. OP-TEE: |
| 98 | |
| 99 | .. include:: k3.rst |
| 100 | :start-after: .. k3_rst_include_start_build_steps_optee |
| 101 | :end-before: .. k3_rst_include_end_build_steps_optee |
Neha Malcom Francis | 507be12 | 2023-07-22 00:14:43 +0530 | [diff] [blame] | 102 | |
| 103 | 3. U-Boot: |
| 104 | |
| 105 | * 4.1 R5: |
| 106 | |
Nishanth Menon | b7ee22f | 2023-07-27 13:58:48 -0500 | [diff] [blame] | 107 | .. include:: k3.rst |
| 108 | :start-after: .. k3_rst_include_start_build_steps_spl_r5 |
| 109 | :end-before: .. k3_rst_include_end_build_steps_spl_r5 |
Neha Malcom Francis | 507be12 | 2023-07-22 00:14:43 +0530 | [diff] [blame] | 110 | |
| 111 | * 4.2 A53: |
| 112 | |
Nishanth Menon | b7ee22f | 2023-07-27 13:58:48 -0500 | [diff] [blame] | 113 | .. include:: k3.rst |
| 114 | :start-after: .. k3_rst_include_start_build_steps_uboot |
| 115 | :end-before: .. k3_rst_include_end_build_steps_uboot |
| 116 | .. am65x_evm_rst_include_end_build_steps |
Neha Malcom Francis | 507be12 | 2023-07-22 00:14:43 +0530 | [diff] [blame] | 117 | |
| 118 | Target Images |
| 119 | -------------- |
Tom Rini | fdf4503 | 2023-07-25 12:44:16 -0400 | [diff] [blame] | 120 | In order to boot we need tiboot3.bin, sysfw.itb, tispl.bin and u-boot.img. |
| 121 | Each SoC variant (GP and HS) requires a different source for these files. |
Neha Malcom Francis | 507be12 | 2023-07-22 00:14:43 +0530 | [diff] [blame] | 122 | |
| 123 | - GP |
| 124 | |
| 125 | * tiboot3-am65x_sr2-gp-evm.bin, sysfw-am65x_sr2-gp-evm.itb from step 4.1 |
| 126 | * tispl.bin_unsigned, u-boot.img_unsigned from step 4.2 |
| 127 | |
| 128 | - HS |
| 129 | |
| 130 | * tiboot3-am65x_sr2-hs-evm.bin, sysfw-am65x_sr2-hs-evm.itb from step 4.1 |
| 131 | * tispl.bin, u-boot.img from step 4.2 |
| 132 | |
| 133 | Image formats: |
| 134 | -------------- |
| 135 | |
Nishanth Menon | 9183494 | 2023-07-27 13:58:51 -0500 | [diff] [blame] | 136 | - tiboot3.bin |
Neha Malcom Francis | 507be12 | 2023-07-22 00:14:43 +0530 | [diff] [blame] | 137 | |
Nishanth Menon | 9183494 | 2023-07-27 13:58:51 -0500 | [diff] [blame] | 138 | .. image:: img/no_multi_cert_tiboot3.bin.svg |
Neha Malcom Francis | 507be12 | 2023-07-22 00:14:43 +0530 | [diff] [blame] | 139 | |
| 140 | - tispl.bin |
| 141 | |
Nishanth Menon | 9183494 | 2023-07-27 13:58:51 -0500 | [diff] [blame] | 142 | .. image:: img/nodm_tispl.bin.svg |
Neha Malcom Francis | 507be12 | 2023-07-22 00:14:43 +0530 | [diff] [blame] | 143 | |
| 144 | - sysfw.itb |
| 145 | |
Nishanth Menon | 9183494 | 2023-07-27 13:58:51 -0500 | [diff] [blame] | 146 | .. image:: img/sysfw.itb.svg |
Neha Malcom Francis | 507be12 | 2023-07-22 00:14:43 +0530 | [diff] [blame] | 147 | |
| 148 | eMMC: |
| 149 | ----- |
| 150 | ROM supports booting from eMMC from boot0 partition offset 0x0 |
| 151 | |
| 152 | Flashing images to eMMC: |
| 153 | |
| 154 | The following commands can be used to download tiboot3.bin, tispl.bin, |
| 155 | u-boot.img, and sysfw.itb from an SD card and write them to the eMMC boot0 |
| 156 | partition at respective addresses. |
| 157 | |
| 158 | .. code-block:: text |
| 159 | |
| 160 | => mmc dev 0 1 |
| 161 | => fatload mmc 1 ${loadaddr} tiboot3.bin |
| 162 | => mmc write ${loadaddr} 0x0 0x400 |
| 163 | => fatload mmc 1 ${loadaddr} tispl.bin |
| 164 | => mmc write ${loadaddr} 0x400 0x1000 |
| 165 | => fatload mmc 1 ${loadaddr} u-boot.img |
| 166 | => mmc write ${loadaddr} 0x1400 0x2000 |
| 167 | => fatload mmc 1 ${loadaddr} sysfw.itb |
| 168 | => mmc write ${loadaddr} 0x3600 0x800 |
| 169 | |
| 170 | To give the ROM access to the boot partition, the following commands must be |
| 171 | used for the first time: |
| 172 | |
| 173 | .. code-block:: text |
| 174 | |
| 175 | => mmc partconf 0 1 1 1 |
| 176 | => mmc bootbus 0 1 0 0 |
| 177 | |
| 178 | To create a software partition for the rootfs, the following command can be |
| 179 | used: |
| 180 | |
| 181 | .. code-block:: text |
| 182 | |
| 183 | => gpt write mmc 0 ${partitions} |
| 184 | |
| 185 | eMMC layout: |
| 186 | |
Nishanth Menon | ef930a7 | 2023-07-27 13:58:58 -0500 | [diff] [blame] | 187 | .. image:: img/emmc_am65x_evm_boot0.svg |
Neha Malcom Francis | 507be12 | 2023-07-22 00:14:43 +0530 | [diff] [blame] | 188 | |
| 189 | Kernel image and DT are expected to be present in the /boot folder of rootfs. |
| 190 | To boot kernel from eMMC, use the following commands: |
| 191 | |
| 192 | .. code-block:: text |
| 193 | |
| 194 | => setenv mmcdev 0 |
| 195 | => setenv bootpart 0 |
| 196 | => boot |
| 197 | |
| 198 | OSPI: |
| 199 | ----- |
| 200 | ROM supports booting from OSPI from offset 0x0. |
| 201 | |
| 202 | Flashing images to OSPI: |
| 203 | |
| 204 | Below commands can be used to download tiboot3.bin, tispl.bin, u-boot.img, |
| 205 | and sysfw.itb over tftp and then flash those to OSPI at their respective |
| 206 | addresses. |
| 207 | |
| 208 | .. code-block:: text |
| 209 | |
| 210 | => sf probe |
| 211 | => tftp ${loadaddr} tiboot3.bin |
| 212 | => sf update $loadaddr 0x0 $filesize |
| 213 | => tftp ${loadaddr} tispl.bin |
| 214 | => sf update $loadaddr 0x80000 $filesize |
| 215 | => tftp ${loadaddr} u-boot.img |
| 216 | => sf update $loadaddr 0x280000 $filesize |
| 217 | => tftp ${loadaddr} sysfw.itb |
| 218 | => sf update $loadaddr 0x6C0000 $filesize |
| 219 | |
| 220 | Flash layout for OSPI: |
| 221 | |
Nishanth Menon | 2bb20e4 | 2023-07-27 13:58:57 -0500 | [diff] [blame] | 222 | .. image:: img/ospi_sysfw.svg |
Neha Malcom Francis | 507be12 | 2023-07-22 00:14:43 +0530 | [diff] [blame] | 223 | |
| 224 | Kernel Image and DT are expected to be present in the /boot folder of UBIFS |
| 225 | ospi.rootfs just like in SD card case. U-Boot looks for UBI volume named |
| 226 | "rootfs" for rootfs. |
| 227 | |
| 228 | To boot kernel from OSPI, at the U-Boot prompt: |
| 229 | |
| 230 | .. code-block:: text |
| 231 | |
| 232 | => setenv boot ubi |
| 233 | => boot |
| 234 | |
| 235 | UART: |
| 236 | ----- |
| 237 | ROM supports booting from MCU_UART0 via X-Modem protocol. The entire UART-based |
| 238 | boot process up to U-Boot (proper) prompt goes through different stages and uses |
| 239 | different UART peripherals as follows: |
| 240 | |
Nishanth Menon | f020680 | 2023-07-27 13:58:56 -0500 | [diff] [blame] | 241 | .. list-table:: ROM UART Boot Responsibilities |
| 242 | :widths: 16 16 16 16 |
| 243 | :header-rows: 1 |
| 244 | |
| 245 | * - Who |
| 246 | - Loading What |
| 247 | - Hardware Module |
| 248 | - Protocol |
| 249 | |
| 250 | * - Boot ROM |
| 251 | - tiboot3.bin |
| 252 | - MCU_UART0 |
| 253 | - X-Modem(*) |
| 254 | |
| 255 | * - R5 SPL |
| 256 | - sysfw.itb |
| 257 | - MCU_UART0 |
| 258 | - Y-Modem(*) |
| 259 | |
| 260 | * - R5 SPL |
| 261 | - tispl.bin |
| 262 | - MAIN_UART0 |
| 263 | - Y-Modem |
Neha Malcom Francis | 507be12 | 2023-07-22 00:14:43 +0530 | [diff] [blame] | 264 | |
Nishanth Menon | f020680 | 2023-07-27 13:58:56 -0500 | [diff] [blame] | 265 | * - A53 SPL |
| 266 | - u-boot.img |
| 267 | - MAIN_UART0 |
| 268 | - Y-Modem |
Neha Malcom Francis | 507be12 | 2023-07-22 00:14:43 +0530 | [diff] [blame] | 269 | |
| 270 | Note that in addition to X/Y-Modem related protocol timeouts the DMSC |
| 271 | watchdog timeout of 3min (typ.) needs to be observed until System Firmware |
| 272 | is fully loaded (from sysfw.itb) and started. |
| 273 | |
| 274 | Example bash script sequence for running on a Linux host PC feeding all boot |
| 275 | artifacts needed to the device: |
| 276 | |
| 277 | .. code-block:: text |
| 278 | |
| 279 | MCU_DEV=/dev/ttyUSB1 |
| 280 | MAIN_DEV=/dev/ttyUSB0 |
| 281 | |
| 282 | stty -F $MCU_DEV 115200 cs8 -cstopb -parenb |
| 283 | stty -F $MAIN_DEV 115200 cs8 -cstopb -parenb |
| 284 | |
| 285 | sb --xmodem tiboot3.bin > $MCU_DEV < $MCU_DEV |
| 286 | sb --ymodem sysfw.itb > $MCU_DEV < $MCU_DEV |
| 287 | sb --ymodem tispl.bin > $MAIN_DEV < $MAIN_DEV |
| 288 | sleep 1 |
| 289 | sb --xmodem u-boot.img > $MAIN_DEV < $MAIN_DEV |
Jason Kacines | b0fdee9 | 2023-08-03 01:29:22 -0500 | [diff] [blame] | 290 | |
| 291 | Debugging U-Boot |
| 292 | ---------------- |
| 293 | |
| 294 | See :ref:`Common Debugging environment - OpenOCD<k3_rst_refer_openocd>`: for |
| 295 | detailed setup information. |
| 296 | |
| 297 | .. warning:: |
| 298 | |
| 299 | **OpenOCD support since**: v0.12.0 |
| 300 | |
| 301 | If the default package version of OpenOCD in your development |
| 302 | environment's distribution needs to be updated, it might be necessary to |
| 303 | build OpenOCD from the source. |
| 304 | |
| 305 | .. include:: k3.rst |
| 306 | :start-after: .. k3_rst_include_start_openocd_connect_XDS110 |
| 307 | :end-before: .. k3_rst_include_end_openocd_connect_XDS110 |
| 308 | |
| 309 | To start OpenOCD and connect to the board |
| 310 | |
| 311 | .. code-block:: bash |
| 312 | |
| 313 | openocd -f board/ti_am654evm.cfg |