am65x_evm.rst 8.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319
  1. .. SPDX-License-Identifier: GPL-2.0+ OR BSD-3-Clause
  2. .. sectionauthor:: Neha Francis <n-francis@ti.com>
  3. AM65x Platforms
  4. ===============
  5. Introduction:
  6. -------------
  7. The AM65x family of SoCs is the first device family from K3 Multicore
  8. SoC architecture, targeted for broad market and industrial control with
  9. aim to meet the complex processing needs of modern embedded products.
  10. The device is built over three domains, each containing specific processing
  11. cores, voltage domains and peripherals:
  12. 1. Wake-up (WKUP) domain:
  13. * Device Management and Security Controller (DMSC)
  14. 2. Microcontroller (MCU) domain:
  15. * Dual Core ARM Cortex-R5F processor
  16. 3. MAIN domain:
  17. * Quad core 64-bit ARM Cortex-A53
  18. More info can be found in TRM: http://www.ti.com/lit/pdf/spruid7
  19. Platform information:
  20. * https://www.ti.com/tool/TMDX654GPEVM
  21. Boot Flow:
  22. ----------
  23. On AM65x family devices, ROM supports boot only via MCU(R5). This means that
  24. bootloader has to run on R5 core. In order to meet this constraint, and for
  25. the following reasons the boot flow is designed as mentioned:
  26. 1. Need to move away from R5 asap, so that we want to start *any*
  27. firmware on the R5 cores for example autosar can be loaded to receive CAN
  28. response and other safety operations to be started. This operation is
  29. very time critical and is applicable for all automotive use cases.
  30. 2. U-Boot on A53 should start other remotecores for various
  31. applications. This should happen before running Linux.
  32. 3. In production boot flow, we might not like to use full U-Boot,
  33. instead use Falcon boot flow to reduce boot time.
  34. .. image:: img/boot_diagram_am65.svg
  35. :alt: Boot flow diagram
  36. - Here DMSC acts as master and provides all the critical services. R5/A53
  37. requests DMSC to get these services done as shown in the above diagram.
  38. Sources:
  39. --------
  40. .. include:: k3.rst
  41. :start-after: .. k3_rst_include_start_boot_sources
  42. :end-before: .. k3_rst_include_end_boot_sources
  43. Build procedure:
  44. ----------------
  45. 0. Setup the environment variables:
  46. .. include:: k3.rst
  47. :start-after: .. k3_rst_include_start_common_env_vars_desc
  48. :end-before: .. k3_rst_include_end_common_env_vars_desc
  49. .. include:: k3.rst
  50. :start-after: .. k3_rst_include_start_board_env_vars_desc
  51. :end-before: .. k3_rst_include_end_board_env_vars_desc
  52. Set the variables corresponding to this platform:
  53. .. include:: k3.rst
  54. :start-after: .. k3_rst_include_start_common_env_vars_defn
  55. :end-before: .. k3_rst_include_end_common_env_vars_defn
  56. .. code-block:: bash
  57. $ export UBOOT_CFG_CORTEXR=am65x_evm_r5_defconfig
  58. $ export UBOOT_CFG_CORTEXA=am65x_evm_a53_defconfig
  59. $ export TFA_BOARD=generic
  60. $ # we dont use any extra TFA parameters
  61. $ unset TFA_EXTRA_ARGS
  62. $ export OPTEE_PLATFORM=k3-am65x
  63. $ # we dont use any extra OP-TEE parameters
  64. $ unset OPTEE_EXTRA_ARGS
  65. .. am65x_evm_rst_include_start_build_steps
  66. 1. Trusted Firmware-A:
  67. .. include:: k3.rst
  68. :start-after: .. k3_rst_include_start_build_steps_tfa
  69. :end-before: .. k3_rst_include_end_build_steps_tfa
  70. 2. OP-TEE:
  71. .. include:: k3.rst
  72. :start-after: .. k3_rst_include_start_build_steps_optee
  73. :end-before: .. k3_rst_include_end_build_steps_optee
  74. 3. U-Boot:
  75. * 3.1 R5:
  76. .. include:: k3.rst
  77. :start-after: .. k3_rst_include_start_build_steps_spl_r5
  78. :end-before: .. k3_rst_include_end_build_steps_spl_r5
  79. * 3.2 A53:
  80. .. include:: k3.rst
  81. :start-after: .. k3_rst_include_start_build_steps_uboot
  82. :end-before: .. k3_rst_include_end_build_steps_uboot
  83. .. am65x_evm_rst_include_end_build_steps
  84. Target Images
  85. --------------
  86. In order to boot we need tiboot3.bin, sysfw.itb, tispl.bin and u-boot.img.
  87. Each SoC variant (GP and HS) requires a different source for these files.
  88. - GP
  89. * tiboot3-am65x_sr2-gp-evm.bin, sysfw-am65x_sr2-gp-evm.itb from step 3.1
  90. * tispl.bin_unsigned, u-boot.img_unsigned from step 3.2
  91. - HS
  92. * tiboot3-am65x_sr2-hs-evm.bin, sysfw-am65x_sr2-hs-evm.itb from step 3.1
  93. * tispl.bin, u-boot.img from step 3.2
  94. Image formats:
  95. --------------
  96. - tiboot3.bin
  97. .. image:: img/no_multi_cert_tiboot3.bin.svg
  98. :alt: tiboot3.bin image format
  99. - tispl.bin
  100. .. image:: img/nodm_tispl.bin.svg
  101. :alt: tispl.bin image format
  102. - sysfw.itb
  103. .. image:: img/sysfw.itb.svg
  104. :alt: sysfw.itb image format
  105. eMMC:
  106. -----
  107. ROM supports booting from eMMC from boot0 partition offset 0x0
  108. Flashing images to eMMC:
  109. The following commands can be used to download tiboot3.bin, tispl.bin,
  110. u-boot.img, and sysfw.itb from an SD card and write them to the eMMC boot0
  111. partition at respective addresses.
  112. .. code-block:: text
  113. => mmc dev 0 1
  114. => fatload mmc 1 ${loadaddr} tiboot3.bin
  115. => mmc write ${loadaddr} 0x0 0x400
  116. => fatload mmc 1 ${loadaddr} tispl.bin
  117. => mmc write ${loadaddr} 0x400 0x1000
  118. => fatload mmc 1 ${loadaddr} u-boot.img
  119. => mmc write ${loadaddr} 0x1400 0x2000
  120. => fatload mmc 1 ${loadaddr} sysfw.itb
  121. => mmc write ${loadaddr} 0x3600 0x800
  122. To give the ROM access to the boot partition, the following commands must be
  123. used for the first time:
  124. .. code-block:: text
  125. => mmc partconf 0 1 1 1
  126. => mmc bootbus 0 1 0 0
  127. To create a software partition for the rootfs, the following command can be
  128. used:
  129. .. code-block:: text
  130. => gpt write mmc 0 ${partitions}
  131. eMMC layout:
  132. .. image:: img/emmc_am65x_evm_boot0.svg
  133. :alt: emmc boot partition layout
  134. Kernel image and DT are expected to be present in the /boot folder of rootfs.
  135. To boot kernel from eMMC, use the following commands:
  136. .. code-block:: text
  137. => setenv mmcdev 0
  138. => setenv bootpart 0
  139. => boot
  140. OSPI:
  141. -----
  142. ROM supports booting from OSPI from offset 0x0.
  143. Flashing images to OSPI:
  144. Below commands can be used to download tiboot3.bin, tispl.bin, u-boot.img,
  145. and sysfw.itb over tftp and then flash those to OSPI at their respective
  146. addresses.
  147. .. code-block:: text
  148. => sf probe
  149. => tftp ${loadaddr} tiboot3.bin
  150. => sf update $loadaddr 0x0 $filesize
  151. => tftp ${loadaddr} tispl.bin
  152. => sf update $loadaddr 0x80000 $filesize
  153. => tftp ${loadaddr} u-boot.img
  154. => sf update $loadaddr 0x280000 $filesize
  155. => tftp ${loadaddr} sysfw.itb
  156. => sf update $loadaddr 0x6C0000 $filesize
  157. Flash layout for OSPI:
  158. .. image:: img/ospi_sysfw.svg
  159. :alt: OSPI flash partition layout
  160. Kernel Image and DT are expected to be present in the /boot folder of UBIFS
  161. ospi.rootfs just like in SD card case. U-Boot looks for UBI volume named
  162. "rootfs" for rootfs.
  163. To boot kernel from OSPI, at the U-Boot prompt:
  164. .. code-block:: text
  165. => setenv boot ubi
  166. => boot
  167. UART:
  168. -----
  169. ROM supports booting from MCU_UART0 via X-Modem protocol. The entire UART-based
  170. boot process up to U-Boot (proper) prompt goes through different stages and uses
  171. different UART peripherals as follows:
  172. .. list-table:: ROM UART Boot Responsibilities
  173. :widths: 16 16 16 16
  174. :header-rows: 1
  175. * - Who
  176. - Loading What
  177. - Hardware Module
  178. - Protocol
  179. * - Boot ROM
  180. - tiboot3.bin
  181. - MCU_UART0
  182. - X-Modem(*)
  183. * - R5 SPL
  184. - sysfw.itb
  185. - MCU_UART0
  186. - Y-Modem(*)
  187. * - R5 SPL
  188. - tispl.bin
  189. - MAIN_UART0
  190. - Y-Modem
  191. * - A53 SPL
  192. - u-boot.img
  193. - MAIN_UART0
  194. - Y-Modem
  195. Note that in addition to X/Y-Modem related protocol timeouts the DMSC
  196. watchdog timeout of 3min (typ.) needs to be observed until System Firmware
  197. is fully loaded (from sysfw.itb) and started.
  198. Example bash script sequence for running on a Linux host PC feeding all boot
  199. artifacts needed to the device:
  200. .. code-block:: text
  201. MCU_DEV=/dev/ttyUSB1
  202. MAIN_DEV=/dev/ttyUSB0
  203. stty -F $MCU_DEV 115200 cs8 -cstopb -parenb
  204. stty -F $MAIN_DEV 115200 cs8 -cstopb -parenb
  205. sb --xmodem tiboot3.bin > $MCU_DEV < $MCU_DEV
  206. sb --ymodem sysfw.itb > $MCU_DEV < $MCU_DEV
  207. sb --ymodem tispl.bin > $MAIN_DEV < $MAIN_DEV
  208. sleep 1
  209. sb --xmodem u-boot.img > $MAIN_DEV < $MAIN_DEV
  210. Debugging U-Boot
  211. ----------------
  212. See :ref:`Common Debugging environment - OpenOCD<k3_rst_refer_openocd>`: for
  213. detailed setup information.
  214. .. warning::
  215. **OpenOCD support since**: v0.12.0
  216. If the default package version of OpenOCD in your development
  217. environment's distribution needs to be updated, it might be necessary to
  218. build OpenOCD from the source.
  219. .. include:: k3.rst
  220. :start-after: .. k3_rst_include_start_openocd_connect_XDS110
  221. :end-before: .. k3_rst_include_end_openocd_connect_XDS110
  222. To start OpenOCD and connect to the board
  223. .. code-block:: bash
  224. openocd -f board/ti_am654evm.cfg