blob: 60b08ceebf0f58d56d3bba630a8c0d27631a2075 [file] [log] [blame]
Neha Malcom Francis507be122023-07-22 00:14:43 +05301.. SPDX-License-Identifier: GPL-2.0+ OR BSD-3-Clause
2.. sectionauthor:: Neha Francis <n-francis@ti.com>
3
4AM65x Platforms
5===============
6
7Introduction:
8-------------
9The AM65x family of SoCs is the first device family from K3 Multicore
10SoC architecture, targeted for broad market and industrial control with
11aim to meet the complex processing needs of modern embedded products.
12
13The device is built over three domains, each containing specific processing
14cores, voltage domains and peripherals:
15
161. Wake-up (WKUP) domain:
17 * Device Management and Security Controller (DMSC)
18
192. Microcontroller (MCU) domain:
20 * Dual Core ARM Cortex-R5F processor
21
223. MAIN domain:
23 * Quad core 64-bit ARM Cortex-A53
24
Nishanth Menoneaa39c62023-11-01 15:56:03 -050025More info can be found in TRM: https://www.ti.com/lit/pdf/spruid7
Neha Malcom Francis507be122023-07-22 00:14:43 +053026
Nishanth Menon4981d9a2023-07-27 13:59:00 -050027Platform information:
28
29* https://www.ti.com/tool/TMDX654GPEVM
30
Neha Malcom Francis507be122023-07-22 00:14:43 +053031Boot Flow:
32----------
33On AM65x family devices, ROM supports boot only via MCU(R5). This means that
34bootloader has to run on R5 core. In order to meet this constraint, and for
35the following reasons the boot flow is designed as mentioned:
36
371. Need to move away from R5 asap, so that we want to start *any*
38firmware on the R5 cores for example autosar can be loaded to receive CAN
39response and other safety operations to be started. This operation is
40very time critical and is applicable for all automotive use cases.
41
422. U-Boot on A53 should start other remotecores for various
43applications. This should happen before running Linux.
44
453. In production boot flow, we might not like to use full U-Boot,
46instead use Falcon boot flow to reduce boot time.
47
Nishanth Menond683f502023-07-27 13:58:46 -050048.. image:: img/boot_diagram_am65.svg
Heinrich Schuchardt529aed02023-08-22 11:40:59 -050049 :alt: Boot flow diagram
Neha Malcom Francis507be122023-07-22 00:14:43 +053050
51- Here DMSC acts as master and provides all the critical services. R5/A53
52 requests DMSC to get these services done as shown in the above diagram.
53
54Sources:
55--------
Neha Malcom Francis507be122023-07-22 00:14:43 +053056
Nishanth Menonee91e482023-07-27 13:58:44 -050057.. include:: k3.rst
58 :start-after: .. k3_rst_include_start_boot_sources
59 :end-before: .. k3_rst_include_end_boot_sources
Neha Malcom Francis507be122023-07-22 00:14:43 +053060
Dhruva Gole26e0ddf2024-08-05 19:59:33 +053061.. include:: k3.rst
62 :start-after: .. k3_rst_include_start_boot_firmwares_sysfw
63 :end-before: .. k3_rst_include_end_boot_firmwares_sysfw
64
Neha Malcom Francis507be122023-07-22 00:14:43 +053065Build procedure:
66----------------
Nishanth Menonb7ee22f2023-07-27 13:58:48 -0500670. Setup the environment variables:
Neha Malcom Francis507be122023-07-22 00:14:43 +053068
Nishanth Menonb7ee22f2023-07-27 13:58:48 -050069.. include:: k3.rst
70 :start-after: .. k3_rst_include_start_common_env_vars_desc
71 :end-before: .. k3_rst_include_end_common_env_vars_desc
Neha Malcom Francis507be122023-07-22 00:14:43 +053072
Nishanth Menonb7ee22f2023-07-27 13:58:48 -050073.. include:: k3.rst
74 :start-after: .. k3_rst_include_start_board_env_vars_desc
75 :end-before: .. k3_rst_include_end_board_env_vars_desc
Neha Malcom Francis507be122023-07-22 00:14:43 +053076
Nishanth Menonb7ee22f2023-07-27 13:58:48 -050077Set the variables corresponding to this platform:
Neha Malcom Francis507be122023-07-22 00:14:43 +053078
Nishanth Menonb7ee22f2023-07-27 13:58:48 -050079.. include:: k3.rst
80 :start-after: .. k3_rst_include_start_common_env_vars_defn
81 :end-before: .. k3_rst_include_end_common_env_vars_defn
Nishanth Menonfdd7cb72023-11-02 23:40:26 -050082.. prompt:: bash $
Neha Malcom Francis507be122023-07-22 00:14:43 +053083
Nishanth Menonfdd7cb72023-11-02 23:40:26 -050084 export UBOOT_CFG_CORTEXR=am65x_evm_r5_defconfig
85 export UBOOT_CFG_CORTEXA=am65x_evm_a53_defconfig
86 export TFA_BOARD=generic
87 # we dont use any extra TFA parameters
88 unset TFA_EXTRA_ARGS
89 export OPTEE_PLATFORM=k3-am65x
90 # we dont use any extra OP-TEE parameters
91 unset OPTEE_EXTRA_ARGS
Nishanth Menonb7ee22f2023-07-27 13:58:48 -050092
93.. am65x_evm_rst_include_start_build_steps
94
951. Trusted Firmware-A:
96
97.. include:: k3.rst
98 :start-after: .. k3_rst_include_start_build_steps_tfa
99 :end-before: .. k3_rst_include_end_build_steps_tfa
100
101
1022. OP-TEE:
103
104.. include:: k3.rst
105 :start-after: .. k3_rst_include_start_build_steps_optee
106 :end-before: .. k3_rst_include_end_build_steps_optee
Neha Malcom Francis507be122023-07-22 00:14:43 +0530107
1083. U-Boot:
109
Nishanth Menond14cec52023-08-22 11:41:04 -0500110* 3.1 R5:
Neha Malcom Francis507be122023-07-22 00:14:43 +0530111
Nishanth Menonb7ee22f2023-07-27 13:58:48 -0500112.. 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
Neha Malcom Francis507be122023-07-22 00:14:43 +0530115
Nishanth Menond14cec52023-08-22 11:41:04 -0500116* 3.2 A53:
Neha Malcom Francis507be122023-07-22 00:14:43 +0530117
Nishanth Menonb7ee22f2023-07-27 13:58:48 -0500118.. include:: k3.rst
119 :start-after: .. k3_rst_include_start_build_steps_uboot
120 :end-before: .. k3_rst_include_end_build_steps_uboot
121.. am65x_evm_rst_include_end_build_steps
Neha Malcom Francis507be122023-07-22 00:14:43 +0530122
123Target Images
Heinrich Schuchardtb72160b2023-10-28 11:59:32 +0200124-------------
125
Tom Rinifdf45032023-07-25 12:44:16 -0400126In order to boot we need tiboot3.bin, sysfw.itb, tispl.bin and u-boot.img.
127Each SoC variant (GP and HS) requires a different source for these files.
Neha Malcom Francis507be122023-07-22 00:14:43 +0530128
129- GP
130
Nishanth Menond14cec52023-08-22 11:41:04 -0500131 * tiboot3-am65x_sr2-gp-evm.bin, sysfw-am65x_sr2-gp-evm.itb from step 3.1
132 * tispl.bin_unsigned, u-boot.img_unsigned from step 3.2
Neha Malcom Francis507be122023-07-22 00:14:43 +0530133
134- HS
135
Nishanth Menond14cec52023-08-22 11:41:04 -0500136 * tiboot3-am65x_sr2-hs-evm.bin, sysfw-am65x_sr2-hs-evm.itb from step 3.1
137 * tispl.bin, u-boot.img from step 3.2
Neha Malcom Francis507be122023-07-22 00:14:43 +0530138
139Image formats:
140--------------
141
Nishanth Menon91834942023-07-27 13:58:51 -0500142- tiboot3.bin
Neha Malcom Francis507be122023-07-22 00:14:43 +0530143
Nishanth Menon91834942023-07-27 13:58:51 -0500144.. image:: img/no_multi_cert_tiboot3.bin.svg
Heinrich Schuchardt529aed02023-08-22 11:40:59 -0500145 :alt: tiboot3.bin image format
Neha Malcom Francis507be122023-07-22 00:14:43 +0530146
147- tispl.bin
148
Nishanth Menon91834942023-07-27 13:58:51 -0500149.. image:: img/nodm_tispl.bin.svg
Heinrich Schuchardt529aed02023-08-22 11:40:59 -0500150 :alt: tispl.bin image format
Neha Malcom Francis507be122023-07-22 00:14:43 +0530151
152- sysfw.itb
153
Nishanth Menon91834942023-07-27 13:58:51 -0500154.. image:: img/sysfw.itb.svg
Heinrich Schuchardt529aed02023-08-22 11:40:59 -0500155 :alt: sysfw.itb image format
Neha Malcom Francis507be122023-07-22 00:14:43 +0530156
157eMMC:
158-----
159ROM supports booting from eMMC from boot0 partition offset 0x0
160
161Flashing images to eMMC:
162
163The following commands can be used to download tiboot3.bin, tispl.bin,
164u-boot.img, and sysfw.itb from an SD card and write them to the eMMC boot0
165partition at respective addresses.
166
Nishanth Menonfdd7cb72023-11-02 23:40:26 -0500167.. prompt:: bash =>
Neha Malcom Francis507be122023-07-22 00:14:43 +0530168
Nishanth Menonfdd7cb72023-11-02 23:40:26 -0500169 mmc dev 0 1
170 fatload mmc 1 ${loadaddr} tiboot3.bin
171 mmc write ${loadaddr} 0x0 0x400
172 fatload mmc 1 ${loadaddr} tispl.bin
173 mmc write ${loadaddr} 0x400 0x1000
174 fatload mmc 1 ${loadaddr} u-boot.img
175 mmc write ${loadaddr} 0x1400 0x2000
176 fatload mmc 1 ${loadaddr} sysfw.itb
177 mmc write ${loadaddr} 0x3600 0x800
Neha Malcom Francis507be122023-07-22 00:14:43 +0530178
179To give the ROM access to the boot partition, the following commands must be
180used for the first time:
181
Nishanth Menonfdd7cb72023-11-02 23:40:26 -0500182.. prompt:: bash =>
Neha Malcom Francis507be122023-07-22 00:14:43 +0530183
Nishanth Menonfdd7cb72023-11-02 23:40:26 -0500184 mmc partconf 0 1 1 1
185 mmc bootbus 0 1 0 0
Neha Malcom Francis507be122023-07-22 00:14:43 +0530186
187To create a software partition for the rootfs, the following command can be
188used:
189
Nishanth Menonfdd7cb72023-11-02 23:40:26 -0500190.. prompt:: bash =>
Neha Malcom Francis507be122023-07-22 00:14:43 +0530191
Nishanth Menonfdd7cb72023-11-02 23:40:26 -0500192 gpt write mmc 0 ${partitions}
Neha Malcom Francis507be122023-07-22 00:14:43 +0530193
194eMMC layout:
195
Nishanth Menonef930a72023-07-27 13:58:58 -0500196.. image:: img/emmc_am65x_evm_boot0.svg
Heinrich Schuchardt529aed02023-08-22 11:40:59 -0500197 :alt: emmc boot partition layout
Neha Malcom Francis507be122023-07-22 00:14:43 +0530198
199Kernel image and DT are expected to be present in the /boot folder of rootfs.
200To boot kernel from eMMC, use the following commands:
201
Nishanth Menonfdd7cb72023-11-02 23:40:26 -0500202.. prompt:: bash =>
Neha Malcom Francis507be122023-07-22 00:14:43 +0530203
Nishanth Menonfdd7cb72023-11-02 23:40:26 -0500204 setenv mmcdev 0
205 setenv bootpart 0
206 boot
Neha Malcom Francis507be122023-07-22 00:14:43 +0530207
208OSPI:
209-----
210ROM supports booting from OSPI from offset 0x0.
211
212Flashing images to OSPI:
213
214Below commands can be used to download tiboot3.bin, tispl.bin, u-boot.img,
215and sysfw.itb over tftp and then flash those to OSPI at their respective
216addresses.
217
Nishanth Menonfdd7cb72023-11-02 23:40:26 -0500218.. prompt:: bash =>
Neha Malcom Francis507be122023-07-22 00:14:43 +0530219
Nishanth Menonfdd7cb72023-11-02 23:40:26 -0500220 sf probe
221 tftp ${loadaddr} tiboot3.bin
222 sf update $loadaddr 0x0 $filesize
223 tftp ${loadaddr} tispl.bin
224 sf update $loadaddr 0x80000 $filesize
225 tftp ${loadaddr} u-boot.img
226 sf update $loadaddr 0x280000 $filesize
227 tftp ${loadaddr} sysfw.itb
228 sf update $loadaddr 0x6C0000 $filesize
Neha Malcom Francis507be122023-07-22 00:14:43 +0530229
230Flash layout for OSPI:
231
Nishanth Menon2bb20e42023-07-27 13:58:57 -0500232.. image:: img/ospi_sysfw.svg
Heinrich Schuchardt529aed02023-08-22 11:40:59 -0500233 :alt: OSPI flash partition layout
Neha Malcom Francis507be122023-07-22 00:14:43 +0530234
235Kernel Image and DT are expected to be present in the /boot folder of UBIFS
236ospi.rootfs just like in SD card case. U-Boot looks for UBI volume named
237"rootfs" for rootfs.
238
239To boot kernel from OSPI, at the U-Boot prompt:
240
Nishanth Menonfdd7cb72023-11-02 23:40:26 -0500241.. prompt:: bash =>
Neha Malcom Francis507be122023-07-22 00:14:43 +0530242
Nishanth Menonfdd7cb72023-11-02 23:40:26 -0500243 setenv boot ubi
244 boot
Neha Malcom Francis507be122023-07-22 00:14:43 +0530245
246UART:
247-----
248ROM supports booting from MCU_UART0 via X-Modem protocol. The entire UART-based
249boot process up to U-Boot (proper) prompt goes through different stages and uses
250different UART peripherals as follows:
251
Nishanth Menonf0206802023-07-27 13:58:56 -0500252.. list-table:: ROM UART Boot Responsibilities
253 :widths: 16 16 16 16
254 :header-rows: 1
255
256 * - Who
257 - Loading What
258 - Hardware Module
259 - Protocol
260
261 * - Boot ROM
262 - tiboot3.bin
263 - MCU_UART0
264 - X-Modem(*)
265
266 * - R5 SPL
267 - sysfw.itb
268 - MCU_UART0
269 - Y-Modem(*)
270
271 * - R5 SPL
272 - tispl.bin
273 - MAIN_UART0
274 - Y-Modem
Neha Malcom Francis507be122023-07-22 00:14:43 +0530275
Nishanth Menonf0206802023-07-27 13:58:56 -0500276 * - A53 SPL
277 - u-boot.img
278 - MAIN_UART0
279 - Y-Modem
Neha Malcom Francis507be122023-07-22 00:14:43 +0530280
281Note that in addition to X/Y-Modem related protocol timeouts the DMSC
282watchdog timeout of 3min (typ.) needs to be observed until System Firmware
283is fully loaded (from sysfw.itb) and started.
284
285Example bash script sequence for running on a Linux host PC feeding all boot
286artifacts needed to the device:
287
Nishanth Menonfdd7cb72023-11-02 23:40:26 -0500288.. prompt:: bash $
Neha Malcom Francis507be122023-07-22 00:14:43 +0530289
Nishanth Menonfdd7cb72023-11-02 23:40:26 -0500290 MCU_DEV=/dev/ttyUSB1
291 MAIN_DEV=/dev/ttyUSB0
Neha Malcom Francis507be122023-07-22 00:14:43 +0530292
Nishanth Menonfdd7cb72023-11-02 23:40:26 -0500293 stty -F $MCU_DEV 115200 cs8 -cstopb -parenb
294 stty -F $MAIN_DEV 115200 cs8 -cstopb -parenb
Neha Malcom Francis507be122023-07-22 00:14:43 +0530295
Nishanth Menonfdd7cb72023-11-02 23:40:26 -0500296 sb --xmodem tiboot3.bin > $MCU_DEV < $MCU_DEV
297 sb --ymodem sysfw.itb > $MCU_DEV < $MCU_DEV
298 sb --ymodem tispl.bin > $MAIN_DEV < $MAIN_DEV
299 sleep 1
300 sb --xmodem u-boot.img > $MAIN_DEV < $MAIN_DEV
Jason Kacinesb0fdee92023-08-03 01:29:22 -0500301
302Debugging U-Boot
303----------------
304
305See :ref:`Common Debugging environment - OpenOCD<k3_rst_refer_openocd>`: for
306detailed setup information.
307
308.. warning::
309
310 **OpenOCD support since**: v0.12.0
311
312 If the default package version of OpenOCD in your development
313 environment's distribution needs to be updated, it might be necessary to
314 build OpenOCD from the source.
315
316.. include:: k3.rst
317 :start-after: .. k3_rst_include_start_openocd_connect_XDS110
318 :end-before: .. k3_rst_include_end_openocd_connect_XDS110
319
320To start OpenOCD and connect to the board
321
Nishanth Menonfdd7cb72023-11-02 23:40:26 -0500322.. prompt:: bash $
Jason Kacinesb0fdee92023-08-03 01:29:22 -0500323
324 openocd -f board/ti_am654evm.cfg