blob: 4f41be413410f4b1c2f37b8bcf22fce7c0b1d087 [file] [log] [blame]
Paul Beesleyd2fcc4e2019-05-29 13:59:40 +01001Performing an Initial Build
2===========================
3
4- Before building TF-A, the environment variable ``CROSS_COMPILE`` must point
Boyan Karatotevdaf0ef62022-10-27 14:47:18 +01005 to your cross compiler.
Paul Beesleyd2fcc4e2019-05-29 13:59:40 +01006
7 For AArch64:
8
9 .. code:: shell
10
Madhukar Pappireddyc0ba2482020-01-10 16:11:18 -060011 export CROSS_COMPILE=<path-to-aarch64-gcc>/bin/aarch64-none-elf-
Paul Beesleyd2fcc4e2019-05-29 13:59:40 +010012
13 For AArch32:
14
15 .. code:: shell
16
Madhukar Pappireddyc0ba2482020-01-10 16:11:18 -060017 export CROSS_COMPILE=<path-to-aarch32-gcc>/bin/arm-none-eabi-
Paul Beesleyd2fcc4e2019-05-29 13:59:40 +010018
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
Harrison Mutai38a293a2022-02-23 11:37:12 +000021 also select the clang or armclang assembler. Arm Compiler 6 will be selected
22 when the base name of the path assigned to ``CC`` matches the string
23 'armclang'. GNU binutils are required since the TF-A build system doesn't
24 currently support Arm Scatter files. Meaning the GNU linker is used by
25 default for Arm Compiler 6. Because of this dependency, ``CROSS_COMPILE``
26 should be set as described above.
Paul Beesleyd2fcc4e2019-05-29 13:59:40 +010027
28 For AArch64 using Arm Compiler 6:
29
30 .. code:: shell
31
Madhukar Pappireddyc0ba2482020-01-10 16:11:18 -060032 export CROSS_COMPILE=<path-to-aarch64-gcc>/bin/aarch64-none-elf-
Paul Beesleyd2fcc4e2019-05-29 13:59:40 +010033 make CC=<path-to-armclang>/bin/armclang PLAT=<platform> all
34
Harrison Mutai38a293a2022-02-23 11:37:12 +000035 On the other hand, Clang uses LLVM linker (LLD) and other LLVM binutils by
36 default instead of GNU utilities (LLVM linker (LLD) 14.0.0 is known to
37 work with TF-A). ``CROSS_COMPILE`` need not be set for Clang. Please note,
38 that the default linker may be manually overridden using the ``LD`` variable.
39
Paul Beesleyd2fcc4e2019-05-29 13:59:40 +010040 Clang will be selected when the base name of the path assigned to ``CC``
41 contains the string 'clang'. This is to allow both clang and clang-X.Y
42 to work.
43
44 For AArch64 using clang:
45
46 .. code:: shell
47
Paul Beesleyd2fcc4e2019-05-29 13:59:40 +010048 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
Harrison Mutai38a293a2022-02-23 11:37:12 +0000118*Copyright (c) 2020-2022, Arm Limited. All rights reserved.*