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