• Home
  • History
  • Annotate
Name Date Size #Lines LOC

..05-Jul-2021-

KconfigH A D05-Jul-20211.1 KiB6244

MAINTAINERSH A D05-Jul-2021264 109

MakefileH A D05-Jul-2021177 91

READMEH A D05-Jul-202114.9 KiB351306

evm.cH A D05-Jul-20218.9 KiB376249

README

1Introduction:
2-------------
3The AM65x family of SoCs is the first device family from K3 Multicore
4SoC architecture, targeted for broad market and industrial control with
5aim to meet the complex processing needs of modern embedded products.
6
7The device is built over three domains, each containing specific processing
8cores, voltage domains and peripherals:
91. Wake-up (WKUP) domain:
10	- Device Management and Security Controller (DMSC)
112. Microcontroller (MCU) domain:
12	- Dual Core ARM Cortex-R5F processor
133. MAIN domain:
14	- Quad core 64-bit ARM Cortex-A53
15
16More info can be found in TRM: http://www.ti.com/lit/pdf/spruid7
17
18Boot Flow:
19----------
20On AM65x family devices, ROM supports boot only via MCU(R5). This means that
21bootloader has to run on R5 core. In order to meet this constraint, and for
22the following reasons the boot flow is designed as mentioned:
231. Need to move away from R5 asap, so that we want to start *any*
24firmware on the r5 cores like.... autosar can be loaded to receive CAN
25response and other safety operations to be started. This operation is
26very time critical and is applicable for all automotive use cases.
272. U-Boot on A53 should start other remotecores for various
28applications. This should happen before running Linux.
293. In production boot flow, we might not like to use full u-boot,
30instead use Flacon boot flow to reduce boot time.
31
32+------------------------------------------------------------------------+
33|        DMSC            |         R5            |        A53            |
34+------------------------------------------------------------------------+
35|    +--------+          |                       |                       |
36|    |  Reset |          |                       |                       |
37|    +--------+          |                       |                       |
38|         :              |                       |                       |
39|    +--------+          |   +-----------+       |                       |
40|    | *ROM*  |----------|-->| Reset rls |       |                       |
41|    +--------+          |   +-----------+       |                       |
42|    |        |          |         :             |                       |
43|    |  ROM   |          |         :             |                       |
44|    |services|          |         :             |                       |
45|    |        |          |   +-------------+     |                       |
46|    |        |          |   |  *R5 ROM*   |     |                       |
47|    |        |          |   +-------------+     |                       |
48|    |        |<---------|---|Load and auth|     |                       |
49|    |        |          |   | tiboot3.bin |     |                       |
50|    |        |          |   +-------------+     |                       |
51|    |        |          |         :             |                       |
52|    |        |          |         :             |                       |
53|    |        |          |         :             |                       |
54|    |        |          |   +-------------+     |                       |
55|    |        |          |   |  *R5 SPL*   |     |                       |
56|    |        |          |   +-------------+     |                       |
57|    |        |          |   |    Load     |     |                       |
58|    |        |          |   |  sysfw.itb  |     |                       |
59|    | Start  |          |   +-------------+     |                       |
60|    | System |<---------|---|    Start    |     |                       |
61|    |Firmware|          |   |    SYSFW    |     |                       |
62|    +--------+          |   +-------------+     |                       |
63|        :               |   |             |     |                       |
64|    +---------+         |   |   Load      |     |                       |
65|    | *SYSFW* |         |   |   system    |     |                       |
66|    +---------+         |   | Config data |     |                       |
67|    |         |<--------|---|             |     |                       |
68|    |         |         |   +-------------+     |                       |
69|    |         |         |   |             |     |                       |
70|    |         |         |   |    DDR      |     |                       |
71|    |         |         |   |   config    |     |                       |
72|    |         |         |   +-------------+     |                       |
73|    |         |         |   |             |     |                       |
74|    |         |<--------|---| Start A53   |     |                       |
75|    |         |         |   |  and Reset  |     |                       |
76|    |         |         |   +-------------+     |                       |
77|    |         |         |                       |     +-----------+     |
78|    |         |---------|-----------------------|---->| Reset rls |     |
79|    |         |         |                       |     +-----------+     |
80|    |  DMSC   |         |                       |          :            |
81|    |Services |         |                       |     +-----------+     |
82|    |         |<--------|-----------------------|---->|*ATF/OPTEE*|     |
83|    |         |         |                       |     +-----------+     |
84|    |         |         |                       |          :            |
85|    |         |         |                       |     +-----------+     |
86|    |         |<--------|-----------------------|---->| *A53 SPL* |     |
87|    |         |         |                       |     +-----------+     |
88|    |         |         |                       |     |   Load    |     |
89|    |         |         |                       |     | u-boot.img|     |
90|    |         |         |                       |     +-----------+     |
91|    |         |         |                       |          :            |
92|    |         |         |                       |     +-----------+     |
93|    |         |<--------|-----------------------|---->| *U-Boot*  |     |
94|    |         |         |                       |     +-----------+     |
95|    |         |         |                       |     |  prompt   |     |
96|    |         |         |                       |     +-----------+     |
97|    +---------+         |                       |                       |
98|                        |                       |                       |
99+------------------------------------------------------------------------+
100
101- Here DMSC acts as master and provides all the critical services. R5/A53
102requests DMSC to get these services done as shown in the above diagram.
103
104Sources:
105--------
1061. SYSFW:
107	Tree: git://git.ti.com/k3-image-gen/k3-image-gen.git
108	Branch: master
109
1102. ATF:
111	Tree: https://github.com/ARM-software/arm-trusted-firmware.git
112	Branch: master
113
1143. OPTEE:
115	Tree: https://github.com/OP-TEE/optee_os.git
116	Branch: master
117
1184. U-Boot:
119	Tree: http://git.denx.de/u-boot.git
120	Branch: master
121
122Build procedure:
123----------------
1241. SYSFW:
125$ make CROSS_COMPILE=arm-linux-gnueabihf-
126
1272. ATF:
128$ make CROSS_COMPILE=aarch64-linux-gnu- ARCH=aarch64 PLAT=k3 TARGET_BOARD=generic SPD=opteed
129
1303. OPTEE:
131$ make PLATFORM=k3-am65x CFG_ARM64_core=y
132
1334. U-Boot:
134
1354.1. R5:
136$ make CROSS_COMPILE=arm-linux-gnueabihf- am65x_evm_r5_defconfig O=/tmp/r5
137$ make CROSS_COMPILE=arm-linux-gnueabihf- O=/tmp/r5
138
1394.2. A53:
140$ make CROSS_COMPILE=aarch64-linux-gnu- am65x_evm_a53_defconfig O=/tmp/a53
141$ make CROSS_COMPILE=aarch64-linux-gnu- ATF=<path to ATF dir>/build/k3/generic/release/bl31.bin TEE=<path to OPTEE OS dir>/out/arm-plat-k3/core/tee-pager_v2.bin O=/tmp/a53
142
143Target Images
144--------------
145Copy the below images to an SD card and boot:
146- sysfw.itb from step 1
147- tiboot3.bin from step 4.1
148- tispl.bin, u-boot.img from 4.2
149
150Image formats:
151--------------
152
153- tiboot3.bin:
154                +-----------------------+
155                |        X.509          |
156                |      Certificate      |
157                | +-------------------+ |
158                | |                   | |
159                | |        R5         | |
160                | |   u-boot-spl.bin  | |
161                | |                   | |
162                | +-------------------+ |
163                | |                   | |
164                | |     FIT header    | |
165                | | +---------------+ | |
166                | | |               | | |
167                | | |   DTB 1...N   | | |
168                | | +---------------+ | |
169                | +-------------------+ |
170                +-----------------------+
171
172- tispl.bin
173                +-----------------------+
174                |                       |
175                |       FIT HEADER      |
176                | +-------------------+ |
177                | |                   | |
178                | |      A53 ATF      | |
179                | +-------------------+ |
180                | |                   | |
181                | |     A53 OPTEE     | |
182                | +-------------------+ |
183                | |                   | |
184                | |      A53 SPL      | |
185                | +-------------------+ |
186                | |                   | |
187                | |   SPL DTB 1...N   | |
188                | +-------------------+ |
189                +-----------------------+
190
191- sysfw.itb
192                +-----------------------+
193                |                       |
194                |       FIT HEADER      |
195                | +-------------------+ |
196                | |                   | |
197                | |     sysfw.bin     | |
198                | +-------------------+ |
199                | |                   | |
200                | |    board config   | |
201                | +-------------------+ |
202                | |                   | |
203                | |     PM config     | |
204                | +-------------------+ |
205                | |                   | |
206                | |     RM config     | |
207                | +-------------------+ |
208                | |                   | |
209                | |    Secure config  | |
210                | +-------------------+ |
211                +-----------------------+
212
213eMMC:
214-----
215ROM supports booting from eMMC from boot0 partition offset 0x0
216
217Flashing images to eMMC:
218
219The following commands can be used to download tiboot3.bin, tispl.bin,
220u-boot.img, and sysfw.itb from an SD card and write them to the eMMC boot0
221partition at respective addresses.
222
223=> mmc dev 0 1
224=> fatload mmc 1 ${loadaddr} tiboot3.bin
225=> mmc write ${loadaddr} 0x0 0x400
226=> fatload mmc 1 ${loadaddr} tispl.bin
227=> mmc write ${loadaddr} 0x400 0x1000
228=> fatload mmc 1 ${loadaddr} u-boot.img
229=> mmc write ${loadaddr} 0x1400 0x2000
230=> fatload mmc 1 ${loadaddr} sysfw.itb
231=> mmc write ${loadaddr} 0x3600 0x800
232
233To give the ROM access to the boot partition, the following commands must be
234used for the first time:
235=> mmc partconf 0 1 1 1
236=> mmc bootbus 0 1 0 0
237
238To create a software partition for the rootfs, the following command can be
239used:
240=> gpt write mmc 0 ${partitions}
241
242eMMC layout:
243
244           boot0 partition (8 MB)                        user partition
245   0x0+----------------------------------+      0x0+-------------------------+
246      |     tiboot3.bin (512 KB)         |         |                         |
247 0x400+----------------------------------+         |                         |
248      |       tispl.bin (2 MB)           |         |                         |
2490x1400+----------------------------------+         |        rootfs           |
250      |       u-boot.img (4 MB)          |         |                         |
2510x3400+----------------------------------+         |                         |
252      |      environment (128 KB)        |         |                         |
2530x3500+----------------------------------+         |                         |
254      |   backup environment (128 KB)    |         |                         |
2550x3600+----------------------------------+         |                         |
256      |          sysfw (1 MB)            |         |                         |
2570x3E00+----------------------------------+         +-------------------------+
258
259Kernel image and DT are expected to be present in the /boot folder of rootfs.
260To boot kernel from eMMC, use the following commands:
261=> setenv mmcdev 0
262=> setenv bootpart 0
263=> boot
264
265OSPI:
266-----
267ROM supports booting from OSPI from offset 0x0.
268
269Flashing images to OSPI:
270
271Below commands can be used to download tiboot3.bin, tispl.bin, u-boot.img,
272and sysfw.itb over tftp and then flash those to OSPI at their respective
273addresses.
274
275=> sf probe
276=> tftp ${loadaddr} tiboot3.bin
277=> sf update $loadaddr 0x0 $filesize
278=> tftp ${loadaddr} tispl.bin
279=> sf update $loadaddr 0x80000 $filesize
280=> tftp ${loadaddr} u-boot.img
281=> sf update $loadaddr 0x280000 $filesize
282=> tftp ${loadaddr} sysfw.itb
283=> sf update $loadaddr 0x6C0000 $filesize
284
285Flash layout for OSPI:
286
287         0x0 +----------------------------+
288             |     ospi.tiboot3(512K)     |
289             |                            |
290     0x80000 +----------------------------+
291             |     ospi.tispl(2M)         |
292             |                            |
293    0x280000 +----------------------------+
294             |     ospi.u-boot(4M)        |
295             |                            |
296    0x680000 +----------------------------+
297             |     ospi.env(128K)         |
298             |                            |
299    0x6A0000 +----------------------------+
300	     |	 ospi.env.backup (128K)   |
301	     |                            |
302    0x6C0000 +----------------------------+
303             |      ospi.sysfw(1M)        |
304             |                            |
305    0x7C0000 +----------------------------+
306	     |      padding (256k)        |
307    0x800000 +----------------------------+
308             |     ospi.rootfs(UBIFS)     |
309             |                            |
310             +----------------------------+
311
312Kernel Image and DT are expected to be present in the /boot folder of UBIFS
313ospi.rootfs just like in SD card case. U-Boot looks for UBI volume named
314"rootfs" for rootfs.
315
316To boot kernel from OSPI, at the U-Boot prompt:
317=> setenv boot ubi
318=> boot
319
320UART:
321-----
322ROM supports booting from MCU_UART0 via X-Modem protocol. The entire UART-based
323boot process up to U-Boot (proper) prompt goes through different stages and uses
324different UART peripherals as follows:
325
326  WHO     | Loading WHAT  |  HW Module  |  Protocol
327----------+---------------+-------------+------------
328Boot ROM  |  tiboot3.bin  |  MCU_UART0  |  X-Modem(*)
329R5 SPL    |  sysfw.itb    |  MCU_UART0  |  Y-Modem(*)
330R5 SPL    |  tispl.bin    |  MAIN_UART0 |  Y-Modem
331A53 SPL   |  u-boot.img   |  MAIN_UART0 |  Y-Modem
332
333(*) Note that in addition to X/Y-Modem related protocol timeouts the DMSC
334    watchdog timeout of 3min (typ.) needs to be observed until System Firmware
335    is fully loaded (from sysfw.itb) and started.
336
337Example bash script sequence for running on a Linux host PC feeding all boot
338artifacts needed to the device:
339
340MCU_DEV=/dev/ttyUSB1
341MAIN_DEV=/dev/ttyUSB0
342
343stty -F $MCU_DEV 115200 cs8 -cstopb -parenb
344stty -F $MAIN_DEV 115200 cs8 -cstopb -parenb
345
346sb --xmodem tiboot3.bin > $MCU_DEV < $MCU_DEV
347sb --ymodem sysfw.itb > $MCU_DEV < $MCU_DEV
348sb --ymodem tispl.bin > $MAIN_DEV < $MAIN_DEV
349sleep 1
350sb --xmodem u-boot.img > $MAIN_DEV < $MAIN_DEV
351