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