fvp-specific-configs.rst 7.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209
  1. Booting Firmware Update images
  2. ------------------------------
  3. When Firmware Update (FWU) is enabled there are at least 2 new images
  4. that have to be loaded, the Non-Secure FWU ROM (NS-BL1U), and the
  5. FWU FIP.
  6. The additional fip images must be loaded with:
  7. ::
  8. --data cluster0.cpu0="<path_to>/ns_bl1u.bin"@0x0beb8000 [ns_bl1u_base_address]
  9. --data cluster0.cpu0="<path_to>/fwu_fip.bin"@0x08400000 [ns_bl2u_base_address]
  10. The address ns_bl1u_base_address is the value of NS_BL1U_BASE.
  11. In the same way, the address ns_bl2u_base_address is the value of
  12. NS_BL2U_BASE.
  13. Booting an EL3 payload
  14. ----------------------
  15. The EL3 payloads boot flow requires the CPU's mailbox to be cleared at reset for
  16. the secondary CPUs holding pen to work properly. Unfortunately, its reset value
  17. is undefined on the FVP platform and the FVP platform code doesn't clear it.
  18. Therefore, one must modify the way the model is normally invoked in order to
  19. clear the mailbox at start-up.
  20. One way to do that is to create an 8-byte file containing all zero bytes using
  21. the following command:
  22. .. code:: shell
  23. dd if=/dev/zero of=mailbox.dat bs=1 count=8
  24. and pre-load it into the FVP memory at the mailbox address (i.e. ``0x04000000``)
  25. using the following model parameters:
  26. ::
  27. --data cluster0.cpu0=mailbox.dat@0x04000000 [Base FVPs]
  28. --data=mailbox.dat@0x04000000 [Foundation FVP]
  29. To provide the model with the EL3 payload image, the following methods may be
  30. used:
  31. #. If the EL3 payload is able to execute in place, it may be programmed into
  32. flash memory. On Base Cortex and AEM FVPs, the following model parameter
  33. loads it at the base address of the NOR FLASH1 (the NOR FLASH0 is already
  34. used for the FIP):
  35. ::
  36. -C bp.flashloader1.fname="<path-to>/<el3-payload>"
  37. On Foundation FVP, there is no flash loader component and the EL3 payload
  38. may be programmed anywhere in flash using method 3 below.
  39. #. When using the ``SPIN_ON_BL1_EXIT=1`` loading method, the following DS-5
  40. command may be used to load the EL3 payload ELF image over JTAG:
  41. ::
  42. load <path-to>/el3-payload.elf
  43. #. The EL3 payload may be pre-loaded in volatile memory using the following
  44. model parameters:
  45. ::
  46. --data cluster0.cpu0="<path-to>/el3-payload>"@address [Base FVPs]
  47. --data="<path-to>/<el3-payload>"@address [Foundation FVP]
  48. The address provided to the FVP must match the ``EL3_PAYLOAD_BASE`` address
  49. used when building TF-A.
  50. Booting a preloaded kernel image (Base FVP)
  51. -------------------------------------------
  52. The following example uses a simplified boot flow by directly jumping from the
  53. TF-A to the Linux kernel, which will use a ramdisk as filesystem. This can be
  54. useful if both the kernel and the device tree blob (DTB) are already present in
  55. memory (like in FVP).
  56. For example, if the kernel is loaded at ``0x80080000`` and the DTB is loaded at
  57. address ``0x82000000``, the firmware can be built like this:
  58. .. code:: shell
  59. CROSS_COMPILE=aarch64-none-elf- \
  60. make PLAT=fvp DEBUG=1 \
  61. RESET_TO_BL31=1 \
  62. ARM_LINUX_KERNEL_AS_BL33=1 \
  63. PRELOADED_BL33_BASE=0x80080000 \
  64. ARM_PRELOADED_DTB_BASE=0x82000000 \
  65. all fip
  66. Now, it is needed to modify the DTB so that the kernel knows the address of the
  67. ramdisk. The following script generates a patched DTB from the provided one,
  68. assuming that the ramdisk is loaded at address ``0x84000000``. Note that this
  69. script assumes that the user is using a ramdisk image prepared for U-Boot, like
  70. the ones provided by Linaro. If using a ramdisk without this header,the ``0x40``
  71. offset in ``INITRD_START`` has to be removed.
  72. .. code:: bash
  73. #!/bin/bash
  74. # Path to the input DTB
  75. KERNEL_DTB=<path-to>/<fdt>
  76. # Path to the output DTB
  77. PATCHED_KERNEL_DTB=<path-to>/<patched-fdt>
  78. # Base address of the ramdisk
  79. INITRD_BASE=0x84000000
  80. # Path to the ramdisk
  81. INITRD=<path-to>/<ramdisk.img>
  82. # Skip uboot header (64 bytes)
  83. INITRD_START=$(printf "0x%x" $((${INITRD_BASE} + 0x40)) )
  84. INITRD_SIZE=$(stat -Lc %s ${INITRD})
  85. INITRD_END=$(printf "0x%x" $((${INITRD_BASE} + ${INITRD_SIZE})) )
  86. CHOSEN_NODE=$(echo \
  87. "/ { \
  88. chosen { \
  89. linux,initrd-start = <${INITRD_START}>; \
  90. linux,initrd-end = <${INITRD_END}>; \
  91. }; \
  92. };")
  93. echo $(dtc -O dts -I dtb ${KERNEL_DTB}) ${CHOSEN_NODE} | \
  94. dtc -O dtb -o ${PATCHED_KERNEL_DTB} -
  95. And the FVP binary can be run with the following command:
  96. .. code:: shell
  97. <path-to>/FVP_Base_AEMv8A-AEMv8A \
  98. -C pctl.startup=0.0.0.0 \
  99. -C bp.secure_memory=1 \
  100. -C cluster0.NUM_CORES=4 \
  101. -C cluster1.NUM_CORES=4 \
  102. -C cache_state_modelled=1 \
  103. -C cluster0.cpu0.RVBAR=0x04001000 \
  104. -C cluster0.cpu1.RVBAR=0x04001000 \
  105. -C cluster0.cpu2.RVBAR=0x04001000 \
  106. -C cluster0.cpu3.RVBAR=0x04001000 \
  107. -C cluster1.cpu0.RVBAR=0x04001000 \
  108. -C cluster1.cpu1.RVBAR=0x04001000 \
  109. -C cluster1.cpu2.RVBAR=0x04001000 \
  110. -C cluster1.cpu3.RVBAR=0x04001000 \
  111. --data cluster0.cpu0="<path-to>/bl31.bin"@0x04001000 \
  112. --data cluster0.cpu0="<path-to>/<patched-fdt>"@0x82000000 \
  113. --data cluster0.cpu0="<path-to>/<kernel-binary>"@0x80080000 \
  114. --data cluster0.cpu0="<path-to>/<ramdisk.img>"@0x84000000
  115. Obtaining the Flattened Device Trees
  116. ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  117. Depending on the FVP configuration and Linux configuration used, different
  118. FDT files are required. FDT source files for the Foundation and Base FVPs can
  119. be found in the TF-A source directory under ``fdts/``. The Foundation FVP has
  120. a subset of the Base FVP components. For example, the Foundation FVP lacks
  121. CLCD and MMC support, and has only one CPU cluster.
  122. .. note::
  123. It is not recommended to use the FDTs built along the kernel because not
  124. all FDTs are available from there.
  125. The dynamic configuration capability is enabled in the firmware for FVPs.
  126. This means that the firmware can authenticate and load the FDT if present in
  127. FIP. A default FDT is packaged into FIP during the build based on
  128. the build configuration. This can be overridden by using the ``FVP_HW_CONFIG``
  129. or ``FVP_HW_CONFIG_DTS`` build options (refer to
  130. :ref:`build_options_arm_fvp_platform` for details on the options).
  131. - ``fvp-base-gicv2-psci.dts``
  132. For use with models such as the Cortex-A57-A53 or Cortex-A32 Base FVPs
  133. without shifted affinities and with Base memory map configuration.
  134. - ``fvp-base-gicv3-psci.dts``
  135. For use with models such as the Cortex-A57-A53 or Cortex-A32 Base FVPs
  136. without shifted affinities and with Base memory map configuration and
  137. Linux GICv3 support.
  138. - ``fvp-base-gicv3-psci-1t.dts``
  139. For use with models such as the AEMv8-RevC Base FVP with shifted affinities,
  140. single threaded CPUs, Base memory map configuration and Linux GICv3 support.
  141. - ``fvp-base-gicv3-psci-dynamiq.dts``
  142. For use with models as the Cortex-A55-A75 Base FVPs with shifted affinities,
  143. single cluster, single threaded CPUs, Base memory map configuration and Linux
  144. GICv3 support.
  145. - ``fvp-foundation-gicv2-psci.dts``
  146. For use with Foundation FVP with Base memory map configuration.
  147. - ``fvp-foundation-gicv3-psci.dts``
  148. (Default) For use with Foundation FVP with Base memory map configuration
  149. and Linux GICv3 support.
  150. --------------
  151. *Copyright (c) 2019-2024, Arm Limited. All rights reserved.*