Paul Beesley | d2fcc4e | 2019-05-29 13:59:40 +0100 | [diff] [blame] | 1 | Performing an Initial Build |
| 2 | =========================== |
| 3 | |
| 4 | - Before building TF-A, the environment variable ``CROSS_COMPILE`` must point |
| 5 | to the Linaro cross compiler. |
| 6 | |
| 7 | For AArch64: |
| 8 | |
| 9 | .. code:: shell |
| 10 | |
Madhukar Pappireddy | c0ba248 | 2020-01-10 16:11:18 -0600 | [diff] [blame] | 11 | export CROSS_COMPILE=<path-to-aarch64-gcc>/bin/aarch64-none-elf- |
Paul Beesley | d2fcc4e | 2019-05-29 13:59:40 +0100 | [diff] [blame] | 12 | |
| 13 | For AArch32: |
| 14 | |
| 15 | .. code:: shell |
| 16 | |
Madhukar Pappireddy | c0ba248 | 2020-01-10 16:11:18 -0600 | [diff] [blame] | 17 | export CROSS_COMPILE=<path-to-aarch32-gcc>/bin/arm-none-eabi- |
Paul Beesley | d2fcc4e | 2019-05-29 13:59:40 +0100 | [diff] [blame] | 18 | |
| 19 | It is possible to build TF-A using Clang or Arm Compiler 6. To do so |
| 20 | ``CC`` needs to point to the clang or armclang binary, which will |
Ambroise Vincent | 05c07c5 | 2019-07-17 11:08:38 +0100 | [diff] [blame] | 21 | also select the clang or armclang assembler. Be aware that for Arm Compiler, |
| 22 | the GNU linker is used by default. However for Clang LLVM linker (LLD) |
| 23 | is used by default. In case of being needed the linker can be overridden |
| 24 | using the ``LD`` variable. LLVM linker (LLD) version 9 is |
Paul Beesley | d2fcc4e | 2019-05-29 13:59:40 +0100 | [diff] [blame] | 25 | known to work with TF-A. |
| 26 | |
| 27 | In both cases ``CROSS_COMPILE`` should be set as described above. |
| 28 | |
| 29 | Arm Compiler 6 will be selected when the base name of the path assigned |
| 30 | to ``CC`` matches the string 'armclang'. |
| 31 | |
| 32 | For AArch64 using Arm Compiler 6: |
| 33 | |
| 34 | .. code:: shell |
| 35 | |
Madhukar Pappireddy | c0ba248 | 2020-01-10 16:11:18 -0600 | [diff] [blame] | 36 | export CROSS_COMPILE=<path-to-aarch64-gcc>/bin/aarch64-none-elf- |
Paul Beesley | d2fcc4e | 2019-05-29 13:59:40 +0100 | [diff] [blame] | 37 | make CC=<path-to-armclang>/bin/armclang PLAT=<platform> all |
| 38 | |
| 39 | Clang will be selected when the base name of the path assigned to ``CC`` |
| 40 | contains the string 'clang'. This is to allow both clang and clang-X.Y |
| 41 | to work. |
| 42 | |
| 43 | For AArch64 using clang: |
| 44 | |
| 45 | .. code:: shell |
| 46 | |
Madhukar Pappireddy | c0ba248 | 2020-01-10 16:11:18 -0600 | [diff] [blame] | 47 | export CROSS_COMPILE=<path-to-aarch64-gcc>/bin/aarch64-none-elf- |
Paul Beesley | d2fcc4e | 2019-05-29 13:59:40 +0100 | [diff] [blame] | 48 | make CC=<path-to-clang>/bin/clang PLAT=<platform> all |
| 49 | |
| 50 | - Change to the root directory of the TF-A source tree and build. |
| 51 | |
| 52 | For AArch64: |
| 53 | |
| 54 | .. code:: shell |
| 55 | |
| 56 | make PLAT=<platform> all |
| 57 | |
| 58 | For AArch32: |
| 59 | |
| 60 | .. code:: shell |
| 61 | |
| 62 | make PLAT=<platform> ARCH=aarch32 AARCH32_SP=sp_min all |
| 63 | |
| 64 | Notes: |
| 65 | |
| 66 | - If ``PLAT`` is not specified, ``fvp`` is assumed by default. See the |
| 67 | :ref:`Build Options` document for more information on available build |
| 68 | options. |
| 69 | |
| 70 | - (AArch32 only) Currently only ``PLAT=fvp`` is supported. |
| 71 | |
| 72 | - (AArch32 only) ``AARCH32_SP`` is the AArch32 EL3 Runtime Software and it |
| 73 | corresponds to the BL32 image. A minimal ``AARCH32_SP``, sp_min, is |
| 74 | provided by TF-A to demonstrate how PSCI Library can be integrated with |
| 75 | an AArch32 EL3 Runtime Software. Some AArch32 EL3 Runtime Software may |
| 76 | include other runtime services, for example Trusted OS services. A guide |
| 77 | to integrate PSCI library with AArch32 EL3 Runtime Software can be found |
| 78 | at :ref:`PSCI Library Integration guide for Armv8-A AArch32 systems`. |
| 79 | |
| 80 | - (AArch64 only) The TSP (Test Secure Payload), corresponding to the BL32 |
| 81 | image, is not compiled in by default. Refer to the |
| 82 | :ref:`Test Secure Payload (TSP) and Dispatcher (TSPD)` document for |
| 83 | details on building the TSP. |
| 84 | |
| 85 | - By default this produces a release version of the build. To produce a |
| 86 | debug version instead, refer to the "Debugging options" section below. |
| 87 | |
| 88 | - The build process creates products in a ``build`` directory tree, building |
| 89 | the objects and binaries for each boot loader stage in separate |
| 90 | sub-directories. The following boot loader binary files are created |
| 91 | from the corresponding ELF files: |
| 92 | |
| 93 | - ``build/<platform>/<build-type>/bl1.bin`` |
| 94 | - ``build/<platform>/<build-type>/bl2.bin`` |
| 95 | - ``build/<platform>/<build-type>/bl31.bin`` (AArch64 only) |
| 96 | - ``build/<platform>/<build-type>/bl32.bin`` (mandatory for AArch32) |
| 97 | |
| 98 | where ``<platform>`` is the name of the chosen platform and ``<build-type>`` |
| 99 | is either ``debug`` or ``release``. The actual number of images might differ |
| 100 | depending on the platform. |
| 101 | |
| 102 | - Build products for a specific build variant can be removed using: |
| 103 | |
| 104 | .. code:: shell |
| 105 | |
| 106 | make DEBUG=<D> PLAT=<platform> clean |
| 107 | |
| 108 | ... where ``<D>`` is ``0`` or ``1``, as specified when building. |
| 109 | |
| 110 | The build tree can be removed completely using: |
| 111 | |
| 112 | .. code:: shell |
| 113 | |
| 114 | make realclean |
| 115 | |
| 116 | -------------- |
| 117 | |
Ambroise Vincent | 05c07c5 | 2019-07-17 11:08:38 +0100 | [diff] [blame] | 118 | *Copyright (c) 2020, Arm Limited. All rights reserved.* |