xref: /rk3399_ARM-atf/docs/getting_started/initial-build.rst (revision f35e5ab39cc9e107779a5bc673e6159cd119aee0)
143f35ef5SPaul BeesleyPerforming an Initial Build
243f35ef5SPaul Beesley===========================
343f35ef5SPaul Beesley
443f35ef5SPaul Beesley-  Before building TF-A, the environment variable ``CROSS_COMPILE`` must point
543f35ef5SPaul Beesley   to the Linaro cross compiler.
643f35ef5SPaul Beesley
743f35ef5SPaul Beesley   For AArch64:
843f35ef5SPaul Beesley
943f35ef5SPaul Beesley   .. code:: shell
1043f35ef5SPaul Beesley
11*f35e5ab3SMadhukar Pappireddy       export CROSS_COMPILE=<path-to-aarch64-gcc>/bin/aarch64-none-elf-
1243f35ef5SPaul Beesley
1343f35ef5SPaul Beesley   For AArch32:
1443f35ef5SPaul Beesley
1543f35ef5SPaul Beesley   .. code:: shell
1643f35ef5SPaul Beesley
17*f35e5ab3SMadhukar Pappireddy       export CROSS_COMPILE=<path-to-aarch32-gcc>/bin/arm-none-eabi-
1843f35ef5SPaul Beesley
1943f35ef5SPaul Beesley   It is possible to build TF-A using Clang or Arm Compiler 6. To do so
2043f35ef5SPaul Beesley   ``CC`` needs to point to the clang or armclang binary, which will
2143f35ef5SPaul Beesley   also select the clang or armclang assembler. Be aware that the
2243f35ef5SPaul Beesley   GNU linker is used by default.  In case of being needed the linker
2343f35ef5SPaul Beesley   can be overridden using the ``LD`` variable. Clang linker version 6 is
2443f35ef5SPaul Beesley   known to work with TF-A.
2543f35ef5SPaul Beesley
2643f35ef5SPaul Beesley   In both cases ``CROSS_COMPILE`` should be set as described above.
2743f35ef5SPaul Beesley
2843f35ef5SPaul Beesley   Arm Compiler 6 will be selected when the base name of the path assigned
2943f35ef5SPaul Beesley   to ``CC`` matches the string 'armclang'.
3043f35ef5SPaul Beesley
3143f35ef5SPaul Beesley   For AArch64 using Arm Compiler 6:
3243f35ef5SPaul Beesley
3343f35ef5SPaul Beesley   .. code:: shell
3443f35ef5SPaul Beesley
35*f35e5ab3SMadhukar Pappireddy       export CROSS_COMPILE=<path-to-aarch64-gcc>/bin/aarch64-none-elf-
3643f35ef5SPaul Beesley       make CC=<path-to-armclang>/bin/armclang PLAT=<platform> all
3743f35ef5SPaul Beesley
3843f35ef5SPaul Beesley   Clang will be selected when the base name of the path assigned to ``CC``
3943f35ef5SPaul Beesley   contains the string 'clang'. This is to allow both clang and clang-X.Y
4043f35ef5SPaul Beesley   to work.
4143f35ef5SPaul Beesley
4243f35ef5SPaul Beesley   For AArch64 using clang:
4343f35ef5SPaul Beesley
4443f35ef5SPaul Beesley   .. code:: shell
4543f35ef5SPaul Beesley
46*f35e5ab3SMadhukar Pappireddy       export CROSS_COMPILE=<path-to-aarch64-gcc>/bin/aarch64-none-elf-
4743f35ef5SPaul Beesley       make CC=<path-to-clang>/bin/clang PLAT=<platform> all
4843f35ef5SPaul Beesley
4943f35ef5SPaul Beesley-  Change to the root directory of the TF-A source tree and build.
5043f35ef5SPaul Beesley
5143f35ef5SPaul Beesley   For AArch64:
5243f35ef5SPaul Beesley
5343f35ef5SPaul Beesley   .. code:: shell
5443f35ef5SPaul Beesley
5543f35ef5SPaul Beesley       make PLAT=<platform> all
5643f35ef5SPaul Beesley
5743f35ef5SPaul Beesley   For AArch32:
5843f35ef5SPaul Beesley
5943f35ef5SPaul Beesley   .. code:: shell
6043f35ef5SPaul Beesley
6143f35ef5SPaul Beesley       make PLAT=<platform> ARCH=aarch32 AARCH32_SP=sp_min all
6243f35ef5SPaul Beesley
6343f35ef5SPaul Beesley   Notes:
6443f35ef5SPaul Beesley
6543f35ef5SPaul Beesley   -  If ``PLAT`` is not specified, ``fvp`` is assumed by default. See the
6643f35ef5SPaul Beesley      :ref:`Build Options` document for more information on available build
6743f35ef5SPaul Beesley      options.
6843f35ef5SPaul Beesley
6943f35ef5SPaul Beesley   -  (AArch32 only) Currently only ``PLAT=fvp`` is supported.
7043f35ef5SPaul Beesley
7143f35ef5SPaul Beesley   -  (AArch32 only) ``AARCH32_SP`` is the AArch32 EL3 Runtime Software and it
7243f35ef5SPaul Beesley      corresponds to the BL32 image. A minimal ``AARCH32_SP``, sp_min, is
7343f35ef5SPaul Beesley      provided by TF-A to demonstrate how PSCI Library can be integrated with
7443f35ef5SPaul Beesley      an AArch32 EL3 Runtime Software. Some AArch32 EL3 Runtime Software may
7543f35ef5SPaul Beesley      include other runtime services, for example Trusted OS services. A guide
7643f35ef5SPaul Beesley      to integrate PSCI library with AArch32 EL3 Runtime Software can be found
7743f35ef5SPaul Beesley      at :ref:`PSCI Library Integration guide for Armv8-A AArch32 systems`.
7843f35ef5SPaul Beesley
7943f35ef5SPaul Beesley   -  (AArch64 only) The TSP (Test Secure Payload), corresponding to the BL32
8043f35ef5SPaul Beesley      image, is not compiled in by default. Refer to the
8143f35ef5SPaul Beesley      :ref:`Test Secure Payload (TSP) and Dispatcher (TSPD)` document for
8243f35ef5SPaul Beesley      details on building the TSP.
8343f35ef5SPaul Beesley
8443f35ef5SPaul Beesley   -  By default this produces a release version of the build. To produce a
8543f35ef5SPaul Beesley      debug version instead, refer to the "Debugging options" section below.
8643f35ef5SPaul Beesley
8743f35ef5SPaul Beesley   -  The build process creates products in a ``build`` directory tree, building
8843f35ef5SPaul Beesley      the objects and binaries for each boot loader stage in separate
8943f35ef5SPaul Beesley      sub-directories. The following boot loader binary files are created
9043f35ef5SPaul Beesley      from the corresponding ELF files:
9143f35ef5SPaul Beesley
9243f35ef5SPaul Beesley      -  ``build/<platform>/<build-type>/bl1.bin``
9343f35ef5SPaul Beesley      -  ``build/<platform>/<build-type>/bl2.bin``
9443f35ef5SPaul Beesley      -  ``build/<platform>/<build-type>/bl31.bin`` (AArch64 only)
9543f35ef5SPaul Beesley      -  ``build/<platform>/<build-type>/bl32.bin`` (mandatory for AArch32)
9643f35ef5SPaul Beesley
9743f35ef5SPaul Beesley      where ``<platform>`` is the name of the chosen platform and ``<build-type>``
9843f35ef5SPaul Beesley      is either ``debug`` or ``release``. The actual number of images might differ
9943f35ef5SPaul Beesley      depending on the platform.
10043f35ef5SPaul Beesley
10143f35ef5SPaul Beesley-  Build products for a specific build variant can be removed using:
10243f35ef5SPaul Beesley
10343f35ef5SPaul Beesley   .. code:: shell
10443f35ef5SPaul Beesley
10543f35ef5SPaul Beesley       make DEBUG=<D> PLAT=<platform> clean
10643f35ef5SPaul Beesley
10743f35ef5SPaul Beesley   ... where ``<D>`` is ``0`` or ``1``, as specified when building.
10843f35ef5SPaul Beesley
10943f35ef5SPaul Beesley   The build tree can be removed completely using:
11043f35ef5SPaul Beesley
11143f35ef5SPaul Beesley   .. code:: shell
11243f35ef5SPaul Beesley
11343f35ef5SPaul Beesley       make realclean
11443f35ef5SPaul Beesley
11543f35ef5SPaul Beesley--------------
11643f35ef5SPaul Beesley
11743f35ef5SPaul Beesley*Copyright (c) 2019, Arm Limited. All rights reserved.*
118