blob: edd5f7d3c549e51b32360ef59ed587624a59b096 [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
233.. code-block:: text
234
235 0x0 +----------------------------+
236 | ospi.tiboot3(512K) |
237 | |
238 0x80000 +----------------------------+
239 | ospi.tispl(2M) |
240 | |
241 0x280000 +----------------------------+
242 | ospi.u-boot(4M) |
243 | |
244 0x680000 +----------------------------+
245 | ospi.env(128K) |
246 | |
247 0x6A0000 +----------------------------+
248 | ospi.env.backup (128K) |
249 | |
250 0x6C0000 +----------------------------+
251 | ospi.sysfw(1M) |
252 | |
253 0x7C0000 +----------------------------+
254 | padding (256k) |
255 0x800000 +----------------------------+
256 | ospi.rootfs(UBIFS) |
257 | |
258 +----------------------------+
259
260Kernel Image and DT are expected to be present in the /boot folder of UBIFS
261ospi.rootfs just like in SD card case. U-Boot looks for UBI volume named
262"rootfs" for rootfs.
263
264To boot kernel from OSPI, at the U-Boot prompt:
265
266.. code-block:: text
267
268 => setenv boot ubi
269 => boot
270
271UART:
272-----
273ROM supports booting from MCU_UART0 via X-Modem protocol. The entire UART-based
274boot process up to U-Boot (proper) prompt goes through different stages and uses
275different UART peripherals as follows:
276
277.. code-block:: text
278
279 +---------+---------------+-------------+------------+
280 | WHO | Loading WHAT | HW Module | Protocol |
281 +---------+---------------+-------------+------------+
282 |Boot ROM | tiboot3.bin | MCU_UART0 | X-Modem(*)|
283 |R5 SPL | sysfw.itb | MCU_UART0 | Y-Modem(*)|
284 |R5 SPL | tispl.bin | MAIN_UART0 | Y-Modem |
285 |A53 SPL | u-boot.img | MAIN_UART0 | Y-Modem |
286 +---------+---------------+-------------+------------+
287
288Note that in addition to X/Y-Modem related protocol timeouts the DMSC
289watchdog timeout of 3min (typ.) needs to be observed until System Firmware
290is fully loaded (from sysfw.itb) and started.
291
292Example bash script sequence for running on a Linux host PC feeding all boot
293artifacts needed to the device:
294
295.. code-block:: text
296
297 MCU_DEV=/dev/ttyUSB1
298 MAIN_DEV=/dev/ttyUSB0
299
300 stty -F $MCU_DEV 115200 cs8 -cstopb -parenb
301 stty -F $MAIN_DEV 115200 cs8 -cstopb -parenb
302
303 sb --xmodem tiboot3.bin > $MCU_DEV < $MCU_DEV
304 sb --ymodem sysfw.itb > $MCU_DEV < $MCU_DEV
305 sb --ymodem tispl.bin > $MAIN_DEV < $MAIN_DEV
306 sleep 1
307 sb --xmodem u-boot.img > $MAIN_DEV < $MAIN_DEV