Nishanth Menon | 756b878 | 2023-11-04 03:11:03 -0500 | [diff] [blame] | 1 | .. SPDX-License-Identifier: GPL-2.0+ OR BSD-3-Clause |
| 2 | .. sectionauthor:: Nishanth Menon <nm@ti.com> |
| 3 | |
| 4 | J721E/TDA4VM Beagleboard.org BeagleBone AI-64 |
| 5 | ============================================= |
| 6 | |
| 7 | Introduction: |
| 8 | ------------- |
| 9 | |
| 10 | BeagleBoard.org BeagleBone AI-64 is an open source hardware single |
| 11 | board computer based on the Texas Instruments TDA4VM SoC featuring |
| 12 | dual-core 2.0GHz Arm Cortex-A72 processor, C7x+MMA and 2 C66x |
| 13 | floating-point VLIW DSPs, 3x dual ARM Cortex-R5 co-processors, |
| 14 | 2x 6-core Programmable Real-Time Unit and Industrial Communication |
| 15 | SubSystem, PowerVR Rogue 8XE GE8430 3D GPU. The board features 4GB |
| 16 | DDR4, USB3.0 Type-C, 2x USB SS Type-A, miniDisplayPort, 2x 4-lane |
| 17 | CSI, DSI, 16GB eMMC flash, 1G Ethernet, M.2 E-key for WiFi/BT, and |
| 18 | BeagleBone expansion headers. |
| 19 | |
| 20 | Further information can be found at: |
| 21 | |
| 22 | * Product Page: https://beagleboard.org/ai-64 |
| 23 | * Hardware documentation: https://git.beagleboard.org/beagleboard/beaglebone-ai-64 |
| 24 | |
| 25 | Boot Flow: |
| 26 | ---------- |
| 27 | Below is the pictorial representation of boot flow: |
| 28 | |
| 29 | .. image:: ../ti/img/boot_diagram_j721e.svg |
| 30 | :alt: Boot flow diagram |
| 31 | |
| 32 | - On this platform, DMSC runs 'TI Foundational Security' (TIFS) which |
| 33 | functions as the security enclave master. The 'Device Manager' (DM), |
| 34 | also known as the 'TISCI server' in "TI terminology", running on boot |
| 35 | R5F, offers all the essential services required for device management. |
| 36 | The A72, C7x, C6x or R5F (Aux cores) sends requests to TIFS/DM to |
| 37 | accomplish the needed services, as illustrated in the diagram above. |
| 38 | |
| 39 | Sources: |
| 40 | -------- |
| 41 | .. include:: ../ti/k3.rst |
| 42 | :start-after: .. k3_rst_include_start_boot_sources |
| 43 | :end-before: .. k3_rst_include_end_boot_sources |
| 44 | |
Dhruva Gole | 26e0ddf | 2024-08-05 19:59:33 +0530 | [diff] [blame] | 45 | .. include:: ../ti/k3.rst |
| 46 | :start-after: .. k3_rst_include_start_boot_firmwares |
| 47 | :end-before: .. k3_rst_include_end_boot_firmwares |
| 48 | |
Nishanth Menon | 756b878 | 2023-11-04 03:11:03 -0500 | [diff] [blame] | 49 | Build procedure: |
| 50 | ---------------- |
| 51 | 0. Setup the environment variables: |
| 52 | |
| 53 | .. include:: ../ti/k3.rst |
| 54 | :start-after: .. k3_rst_include_start_common_env_vars_desc |
| 55 | :end-before: .. k3_rst_include_end_common_env_vars_desc |
| 56 | |
| 57 | .. include:: ../ti/k3.rst |
| 58 | :start-after: .. k3_rst_include_start_board_env_vars_desc |
| 59 | :end-before: .. k3_rst_include_end_board_env_vars_desc |
| 60 | |
| 61 | Set the variables corresponding to this platform: |
| 62 | |
| 63 | .. include:: ../ti/k3.rst |
| 64 | :start-after: .. k3_rst_include_start_common_env_vars_defn |
| 65 | :end-before: .. k3_rst_include_end_common_env_vars_defn |
| 66 | .. prompt:: bash $ |
| 67 | |
| 68 | export UBOOT_CFG_CORTEXR=j721e_beagleboneai64_r5_defconfig |
| 69 | export UBOOT_CFG_CORTEXA=j721e_beagleboneai64_a72_defconfig |
| 70 | export TFA_BOARD=generic |
| 71 | # we dont use any extra TFA parameters |
| 72 | unset TFA_EXTRA_ARGS |
| 73 | export OPTEE_PLATFORM=k3-j721e |
| 74 | # we dont use any extra OP-TEE parameters |
| 75 | unset OPTEE_EXTRA_ARGS |
| 76 | |
| 77 | .. include:: ../ti/j721e_evm.rst |
| 78 | :start-after: .. j721e_evm_rst_include_start_build_steps |
| 79 | :end-before: .. j721e_evm_rst_include_end_build_steps |
| 80 | |
| 81 | Target Images |
| 82 | -------------- |
| 83 | Copy the below images to an SD card and boot: |
| 84 | |
| 85 | * tiboot3-j721e-gp-evm.bin from R5 build as tiboot3.bin |
| 86 | * tispl.bin_unsigned from Cortex-A build as tispl.bin |
| 87 | * u-boot.img_unsigned from Cortex-A build as u-boot.img |
| 88 | |
| 89 | Image formats |
| 90 | ------------- |
| 91 | |
| 92 | - tiboot3.bin |
| 93 | |
| 94 | .. image:: ../ti/img/no_multi_cert_tiboot3.bin.svg |
| 95 | :alt: tiboot3.bin image format |
| 96 | |
| 97 | - tispl.bin |
| 98 | |
| 99 | .. image:: ../ti/img/dm_tispl.bin.svg |
| 100 | :alt: tispl.bin image format |
| 101 | |
| 102 | - sysfw.itb |
| 103 | |
| 104 | .. image:: ../ti/img/sysfw.itb.svg |
| 105 | :alt: sysfw.itb image format |
| 106 | |
| 107 | Additional hardware for U-Boot development |
| 108 | ------------------------------------------ |
| 109 | |
| 110 | * Serial Console is critical for U-Boot development on BeagleBone AI-64. See |
| 111 | `BeagleBone AI-64 connector documentation |
| 112 | <https://docs.beagleboard.org/latest/boards/beaglebone/ai-64/ch07.html>`_. |
| 113 | * uSD is preferred option over eMMC, and a SD/MMC reader will be needed. |
| 114 | * (optionally) JTAG is useful when working with very early stages of boot. |
| 115 | |
| 116 | Default storage options |
| 117 | ----------------------- |
| 118 | |
| 119 | There are multiple storage media options on BeagleBone AI-64, but primarily: |
| 120 | |
| 121 | * Onboard eMMC (default) - reliable, fast and meant for deployment use. |
| 122 | * SD/MMC card interface (hold 'BOOT' switch and power on) - Entirely |
| 123 | depends on the SD card quality. |
| 124 | |
| 125 | Flash to uSD card or how to deal with "bricked" Board |
| 126 | -------------------------------------------------------- |
| 127 | |
| 128 | When deploying or working on Linux, it's common to use the onboard |
| 129 | eMMC. However, avoiding the eMMC and using the uSD card is safer when |
| 130 | working with U-Boot. |
| 131 | |
| 132 | If you choose to hand format your own bootable uSD card, be |
| 133 | aware that it can be difficult. The following information |
| 134 | may be helpful, but remember that it is only sometimes |
| 135 | reliable, and partition options can cause issues. These |
| 136 | can potentially help: |
| 137 | |
| 138 | * https://git.ti.com/cgit/arago-project/tisdk-setup-scripts/tree/create-sdcard.sh |
| 139 | * https://elinux.org/Beagleboard:Expanding_File_System_Partition_On_A_microSD |
| 140 | |
| 141 | The simplest option is to start with a standard distribution |
| 142 | image like those in `BeagleBoard.org Distros Page |
| 143 | <https://www.beagleboard.org/distros>`_ and download a disk image for |
| 144 | BeagleBone AI-64. Pick a 16GB+ uSD card to be on the safer side. |
| 145 | |
| 146 | With an SD/MMC Card reader and `Balena Etcher |
| 147 | <https://etcher.balena.io/>`_, having a functional setup in minutes is |
| 148 | a trivial matter, and it works on almost all Host Operating Systems. |
| 149 | Yes Windows users, Windows Subsystem for Linux(WSL) based development |
| 150 | with U-Boot and update uSD card is practical. |
| 151 | |
| 152 | Updating U-Boot is a matter of copying the tiboot3.bin, tispl.bin and |
| 153 | u-boot.img to the "BOOT" partition of the uSD card. Remember to sync |
| 154 | and unmount (or Eject - depending on the Operating System) the uSD |
| 155 | card prior to physically removing from SD card reader. |
| 156 | |
| 157 | Also see following section on switch setting used for booting using |
| 158 | uSD card. |
| 159 | |
| 160 | .. note:: |
| 161 | Great news! If the board has not been damaged physically, there's no |
| 162 | need to worry about it being "bricked" on this platform. You only have |
| 163 | to flash an uSD card, plug it in, and reinstall the image on eMMC. This |
| 164 | means that even if you make a mistake, you can quickly fix it and rest |
| 165 | easy. |
| 166 | |
| 167 | If you are frequently working with uSD cards, you might find the |
| 168 | following useful: |
| 169 | |
| 170 | * `USB-SD-Mux <https://www.linux-automation.com/en/products/usb-sd-mux.html>`_ |
| 171 | * `SD-Wire <https://wiki.tizen.org/SDWire>`_ |
| 172 | |
| 173 | Flash to eMMC |
| 174 | ------------- |
| 175 | |
| 176 | The eMMC layout selected is user-friendly for developers. The |
| 177 | boot hardware partition of the eMMC only contains the fixed-size |
| 178 | tiboot3.bin image. This is because the contents of the boot partitions |
| 179 | need to run from the SoC's internal SRAM, which remains a fixed size |
| 180 | constant. The other components of the boot sequence, such as tispl.bin |
| 181 | and u-boot.img, are located in the /BOOT partition in the User Defined |
| 182 | Area (UDA) hardware partition of the eMMC. These components can vary |
| 183 | significantly in size. The choice of keeping tiboot3.bin in boot0 or |
| 184 | boot1 partition depends on A/B update requirements. |
| 185 | |
| 186 | .. image:: img/beagleplay_emmc.svg |
| 187 | :alt: eMMC partitions and boot file organization for BeagleBone AI-64 |
| 188 | |
| 189 | The following are the steps from Linux shell to program eMMC: |
| 190 | |
| 191 | .. prompt:: bash # |
| 192 | |
| 193 | # Enable Boot0 boot |
| 194 | mmc bootpart enable 1 2 /dev/mmcblk0 |
| 195 | mmc bootbus set single_backward x1 x8 /dev/mmcblk0 |
| 196 | mmc hwreset enable /dev/mmcblk0 |
| 197 | |
| 198 | # Clear eMMC boot0 |
| 199 | echo '0' >> /sys/class/block/mmcblk0boot0/force_ro |
| 200 | dd if=/dev/zero of=/dev/mmcblk0boot0 count=32 bs=128k |
| 201 | # Write tiboot3.bin |
| 202 | dd if=tiboot3.bin of=/dev/mmcblk0boot0 bs=128k |
| 203 | |
| 204 | # Copy the rest of the boot binaries |
| 205 | mount /dev/mmcblk0p1 /boot/firmware |
| 206 | cp tispl.bin /boot/firmware |
| 207 | cp u-boot.img /boot/firmware |
| 208 | sync |
| 209 | |
| 210 | .. warning :: |
| 211 | |
| 212 | U-Boot is configured to prioritize booting from an SD card if it |
| 213 | detects a valid boot partition and boot files on it, even if the |
| 214 | system initially booted from eMMC. The boot order is set as follows: |
| 215 | |
| 216 | * SD/MMC |
| 217 | * eMMC |
| 218 | * USB |
| 219 | * PXE |
| 220 | |
| 221 | LED patterns during boot |
| 222 | ------------------------ |
| 223 | |
| 224 | .. list-table:: USR LED status indication |
| 225 | :widths: 16 16 |
| 226 | :header-rows: 1 |
| 227 | |
| 228 | * - USR LEDs (012345) |
| 229 | - Indicates |
| 230 | |
| 231 | * - 00000 |
| 232 | - Boot failure or R5 image not started up |
| 233 | |
| 234 | * - 11111 |
| 235 | - A53 SPL/U-boot has started up |
| 236 | |
| 237 | * - 10101 |
| 238 | - OS boot process has been initiated |
| 239 | |
| 240 | * - 01010 |
| 241 | - OS boot process failed and drops to U-Boot shell |
| 242 | |
| 243 | .. note :: |
| 244 | |
| 245 | In the table above, 0 indicates LED switched off and 1 indicates LED |
| 246 | switched ON. |
| 247 | |
| 248 | .. warning :: |
| 249 | |
| 250 | The green LED very next to the serial connector labelled "WKUP UART0" |
| 251 | is the power LED (LED6). This is the same color as the rest of the USR |
| 252 | LEDs. If the "green" LED6 power LED is not glowing, the system power |
| 253 | supply is not functional. Please refer to `BeagleBone AI-64 documentation |
| 254 | <https://beagleboard.org/ai-64/>`_ for further information. |
| 255 | |
| 256 | Switch Setting for Boot Mode |
| 257 | ---------------------------- |
| 258 | |
| 259 | The boot time option is configured via "BOOT" button on the board. |
| 260 | See `BeagleBone AI-64 Schematics <https://git.beagleboard.org/beagleboard/beaglebone-ai-64/-/blob/main/BeagleBone_AI-64_SCH.pdf>`_ |
| 261 | for details. |
| 262 | |
| 263 | .. list-table:: Boot Modes |
| 264 | :widths: 16 16 16 |
| 265 | :header-rows: 1 |
| 266 | |
| 267 | * - BOOT Switch Position |
| 268 | - Primary Boot |
| 269 | - Secondary Boot |
| 270 | |
| 271 | * - Not Pressed |
| 272 | - eMMC |
| 273 | - SD Card |
| 274 | |
| 275 | * - Pressed |
| 276 | - SD Card |
| 277 | - SD Card |
| 278 | |
| 279 | To switch to SD card boot mode, hold the BOOT button while powering on |
| 280 | with Type-C power supply, then release when power LED lights up. |
| 281 | |
| 282 | Debugging U-Boot |
| 283 | ---------------- |
| 284 | |
| 285 | See :ref:`Common Debugging environment - OpenOCD<k3_rst_refer_openocd>`: for |
| 286 | detailed setup and debugging information. |
| 287 | |
| 288 | .. warning:: |
| 289 | |
| 290 | **OpenOCD support since**: v0.12.0 |
| 291 | |
| 292 | If the default package version of OpenOCD in your development |
| 293 | environment's distribution needs to be updated, it might be necessary to |
| 294 | build OpenOCD from the source. |
| 295 | |
| 296 | .. include:: ../ti/k3.rst |
| 297 | :start-after: .. k3_rst_include_start_openocd_connect_tag_connect |
| 298 | :end-before: .. k3_rst_include_end_openocd_connect_tag_connect |
| 299 | |
| 300 | .. include:: ../ti/k3.rst |
| 301 | :start-after: .. k3_rst_include_start_openocd_cfg_external_intro |
| 302 | :end-before: .. k3_rst_include_end_openocd_cfg_external_intro |
| 303 | |
| 304 | For example, with BeagleBone AI-64 (J721e platform), the openocd_connect.cfg: |
| 305 | |
| 306 | .. code-block:: tcl |
| 307 | |
| 308 | # TUMPA example: |
| 309 | # http://www.tiaowiki.com/w/TIAO_USB_Multi_Protocol_Adapter_User's_Manual |
| 310 | source [find interface/ftdi/tumpa.cfg] |
| 311 | |
| 312 | transport select jtag |
| 313 | |
| 314 | # default JTAG configuration has only SRST and no TRST |
| 315 | reset_config srst_only srst_push_pull |
| 316 | |
| 317 | # delay after SRST goes inactive |
| 318 | adapter srst delay 20 |
| 319 | |
| 320 | if { ![info exists SOC] } { |
| 321 | # Set the SoC of interest |
| 322 | set SOC j721e |
| 323 | } |
| 324 | |
| 325 | source [find target/ti_k3.cfg] |
| 326 | |
| 327 | ftdi tdo_sample_edge falling |
| 328 | |
| 329 | # Speeds for FT2232H are in multiples of 2, and 32MHz is tops |
| 330 | # max speed we seem to achieve is ~20MHz.. so we pick 16MHz |
| 331 | adapter speed 16000 |