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