|
| 1 | +.. zephyr:board:: am243x_evm |
| 2 | +
|
| 3 | +Overview |
| 4 | +******** |
| 5 | + |
| 6 | +The AM243x EVM is a development board that is based of a AM2434 SoC. The |
| 7 | +Cortex R5F cores in the SoC run at 800 MHz. The board also includes a flash |
| 8 | +region, DIP-Switches for the boot mode selection and 2 RJ45 Ethernet ports. |
| 9 | + |
| 10 | +See the `TI TMDS243EVM Product Page`_ for details. |
| 11 | + |
| 12 | +Hardware |
| 13 | +******** |
| 14 | + |
| 15 | +The AM2434 SoC has 2 domains. A MAIN domain and a MCU domain. The MAIN domain |
| 16 | +consists of 4 R5F cores and the MCU domain of one M4F core. |
| 17 | + |
| 18 | +Zephyr currently supports the following cores: |
| 19 | + |
| 20 | +- R5F Subsystem 0 Core 0 (R5F0_0) |
| 21 | +- M4F Core (M4) |
| 22 | + |
| 23 | +The board physically contains: |
| 24 | + |
| 25 | +- Memory. |
| 26 | + |
| 27 | + - 256KB of SRAM |
| 28 | + - 2GB of DDR4 |
| 29 | + |
| 30 | +- Debug |
| 31 | + |
| 32 | + - XDS110 based JTAG |
| 33 | + |
| 34 | +Devices |
| 35 | +======== |
| 36 | +System Clock |
| 37 | +------------ |
| 38 | + |
| 39 | +This board configuration uses a system clock frequency of |
| 40 | + |
| 41 | +- 800MHz for R5F0_0 |
| 42 | +- 400MHz for M4 |
| 43 | + |
| 44 | +DDR RAM |
| 45 | +------- |
| 46 | + |
| 47 | +The board has 2GB of DDR RAM available. This board configuration allocates: |
| 48 | + |
| 49 | +- 4KB Resource Table at 0xa4100000 for M4 |
| 50 | +- 4KB Resource Table at 0xa0100000 for R5F0_0 |
| 51 | +- 8MB Shared Memory at 0xa5000000 for inter-processor communication |
| 52 | + |
| 53 | +Serial Port |
| 54 | +----------- |
| 55 | + |
| 56 | +This board configuration uses by default: |
| 57 | + |
| 58 | +- MAIN domain UART (UART0) for R5F0_0 |
| 59 | +- MCU domain UART (MCU_UART0) for M4 |
| 60 | + |
| 61 | +Supported Features |
| 62 | +================== |
| 63 | + |
| 64 | +.. zephyr:board-supported-hw:: |
| 65 | +
|
| 66 | +
|
| 67 | +Flashing |
| 68 | +******** |
| 69 | +The boot process of the AM2434 SoC requires the booting image to be in a |
| 70 | +specific format and to wait for the internal DMSC-L of the AM2434 to start up |
| 71 | +and configure memory firewalls. Since there exists no Zephyr support it's |
| 72 | +required to use one of the SBL bootloader examples from the TI MCU+ SDK. |
| 73 | + |
| 74 | + |
| 75 | +Prerequisites |
| 76 | +============= |
| 77 | + |
| 78 | +The following steps are from the time this documentation was written and might |
| 79 | +change in the future. They also target Linux with assumption some basic things |
| 80 | +(like python3 and openssl) are installed. |
| 81 | + |
| 82 | +You might also want to take a look at the `Bootflow Guide`_ for more details. |
| 83 | + |
| 84 | +To build these you need to install the TI MCU+ SDK. To do this you need to |
| 85 | +follow the steps described in the ``mcupsdk-core`` repository, which includes |
| 86 | +cloning the repositories with west. It's recommended to use another Python venv |
| 87 | +for this since the MCU+ SDK has own Python dependencies that could conflict with |
| 88 | +Zephyr dependencies. You can replace ``all/dev.yml`` in the ``west init`` |
| 89 | +command with ``am243x/dev.yml``, if you want to clone a few less repositories. |
| 90 | + |
| 91 | +You also need to follow the "Downloading And Installing Dependencies" section |
| 92 | +but you need to replace all ``am263x`` occurences in commands with ``am243x``. |
| 93 | +Please also take note of the ``tools`` and ``mcu_plus_sdk`` install path. The |
| 94 | +``tools`` install path will later be referred to as ``$TI_TOOLS`` and the MCU+ |
| 95 | +SDK path as ``$MCUPSDK``. You can pass ``--skip_doxygen=true`` and |
| 96 | +``--skip_ccs=true`` to the install script since they aren't needed. You might |
| 97 | +encounter a error that a script can't be executed. To fix it you need to mark it |
| 98 | +as executable with ``chmod +x <path>`` and run the ``download_components.sh`` |
| 99 | +again. |
| 100 | + |
| 101 | +Summarized you will most likely want to run the following commands or similar |
| 102 | +versions for setting up the MCU+ SDK: |
| 103 | + |
| 104 | +.. code-block:: console |
| 105 | +
|
| 106 | + python3 -m venv .venv |
| 107 | + source .venv/bin/activate |
| 108 | + pip3 install west |
| 109 | + west init -m https://github.com/TexasInstruments/mcupsdk-manifests.git --mr mcupsdk_west --mf am243x/dev.yml |
| 110 | + west update |
| 111 | + ./mcupsdk_setup/am243x/download_components.sh --skip_doxygen=true --skip_ccs=true |
| 112 | +
|
| 113 | +After the script finished successfully you want to switch into the |
| 114 | +``mcu_plus_sdk`` directory and edit the |
| 115 | +``source/drivers/bootloader/bootloader.c`` file to set the ``entryPoint`` to |
| 116 | +``0`` inside ``Bootloader_runCpu`` unconditionally. This is needed due to how |
| 117 | +Zephyr builds the image currently. |
| 118 | + |
| 119 | +Now you can build the internal libraries with the following commands: |
| 120 | + |
| 121 | +.. code-block:: console |
| 122 | +
|
| 123 | + make gen-buildfiles DEVICE=am243x PROFILE=release |
| 124 | + make libs DEVICE=am243x PROFILE=release |
| 125 | +
|
| 126 | +If you encounter compile errors you have to fix them. For that you might have to |
| 127 | +change parameter types, remove missing source files from makefiles or download |
| 128 | +missing headers from the TI online reference. |
| 129 | + |
| 130 | +Depending on whether you later want to boot from flash or by loading the image |
| 131 | +via UART either the ``sbl_ospi`` or the ``sbl_uart`` example is relevant for the |
| 132 | +next section. |
| 133 | + |
| 134 | + |
| 135 | +Building the bootloader itself |
| 136 | +============================== |
| 137 | + |
| 138 | +The example bootloader implementation is found in the |
| 139 | +``examples/drivers/boot/<example>/am243x-evm/r5fss0-0_nortos`` directory. |
| 140 | + |
| 141 | +You can either build the example by invoking ``make -C |
| 142 | +examples/drivers/boot/<example>/am243x-evm/r5fss0-0_nortos/ti-arm-clang/ |
| 143 | +DEVICE=am243x PROFILE=release`` or use the prebuilt binaries in |
| 144 | +``tools/boot/sbl_prebuilt/am243x-evm`` |
| 145 | + |
| 146 | + |
| 147 | +Converting the Zephyr application |
| 148 | +================================= |
| 149 | + |
| 150 | +Additionally for booting you need to convert your built Zephyr binary into a |
| 151 | +format that the TI example bootloader can boot. You can do this with the |
| 152 | +following commands, where ``$TI_TOOLS`` refers to the root of where your |
| 153 | +ti-tools (clang, sysconfig etc.) are installed (``$HOME/ti`` by default) and |
| 154 | +``$MCUPSDK`` to the root of the MCU+ SDK (directory called ``mcu_plus_sdk``). |
| 155 | +You might have to change version numbers in the commands. It's expected that the |
| 156 | +``zephyr.elf`` from the build output is in the current directory. |
| 157 | + |
| 158 | +.. code-block:: bash |
| 159 | +
|
| 160 | + export BOOTIMAGE_CORE_ID_r5fss0-0=4 |
| 161 | + export BOOTIMAGE_CORE_ID_m4=14 |
| 162 | + # set CORE_ID as per your target core |
| 163 | + export BOOTIMAGE_CORE_ID=${BOOTIMAGE_CORE_ID_desired-core} |
| 164 | + $TI_TOOLS/sysconfig_1.21.2/nodejs/node $MCUPSDK/tools/boot/out2rprc/elf2rprc.js ./zephyr.elf |
| 165 | + $MCUPSDK/tools/boot/xipGen/xipGen.out -i ./zephyr.rprc -o ./zephyr.rprc_out -x ./zephyr.rprc_out_xip --flash-start-addr 0x60000000 |
| 166 | + $TI_TOOLS/sysconfig_1.21.2/nodejs/node $MCUPSDK/tools/boot/multicoreImageGen/multicoreImageGen.js --devID 55 --out ./zephyr.appimage ./zephyr.rprc_out@${BOOTIMAGE_CORE_ID} |
| 167 | + $TI_TOOLS/sysconfig_1.21.2/nodejs/node $MCUPSDK/tools/boot/multicoreImageGen/multicoreImageGen.js --devID 55 --out ./zephyr.appimage_xip ./zephyr.rprc_out_xip@${BOOTIMAGE_CORE_ID} |
| 168 | + python3 $MCUPSDK/source/security/security_common/tools/boot/signing/appimage_x509_cert_gen.py --bin ./zephyr.appimage --authtype 1 --key $MCUPSDK/source/security/security_common/tools/boot/signing/app_degenerateKey.pem --output ./zephyr.appimage.hs_fs |
| 169 | +
|
| 170 | +All these steps are also present in various Makefiles in the ``examples/`` |
| 171 | +directory of MCU+ SDK source. |
| 172 | + |
| 173 | + |
| 174 | +Running the Zephyr image |
| 175 | +======================== |
| 176 | + |
| 177 | +After that you want to switch the bootmode to UART by switching the DIP-Switches |
| 178 | +into the following configuration: |
| 179 | + |
| 180 | +.. list-table:: UART Boot Mode |
| 181 | + :header-rows: 1 |
| 182 | + |
| 183 | + * - SW2 [0:7] |
| 184 | + - SW3 [8:15] |
| 185 | + * - 11011100 |
| 186 | + - 10110000 |
| 187 | + |
| 188 | +If you want to just run the image via UART you need to run |
| 189 | + |
| 190 | +.. code-block:: console |
| 191 | +
|
| 192 | + python3 uart_bootloader.py -p /dev/ttyUSB0 --bootloader=sbl_uart.release.hs_fs.tiimage --file=zephyr.appimage.hs_fs |
| 193 | +
|
| 194 | +The ``uart_bootloader.py`` script is found in ``$MCUPSDK/tools/boot`` and the |
| 195 | +``sbl_uart.release.hs_fs.tiimage`` in |
| 196 | +``$MCUPSDK/tools/boot/sbl_prebuilt/am243x-evm``. After sending the image your |
| 197 | +Zephyr application will run after a 2 second long delay. |
| 198 | + |
| 199 | +If you want to flash the image instead you have to take the OSPI example config |
| 200 | +file from the ``$MCUPSDK/tools/boot/sbl_prebuilt/am243x-evm`` directory and |
| 201 | +change the filepath according to your names. It should look approximately like: |
| 202 | + |
| 203 | +.. code-block:: |
| 204 | +
|
| 205 | + --flash-writer=sbl_uart_uniflash.release.hs_fs.tiimage |
| 206 | + --operation=flash-phy-tuning-data |
| 207 | + --file=sbl_prebuilt/am243x-evm/sbl_ospi.release.hs_fs.tiimage --operation=flash --flash-offset=0x0 |
| 208 | + --file=zephyr.appimage.hs_fs --operation=flash --flash-offset=0x80000 |
| 209 | + --file=zephyr.appimage_xip --operation=flash-xip |
| 210 | +
|
| 211 | +You then need to run ``python3 uart_uniflash.py -p /dev/ttyUSB0 |
| 212 | +--cfg=<path/to/your-config-file>``. The scripts and images are in the same path |
| 213 | +as described in the UART section above. |
| 214 | + |
| 215 | +After flashing your image you can power off your board, switch the DIP-Switches |
| 216 | +into following configuration to boot in OSPI mode and your Zephyr application |
| 217 | +will boot immediately after powering on the board. |
| 218 | + |
| 219 | +.. list-table:: OSPI Boot Mode |
| 220 | + :header-rows: 1 |
| 221 | + |
| 222 | + * - SW2 [0:7] |
| 223 | + - SW3 [8:15] |
| 224 | + * - 11001110 |
| 225 | + - 01000000 |
| 226 | + |
| 227 | +Debugging |
| 228 | +********* |
| 229 | + |
| 230 | +OpenOCD |
| 231 | +======= |
| 232 | + |
| 233 | +The board is equipped with an XDS110 JTAG debugger. To debug a binary, utilize |
| 234 | +the ``debug`` build target: |
| 235 | + |
| 236 | +.. zephyr-app-commands:: |
| 237 | + :app: <my_app> |
| 238 | + :board: am243x_evm/<soc>/<core> |
| 239 | + :maybe-skip-config: |
| 240 | + :goals: debug |
| 241 | + |
| 242 | +.. hint:: |
| 243 | + To utilize this feature, you'll need OpenOCD version 0.12 or higher. Due to the possibility of |
| 244 | + older versions being available in package feeds, it's advisable to `build OpenOCD from source`_. |
| 245 | + |
| 246 | +Code Composer Studio |
| 247 | +==================== |
| 248 | + |
| 249 | +Instead of using ``sbl_ospi`` from above, one may also flash ``sbl_null`` and load the |
| 250 | +application ELFs using Code Composer Studio IDE to individual cores and run/debug |
| 251 | +the application. Note that this does not require converting the Zephyr ELF to another |
| 252 | +forma, making development much easier. |
| 253 | + |
| 254 | + |
| 255 | +References |
| 256 | +********** |
| 257 | + |
| 258 | +AM64x/AM243x EVM Technical Reference Manual: |
| 259 | + https://www.ti.com/lit/ug/spruj63a/spruj63a.pdf |
| 260 | + |
| 261 | +MCU+ SDK Github repository: |
| 262 | + https://github.com/TexasInstruments/mcupsdk-core |
| 263 | + |
| 264 | +.. _Bootflow Guide: |
| 265 | + https://software-dl.ti.com/mcu-plus-sdk/esd/AM64X/latest/exports/docs/api_guide_am64x/BOOTFLOW_GUIDE.html |
| 266 | + |
| 267 | +.. _TI TMDS243EVM Product Page: |
| 268 | + https://www.ti.com/tool/TMDS243EVM |
| 269 | + |
| 270 | +.. _build OpenOCD from source: |
| 271 | + https://docs.u-boot.org/en/latest/board/ti/k3.html#building-openocd-from-source |
| 272 | + |
| 273 | +License |
| 274 | +******* |
| 275 | + |
| 276 | +This document Copyright (c) Siemens Mobility GmbH |
| 277 | + |
| 278 | +This document Copyright (c) 2025 Texas Instruments |
| 279 | + |
| 280 | +SPDX-License-Identifier: Apache-2.0 |
0 commit comments