Manorit Chawdhry | 670a22b | 2023-10-06 10:16:00 +0530 | [diff] [blame] | 1 | .. SPDX-License-Identifier: GPL-2.0+ OR BSD-3-Clause |
| 2 | .. sectionauthor:: Manorit Chawdhry <m-chawdhry@ti.com> |
| 3 | |
| 4 | J721S2 and AM68 Platforms |
| 5 | ========================= |
| 6 | |
| 7 | Introduction: |
| 8 | ------------- |
Heinrich Schuchardt | b72160b | 2023-10-28 11:59:32 +0200 | [diff] [blame] | 9 | |
Manorit Chawdhry | 670a22b | 2023-10-06 10:16:00 +0530 | [diff] [blame] | 10 | The J721S2 family of SoCs are part of K3 Multicore SoC architecture platform |
| 11 | targeting automotive applications. They are designed as a low power, high |
| 12 | performance and highly integrated device architecture, adding significant |
| 13 | enhancement on processing power, graphics capability, video and imaging |
| 14 | processing, virtualization and coherent memory support. |
| 15 | |
| 16 | The AM68 Starter Kit/Evaluation Module (EVM) is based on the J721S2 family |
| 17 | of SoCs. They are designed for machine vision, traffic monitoring, retail |
| 18 | automation, and factory automation. |
| 19 | |
| 20 | The device is partitioned into three functional domains, each containing |
| 21 | specific processing cores and peripherals: |
| 22 | |
| 23 | 1. Wake-up (WKUP) domain: |
| 24 | * ARM Cortex-M4F processor, runs TI Foundational Security (TIFS) |
| 25 | |
| 26 | 2. Microcontroller (MCU) domain: |
| 27 | * Dual core ARM Cortex-R5F processor, runs device management |
| 28 | and SoC early boot |
| 29 | |
| 30 | 3. MAIN domain: |
| 31 | * Dual core 64-bit ARM Cortex-A72, runs HLOS |
| 32 | |
| 33 | More info can be found in TRM: https://www.ti.com/lit/pdf/spruj28 |
| 34 | |
| 35 | Platform information: |
| 36 | |
| 37 | * https://www.ti.com/tool/J721S2XSOMXEVM |
| 38 | * https://www.ti.com/tool/SK-AM68 |
| 39 | |
| 40 | Boot Flow: |
| 41 | ---------- |
Heinrich Schuchardt | b72160b | 2023-10-28 11:59:32 +0200 | [diff] [blame] | 42 | |
Manorit Chawdhry | 670a22b | 2023-10-06 10:16:00 +0530 | [diff] [blame] | 43 | Below is the pictorial representation of boot flow: |
| 44 | |
| 45 | .. image:: img/boot_diagram_k3_current.svg |
| 46 | |
| 47 | - On this platform, "TI Foundational Security" (TIFS) functions as the |
| 48 | security enclave master while "Device Manager" (DM), also known as the |
| 49 | "TISCI server" in TI terminology, offers all the essential services. |
| 50 | |
| 51 | - As illustrated in the diagram above, R5 SPL manages power and clock |
| 52 | services independently before handing over control to "DM". The A72 or |
| 53 | the C7x (Aux core) software components request TIFS/DM to handle |
| 54 | security or device management services. |
| 55 | |
| 56 | Sources: |
| 57 | -------- |
| 58 | |
| 59 | .. include:: k3.rst |
| 60 | :start-after: .. k3_rst_include_start_boot_sources |
| 61 | :end-before: .. k3_rst_include_end_boot_sources |
| 62 | |
| 63 | Build procedure: |
| 64 | ---------------- |
Heinrich Schuchardt | b72160b | 2023-10-28 11:59:32 +0200 | [diff] [blame] | 65 | |
Manorit Chawdhry | 670a22b | 2023-10-06 10:16:00 +0530 | [diff] [blame] | 66 | 0. Setup the environment variables: |
| 67 | |
| 68 | .. include:: k3.rst |
| 69 | :start-after: .. k3_rst_include_start_common_env_vars_desc |
| 70 | :end-before: .. k3_rst_include_end_common_env_vars_desc |
| 71 | |
| 72 | .. include:: k3.rst |
| 73 | :start-after: .. k3_rst_include_start_board_env_vars_desc |
| 74 | :end-before: .. k3_rst_include_end_board_env_vars_desc |
| 75 | |
| 76 | Set the variables corresponding to this platform: |
| 77 | |
| 78 | .. include:: k3.rst |
| 79 | :start-after: .. k3_rst_include_start_common_env_vars_defn |
| 80 | :end-before: .. k3_rst_include_end_common_env_vars_defn |
Nishanth Menon | fdd7cb7 | 2023-11-02 23:40:26 -0500 | [diff] [blame] | 81 | .. prompt:: bash $ |
Manorit Chawdhry | 670a22b | 2023-10-06 10:16:00 +0530 | [diff] [blame] | 82 | |
Nishanth Menon | fdd7cb7 | 2023-11-02 23:40:26 -0500 | [diff] [blame] | 83 | export UBOOT_CFG_CORTEXR=j721s2_evm_r5_defconfig |
| 84 | export UBOOT_CFG_CORTEXA=j721s2_evm_a72_defconfig |
| 85 | export TFA_BOARD=generic |
| 86 | export TFA_EXTRA_ARGS="K3_USART=0x8" |
| 87 | # The following is not a typo, j784s4 is the OP-TEE platform for j721s2 |
| 88 | export OPTEE_PLATFORM=k3-j784s4 |
| 89 | export OPTEE_EXTRA_ARGS="CFG_CONSOLE_UART=0x8" |
Manorit Chawdhry | 670a22b | 2023-10-06 10:16:00 +0530 | [diff] [blame] | 90 | |
| 91 | .. j721s2_evm_rst_include_start_build_steps |
| 92 | |
| 93 | 1. Trusted Firmware-A: |
| 94 | |
| 95 | .. include:: k3.rst |
| 96 | :start-after: .. k3_rst_include_start_build_steps_tfa |
| 97 | :end-before: .. k3_rst_include_end_build_steps_tfa |
| 98 | |
| 99 | |
| 100 | 2. OP-TEE: |
| 101 | |
| 102 | .. include:: k3.rst |
| 103 | :start-after: .. k3_rst_include_start_build_steps_optee |
| 104 | :end-before: .. k3_rst_include_end_build_steps_optee |
| 105 | |
| 106 | 3. U-Boot: |
| 107 | |
| 108 | .. _j721s2_evm_rst_u_boot_r5: |
| 109 | |
| 110 | * 3.1 R5: |
| 111 | |
| 112 | .. include:: k3.rst |
| 113 | :start-after: .. k3_rst_include_start_build_steps_spl_r5 |
| 114 | :end-before: .. k3_rst_include_end_build_steps_spl_r5 |
| 115 | |
| 116 | .. _j721s2_evm_rst_u_boot_a72: |
| 117 | |
| 118 | * 3.2 A72: |
| 119 | |
| 120 | .. include:: k3.rst |
| 121 | :start-after: .. k3_rst_include_start_build_steps_uboot |
| 122 | :end-before: .. k3_rst_include_end_build_steps_uboot |
| 123 | .. j721s2_evm_rst_include_end_build_steps |
| 124 | |
| 125 | Target Images |
Heinrich Schuchardt | b72160b | 2023-10-28 11:59:32 +0200 | [diff] [blame] | 126 | ------------- |
| 127 | |
Manorit Chawdhry | 670a22b | 2023-10-06 10:16:00 +0530 | [diff] [blame] | 128 | In order to boot we need tiboot3.bin, tispl.bin and u-boot.img. Each SoC |
| 129 | variant (GP, HS-FS, HS-SE) requires a different source for these files. |
| 130 | |
| 131 | - GP |
| 132 | |
| 133 | * tiboot3-j721s2-gp-evm.bin from :ref:`step 3.1 <j721s2_evm_rst_u_boot_r5>` |
| 134 | * tispl.bin_unsigned, u-boot.img_unsigned from :ref:`step 3.2 <j721s2_evm_rst_u_boot_a72>` |
| 135 | |
| 136 | - HS-FS |
| 137 | |
| 138 | * tiboot3-j721s2-hs-fs-evm.bin from :ref:`step 3.1 <j721s2_evm_rst_u_boot_r5>` |
| 139 | * tispl.bin, u-boot.img from :ref:`step 3.2 <j721s2_evm_rst_u_boot_a72>` |
| 140 | |
| 141 | - HS-SE |
| 142 | |
| 143 | * tiboot3-j721s2-hs-evm.bin from :ref:`step 3.1 <j721s2_evm_rst_u_boot_r5>` |
| 144 | * tispl.bin, u-boot.img from :ref:`step 3.2 <j721s2_evm_rst_u_boot_a72>` |
| 145 | |
| 146 | Image formats: |
| 147 | -------------- |
| 148 | |
| 149 | - tiboot3.bin |
| 150 | |
| 151 | .. image:: img/multi_cert_tiboot3.bin.svg |
| 152 | |
| 153 | - tispl.bin |
| 154 | |
| 155 | .. image:: img/dm_tispl.bin.svg |
| 156 | |
| 157 | R5 Memory Map: |
| 158 | -------------- |
| 159 | |
| 160 | .. list-table:: |
| 161 | :widths: 16 16 16 |
| 162 | :header-rows: 1 |
| 163 | |
| 164 | * - Region |
| 165 | - Start Address |
| 166 | - End Address |
| 167 | |
| 168 | * - SPL |
| 169 | - 0x41c00000 |
| 170 | - 0x41c40000 |
| 171 | |
| 172 | * - EMPTY |
| 173 | - 0x41c40000 |
| 174 | - 0x41c61f20 |
| 175 | |
| 176 | * - STACK |
| 177 | - 0x41c65f20 |
| 178 | - 0x41c61f20 |
| 179 | |
| 180 | * - Global data |
| 181 | - 0x41c65f20 |
| 182 | - 0x41c66000 |
| 183 | |
| 184 | * - Heap |
| 185 | - 0x41c66000 |
| 186 | - 0x41c76000 |
| 187 | |
| 188 | * - BSS |
| 189 | - 0x41c76000 |
| 190 | - 0x41c80000 |
| 191 | |
| 192 | * - DM DATA |
| 193 | - 0x41c80000 |
| 194 | - 0x41c84130 |
| 195 | |
| 196 | * - EMPTY |
| 197 | - 0x41c84130 |
| 198 | - 0x41cff9fc |
| 199 | |
| 200 | * - MCU Scratchpad |
| 201 | - 0x41cff9fc |
| 202 | - 0x41cffbfc |
| 203 | |
| 204 | * - ROM DATA |
| 205 | - 0x41cffbfc |
| 206 | - 0x41cfffff |
| 207 | |
| 208 | Switch Setting for Boot Mode |
| 209 | ---------------------------- |
| 210 | |
| 211 | Boot Mode pins provide means to select the boot mode and options before the |
| 212 | device is powered up. After every POR, they are the main source to populate |
| 213 | the Boot Parameter Tables. |
| 214 | |
| 215 | Boot Mode Pins for J721S2-EVM |
| 216 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ |
| 217 | |
| 218 | The following table shows some common boot modes used on J721S2 platform. |
| 219 | More details can be found in the Technical Reference Manual: |
| 220 | https://www.ti.com/lit/pdf/spruj28 under the `Boot Mode Pins` section. |
| 221 | |
| 222 | .. list-table:: Boot Modes |
| 223 | :widths: 16 16 16 |
| 224 | :header-rows: 1 |
| 225 | |
| 226 | * - Switch Label |
| 227 | - SW9: 12345678 |
| 228 | - SW8: 12345678 |
| 229 | |
| 230 | * - SD |
| 231 | - 00000000 |
| 232 | - 10000010 |
| 233 | |
| 234 | * - EMMC |
| 235 | - 01000000 |
| 236 | - 10000000 |
| 237 | |
| 238 | * - OSPI |
| 239 | - 01000000 |
| 240 | - 00000110 |
| 241 | |
| 242 | * - UART |
| 243 | - 01110000 |
| 244 | - 00000000 |
| 245 | |
| 246 | * - USB DFU |
| 247 | - 00100000 |
| 248 | - 10000000 |
| 249 | |
| 250 | For SW8 and SW9, the switch state in the "ON" position = 1. |
| 251 | |
| 252 | Boot Mode Pins for SK-AM68 |
| 253 | ^^^^^^^^^^^^^^^^^^^^^^^^^^ |
| 254 | |
| 255 | The following table shows some common boot modes used on AM68-SK platform. |
| 256 | More details can be found in the User Guide for AM68-SK: |
| 257 | https://www.ti.com/lit/pdf/spruj68 under the `Bootmode Settings` section. |
| 258 | |
| 259 | .. list-table:: Boot Modes |
| 260 | :widths: 16 16 |
| 261 | :header-rows: 1 |
| 262 | |
| 263 | * - Switch Label |
| 264 | - SW1: 1234 |
| 265 | |
| 266 | * - SD |
| 267 | - 0000 |
| 268 | |
| 269 | * - xSPI |
| 270 | - 0010 |
| 271 | |
| 272 | * - UART |
| 273 | - 1010 |
| 274 | |
| 275 | * - Ethernet |
| 276 | - 0100 |
| 277 | |
| 278 | For SW1, the switch state in the "ON" position = 1. |
| 279 | |
| 280 | Debugging U-Boot |
| 281 | ---------------- |
| 282 | |
| 283 | See :ref:`Common Debugging environment - OpenOCD<k3_rst_refer_openocd>`: for |
| 284 | detailed setup information. |
| 285 | |
| 286 | .. warning:: |
| 287 | |
| 288 | **OpenOCD support since**: v0.12.0 |
| 289 | |
| 290 | If the default package version of OpenOCD in your development |
| 291 | environment's distribution needs to be updated, it might be necessary to |
| 292 | build OpenOCD from the source. |
| 293 | |
| 294 | Debugging U-Boot on J721S2-EVM |
| 295 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ |
| 296 | |
| 297 | .. include:: k3.rst |
| 298 | :start-after: .. k3_rst_include_start_openocd_connect_XDS110 |
| 299 | :end-before: .. k3_rst_include_end_openocd_connect_XDS110 |
| 300 | |
| 301 | To start OpenOCD and connect to the board |
| 302 | |
Nishanth Menon | fdd7cb7 | 2023-11-02 23:40:26 -0500 | [diff] [blame] | 303 | .. prompt:: bash $ |
Manorit Chawdhry | 670a22b | 2023-10-06 10:16:00 +0530 | [diff] [blame] | 304 | |
| 305 | openocd -f board/ti_j721s2evm.cfg |
| 306 | |
| 307 | Debugging U-Boot on SK-AM68 |
| 308 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ |
| 309 | |
| 310 | .. include:: k3.rst |
| 311 | :start-after: .. k3_rst_include_start_openocd_connect_cti20 |
| 312 | :end-before: .. k3_rst_include_end_openocd_connect_cti20 |
| 313 | |
| 314 | .. include:: k3.rst |
| 315 | :start-after: .. k3_rst_include_start_openocd_cfg_external_intro |
| 316 | :end-before: .. k3_rst_include_end_openocd_cfg_external_intro |
| 317 | |
| 318 | For SK-AM68, the openocd_connect.cfg is as follows: |
| 319 | |
| 320 | .. code-block:: tcl |
| 321 | |
| 322 | # TUMPA example: |
| 323 | # http://www.tiaowiki.com/w/TIAO_USB_Multi_Protocol_Adapter_User's_Manual |
| 324 | source [find interface/ftdi/tumpa.cfg] |
| 325 | |
| 326 | transport select jtag |
| 327 | |
| 328 | # default JTAG configuration has only SRST and no TRST |
| 329 | reset_config srst_only srst_push_pull |
| 330 | |
| 331 | # delay after SRST goes inactive |
| 332 | adapter srst delay 20 |
| 333 | |
| 334 | if { ![info exists SOC] } { |
| 335 | # Set the SoC of interest |
| 336 | set SOC j721s2 |
| 337 | } |
| 338 | |
| 339 | source [find target/ti_k3.cfg] |
| 340 | |
| 341 | ftdi tdo_sample_edge falling |
| 342 | |
| 343 | # Speeds for FT2232H are in multiples of 2, and 32MHz is tops |
| 344 | # max speed we seem to achieve is ~20MHz.. so we pick 16MHz |
| 345 | adapter speed 16000 |