xref: /rk3399_ARM-atf/docs/plat/arm/juno/index.rst (revision 90329375d0f44ad5e68772ae4c63b5482143937e)
143f35ef5SPaul BeesleyArm Juno Development Platform
243f35ef5SPaul Beesley=============================
343f35ef5SPaul Beesley
443f35ef5SPaul BeesleyPlatform-specific build options
543f35ef5SPaul Beesley-------------------------------
643f35ef5SPaul Beesley
743f35ef5SPaul Beesley-  ``JUNO_TZMP1`` : Boolean option to configure Juno to be used for TrustZone
843f35ef5SPaul Beesley   Media Protection (TZ-MP1). Default value of this flag is 0.
943f35ef5SPaul Beesley
1043f35ef5SPaul BeesleyRunning software on Juno
1143f35ef5SPaul Beesley------------------------
1243f35ef5SPaul Beesley
1343f35ef5SPaul BeesleyThis version of TF-A has been tested on variants r0, r1 and r2 of Juno.
1443f35ef5SPaul Beesley
1592473b3bSZelalemTo run TF-A on Juno, you need to first prepare an SD card with Juno software
1692473b3bSZelalemstack that includes TF-A. This version of TF-A is tested with pre-built
1792473b3bSZelalem`Linaro release software stack`_ version 20.01. You can alternatively
1892473b3bSZelalembuild the software stack yourself by following the
1992473b3bSZelalem`Juno platform software user guide`_. Once you prepare the software stack
2092473b3bSZelalemon an SD card, you can replace the ``bl1.bin`` and ``fip.bin``
2192473b3bSZelalembinaries in the ``SOFTWARE/`` directory with custom built TF-A binaries.
2243f35ef5SPaul Beesley
2343f35ef5SPaul BeesleyPreparing TF-A images
2443f35ef5SPaul Beesley---------------------
2543f35ef5SPaul Beesley
2643f35ef5SPaul BeesleyThis section provides Juno and FVP specific instructions to build Trusted
2743f35ef5SPaul BeesleyFirmware, obtain the additional required firmware, and pack it all together in
2892473b3bSZelalema single FIP binary. It assumes that a Linaro release software stack has been
2992473b3bSZelaleminstalled.
3043f35ef5SPaul Beesley
3143f35ef5SPaul Beesley.. note::
3243f35ef5SPaul Beesley   Pre-built binaries for AArch32 are available from Linaro Release 16.12
3343f35ef5SPaul Beesley   onwards. Before that release, pre-built binaries are only available for
3443f35ef5SPaul Beesley   AArch64.
3543f35ef5SPaul Beesley
3643f35ef5SPaul Beesley.. warning::
3743f35ef5SPaul Beesley   Follow the full instructions for one platform before switching to a
3843f35ef5SPaul Beesley   different one. Mixing instructions for different platforms may result in
3943f35ef5SPaul Beesley   corrupted binaries.
4043f35ef5SPaul Beesley
4143f35ef5SPaul Beesley.. warning::
4243f35ef5SPaul Beesley   The uboot image downloaded by the Linaro workspace script does not always
4343f35ef5SPaul Beesley   match the uboot image packaged as BL33 in the corresponding fip file. It is
4443f35ef5SPaul Beesley   recommended to use the version that is packaged in the fip file using the
4543f35ef5SPaul Beesley   instructions below.
4643f35ef5SPaul Beesley
4743f35ef5SPaul Beesley.. note::
4843f35ef5SPaul Beesley   For the FVP, the kernel FDT is packaged in FIP during build and loaded
4943f35ef5SPaul Beesley   by the firmware at runtime.
5043f35ef5SPaul Beesley
5143f35ef5SPaul Beesley#. Clean the working directory
5243f35ef5SPaul Beesley
5343f35ef5SPaul Beesley   .. code:: shell
5443f35ef5SPaul Beesley
5543f35ef5SPaul Beesley       make realclean
5643f35ef5SPaul Beesley
5792473b3bSZelalem#. Obtain SCP binaries (Juno)
5843f35ef5SPaul Beesley
595bf352d1SHarrison Mutai   This version of TF-A is tested with SCP version 2.14.0 on Juno. You can
6092473b3bSZelalem   download pre-built SCP binaries (``scp_bl1.bin`` and ``scp_bl2.bin``)
6192473b3bSZelalem   from `TF-A downloads page`_. Alternatively, you can `build
6292473b3bSZelalem   the binaries from source`_.
6392473b3bSZelalem
6492473b3bSZelalem#. Obtain BL33 (all platforms)
6592473b3bSZelalem
6692473b3bSZelalem   Use the fiptool to extract the BL33 image from the FIP
6743f35ef5SPaul Beesley   package included in the Linaro release:
6843f35ef5SPaul Beesley
6943f35ef5SPaul Beesley   .. code:: shell
7043f35ef5SPaul Beesley
7143f35ef5SPaul Beesley       # Build the fiptool
7243f35ef5SPaul Beesley       make [DEBUG=1] [V=1] fiptool
7343f35ef5SPaul Beesley
7443f35ef5SPaul Beesley       # Unpack firmware images from Linaro FIP
7543f35ef5SPaul Beesley       ./tools/fiptool/fiptool unpack <path-to-linaro-release>/[SOFTWARE]/fip.bin
7643f35ef5SPaul Beesley
7743f35ef5SPaul Beesley   The unpack operation will result in a set of binary images extracted to the
7892473b3bSZelalem   current working directory. BL33 corresponds to ``nt-fw.bin``.
7943f35ef5SPaul Beesley
8043f35ef5SPaul Beesley   .. note::
8143f35ef5SPaul Beesley      The fiptool will complain if the images to be unpacked already
8243f35ef5SPaul Beesley      exist in the current directory. If that is the case, either delete those
8343f35ef5SPaul Beesley      files or use the ``--force`` option to overwrite.
8443f35ef5SPaul Beesley
8543f35ef5SPaul Beesley   .. note::
8643f35ef5SPaul Beesley      For AArch32, the instructions below assume that nt-fw.bin is a
8743f35ef5SPaul Beesley      normal world boot loader that supports AArch32.
8843f35ef5SPaul Beesley
8943f35ef5SPaul Beesley#. Build TF-A images and create a new FIP for FVP
9043f35ef5SPaul Beesley
9143f35ef5SPaul Beesley   .. code:: shell
9243f35ef5SPaul Beesley
9343f35ef5SPaul Beesley       # AArch64
9443f35ef5SPaul Beesley       make PLAT=fvp BL33=nt-fw.bin all fip
9543f35ef5SPaul Beesley
9643f35ef5SPaul Beesley       # AArch32
9743f35ef5SPaul Beesley       make PLAT=fvp ARCH=aarch32 AARCH32_SP=sp_min BL33=nt-fw.bin all fip
9843f35ef5SPaul Beesley
9943f35ef5SPaul Beesley#. Build TF-A images and create a new FIP for Juno
10043f35ef5SPaul Beesley
10143f35ef5SPaul Beesley   For AArch64:
10243f35ef5SPaul Beesley
10343f35ef5SPaul Beesley   Building for AArch64 on Juno simply requires the addition of ``SCP_BL2``
10443f35ef5SPaul Beesley   as a build parameter.
10543f35ef5SPaul Beesley
10643f35ef5SPaul Beesley   .. code:: shell
10743f35ef5SPaul Beesley
10892473b3bSZelalem       make PLAT=juno BL33=nt-fw.bin SCP_BL2=scp_bl2.bin all fip
10943f35ef5SPaul Beesley
11043f35ef5SPaul Beesley   For AArch32:
11143f35ef5SPaul Beesley
11243f35ef5SPaul Beesley   Hardware restrictions on Juno prevent cold reset into AArch32 execution mode,
11343f35ef5SPaul Beesley   therefore BL1 and BL2 must be compiled for AArch64, and BL32 is compiled
11443f35ef5SPaul Beesley   separately for AArch32.
11543f35ef5SPaul Beesley
11643f35ef5SPaul Beesley   -  Before building BL32, the environment variable ``CROSS_COMPILE`` must point
11743f35ef5SPaul Beesley      to the AArch32 Linaro cross compiler.
11843f35ef5SPaul Beesley
11943f35ef5SPaul Beesley      .. code:: shell
12043f35ef5SPaul Beesley
12143f35ef5SPaul Beesley          export CROSS_COMPILE=<path-to-aarch32-gcc>/bin/arm-linux-gnueabihf-
12243f35ef5SPaul Beesley
12343f35ef5SPaul Beesley   -  Build BL32 in AArch32.
12443f35ef5SPaul Beesley
12543f35ef5SPaul Beesley      .. code:: shell
12643f35ef5SPaul Beesley
12743f35ef5SPaul Beesley          make ARCH=aarch32 PLAT=juno AARCH32_SP=sp_min \
12843f35ef5SPaul Beesley          RESET_TO_SP_MIN=1 JUNO_AARCH32_EL3_RUNTIME=1 bl32
12943f35ef5SPaul Beesley
13043f35ef5SPaul Beesley   -  Save ``bl32.bin`` to a temporary location and clean the build products.
13143f35ef5SPaul Beesley
13243f35ef5SPaul Beesley      ::
13343f35ef5SPaul Beesley
13443f35ef5SPaul Beesley          cp <path-to-build>/bl32.bin <path-to-temporary>
13543f35ef5SPaul Beesley          make realclean
13643f35ef5SPaul Beesley
13743f35ef5SPaul Beesley   -  Before building BL1 and BL2, the environment variable ``CROSS_COMPILE``
13843f35ef5SPaul Beesley      must point to the AArch64 Linaro cross compiler.
13943f35ef5SPaul Beesley
14043f35ef5SPaul Beesley      .. code:: shell
14143f35ef5SPaul Beesley
142f35e5ab3SMadhukar Pappireddy          export CROSS_COMPILE=<path-to-aarch64-gcc>/bin/aarch64-none-elf-
14343f35ef5SPaul Beesley
14443f35ef5SPaul Beesley   -  The following parameters should be used to build BL1 and BL2 in AArch64
14543f35ef5SPaul Beesley      and point to the BL32 file.
14643f35ef5SPaul Beesley
14743f35ef5SPaul Beesley      .. code:: shell
14843f35ef5SPaul Beesley
14943f35ef5SPaul Beesley          make ARCH=aarch64 PLAT=juno JUNO_AARCH32_EL3_RUNTIME=1 \
15092473b3bSZelalem          BL33=nt-fw.bin SCP_BL2=scp_bl2.bin \
15143f35ef5SPaul Beesley          BL32=<path-to-temporary>/bl32.bin all fip
15243f35ef5SPaul Beesley
15343f35ef5SPaul BeesleyThe resulting BL1 and FIP images may be found in:
15443f35ef5SPaul Beesley
15543f35ef5SPaul Beesley::
15643f35ef5SPaul Beesley
15743f35ef5SPaul Beesley    # Juno
15843f35ef5SPaul Beesley    ./build/juno/release/bl1.bin
15943f35ef5SPaul Beesley    ./build/juno/release/fip.bin
16043f35ef5SPaul Beesley
16143f35ef5SPaul Beesley    # FVP
16243f35ef5SPaul Beesley    ./build/fvp/release/bl1.bin
16343f35ef5SPaul Beesley    ./build/fvp/release/fip.bin
16443f35ef5SPaul Beesley
16592473b3bSZelalemAfter building TF-A, the files ``bl1.bin``, ``fip.bin`` and ``scp_bl1.bin``
16692473b3bSZelalemneed to be copied to the ``SOFTWARE/`` directory on the Juno SD card.
16743f35ef5SPaul Beesley
16843f35ef5SPaul BeesleyBooting Firmware Update images
16943f35ef5SPaul Beesley------------------------------
17043f35ef5SPaul Beesley
17143f35ef5SPaul BeesleyThe new images must be programmed in flash memory by adding
17243f35ef5SPaul Beesleyan entry in the ``SITE1/HBI0262x/images.txt`` configuration file
17343f35ef5SPaul Beesleyon the Juno SD card (where ``x`` depends on the revision of the Juno board).
17443f35ef5SPaul BeesleyRefer to the `Juno Getting Started Guide`_, section 2.3 "Flash memory
17543f35ef5SPaul Beesleyprogramming" for more information. User should ensure these do not
17643f35ef5SPaul Beesleyoverlap with any other entries in the file.
17743f35ef5SPaul Beesley
17843f35ef5SPaul Beesley::
17943f35ef5SPaul Beesley
18043f35ef5SPaul Beesley        NOR10UPDATE: AUTO                       ;Image Update:NONE/AUTO/FORCE
18143f35ef5SPaul Beesley        NOR10ADDRESS: 0x00400000                ;Image Flash Address [ns_bl2u_base_address]
18243f35ef5SPaul Beesley        NOR10FILE: \SOFTWARE\fwu_fip.bin        ;Image File Name
18343f35ef5SPaul Beesley        NOR10LOAD: 00000000                     ;Image Load Address
18443f35ef5SPaul Beesley        NOR10ENTRY: 00000000                    ;Image Entry Point
18543f35ef5SPaul Beesley
18643f35ef5SPaul Beesley        NOR11UPDATE: AUTO                       ;Image Update:NONE/AUTO/FORCE
18743f35ef5SPaul Beesley        NOR11ADDRESS: 0x03EB8000                ;Image Flash Address [ns_bl1u_base_address]
18843f35ef5SPaul Beesley        NOR11FILE: \SOFTWARE\ns_bl1u.bin        ;Image File Name
18943f35ef5SPaul Beesley        NOR11LOAD: 00000000                     ;Image Load Address
19043f35ef5SPaul Beesley
19143f35ef5SPaul BeesleyThe address ns_bl1u_base_address is the value of NS_BL1U_BASE - 0x8000000.
19243f35ef5SPaul BeesleyIn the same way, the address ns_bl2u_base_address is the value of
19343f35ef5SPaul BeesleyNS_BL2U_BASE - 0x8000000.
19443f35ef5SPaul Beesley
19543f35ef5SPaul Beesley.. _plat_juno_booting_el3_payload:
19643f35ef5SPaul Beesley
19743f35ef5SPaul BeesleyBooting an EL3 payload
19843f35ef5SPaul Beesley----------------------
19943f35ef5SPaul Beesley
20043f35ef5SPaul BeesleyIf the EL3 payload is able to execute in place, it may be programmed in flash
20143f35ef5SPaul Beesleymemory by adding an entry in the ``SITE1/HBI0262x/images.txt`` configuration file
20243f35ef5SPaul Beesleyon the Juno SD card (where ``x`` depends on the revision of the Juno board).
20343f35ef5SPaul BeesleyRefer to the `Juno Getting Started Guide`_, section 2.3 "Flash memory
20443f35ef5SPaul Beesleyprogramming" for more information.
20543f35ef5SPaul Beesley
20643f35ef5SPaul BeesleyAlternatively, the same DS-5 command mentioned in the FVP section above can
20743f35ef5SPaul Beesleybe used to load the EL3 payload's ELF file over JTAG on Juno.
20843f35ef5SPaul Beesley
20943f35ef5SPaul BeesleyFor more information on EL3 payloads in general, see
21043f35ef5SPaul Beesley:ref:`alt_boot_flows_el3_payload`.
21143f35ef5SPaul Beesley
21243f35ef5SPaul BeesleyBooting a preloaded kernel image
21343f35ef5SPaul Beesley--------------------------------
21443f35ef5SPaul Beesley
21543f35ef5SPaul BeesleyThe Trusted Firmware must be compiled in a similar way as for FVP explained
21643f35ef5SPaul Beesleyabove. The process to load binaries to memory is the one explained in
21743f35ef5SPaul Beesley`plat_juno_booting_el3_payload`_.
21843f35ef5SPaul Beesley
21943f35ef5SPaul BeesleyTesting System Suspend
22043f35ef5SPaul Beesley----------------------
22143f35ef5SPaul Beesley
22243f35ef5SPaul BeesleyThe SYSTEM SUSPEND is a PSCI API which can be used to implement system suspend
22343f35ef5SPaul Beesleyto RAM. For more details refer to section 5.16 of `PSCI`_. To test system suspend
22443f35ef5SPaul Beesleyon Juno, at the linux shell prompt, issue the following command:
22543f35ef5SPaul Beesley
22643f35ef5SPaul Beesley.. code:: shell
22743f35ef5SPaul Beesley
22843f35ef5SPaul Beesley    echo +10 > /sys/class/rtc/rtc0/wakealarm
22943f35ef5SPaul Beesley    echo -n mem > /sys/power/state
23043f35ef5SPaul Beesley
23143f35ef5SPaul BeesleyThe Juno board should suspend to RAM and then wakeup after 10 seconds due to
23243f35ef5SPaul Beesleywakeup interrupt from RTC.
23343f35ef5SPaul Beesley
23443f35ef5SPaul BeesleyAdditional Resources
23543f35ef5SPaul Beesley--------------------
23643f35ef5SPaul Beesley
23743f35ef5SPaul BeesleyPlease visit the `Arm Platforms Portal`_ to get support and obtain any other Juno
23843f35ef5SPaul Beesleysoftware information. Please also refer to the `Juno Getting Started Guide`_ to
23943f35ef5SPaul Beesleyget more detailed information about the Juno Arm development platform and how to
24043f35ef5SPaul Beesleyconfigure it.
24143f35ef5SPaul Beesley
24243f35ef5SPaul Beesley--------------
24343f35ef5SPaul Beesley
2445bf352d1SHarrison Mutai*Copyright (c) 2019-2025, Arm Limited. All rights reserved.*
24543f35ef5SPaul Beesley
24692473b3bSZelalem.. _Linaro release software stack: http://releases.linaro.org/members/arm/platforms/
247*854d199bSGovindraj Raja.. _Juno platform software user guide: https://git.linaro.org/plugins/gitiles/landing-teams/working/arm/arm-reference-platforms/+/refs/heads/master/docs/juno/user-guide.rst
2485bf352d1SHarrison Mutai.. _TF-A downloads page: https://downloads.trustedfirmware.org/tf-a/css_scp_2.14.0/juno/
24992473b3bSZelalem.. _build the binaries from source: https://github.com/ARM-software/SCP-firmware/blob/master/user_guide.md#scp-firmware-user-guide
250*854d199bSGovindraj Raja.. _Arm Platforms Portal: https://developer.arm.com/documentation/110354/0100/Release-notes?lang=en
25189e4cea1SArthur She.. _Juno Getting Started Guide: https://developer.arm.com/documentation/den0928/f/?lang=en
2523be6b4fbSManish V Badarkhe.. _PSCI: https://developer.arm.com/documentation/den0022/latest/
253