blob: 7cebb1ca62d332a012ee618f496383f802fc7b27 [file] [log] [blame]
Neha Malcom Francis1ee652a2023-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
25More info can be found in TRM: http://www.ti.com/lit/pdf/spruid7
26
Nishanth Menon08df7462023-07-27 13:59:00 -050027Platform information:
28
29* https://www.ti.com/tool/TMDX654GPEVM
30
Neha Malcom Francis1ee652a2023-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 Menonfd358122023-07-27 13:58:46 -050048.. image:: img/boot_diagram_am65.svg
Heinrich Schuchardtdfd299a2023-08-22 11:40:59 -050049 :alt: Boot flow diagram
Neha Malcom Francis1ee652a2023-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 Francis1ee652a2023-07-22 00:14:43 +053056
Nishanth Menoncce3e7a2023-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 Francis1ee652a2023-07-22 00:14:43 +053060
61Build procedure:
62----------------
Nishanth Menonc727b812023-07-27 13:58:48 -0500630. Setup the environment variables:
Neha Malcom Francis1ee652a2023-07-22 00:14:43 +053064
Nishanth Menonc727b812023-07-27 13:58:48 -050065.. include:: k3.rst
66 :start-after: .. k3_rst_include_start_common_env_vars_desc
67 :end-before: .. k3_rst_include_end_common_env_vars_desc
68
69.. include:: k3.rst
70 :start-after: .. k3_rst_include_start_board_env_vars_desc
71 :end-before: .. k3_rst_include_end_board_env_vars_desc
72
73Set the variables corresponding to this platform:
74
75.. include:: k3.rst
76 :start-after: .. k3_rst_include_start_common_env_vars_defn
77 :end-before: .. k3_rst_include_end_common_env_vars_defn
Neha Malcom Francis1ee652a2023-07-22 00:14:43 +053078.. code-block:: bash
79
Nishanth Menonc727b812023-07-27 13:58:48 -050080 $ export UBOOT_CFG_CORTEXR=am65x_evm_r5_defconfig
81 $ export UBOOT_CFG_CORTEXA=am65x_evm_a53_defconfig
82 $ export TFA_BOARD=generic
83 $ # we dont use any extra TFA parameters
84 $ unset TFA_EXTRA_ARGS
85 $ export OPTEE_PLATFORM=k3-am65x
86 $ # we dont use any extra OP-TEE parameters
87 $ unset OPTEE_EXTRA_ARGS
88
89.. am65x_evm_rst_include_start_build_steps
90
911. Trusted Firmware-A:
92
93.. include:: k3.rst
94 :start-after: .. k3_rst_include_start_build_steps_tfa
95 :end-before: .. k3_rst_include_end_build_steps_tfa
96
Neha Malcom Francis1ee652a2023-07-22 00:14:43 +053097
982. OP-TEE:
99
Nishanth Menonc727b812023-07-27 13:58:48 -0500100.. include:: k3.rst
101 :start-after: .. k3_rst_include_start_build_steps_optee
102 :end-before: .. k3_rst_include_end_build_steps_optee
Neha Malcom Francis1ee652a2023-07-22 00:14:43 +0530103
1043. U-Boot:
105
Nishanth Menonc8612e22023-08-22 11:41:04 -0500106* 3.1 R5:
Neha Malcom Francis1ee652a2023-07-22 00:14:43 +0530107
Nishanth Menonc727b812023-07-27 13:58:48 -0500108.. include:: k3.rst
109 :start-after: .. k3_rst_include_start_build_steps_spl_r5
110 :end-before: .. k3_rst_include_end_build_steps_spl_r5
Neha Malcom Francis1ee652a2023-07-22 00:14:43 +0530111
Nishanth Menonc8612e22023-08-22 11:41:04 -0500112* 3.2 A53:
Neha Malcom Francis1ee652a2023-07-22 00:14:43 +0530113
Nishanth Menonc727b812023-07-27 13:58:48 -0500114.. include:: k3.rst
115 :start-after: .. k3_rst_include_start_build_steps_uboot
116 :end-before: .. k3_rst_include_end_build_steps_uboot
117.. am65x_evm_rst_include_end_build_steps
Neha Malcom Francis1ee652a2023-07-22 00:14:43 +0530118
119Target Images
120--------------
Tom Rinif687c8f2023-07-25 12:44:16 -0400121In order to boot we need tiboot3.bin, sysfw.itb, tispl.bin and u-boot.img.
122Each SoC variant (GP and HS) requires a different source for these files.
Neha Malcom Francis1ee652a2023-07-22 00:14:43 +0530123
124- GP
125
Nishanth Menonc8612e22023-08-22 11:41:04 -0500126 * tiboot3-am65x_sr2-gp-evm.bin, sysfw-am65x_sr2-gp-evm.itb from step 3.1
127 * tispl.bin_unsigned, u-boot.img_unsigned from step 3.2
Neha Malcom Francis1ee652a2023-07-22 00:14:43 +0530128
129- HS
130
Nishanth Menonc8612e22023-08-22 11:41:04 -0500131 * tiboot3-am65x_sr2-hs-evm.bin, sysfw-am65x_sr2-hs-evm.itb from step 3.1
132 * tispl.bin, u-boot.img from step 3.2
Neha Malcom Francis1ee652a2023-07-22 00:14:43 +0530133
134Image formats:
135--------------
136
Nishanth Menon654dced2023-07-27 13:58:51 -0500137- tiboot3.bin
Neha Malcom Francis1ee652a2023-07-22 00:14:43 +0530138
Nishanth Menon654dced2023-07-27 13:58:51 -0500139.. image:: img/no_multi_cert_tiboot3.bin.svg
Heinrich Schuchardtdfd299a2023-08-22 11:40:59 -0500140 :alt: tiboot3.bin image format
Neha Malcom Francis1ee652a2023-07-22 00:14:43 +0530141
142- tispl.bin
143
Nishanth Menon654dced2023-07-27 13:58:51 -0500144.. image:: img/nodm_tispl.bin.svg
Heinrich Schuchardtdfd299a2023-08-22 11:40:59 -0500145 :alt: tispl.bin image format
Neha Malcom Francis1ee652a2023-07-22 00:14:43 +0530146
147- sysfw.itb
148
Nishanth Menon654dced2023-07-27 13:58:51 -0500149.. image:: img/sysfw.itb.svg
Heinrich Schuchardtdfd299a2023-08-22 11:40:59 -0500150 :alt: sysfw.itb image format
Neha Malcom Francis1ee652a2023-07-22 00:14:43 +0530151
152eMMC:
153-----
154ROM supports booting from eMMC from boot0 partition offset 0x0
155
156Flashing images to eMMC:
157
158The following commands can be used to download tiboot3.bin, tispl.bin,
159u-boot.img, and sysfw.itb from an SD card and write them to the eMMC boot0
160partition at respective addresses.
161
162.. code-block:: text
163
164 => mmc dev 0 1
165 => fatload mmc 1 ${loadaddr} tiboot3.bin
166 => mmc write ${loadaddr} 0x0 0x400
167 => fatload mmc 1 ${loadaddr} tispl.bin
168 => mmc write ${loadaddr} 0x400 0x1000
169 => fatload mmc 1 ${loadaddr} u-boot.img
170 => mmc write ${loadaddr} 0x1400 0x2000
171 => fatload mmc 1 ${loadaddr} sysfw.itb
172 => mmc write ${loadaddr} 0x3600 0x800
173
174To give the ROM access to the boot partition, the following commands must be
175used for the first time:
176
177.. code-block:: text
178
179 => mmc partconf 0 1 1 1
180 => mmc bootbus 0 1 0 0
181
182To create a software partition for the rootfs, the following command can be
183used:
184
185.. code-block:: text
186
187 => gpt write mmc 0 ${partitions}
188
189eMMC layout:
190
Nishanth Menone19efb12023-07-27 13:58:58 -0500191.. image:: img/emmc_am65x_evm_boot0.svg
Heinrich Schuchardtdfd299a2023-08-22 11:40:59 -0500192 :alt: emmc boot partition layout
Neha Malcom Francis1ee652a2023-07-22 00:14:43 +0530193
194Kernel image and DT are expected to be present in the /boot folder of rootfs.
195To boot kernel from eMMC, use the following commands:
196
197.. code-block:: text
198
199 => setenv mmcdev 0
200 => setenv bootpart 0
201 => boot
202
203OSPI:
204-----
205ROM supports booting from OSPI from offset 0x0.
206
207Flashing images to OSPI:
208
209Below commands can be used to download tiboot3.bin, tispl.bin, u-boot.img,
210and sysfw.itb over tftp and then flash those to OSPI at their respective
211addresses.
212
213.. code-block:: text
214
215 => sf probe
216 => tftp ${loadaddr} tiboot3.bin
217 => sf update $loadaddr 0x0 $filesize
218 => tftp ${loadaddr} tispl.bin
219 => sf update $loadaddr 0x80000 $filesize
220 => tftp ${loadaddr} u-boot.img
221 => sf update $loadaddr 0x280000 $filesize
222 => tftp ${loadaddr} sysfw.itb
223 => sf update $loadaddr 0x6C0000 $filesize
224
225Flash layout for OSPI:
226
Nishanth Menon757836d2023-07-27 13:58:57 -0500227.. image:: img/ospi_sysfw.svg
Heinrich Schuchardtdfd299a2023-08-22 11:40:59 -0500228 :alt: OSPI flash partition layout
Neha Malcom Francis1ee652a2023-07-22 00:14:43 +0530229
230Kernel Image and DT are expected to be present in the /boot folder of UBIFS
231ospi.rootfs just like in SD card case. U-Boot looks for UBI volume named
232"rootfs" for rootfs.
233
234To boot kernel from OSPI, at the U-Boot prompt:
235
236.. code-block:: text
237
238 => setenv boot ubi
239 => boot
240
241UART:
242-----
243ROM supports booting from MCU_UART0 via X-Modem protocol. The entire UART-based
244boot process up to U-Boot (proper) prompt goes through different stages and uses
245different UART peripherals as follows:
246
Nishanth Menonfc5b2b82023-07-27 13:58:56 -0500247.. list-table:: ROM UART Boot Responsibilities
248 :widths: 16 16 16 16
249 :header-rows: 1
Neha Malcom Francis1ee652a2023-07-22 00:14:43 +0530250
Nishanth Menonfc5b2b82023-07-27 13:58:56 -0500251 * - Who
252 - Loading What
253 - Hardware Module
254 - Protocol
255
256 * - Boot ROM
257 - tiboot3.bin
258 - MCU_UART0
259 - X-Modem(*)
260
261 * - R5 SPL
262 - sysfw.itb
263 - MCU_UART0
264 - Y-Modem(*)
265
266 * - R5 SPL
267 - tispl.bin
268 - MAIN_UART0
269 - Y-Modem
270
271 * - A53 SPL
272 - u-boot.img
273 - MAIN_UART0
274 - Y-Modem
Neha Malcom Francis1ee652a2023-07-22 00:14:43 +0530275
276Note that in addition to X/Y-Modem related protocol timeouts the DMSC
277watchdog timeout of 3min (typ.) needs to be observed until System Firmware
278is fully loaded (from sysfw.itb) and started.
279
280Example bash script sequence for running on a Linux host PC feeding all boot
281artifacts needed to the device:
282
283.. code-block:: text
284
285 MCU_DEV=/dev/ttyUSB1
286 MAIN_DEV=/dev/ttyUSB0
287
288 stty -F $MCU_DEV 115200 cs8 -cstopb -parenb
289 stty -F $MAIN_DEV 115200 cs8 -cstopb -parenb
290
291 sb --xmodem tiboot3.bin > $MCU_DEV < $MCU_DEV
292 sb --ymodem sysfw.itb > $MCU_DEV < $MCU_DEV
293 sb --ymodem tispl.bin > $MAIN_DEV < $MAIN_DEV
294 sleep 1
295 sb --xmodem u-boot.img > $MAIN_DEV < $MAIN_DEV
Jason Kacineseffe5082023-08-03 01:29:22 -0500296
297Debugging U-Boot
298----------------
299
300See :ref:`Common Debugging environment - OpenOCD<k3_rst_refer_openocd>`: for
301detailed setup information.
302
303.. warning::
304
305 **OpenOCD support since**: v0.12.0
306
307 If the default package version of OpenOCD in your development
308 environment's distribution needs to be updated, it might be necessary to
309 build OpenOCD from the source.
310
311.. include:: k3.rst
312 :start-after: .. k3_rst_include_start_openocd_connect_XDS110
313 :end-before: .. k3_rst_include_end_openocd_connect_XDS110
314
315To start OpenOCD and connect to the board
316
317.. code-block:: bash
318
319 openocd -f board/ti_am654evm.cfg