Galanakis, Minos | 41f8597 | 2019-09-30 15:56:40 +0100 | [diff] [blame] | 1 | ################## |
| 2 | Build instructions |
| 3 | ################## |
Gyorgy Szing | db9783c | 2019-04-17 21:08:48 +0200 | [diff] [blame] | 4 | Please make sure you have all required software installed as explained in the |
| 5 | :doc:`software requirements <tfm_sw_requirement>`. |
| 6 | |
Galanakis, Minos | 757139a | 2019-11-11 15:00:11 +0000 | [diff] [blame] | 7 | The external dependecies are briefly listed in the |
| 8 | :ref:`docs/user_guides/tfm_build_instruction:External dependencies` section. |
Gyorgy Szing | db9783c | 2019-04-17 21:08:48 +0200 | [diff] [blame] | 9 | |
Galanakis, Minos | 757139a | 2019-11-11 15:00:11 +0000 | [diff] [blame] | 10 | The configuration-table |
| 11 | :ref:`docs/user_guides/tfm_build_instruction:Configuring the build` section |
| 12 | explains all the supported build parameters: |
Gyorgy Szing | db9783c | 2019-04-17 21:08:48 +0200 | [diff] [blame] | 13 | |
| 14 | **************** |
| 15 | TF-M build steps |
| 16 | **************** |
| 17 | TF-M uses `cmake <https://cmake.org/overview/>`__ to provide an out-of-source |
| 18 | build environment. The instructions are below. |
| 19 | |
| 20 | .. Note:: |
| 21 | |
| 22 | It is recommended to build each different build configurations in separate |
| 23 | directories. |
| 24 | |
| 25 | Getting the source-code |
| 26 | ======================= |
| 27 | .. code-block:: bash |
| 28 | |
| 29 | cd <TF-M base folder> |
| 30 | git clone https://git.trustedfirmware.org/trusted-firmware-m.git |
Antonio de Angelis | 2e7d296 | 2019-06-27 11:30:04 +0100 | [diff] [blame] | 31 | git clone https://github.com/ARMmbed/mbed-crypto.git -b mbedcrypto-1.1.0 |
Antonio de Angelis | 70ae80f | 2019-02-26 14:57:40 +0000 | [diff] [blame] | 32 | git clone https://github.com/ARM-software/CMSIS_5.git -b 5.5.0 |
| 33 | |
| 34 | .. Note:: |
| 35 | `CMSIS_5` now uses `git-lfs` for storing large size binaries so the cloning |
| 36 | process has changed from previous releases. Please refer to the `CMSIS_5` |
| 37 | documentation for more details. |
Gyorgy Szing | db9783c | 2019-04-17 21:08:48 +0200 | [diff] [blame] | 38 | |
| 39 | Build steps for the AN521 target platform: |
| 40 | ========================================== |
| 41 | .. code-block:: bash |
| 42 | |
| 43 | cd <TF-M base folder> |
| 44 | cd trusted-firmware-m |
| 45 | mkdir cmake_build |
| 46 | cd cmake_build |
| 47 | cmake ../ -G"Unix Makefiles" -DTARGET_PLATFORM=AN521 -DCOMPILER=ARMCLANG |
| 48 | cmake --build ./ -- install |
| 49 | |
| 50 | Regression Tests for the AN521 target platform |
| 51 | ============================================== |
| 52 | *TF-M build regression tests on Linux* |
| 53 | |
| 54 | .. code-block:: bash |
| 55 | |
| 56 | cd <TF-M base folder> |
| 57 | cd trusted-firmware-m |
| 58 | mkdir cmake_test |
| 59 | cd cmake_test |
Ken Liu | e40f9a2 | 2019-06-03 16:42:47 +0800 | [diff] [blame] | 60 | cmake -G"Unix Makefiles" -DPROJ_CONFIG=`readlink -f ../configs/ConfigRegression.cmake` -DTARGET_PLATFORM=AN521 -DCOMPILER=ARMCLANG ../ |
Gyorgy Szing | db9783c | 2019-04-17 21:08:48 +0200 | [diff] [blame] | 61 | cmake --build ./ -- install |
| 62 | |
| 63 | *TF-M build regression tests on Windows* |
| 64 | |
| 65 | .. code-block:: bash |
| 66 | |
| 67 | cd <TF-M base folder> |
| 68 | cd trusted-firmware-m |
| 69 | mkdir cmake_test |
| 70 | cd cmake_test |
Ken Liu | e40f9a2 | 2019-06-03 16:42:47 +0800 | [diff] [blame] | 71 | cmake -G"Unix Makefiles" -DPROJ_CONFIG=`cygpath -am ../configs/ConfigRegression.cmake` -DTARGET_PLATFORM=AN521 -DCOMPILER=ARMCLANG ../ |
Gyorgy Szing | db9783c | 2019-04-17 21:08:48 +0200 | [diff] [blame] | 72 | cmake --build ./ -- install |
| 73 | |
| 74 | Build for PSA API compliance tests |
| 75 | ================================== |
| 76 | The build system provides the support for linking with prebuilt PSA API |
Jamie Fox | 6b6a19b | 2019-09-30 16:54:17 +0100 | [diff] [blame] | 77 | compliance NS test libraries when using the ``ConfigPsaApiTest.cmake``, |
| 78 | ``ConfigPsaApiTestIPC.cmake`` or ``ConfigPsaApiTestIPCTfmLevel2.cmake`` config |
| 79 | file. The build system assumes that the PSA API compliance test suite is checked |
| 80 | out at the same level of the TF-M root folder and the default name for the build |
| 81 | folder has been used when compiling the PSA API compliance tests. Each set of |
| 82 | tests for the Internal Trusted Storage, Secure Storage, Crypto and Attestation |
| 83 | services needs to be enabled at the build configuration step by defining:: |
Gyorgy Szing | db9783c | 2019-04-17 21:08:48 +0200 | [diff] [blame] | 84 | |
Jamie Fox | 6b6a19b | 2019-09-30 16:54:17 +0100 | [diff] [blame] | 85 | -DPSA_API_TEST_INTERNAL_TRUSTED_STORAGE=ON |
| 86 | -DPSA_API_TEST_SECURE_STORAGE=ON |
| 87 | -DPSA_API_TEST_CRYPTO=ON |
| 88 | -DPSA_API_TEST_ATTESTATION=ON |
Gyorgy Szing | db9783c | 2019-04-17 21:08:48 +0200 | [diff] [blame] | 89 | |
| 90 | respectively for the corresponding service. For example, to enable the PSA API |
| 91 | tests for the Crypto service only: |
| 92 | |
| 93 | .. code-block:: bash |
| 94 | |
| 95 | cd <TF-M base folder> |
| 96 | cd trusted-firmware-m |
| 97 | mkdir cmake_psa_test |
| 98 | cd cmake_psa_test |
Antonio de Angelis | 0169b9f | 2019-06-28 11:37:24 +0100 | [diff] [blame] | 99 | cmake -G"Unix Makefiles" -DPROJ_CONFIG=`readlink -f ../configs/ConfigPsaApiTest.cmake` -DPSA_API_TEST_CRYPTO=ON -DTARGET_PLATFORM=AN521 -DCOMPILER=ARMCLANG ../ |
Gyorgy Szing | db9783c | 2019-04-17 21:08:48 +0200 | [diff] [blame] | 100 | cmake --build ./ -- install |
| 101 | |
| 102 | Location of build artifacts |
| 103 | =========================== |
| 104 | The build system defines an API which allow easy usage of build |
| 105 | artifacts. The ``install`` build target copies all files which might be needed |
| 106 | as a dependency by external tools or build systems to the |
| 107 | ``<build_dir>/install/outputs`` |
| 108 | directory, with the following directory hierarchy: |
| 109 | |
| 110 | :: |
| 111 | |
| 112 | <build_dir>/install/outputs/fvp/ |
| 113 | <build_dir>/install/outputs/<target_platform>/ |
| 114 | |
| 115 | There is one folder for FVP testing, with more elaborate naming and |
| 116 | there is an other for testing on target hardware platform (AN521, etc.), where |
| 117 | naming convention is aligned with 8.3 format. The dependency tree of |
| 118 | ``install`` build target ensures a proper update (i.e. build) of all output |
| 119 | files before the actual installation step takes place. As such it is suggested |
| 120 | to use this build target to build TF-M. |
| 121 | |
| 122 | Export dependency files for NS applications |
| 123 | ------------------------------------------- |
| 124 | An NS application requires a number of files to interface with TF-M. |
| 125 | The build system exports these files as part of the ``install`` target and |
| 126 | places them in to a single directory:: |
| 127 | |
| 128 | <build_dir>/install/export/tfm |
| 129 | |
| 130 | Further details on how to integrate a new NS app with TF-M are available in the |
| 131 | :doc:`integration guide <tfm_integration_guide>`. |
| 132 | |
| 133 | Building the documentation |
| 134 | ========================== |
| 135 | Please ensure the dependencies for building the firmware and the |
| 136 | documentation are installed as explained in the |
| 137 | :doc:`software requirements <tfm_sw_requirement>`. |
| 138 | |
| 139 | Building PDF output is optional and can be disabled by removing LaTex from the |
| 140 | PATH. |
| 141 | |
| 142 | .. Note:: |
| 143 | For building the documentation all tools needed to build the firmware must |
| 144 | be available. |
| 145 | |
| 146 | Building the Reference Manual |
| 147 | ----------------------------- |
| 148 | .. code-block:: bash |
| 149 | |
| 150 | cd <TF-M base folder> |
| 151 | mkdir cmake_doc |
| 152 | cd cmake_doc |
| 153 | cmake ../ -G"Unix Makefiles" -DTARGET_PLATFORM=AN521 -DCOMPILER=GNUARM |
| 154 | cmake --build ./ -- install_doc |
| 155 | |
| 156 | The documentation files will be available under the directory:: |
| 157 | |
| 158 | cmake_doc/install/doc/reference_manual |
| 159 | |
| 160 | Building the User Guide |
| 161 | ----------------------- |
| 162 | .. code-block:: bash |
| 163 | |
| 164 | cd <TF-M base folder> |
| 165 | mkdir cmake_doc |
| 166 | cd cmake_doc |
| 167 | cmake ../ -G"Unix Makefiles" -DTARGET_PLATFORM=AN521 -DCOMPILER=ARMCLANG |
| 168 | cmake --build ./ -- install_userguide |
| 169 | |
| 170 | The documentation files will be available under the directory:: |
| 171 | |
| 172 | cmake_doc/install/doc/user_guide |
| 173 | |
Galanakis, Minos | 757139a | 2019-11-11 15:00:11 +0000 | [diff] [blame] | 174 | ********************* |
| 175 | External dependencies |
| 176 | ********************* |
| 177 | - `CMSIS_5` is used to import RTX for the example non-secure app |
| 178 | - `Mbed Crypto` is used as crypto library on the secure side |
| 179 | |
| 180 | ********************* |
| 181 | Configuring the build |
| 182 | ********************* |
| 183 | The build configuration for TF-M is provided to the build system using command |
| 184 | line arguments: |
| 185 | |
| 186 | .. list-table:: |
| 187 | :widths: 20 80 |
| 188 | |
| 189 | * - -DPROJ_CONFIG=<file> |
| 190 | - Specifies the way the application is built. |
| 191 | |
| 192 | | <file> is the absolute path to configurations file |
| 193 | named as ``Config<APP_NAME>.cmake``. |
| 194 | | i.e. On Linux: |
| 195 | ``-DPROJ_CONFIG=`readlink -f ../configs/ConfigRegression.cmake``` |
| 196 | |
| 197 | * - -DTARGET_PLATFORM=<target platform name> |
| 198 | - Specifies the target platform. |
| 199 | Supported platforms: |
| 200 | |
| 201 | - Cortex-M33 SSE-200 subsystem for MPS2+ (AN521) |
| 202 | ``-DTARGET_PLATFORM=AN521`` |
| 203 | - Cortex-M23 IoT Kit subsystem for MPS2+ (AN519) |
| 204 | ``-DTARGET_PLATFORM=AN519`` |
Marton Berke | 8aae06f | 2019-11-25 16:46:12 +0100 | [diff] [blame] | 205 | - Arm SSE-123 Example Subsystem for MPS2+ (AN539) |
| 206 | ``-DTARGET_PLATFORM=AN539`` |
Galanakis, Minos | 757139a | 2019-11-11 15:00:11 +0000 | [diff] [blame] | 207 | - Musca-A test chip board (Cortex-M33 SSE-200 subsystem) |
| 208 | ``-DTARGET_PLATFORM=MUSCA_A`` |
| 209 | - Musca-B1 test chip board (Cortex-M33 SSE-200 subsystem) |
| 210 | ``-DTARGET_PLATFORM=MUSCA_B1`` |
Marton Berke | 8aae06f | 2019-11-25 16:46:12 +0100 | [diff] [blame] | 211 | - Musca-S1 test chip board (Cortex-M33 SSE-200 subsystem) |
| 212 | ``-DTARGET_PLATFORM=MUSCA_S1`` |
Galanakis, Minos | 757139a | 2019-11-11 15:00:11 +0000 | [diff] [blame] | 213 | - Cortex-M33 SSE-200 subsystem for MPS3 (AN524) |
| 214 | ``-DTARGET_PLATFORM=AN524`` |
Chris Brand | b42fed5 | 2019-12-02 16:10:17 -0800 | [diff] [blame^] | 215 | - Cypress CYS0644ABZI-S2D44 board (PSoC64 platform) |
| 216 | ``-DTARGET_PLATFORM=psoc64`` |
| 217 | See :doc:`Cypress PSoC 64 platform specifics </platform/ext/target/cypress/psoc64/cypress_psoc_64_spec>` |
Galanakis, Minos | 757139a | 2019-11-11 15:00:11 +0000 | [diff] [blame] | 218 | |
| 219 | * - -DCOMPILER=<compiler name> |
| 220 | - Specifies the compiler toolchain |
| 221 | The possible values are: |
| 222 | |
| 223 | - ``ARMCLANG`` |
| 224 | - ``GNUARM`` |
| 225 | * - -DCMAKE_BUILD_TYPE=<build type> |
| 226 | - Configures debugging support. |
| 227 | The possible values are: |
| 228 | |
| 229 | - ``Debug`` |
| 230 | - ``Release`` |
| 231 | - ``Relwithdebinfo`` |
| 232 | - ``Minsizerel`` |
Raef Coles | 1bb168e | 2019-10-17 09:04:55 +0100 | [diff] [blame] | 233 | * - -DMBEDCRYPTO_DEBUG=<ON|OFF> |
Raef Coles | a657a9c | 2019-10-24 14:36:43 +0100 | [diff] [blame] | 234 | - Enables debug symbols for Mbed Crypto library. If a cryptographic |
| 235 | accelerator is enabled then this will also enable debug symbols and |
| 236 | logging for any accelerator libraries. |
Galanakis, Minos | 757139a | 2019-11-11 15:00:11 +0000 | [diff] [blame] | 237 | * - -DBUILD_DWARF_VERSION=<dwarf version> |
| 238 | - Configures DWARF version. |
| 239 | The possible values are: |
| 240 | |
| 241 | - 2 |
| 242 | - 3 |
| 243 | - 4 |
| 244 | |
| 245 | .. Note:: |
| 246 | Follow :doc:`secure boot <./tfm_secure_boot>` to build the binaries with or |
| 247 | without BL2 bootloader. |
| 248 | |
Gyorgy Szing | db9783c | 2019-04-17 21:08:48 +0200 | [diff] [blame] | 249 | -------------- |
| 250 | |
| 251 | *Copyright (c) 2017-2019, Arm Limited. All rights reserved.* |