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 1543f35ef5SPaul BeesleyTo execute the software stack on Juno, the version of the Juno board recovery 1643f35ef5SPaul Beesleyimage indicated in the `Linaro Release Notes`_ must be installed. If you have an 1743f35ef5SPaul Beesleyearlier version installed or are unsure which version is installed, please 1843f35ef5SPaul Beesleyre-install the recovery image by following the 1943f35ef5SPaul Beesley`Instructions for using Linaro's deliverables on Juno`_. 2043f35ef5SPaul Beesley 2143f35ef5SPaul BeesleyPreparing TF-A images 2243f35ef5SPaul Beesley--------------------- 2343f35ef5SPaul Beesley 2443f35ef5SPaul BeesleyAfter building TF-A, the files ``bl1.bin`` and ``fip.bin`` need copying to the 2543f35ef5SPaul Beesley``SOFTWARE/`` directory of the Juno SD card. 2643f35ef5SPaul Beesley 2743f35ef5SPaul BeesleyCreating a Firmware Image Package (FIP) 2843f35ef5SPaul Beesley--------------------------------------- 2943f35ef5SPaul Beesley 3043f35ef5SPaul BeesleyThis section provides Juno and FVP specific instructions to build Trusted 3143f35ef5SPaul BeesleyFirmware, obtain the additional required firmware, and pack it all together in 3243f35ef5SPaul Beesleya single FIP binary. It assumes that a Linaro release has been installed. 3343f35ef5SPaul Beesley 3443f35ef5SPaul Beesley.. note:: 3543f35ef5SPaul Beesley Pre-built binaries for AArch32 are available from Linaro Release 16.12 3643f35ef5SPaul Beesley onwards. Before that release, pre-built binaries are only available for 3743f35ef5SPaul Beesley AArch64. 3843f35ef5SPaul Beesley 3943f35ef5SPaul Beesley.. warning:: 4043f35ef5SPaul Beesley Follow the full instructions for one platform before switching to a 4143f35ef5SPaul Beesley different one. Mixing instructions for different platforms may result in 4243f35ef5SPaul Beesley corrupted binaries. 4343f35ef5SPaul Beesley 4443f35ef5SPaul Beesley.. warning:: 4543f35ef5SPaul Beesley The uboot image downloaded by the Linaro workspace script does not always 4643f35ef5SPaul Beesley match the uboot image packaged as BL33 in the corresponding fip file. It is 4743f35ef5SPaul Beesley recommended to use the version that is packaged in the fip file using the 4843f35ef5SPaul Beesley instructions below. 4943f35ef5SPaul Beesley 5043f35ef5SPaul Beesley.. note:: 5143f35ef5SPaul Beesley For the FVP, the kernel FDT is packaged in FIP during build and loaded 5243f35ef5SPaul Beesley by the firmware at runtime. 5343f35ef5SPaul Beesley 5443f35ef5SPaul Beesley#. Clean the working directory 5543f35ef5SPaul Beesley 5643f35ef5SPaul Beesley .. code:: shell 5743f35ef5SPaul Beesley 5843f35ef5SPaul Beesley make realclean 5943f35ef5SPaul Beesley 6043f35ef5SPaul Beesley#. Obtain SCP_BL2 (Juno) and BL33 (all platforms) 6143f35ef5SPaul Beesley 6243f35ef5SPaul Beesley Use the fiptool to extract the SCP_BL2 and BL33 images from the FIP 6343f35ef5SPaul Beesley package included in the Linaro release: 6443f35ef5SPaul Beesley 6543f35ef5SPaul Beesley .. code:: shell 6643f35ef5SPaul Beesley 6743f35ef5SPaul Beesley # Build the fiptool 6843f35ef5SPaul Beesley make [DEBUG=1] [V=1] fiptool 6943f35ef5SPaul Beesley 7043f35ef5SPaul Beesley # Unpack firmware images from Linaro FIP 7143f35ef5SPaul Beesley ./tools/fiptool/fiptool unpack <path-to-linaro-release>/[SOFTWARE]/fip.bin 7243f35ef5SPaul Beesley 7343f35ef5SPaul Beesley The unpack operation will result in a set of binary images extracted to the 7443f35ef5SPaul Beesley current working directory. The SCP_BL2 image corresponds to 7543f35ef5SPaul Beesley ``scp-fw.bin`` and BL33 corresponds to ``nt-fw.bin``. 7643f35ef5SPaul Beesley 7743f35ef5SPaul Beesley .. note:: 7843f35ef5SPaul Beesley The fiptool will complain if the images to be unpacked already 7943f35ef5SPaul Beesley exist in the current directory. If that is the case, either delete those 8043f35ef5SPaul Beesley files or use the ``--force`` option to overwrite. 8143f35ef5SPaul Beesley 8243f35ef5SPaul Beesley .. note:: 8343f35ef5SPaul Beesley For AArch32, the instructions below assume that nt-fw.bin is a 8443f35ef5SPaul Beesley normal world boot loader that supports AArch32. 8543f35ef5SPaul Beesley 8643f35ef5SPaul Beesley#. Build TF-A images and create a new FIP for FVP 8743f35ef5SPaul Beesley 8843f35ef5SPaul Beesley .. code:: shell 8943f35ef5SPaul Beesley 9043f35ef5SPaul Beesley # AArch64 9143f35ef5SPaul Beesley make PLAT=fvp BL33=nt-fw.bin all fip 9243f35ef5SPaul Beesley 9343f35ef5SPaul Beesley # AArch32 9443f35ef5SPaul Beesley make PLAT=fvp ARCH=aarch32 AARCH32_SP=sp_min BL33=nt-fw.bin all fip 9543f35ef5SPaul Beesley 9643f35ef5SPaul Beesley#. Build TF-A images and create a new FIP for Juno 9743f35ef5SPaul Beesley 9843f35ef5SPaul Beesley For AArch64: 9943f35ef5SPaul Beesley 10043f35ef5SPaul Beesley Building for AArch64 on Juno simply requires the addition of ``SCP_BL2`` 10143f35ef5SPaul Beesley as a build parameter. 10243f35ef5SPaul Beesley 10343f35ef5SPaul Beesley .. code:: shell 10443f35ef5SPaul Beesley 10543f35ef5SPaul Beesley make PLAT=juno BL33=nt-fw.bin SCP_BL2=scp-fw.bin all fip 10643f35ef5SPaul Beesley 10743f35ef5SPaul Beesley For AArch32: 10843f35ef5SPaul Beesley 10943f35ef5SPaul Beesley Hardware restrictions on Juno prevent cold reset into AArch32 execution mode, 11043f35ef5SPaul Beesley therefore BL1 and BL2 must be compiled for AArch64, and BL32 is compiled 11143f35ef5SPaul Beesley separately for AArch32. 11243f35ef5SPaul Beesley 11343f35ef5SPaul Beesley - Before building BL32, the environment variable ``CROSS_COMPILE`` must point 11443f35ef5SPaul Beesley to the AArch32 Linaro cross compiler. 11543f35ef5SPaul Beesley 11643f35ef5SPaul Beesley .. code:: shell 11743f35ef5SPaul Beesley 11843f35ef5SPaul Beesley export CROSS_COMPILE=<path-to-aarch32-gcc>/bin/arm-linux-gnueabihf- 11943f35ef5SPaul Beesley 12043f35ef5SPaul Beesley - Build BL32 in AArch32. 12143f35ef5SPaul Beesley 12243f35ef5SPaul Beesley .. code:: shell 12343f35ef5SPaul Beesley 12443f35ef5SPaul Beesley make ARCH=aarch32 PLAT=juno AARCH32_SP=sp_min \ 12543f35ef5SPaul Beesley RESET_TO_SP_MIN=1 JUNO_AARCH32_EL3_RUNTIME=1 bl32 12643f35ef5SPaul Beesley 12743f35ef5SPaul Beesley - Save ``bl32.bin`` to a temporary location and clean the build products. 12843f35ef5SPaul Beesley 12943f35ef5SPaul Beesley :: 13043f35ef5SPaul Beesley 13143f35ef5SPaul Beesley cp <path-to-build>/bl32.bin <path-to-temporary> 13243f35ef5SPaul Beesley make realclean 13343f35ef5SPaul Beesley 13443f35ef5SPaul Beesley - Before building BL1 and BL2, the environment variable ``CROSS_COMPILE`` 13543f35ef5SPaul Beesley must point to the AArch64 Linaro cross compiler. 13643f35ef5SPaul Beesley 13743f35ef5SPaul Beesley .. code:: shell 13843f35ef5SPaul Beesley 139*f35e5ab3SMadhukar Pappireddy export CROSS_COMPILE=<path-to-aarch64-gcc>/bin/aarch64-none-elf- 14043f35ef5SPaul Beesley 14143f35ef5SPaul Beesley - The following parameters should be used to build BL1 and BL2 in AArch64 14243f35ef5SPaul Beesley and point to the BL32 file. 14343f35ef5SPaul Beesley 14443f35ef5SPaul Beesley .. code:: shell 14543f35ef5SPaul Beesley 14643f35ef5SPaul Beesley make ARCH=aarch64 PLAT=juno JUNO_AARCH32_EL3_RUNTIME=1 \ 14743f35ef5SPaul Beesley BL33=nt-fw.bin SCP_BL2=scp-fw.bin \ 14843f35ef5SPaul Beesley BL32=<path-to-temporary>/bl32.bin all fip 14943f35ef5SPaul Beesley 15043f35ef5SPaul BeesleyThe resulting BL1 and FIP images may be found in: 15143f35ef5SPaul Beesley 15243f35ef5SPaul Beesley:: 15343f35ef5SPaul Beesley 15443f35ef5SPaul Beesley # Juno 15543f35ef5SPaul Beesley ./build/juno/release/bl1.bin 15643f35ef5SPaul Beesley ./build/juno/release/fip.bin 15743f35ef5SPaul Beesley 15843f35ef5SPaul Beesley # FVP 15943f35ef5SPaul Beesley ./build/fvp/release/bl1.bin 16043f35ef5SPaul Beesley ./build/fvp/release/fip.bin 16143f35ef5SPaul Beesley 16243f35ef5SPaul Beesley 16343f35ef5SPaul BeesleyBooting Firmware Update images 16443f35ef5SPaul Beesley------------------------------ 16543f35ef5SPaul Beesley 16643f35ef5SPaul BeesleyThe new images must be programmed in flash memory by adding 16743f35ef5SPaul Beesleyan entry in the ``SITE1/HBI0262x/images.txt`` configuration file 16843f35ef5SPaul Beesleyon the Juno SD card (where ``x`` depends on the revision of the Juno board). 16943f35ef5SPaul BeesleyRefer to the `Juno Getting Started Guide`_, section 2.3 "Flash memory 17043f35ef5SPaul Beesleyprogramming" for more information. User should ensure these do not 17143f35ef5SPaul Beesleyoverlap with any other entries in the file. 17243f35ef5SPaul Beesley 17343f35ef5SPaul Beesley:: 17443f35ef5SPaul Beesley 17543f35ef5SPaul Beesley NOR10UPDATE: AUTO ;Image Update:NONE/AUTO/FORCE 17643f35ef5SPaul Beesley NOR10ADDRESS: 0x00400000 ;Image Flash Address [ns_bl2u_base_address] 17743f35ef5SPaul Beesley NOR10FILE: \SOFTWARE\fwu_fip.bin ;Image File Name 17843f35ef5SPaul Beesley NOR10LOAD: 00000000 ;Image Load Address 17943f35ef5SPaul Beesley NOR10ENTRY: 00000000 ;Image Entry Point 18043f35ef5SPaul Beesley 18143f35ef5SPaul Beesley NOR11UPDATE: AUTO ;Image Update:NONE/AUTO/FORCE 18243f35ef5SPaul Beesley NOR11ADDRESS: 0x03EB8000 ;Image Flash Address [ns_bl1u_base_address] 18343f35ef5SPaul Beesley NOR11FILE: \SOFTWARE\ns_bl1u.bin ;Image File Name 18443f35ef5SPaul Beesley NOR11LOAD: 00000000 ;Image Load Address 18543f35ef5SPaul Beesley 18643f35ef5SPaul BeesleyThe address ns_bl1u_base_address is the value of NS_BL1U_BASE - 0x8000000. 18743f35ef5SPaul BeesleyIn the same way, the address ns_bl2u_base_address is the value of 18843f35ef5SPaul BeesleyNS_BL2U_BASE - 0x8000000. 18943f35ef5SPaul Beesley 19043f35ef5SPaul Beesley.. _plat_juno_booting_el3_payload: 19143f35ef5SPaul Beesley 19243f35ef5SPaul BeesleyBooting an EL3 payload 19343f35ef5SPaul Beesley---------------------- 19443f35ef5SPaul Beesley 19543f35ef5SPaul BeesleyIf the EL3 payload is able to execute in place, it may be programmed in flash 19643f35ef5SPaul Beesleymemory by adding an entry in the ``SITE1/HBI0262x/images.txt`` configuration file 19743f35ef5SPaul Beesleyon the Juno SD card (where ``x`` depends on the revision of the Juno board). 19843f35ef5SPaul BeesleyRefer to the `Juno Getting Started Guide`_, section 2.3 "Flash memory 19943f35ef5SPaul Beesleyprogramming" for more information. 20043f35ef5SPaul Beesley 20143f35ef5SPaul BeesleyAlternatively, the same DS-5 command mentioned in the FVP section above can 20243f35ef5SPaul Beesleybe used to load the EL3 payload's ELF file over JTAG on Juno. 20343f35ef5SPaul Beesley 20443f35ef5SPaul BeesleyFor more information on EL3 payloads in general, see 20543f35ef5SPaul Beesley:ref:`alt_boot_flows_el3_payload`. 20643f35ef5SPaul Beesley 20743f35ef5SPaul BeesleyBooting a preloaded kernel image 20843f35ef5SPaul Beesley-------------------------------- 20943f35ef5SPaul Beesley 21043f35ef5SPaul BeesleyThe Trusted Firmware must be compiled in a similar way as for FVP explained 21143f35ef5SPaul Beesleyabove. The process to load binaries to memory is the one explained in 21243f35ef5SPaul Beesley`plat_juno_booting_el3_payload`_. 21343f35ef5SPaul Beesley 21443f35ef5SPaul BeesleyTesting System Suspend 21543f35ef5SPaul Beesley---------------------- 21643f35ef5SPaul Beesley 21743f35ef5SPaul BeesleyThe SYSTEM SUSPEND is a PSCI API which can be used to implement system suspend 21843f35ef5SPaul Beesleyto RAM. For more details refer to section 5.16 of `PSCI`_. To test system suspend 21943f35ef5SPaul Beesleyon Juno, at the linux shell prompt, issue the following command: 22043f35ef5SPaul Beesley 22143f35ef5SPaul Beesley.. code:: shell 22243f35ef5SPaul Beesley 22343f35ef5SPaul Beesley echo +10 > /sys/class/rtc/rtc0/wakealarm 22443f35ef5SPaul Beesley echo -n mem > /sys/power/state 22543f35ef5SPaul Beesley 22643f35ef5SPaul BeesleyThe Juno board should suspend to RAM and then wakeup after 10 seconds due to 22743f35ef5SPaul Beesleywakeup interrupt from RTC. 22843f35ef5SPaul Beesley 22943f35ef5SPaul BeesleyAdditional Resources 23043f35ef5SPaul Beesley-------------------- 23143f35ef5SPaul Beesley 23243f35ef5SPaul BeesleyPlease visit the `Arm Platforms Portal`_ to get support and obtain any other Juno 23343f35ef5SPaul Beesleysoftware information. Please also refer to the `Juno Getting Started Guide`_ to 23443f35ef5SPaul Beesleyget more detailed information about the Juno Arm development platform and how to 23543f35ef5SPaul Beesleyconfigure it. 23643f35ef5SPaul Beesley 23743f35ef5SPaul Beesley-------------- 23843f35ef5SPaul Beesley 23943f35ef5SPaul Beesley*Copyright (c) 2019, Arm Limited. All rights reserved.* 24043f35ef5SPaul Beesley 24143f35ef5SPaul Beesley.. _Linaro Release Notes: https://community.arm.com/dev-platforms/w/docs/226/old-release-notes 24243f35ef5SPaul Beesley.. _Instructions for using Linaro's deliverables on Juno: https://community.arm.com/dev-platforms/w/docs/303/juno 24343f35ef5SPaul Beesley.. _Arm Platforms Portal: https://community.arm.com/dev-platforms/ 24443f35ef5SPaul Beesley.. _Juno Getting Started Guide: http://infocenter.arm.com/help/topic/com.arm.doc.dui0928e/DUI0928E_juno_arm_development_platform_gsg.pdf 24543f35ef5SPaul Beesley.. _PSCI: http://infocenter.arm.com/help/topic/com.arm.doc.den0022d/Power_State_Coordination_Interface_PDD_v1_1_DEN0022D.pdf 24643f35ef5SPaul Beesley.. _Juno Arm Development Platform: http://www.arm.com/products/tools/development-boards/versatile-express/juno-arm-development-platform.php 247