initial-build.rst 4.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118
  1. Performing an Initial Build
  2. ===========================
  3. - Before building TF-A, the environment variable ``CROSS_COMPILE`` must point
  4. to your cross compiler.
  5. For AArch64:
  6. .. code:: shell
  7. export CROSS_COMPILE=<path-to-aarch64-gcc>/bin/aarch64-none-elf-
  8. For AArch32:
  9. .. code:: shell
  10. export CROSS_COMPILE=<path-to-aarch32-gcc>/bin/arm-none-eabi-
  11. It is possible to build TF-A using Clang or Arm Compiler 6. To do so
  12. ``CC`` needs to point to the clang or armclang binary, which will
  13. also select the clang or armclang assembler. Arm Compiler 6 will be selected
  14. when the base name of the path assigned to ``CC`` matches the string
  15. 'armclang'. GNU binutils are required since the TF-A build system doesn't
  16. currently support Arm Scatter files. Meaning the GNU linker is used by
  17. default for Arm Compiler 6. Because of this dependency, ``CROSS_COMPILE``
  18. should be set as described above.
  19. For AArch64 using Arm Compiler 6:
  20. .. code:: shell
  21. export CROSS_COMPILE=<path-to-aarch64-gcc>/bin/aarch64-none-elf-
  22. make CC=<path-to-armclang>/bin/armclang PLAT=<platform> all
  23. On the other hand, Clang uses LLVM linker (LLD) and other LLVM binutils by
  24. default instead of GNU utilities (LLVM linker (LLD) 14.0.0 is known to
  25. work with TF-A). ``CROSS_COMPILE`` need not be set for Clang. Please note,
  26. that the default linker may be manually overridden using the ``LD`` variable.
  27. Clang will be selected when the base name of the path assigned to ``CC``
  28. contains the string 'clang'. This is to allow both clang and clang-X.Y
  29. to work.
  30. For AArch64 using clang:
  31. .. code:: shell
  32. make CC=<path-to-clang>/bin/clang PLAT=<platform> all
  33. - Change to the root directory of the TF-A source tree and build.
  34. For AArch64:
  35. .. code:: shell
  36. make PLAT=<platform> all
  37. For AArch32:
  38. .. code:: shell
  39. make PLAT=<platform> ARCH=aarch32 AARCH32_SP=sp_min all
  40. Notes:
  41. - If ``PLAT`` is not specified, ``fvp`` is assumed by default. See the
  42. :ref:`Build Options` document for more information on available build
  43. options.
  44. - (AArch32 only) Currently only ``PLAT=fvp`` is supported.
  45. - (AArch32 only) ``AARCH32_SP`` is the AArch32 EL3 Runtime Software and it
  46. corresponds to the BL32 image. A minimal ``AARCH32_SP``, sp_min, is
  47. provided by TF-A to demonstrate how PSCI Library can be integrated with
  48. an AArch32 EL3 Runtime Software. Some AArch32 EL3 Runtime Software may
  49. include other runtime services, for example Trusted OS services. A guide
  50. to integrate PSCI library with AArch32 EL3 Runtime Software can be found
  51. at :ref:`PSCI Library Integration guide for Armv8-A AArch32 systems`.
  52. - (AArch64 only) The TSP (Test Secure Payload), corresponding to the BL32
  53. image, is not compiled in by default. Refer to the
  54. :ref:`Test Secure Payload (TSP) and Dispatcher (TSPD)` document for
  55. details on building the TSP.
  56. - By default this produces a release version of the build. To produce a
  57. debug version instead, refer to the "Debugging options" section below.
  58. - The build process creates products in a ``build`` directory tree, building
  59. the objects and binaries for each boot loader stage in separate
  60. sub-directories. The following boot loader binary files are created
  61. from the corresponding ELF files:
  62. - ``build/<platform>/<build-type>/bl1.bin``
  63. - ``build/<platform>/<build-type>/bl2.bin``
  64. - ``build/<platform>/<build-type>/bl31.bin`` (AArch64 only)
  65. - ``build/<platform>/<build-type>/bl32.bin`` (mandatory for AArch32)
  66. where ``<platform>`` is the name of the chosen platform and ``<build-type>``
  67. is either ``debug`` or ``release``. The actual number of images might differ
  68. depending on the platform.
  69. - Build products for a specific build variant can be removed using:
  70. .. code:: shell
  71. make DEBUG=<D> PLAT=<platform> clean
  72. ... where ``<D>`` is ``0`` or ``1``, as specified when building.
  73. The build tree can be removed completely using:
  74. .. code:: shell
  75. make realclean
  76. --------------
  77. *Copyright (c) 2020-2022, Arm Limited. All rights reserved.*