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