blob: e68b855d963130684c5de6e0092a8cc9dbb2cc0f [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
25More info can be found in TRM: http://www.ti.com/lit/pdf/spruid7
26
27Boot Flow:
28----------
29On AM65x family devices, ROM supports boot only via MCU(R5). This means that
30bootloader has to run on R5 core. In order to meet this constraint, and for
31the following reasons the boot flow is designed as mentioned:
32
331. Need to move away from R5 asap, so that we want to start *any*
34firmware on the R5 cores for example autosar can be loaded to receive CAN
35response and other safety operations to be started. This operation is
36very time critical and is applicable for all automotive use cases.
37
382. U-Boot on A53 should start other remotecores for various
39applications. This should happen before running Linux.
40
413. In production boot flow, we might not like to use full U-Boot,
42instead use Falcon boot flow to reduce boot time.
43
Nishanth Menond683f502023-07-27 13:58:46 -050044.. image:: img/boot_diagram_am65.svg
Neha Malcom Francis507be122023-07-22 00:14:43 +053045
46- Here DMSC acts as master and provides all the critical services. R5/A53
47 requests DMSC to get these services done as shown in the above diagram.
48
49Sources:
50--------
Neha Malcom Francis507be122023-07-22 00:14:43 +053051
Nishanth Menonee91e482023-07-27 13:58:44 -050052.. include:: k3.rst
53 :start-after: .. k3_rst_include_start_boot_sources
54 :end-before: .. k3_rst_include_end_boot_sources
Neha Malcom Francis507be122023-07-22 00:14:43 +053055
56Build procedure:
57----------------
Nishanth Menonb7ee22f2023-07-27 13:58:48 -0500580. Setup the environment variables:
Neha Malcom Francis507be122023-07-22 00:14:43 +053059
Nishanth Menonb7ee22f2023-07-27 13:58:48 -050060.. include:: k3.rst
61 :start-after: .. k3_rst_include_start_common_env_vars_desc
62 :end-before: .. k3_rst_include_end_common_env_vars_desc
Neha Malcom Francis507be122023-07-22 00:14:43 +053063
Nishanth Menonb7ee22f2023-07-27 13:58:48 -050064.. include:: k3.rst
65 :start-after: .. k3_rst_include_start_board_env_vars_desc
66 :end-before: .. k3_rst_include_end_board_env_vars_desc
Neha Malcom Francis507be122023-07-22 00:14:43 +053067
Nishanth Menonb7ee22f2023-07-27 13:58:48 -050068Set the variables corresponding to this platform:
Neha Malcom Francis507be122023-07-22 00:14:43 +053069
Nishanth Menonb7ee22f2023-07-27 13:58:48 -050070.. include:: k3.rst
71 :start-after: .. k3_rst_include_start_common_env_vars_defn
72 :end-before: .. k3_rst_include_end_common_env_vars_defn
Neha Malcom Francis507be122023-07-22 00:14:43 +053073.. code-block:: bash
74
Nishanth Menonb7ee22f2023-07-27 13:58:48 -050075 $ export UBOOT_CFG_CORTEXR=am65x_evm_r5_defconfig
76 $ export UBOOT_CFG_CORTEXA=am65x_evm_a53_defconfig
77 $ export TFA_BOARD=generic
78 $ # we dont use any extra TFA parameters
79 $ unset TFA_EXTRA_ARGS
80 $ export OPTEE_PLATFORM=k3-am65x
81 $ # we dont use any extra OP-TEE parameters
82 $ unset OPTEE_EXTRA_ARGS
83
84.. am65x_evm_rst_include_start_build_steps
85
861. Trusted Firmware-A:
87
88.. include:: k3.rst
89 :start-after: .. k3_rst_include_start_build_steps_tfa
90 :end-before: .. k3_rst_include_end_build_steps_tfa
91
92
932. OP-TEE:
94
95.. include:: k3.rst
96 :start-after: .. k3_rst_include_start_build_steps_optee
97 :end-before: .. k3_rst_include_end_build_steps_optee
Neha Malcom Francis507be122023-07-22 00:14:43 +053098
993. U-Boot:
100
101* 4.1 R5:
102
Nishanth Menonb7ee22f2023-07-27 13:58:48 -0500103.. include:: k3.rst
104 :start-after: .. k3_rst_include_start_build_steps_spl_r5
105 :end-before: .. k3_rst_include_end_build_steps_spl_r5
Neha Malcom Francis507be122023-07-22 00:14:43 +0530106
107* 4.2 A53:
108
Nishanth Menonb7ee22f2023-07-27 13:58:48 -0500109.. include:: k3.rst
110 :start-after: .. k3_rst_include_start_build_steps_uboot
111 :end-before: .. k3_rst_include_end_build_steps_uboot
112.. am65x_evm_rst_include_end_build_steps
Neha Malcom Francis507be122023-07-22 00:14:43 +0530113
114Target Images
115--------------
Tom Rinifdf45032023-07-25 12:44:16 -0400116In order to boot we need tiboot3.bin, sysfw.itb, tispl.bin and u-boot.img.
117Each SoC variant (GP and HS) requires a different source for these files.
Neha Malcom Francis507be122023-07-22 00:14:43 +0530118
119- GP
120
121 * tiboot3-am65x_sr2-gp-evm.bin, sysfw-am65x_sr2-gp-evm.itb from step 4.1
122 * tispl.bin_unsigned, u-boot.img_unsigned from step 4.2
123
124- HS
125
126 * tiboot3-am65x_sr2-hs-evm.bin, sysfw-am65x_sr2-hs-evm.itb from step 4.1
127 * tispl.bin, u-boot.img from step 4.2
128
129Image formats:
130--------------
131
Nishanth Menon91834942023-07-27 13:58:51 -0500132- tiboot3.bin
Neha Malcom Francis507be122023-07-22 00:14:43 +0530133
Nishanth Menon91834942023-07-27 13:58:51 -0500134.. image:: img/no_multi_cert_tiboot3.bin.svg
Neha Malcom Francis507be122023-07-22 00:14:43 +0530135
136- tispl.bin
137
Nishanth Menon91834942023-07-27 13:58:51 -0500138.. image:: img/nodm_tispl.bin.svg
Neha Malcom Francis507be122023-07-22 00:14:43 +0530139
140- sysfw.itb
141
Nishanth Menon91834942023-07-27 13:58:51 -0500142.. image:: img/sysfw.itb.svg
Neha Malcom Francis507be122023-07-22 00:14:43 +0530143
144eMMC:
145-----
146ROM supports booting from eMMC from boot0 partition offset 0x0
147
148Flashing images to eMMC:
149
150The following commands can be used to download tiboot3.bin, tispl.bin,
151u-boot.img, and sysfw.itb from an SD card and write them to the eMMC boot0
152partition at respective addresses.
153
154.. code-block:: text
155
156 => mmc dev 0 1
157 => fatload mmc 1 ${loadaddr} tiboot3.bin
158 => mmc write ${loadaddr} 0x0 0x400
159 => fatload mmc 1 ${loadaddr} tispl.bin
160 => mmc write ${loadaddr} 0x400 0x1000
161 => fatload mmc 1 ${loadaddr} u-boot.img
162 => mmc write ${loadaddr} 0x1400 0x2000
163 => fatload mmc 1 ${loadaddr} sysfw.itb
164 => mmc write ${loadaddr} 0x3600 0x800
165
166To give the ROM access to the boot partition, the following commands must be
167used for the first time:
168
169.. code-block:: text
170
171 => mmc partconf 0 1 1 1
172 => mmc bootbus 0 1 0 0
173
174To create a software partition for the rootfs, the following command can be
175used:
176
177.. code-block:: text
178
179 => gpt write mmc 0 ${partitions}
180
181eMMC layout:
182
183.. code-block:: text
184
185 boot0 partition (8 MB) user partition
186 0x0+----------------------------------+ 0x0+-------------------------+
187 | tiboot3.bin (512 KB) | | |
188 0x400+----------------------------------+ | |
189 | tispl.bin (2 MB) | | |
190 0x1400+----------------------------------+ | rootfs |
191 | u-boot.img (4 MB) | | |
192 0x3400+----------------------------------+ | |
193 | environment (128 KB) | | |
194 0x3500+----------------------------------+ | |
195 | backup environment (128 KB) | | |
196 0x3600+----------------------------------+ | |
197 | sysfw (1 MB) | | |
198 0x3E00+----------------------------------+ +-------------------------+
199
200Kernel image and DT are expected to be present in the /boot folder of rootfs.
201To boot kernel from eMMC, use the following commands:
202
203.. code-block:: text
204
205 => setenv mmcdev 0
206 => setenv bootpart 0
207 => boot
208
209OSPI:
210-----
211ROM supports booting from OSPI from offset 0x0.
212
213Flashing images to OSPI:
214
215Below commands can be used to download tiboot3.bin, tispl.bin, u-boot.img,
216and sysfw.itb over tftp and then flash those to OSPI at their respective
217addresses.
218
219.. code-block:: text
220
221 => sf probe
222 => tftp ${loadaddr} tiboot3.bin
223 => sf update $loadaddr 0x0 $filesize
224 => tftp ${loadaddr} tispl.bin
225 => sf update $loadaddr 0x80000 $filesize
226 => tftp ${loadaddr} u-boot.img
227 => sf update $loadaddr 0x280000 $filesize
228 => tftp ${loadaddr} sysfw.itb
229 => sf update $loadaddr 0x6C0000 $filesize
230
231Flash layout for OSPI:
232
Nishanth Menon2bb20e42023-07-27 13:58:57 -0500233.. image:: img/ospi_sysfw.svg
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
241.. code-block:: text
242
243 => setenv boot ubi
244 => boot
245
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
288.. code-block:: text
289
290 MCU_DEV=/dev/ttyUSB1
291 MAIN_DEV=/dev/ttyUSB0
292
293 stty -F $MCU_DEV 115200 cs8 -cstopb -parenb
294 stty -F $MAIN_DEV 115200 cs8 -cstopb -parenb
295
296 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