xref: /arm-trusted-firmware/docs/plat/arm/juno/index.rst (revision 91f16700b400a8c0651d24a598fc48ee2997a0d7)
1*91f16700SchasingluluArm Juno Development Platform
2*91f16700Schasinglulu=============================
3*91f16700Schasinglulu
4*91f16700SchasingluluPlatform-specific build options
5*91f16700Schasinglulu-------------------------------
6*91f16700Schasinglulu
7*91f16700Schasinglulu-  ``JUNO_TZMP1`` : Boolean option to configure Juno to be used for TrustZone
8*91f16700Schasinglulu   Media Protection (TZ-MP1). Default value of this flag is 0.
9*91f16700Schasinglulu
10*91f16700SchasingluluRunning software on Juno
11*91f16700Schasinglulu------------------------
12*91f16700Schasinglulu
13*91f16700SchasingluluThis version of TF-A has been tested on variants r0, r1 and r2 of Juno.
14*91f16700Schasinglulu
15*91f16700SchasingluluTo run TF-A on Juno, you need to first prepare an SD card with Juno software
16*91f16700Schasinglulustack that includes TF-A. This version of TF-A is tested with pre-built
17*91f16700Schasinglulu`Linaro release software stack`_ version 20.01. You can alternatively
18*91f16700Schasinglulubuild the software stack yourself by following the
19*91f16700Schasinglulu`Juno platform software user guide`_. Once you prepare the software stack
20*91f16700Schasingluluon an SD card, you can replace the ``bl1.bin`` and ``fip.bin``
21*91f16700Schasinglulubinaries in the ``SOFTWARE/`` directory with custom built TF-A binaries.
22*91f16700Schasinglulu
23*91f16700SchasingluluPreparing TF-A images
24*91f16700Schasinglulu---------------------
25*91f16700Schasinglulu
26*91f16700SchasingluluThis section provides Juno and FVP specific instructions to build Trusted
27*91f16700SchasingluluFirmware, obtain the additional required firmware, and pack it all together in
28*91f16700Schasinglulua single FIP binary. It assumes that a Linaro release software stack has been
29*91f16700Schasingluluinstalled.
30*91f16700Schasinglulu
31*91f16700Schasinglulu.. note::
32*91f16700Schasinglulu   Pre-built binaries for AArch32 are available from Linaro Release 16.12
33*91f16700Schasinglulu   onwards. Before that release, pre-built binaries are only available for
34*91f16700Schasinglulu   AArch64.
35*91f16700Schasinglulu
36*91f16700Schasinglulu.. warning::
37*91f16700Schasinglulu   Follow the full instructions for one platform before switching to a
38*91f16700Schasinglulu   different one. Mixing instructions for different platforms may result in
39*91f16700Schasinglulu   corrupted binaries.
40*91f16700Schasinglulu
41*91f16700Schasinglulu.. warning::
42*91f16700Schasinglulu   The uboot image downloaded by the Linaro workspace script does not always
43*91f16700Schasinglulu   match the uboot image packaged as BL33 in the corresponding fip file. It is
44*91f16700Schasinglulu   recommended to use the version that is packaged in the fip file using the
45*91f16700Schasinglulu   instructions below.
46*91f16700Schasinglulu
47*91f16700Schasinglulu.. note::
48*91f16700Schasinglulu   For the FVP, the kernel FDT is packaged in FIP during build and loaded
49*91f16700Schasinglulu   by the firmware at runtime.
50*91f16700Schasinglulu
51*91f16700Schasinglulu#. Clean the working directory
52*91f16700Schasinglulu
53*91f16700Schasinglulu   .. code:: shell
54*91f16700Schasinglulu
55*91f16700Schasinglulu       make realclean
56*91f16700Schasinglulu
57*91f16700Schasinglulu#. Obtain SCP binaries (Juno)
58*91f16700Schasinglulu
59*91f16700Schasinglulu   This version of TF-A is tested with SCP version 2.12.0 on Juno. You can
60*91f16700Schasinglulu   download pre-built SCP binaries (``scp_bl1.bin`` and ``scp_bl2.bin``)
61*91f16700Schasinglulu   from `TF-A downloads page`_. Alternatively, you can `build
62*91f16700Schasinglulu   the binaries from source`_.
63*91f16700Schasinglulu
64*91f16700Schasinglulu#. Obtain BL33 (all platforms)
65*91f16700Schasinglulu
66*91f16700Schasinglulu   Use the fiptool to extract the BL33 image from the FIP
67*91f16700Schasinglulu   package included in the Linaro release:
68*91f16700Schasinglulu
69*91f16700Schasinglulu   .. code:: shell
70*91f16700Schasinglulu
71*91f16700Schasinglulu       # Build the fiptool
72*91f16700Schasinglulu       make [DEBUG=1] [V=1] fiptool
73*91f16700Schasinglulu
74*91f16700Schasinglulu       # Unpack firmware images from Linaro FIP
75*91f16700Schasinglulu       ./tools/fiptool/fiptool unpack <path-to-linaro-release>/[SOFTWARE]/fip.bin
76*91f16700Schasinglulu
77*91f16700Schasinglulu   The unpack operation will result in a set of binary images extracted to the
78*91f16700Schasinglulu   current working directory. BL33 corresponds to ``nt-fw.bin``.
79*91f16700Schasinglulu
80*91f16700Schasinglulu   .. note::
81*91f16700Schasinglulu      The fiptool will complain if the images to be unpacked already
82*91f16700Schasinglulu      exist in the current directory. If that is the case, either delete those
83*91f16700Schasinglulu      files or use the ``--force`` option to overwrite.
84*91f16700Schasinglulu
85*91f16700Schasinglulu   .. note::
86*91f16700Schasinglulu      For AArch32, the instructions below assume that nt-fw.bin is a
87*91f16700Schasinglulu      normal world boot loader that supports AArch32.
88*91f16700Schasinglulu
89*91f16700Schasinglulu#. Build TF-A images and create a new FIP for FVP
90*91f16700Schasinglulu
91*91f16700Schasinglulu   .. code:: shell
92*91f16700Schasinglulu
93*91f16700Schasinglulu       # AArch64
94*91f16700Schasinglulu       make PLAT=fvp BL33=nt-fw.bin all fip
95*91f16700Schasinglulu
96*91f16700Schasinglulu       # AArch32
97*91f16700Schasinglulu       make PLAT=fvp ARCH=aarch32 AARCH32_SP=sp_min BL33=nt-fw.bin all fip
98*91f16700Schasinglulu
99*91f16700Schasinglulu#. Build TF-A images and create a new FIP for Juno
100*91f16700Schasinglulu
101*91f16700Schasinglulu   For AArch64:
102*91f16700Schasinglulu
103*91f16700Schasinglulu   Building for AArch64 on Juno simply requires the addition of ``SCP_BL2``
104*91f16700Schasinglulu   as a build parameter.
105*91f16700Schasinglulu
106*91f16700Schasinglulu   .. code:: shell
107*91f16700Schasinglulu
108*91f16700Schasinglulu       make PLAT=juno BL33=nt-fw.bin SCP_BL2=scp_bl2.bin all fip
109*91f16700Schasinglulu
110*91f16700Schasinglulu   For AArch32:
111*91f16700Schasinglulu
112*91f16700Schasinglulu   Hardware restrictions on Juno prevent cold reset into AArch32 execution mode,
113*91f16700Schasinglulu   therefore BL1 and BL2 must be compiled for AArch64, and BL32 is compiled
114*91f16700Schasinglulu   separately for AArch32.
115*91f16700Schasinglulu
116*91f16700Schasinglulu   -  Before building BL32, the environment variable ``CROSS_COMPILE`` must point
117*91f16700Schasinglulu      to the AArch32 Linaro cross compiler.
118*91f16700Schasinglulu
119*91f16700Schasinglulu      .. code:: shell
120*91f16700Schasinglulu
121*91f16700Schasinglulu          export CROSS_COMPILE=<path-to-aarch32-gcc>/bin/arm-linux-gnueabihf-
122*91f16700Schasinglulu
123*91f16700Schasinglulu   -  Build BL32 in AArch32.
124*91f16700Schasinglulu
125*91f16700Schasinglulu      .. code:: shell
126*91f16700Schasinglulu
127*91f16700Schasinglulu          make ARCH=aarch32 PLAT=juno AARCH32_SP=sp_min \
128*91f16700Schasinglulu          RESET_TO_SP_MIN=1 JUNO_AARCH32_EL3_RUNTIME=1 bl32
129*91f16700Schasinglulu
130*91f16700Schasinglulu   -  Save ``bl32.bin`` to a temporary location and clean the build products.
131*91f16700Schasinglulu
132*91f16700Schasinglulu      ::
133*91f16700Schasinglulu
134*91f16700Schasinglulu          cp <path-to-build>/bl32.bin <path-to-temporary>
135*91f16700Schasinglulu          make realclean
136*91f16700Schasinglulu
137*91f16700Schasinglulu   -  Before building BL1 and BL2, the environment variable ``CROSS_COMPILE``
138*91f16700Schasinglulu      must point to the AArch64 Linaro cross compiler.
139*91f16700Schasinglulu
140*91f16700Schasinglulu      .. code:: shell
141*91f16700Schasinglulu
142*91f16700Schasinglulu          export CROSS_COMPILE=<path-to-aarch64-gcc>/bin/aarch64-none-elf-
143*91f16700Schasinglulu
144*91f16700Schasinglulu   -  The following parameters should be used to build BL1 and BL2 in AArch64
145*91f16700Schasinglulu      and point to the BL32 file.
146*91f16700Schasinglulu
147*91f16700Schasinglulu      .. code:: shell
148*91f16700Schasinglulu
149*91f16700Schasinglulu          make ARCH=aarch64 PLAT=juno JUNO_AARCH32_EL3_RUNTIME=1 \
150*91f16700Schasinglulu          BL33=nt-fw.bin SCP_BL2=scp_bl2.bin \
151*91f16700Schasinglulu          BL32=<path-to-temporary>/bl32.bin all fip
152*91f16700Schasinglulu
153*91f16700SchasingluluThe resulting BL1 and FIP images may be found in:
154*91f16700Schasinglulu
155*91f16700Schasinglulu::
156*91f16700Schasinglulu
157*91f16700Schasinglulu    # Juno
158*91f16700Schasinglulu    ./build/juno/release/bl1.bin
159*91f16700Schasinglulu    ./build/juno/release/fip.bin
160*91f16700Schasinglulu
161*91f16700Schasinglulu    # FVP
162*91f16700Schasinglulu    ./build/fvp/release/bl1.bin
163*91f16700Schasinglulu    ./build/fvp/release/fip.bin
164*91f16700Schasinglulu
165*91f16700SchasingluluAfter building TF-A, the files ``bl1.bin``, ``fip.bin`` and ``scp_bl1.bin``
166*91f16700Schasingluluneed to be copied to the ``SOFTWARE/`` directory on the Juno SD card.
167*91f16700Schasinglulu
168*91f16700SchasingluluBooting Firmware Update images
169*91f16700Schasinglulu------------------------------
170*91f16700Schasinglulu
171*91f16700SchasingluluThe new images must be programmed in flash memory by adding
172*91f16700Schasingluluan entry in the ``SITE1/HBI0262x/images.txt`` configuration file
173*91f16700Schasingluluon the Juno SD card (where ``x`` depends on the revision of the Juno board).
174*91f16700SchasingluluRefer to the `Juno Getting Started Guide`_, section 2.3 "Flash memory
175*91f16700Schasingluluprogramming" for more information. User should ensure these do not
176*91f16700Schasingluluoverlap with any other entries in the file.
177*91f16700Schasinglulu
178*91f16700Schasinglulu::
179*91f16700Schasinglulu
180*91f16700Schasinglulu        NOR10UPDATE: AUTO                       ;Image Update:NONE/AUTO/FORCE
181*91f16700Schasinglulu        NOR10ADDRESS: 0x00400000                ;Image Flash Address [ns_bl2u_base_address]
182*91f16700Schasinglulu        NOR10FILE: \SOFTWARE\fwu_fip.bin        ;Image File Name
183*91f16700Schasinglulu        NOR10LOAD: 00000000                     ;Image Load Address
184*91f16700Schasinglulu        NOR10ENTRY: 00000000                    ;Image Entry Point
185*91f16700Schasinglulu
186*91f16700Schasinglulu        NOR11UPDATE: AUTO                       ;Image Update:NONE/AUTO/FORCE
187*91f16700Schasinglulu        NOR11ADDRESS: 0x03EB8000                ;Image Flash Address [ns_bl1u_base_address]
188*91f16700Schasinglulu        NOR11FILE: \SOFTWARE\ns_bl1u.bin        ;Image File Name
189*91f16700Schasinglulu        NOR11LOAD: 00000000                     ;Image Load Address
190*91f16700Schasinglulu
191*91f16700SchasingluluThe address ns_bl1u_base_address is the value of NS_BL1U_BASE - 0x8000000.
192*91f16700SchasingluluIn the same way, the address ns_bl2u_base_address is the value of
193*91f16700SchasingluluNS_BL2U_BASE - 0x8000000.
194*91f16700Schasinglulu
195*91f16700Schasinglulu.. _plat_juno_booting_el3_payload:
196*91f16700Schasinglulu
197*91f16700SchasingluluBooting an EL3 payload
198*91f16700Schasinglulu----------------------
199*91f16700Schasinglulu
200*91f16700SchasingluluIf the EL3 payload is able to execute in place, it may be programmed in flash
201*91f16700Schasinglulumemory by adding an entry in the ``SITE1/HBI0262x/images.txt`` configuration file
202*91f16700Schasingluluon the Juno SD card (where ``x`` depends on the revision of the Juno board).
203*91f16700SchasingluluRefer to the `Juno Getting Started Guide`_, section 2.3 "Flash memory
204*91f16700Schasingluluprogramming" for more information.
205*91f16700Schasinglulu
206*91f16700SchasingluluAlternatively, the same DS-5 command mentioned in the FVP section above can
207*91f16700Schasinglulube used to load the EL3 payload's ELF file over JTAG on Juno.
208*91f16700Schasinglulu
209*91f16700SchasingluluFor more information on EL3 payloads in general, see
210*91f16700Schasinglulu:ref:`alt_boot_flows_el3_payload`.
211*91f16700Schasinglulu
212*91f16700SchasingluluBooting a preloaded kernel image
213*91f16700Schasinglulu--------------------------------
214*91f16700Schasinglulu
215*91f16700SchasingluluThe Trusted Firmware must be compiled in a similar way as for FVP explained
216*91f16700Schasingluluabove. The process to load binaries to memory is the one explained in
217*91f16700Schasinglulu`plat_juno_booting_el3_payload`_.
218*91f16700Schasinglulu
219*91f16700SchasingluluTesting System Suspend
220*91f16700Schasinglulu----------------------
221*91f16700Schasinglulu
222*91f16700SchasingluluThe SYSTEM SUSPEND is a PSCI API which can be used to implement system suspend
223*91f16700Schasingluluto RAM. For more details refer to section 5.16 of `PSCI`_. To test system suspend
224*91f16700Schasingluluon Juno, at the linux shell prompt, issue the following command:
225*91f16700Schasinglulu
226*91f16700Schasinglulu.. code:: shell
227*91f16700Schasinglulu
228*91f16700Schasinglulu    echo +10 > /sys/class/rtc/rtc0/wakealarm
229*91f16700Schasinglulu    echo -n mem > /sys/power/state
230*91f16700Schasinglulu
231*91f16700SchasingluluThe Juno board should suspend to RAM and then wakeup after 10 seconds due to
232*91f16700Schasingluluwakeup interrupt from RTC.
233*91f16700Schasinglulu
234*91f16700SchasingluluAdditional Resources
235*91f16700Schasinglulu--------------------
236*91f16700Schasinglulu
237*91f16700SchasingluluPlease visit the `Arm Platforms Portal`_ to get support and obtain any other Juno
238*91f16700Schasinglulusoftware information. Please also refer to the `Juno Getting Started Guide`_ to
239*91f16700Schasingluluget more detailed information about the Juno Arm development platform and how to
240*91f16700Schasingluluconfigure it.
241*91f16700Schasinglulu
242*91f16700Schasinglulu--------------
243*91f16700Schasinglulu
244*91f16700Schasinglulu*Copyright (c) 2019-2023, Arm Limited. All rights reserved.*
245*91f16700Schasinglulu
246*91f16700Schasinglulu.. _Linaro release software stack: http://releases.linaro.org/members/arm/platforms/
247*91f16700Schasinglulu.. _Juno platform software user guide: https://git.linaro.org/landing-teams/working/arm/arm-reference-platforms.git/about/docs/juno/user-guide.rst
248*91f16700Schasinglulu.. _TF-A downloads page: https://downloads.trustedfirmware.org/tf-a/css_scp_2.12.0/juno/
249*91f16700Schasinglulu.. _build the binaries from source: https://github.com/ARM-software/SCP-firmware/blob/master/user_guide.md#scp-firmware-user-guide
250*91f16700Schasinglulu.. _Arm Platforms Portal: https://community.arm.com/dev-platforms/
251*91f16700Schasinglulu.. _Juno Getting Started Guide: https://developer.arm.com/documentation/den0928/f/?lang=en
252*91f16700Schasinglulu.. _PSCI: https://developer.arm.com/documentation/den0022/latest/
253