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 | |
Gyorgy Szing | db9783c | 2019-04-17 21:08:48 +0200 | [diff] [blame] | 7 | **************** |
| 8 | TF-M build steps |
| 9 | **************** |
| 10 | TF-M uses `cmake <https://cmake.org/overview/>`__ to provide an out-of-source |
| 11 | build environment. The instructions are below. |
| 12 | |
Gyorgy Szing | db9783c | 2019-04-17 21:08:48 +0200 | [diff] [blame] | 13 | Getting the source-code |
| 14 | ======================= |
| 15 | .. code-block:: bash |
| 16 | |
Leonardo Sandoval | d7f72d5 | 2020-07-28 18:02:34 -0500 | [diff] [blame] | 17 | cd <base folder> |
Minos Galanakis | 0f39fa5 | 2020-06-08 16:53:53 +0100 | [diff] [blame] | 18 | git clone https://git.trustedfirmware.org/TF-M/trusted-firmware-m.git |
Anton Komlev | b8e3af0 | 2020-08-28 10:23:57 +0100 | [diff] [blame] | 19 | |
| 20 | Dependency management is now handled by cmake. If you wish to alter this |
| 21 | behaviour, see :ref:`docs/getting_started/tfm_build_instruction:Manual |
| 22 | dependency management` |
Gyorgy Szing | db9783c | 2019-04-17 21:08:48 +0200 | [diff] [blame] | 23 | |
Minos Galanakis | ac6b06c | 2020-03-19 12:57:02 +0000 | [diff] [blame] | 24 | .. Note:: |
Anton Komlev | b8e3af0 | 2020-08-28 10:23:57 +0100 | [diff] [blame] | 25 | |
| 26 | - For building with Armclang compiler version 6.10.0, please follow the note |
Minos Galanakis | e409401 | 2020-06-12 14:25:34 +0100 | [diff] [blame] | 27 | in :ref:`docs/getting_started/tfm_sw_requirement:External dependencies` section. |
Anton Komlev | b8e3af0 | 2020-08-28 10:23:57 +0100 | [diff] [blame] | 28 | - For building with the IAR toolchain, please see the notes in |
TTornblom | b9e5ed0 | 2020-02-13 16:53:15 +0100 | [diff] [blame] | 29 | :doc:`software requirements <tfm_build_instruction_iar>` |
| 30 | |
Anton Komlev | b8e3af0 | 2020-08-28 10:23:57 +0100 | [diff] [blame] | 31 | .. _tfm_cmake_configuration: |
| 32 | |
| 33 | Cmake configuration |
| 34 | =================== |
| 35 | |
| 36 | All configuration options are provided by cmake variables, and their default |
| 37 | values, with docstrings, can be found in ``config/config_default.cmake``. |
| 38 | |
| 39 | Configuration is provided in multiple stages, with multiple priorities. |
| 40 | |
| 41 | 1. ``config/config_default.cmake`` is loaded. |
| 42 | 2. Command-line variable settings are applied, overriding all previous settings. |
| 43 | 3. If it exists, CMAKE_BUILD_TYPE specific config is applied from ``config/build_type/<build_type>.cmake``, overriding all previous settings. |
| 44 | 4. If it exists, TFM Profile specific config is applied from ``config/profile/<tfm_profile>.cmake``, overriding all previous settings. |
| 45 | 5. Target specific config from ``platform/ext/target/<target_platform>/config.cmake`` is applied, overriding all previous settings. |
| 46 | 6. If the ``TFM_EXTRA_CONFIG_PATH`` variable has been set, that file is loaded and overrides all previous settings. |
| 47 | |
| 48 | .. Warning:: |
| 49 | This means that command-line settings are not applied when they conflict |
| 50 | with required platform settings. If it is required to override platform |
| 51 | settings (this is not usually a good idea) then TFM_EXTRA_CONFIG_PATH should be |
| 52 | used. |
| 53 | |
| 54 | Required cmake parameters for building TF-M |
| 55 | ------------------------------------------- |
| 56 | |
| 57 | +----------------------+-------------------------------------------------------+ |
| 58 | | Parameter | Description | |
| 59 | +======================+=======================================================+ |
| 60 | | TFM_PLATFORM | The target platform as a path from the base directory | |
| 61 | | | ``/platform/ext/target`` | |
| 62 | +----------------------+-------------------------------------------------------+ |
| 63 | | CMAKE_TOOLCHAIN_FILE | The path to the toolchain file that corresponds to | |
| 64 | | | the desired compiler. | |
| 65 | +----------------------+-------------------------------------------------------+ |
| 66 | |
| 67 | By default release configuration builds. Alternate build types can be controlled |
| 68 | by the CMAKE_BUILD_TYPE variable. |
| 69 | |
| 70 | Build type |
| 71 | ---------- |
| 72 | |
| 73 | Build type is controlled by the ``CMAKE_BUILD_TYPE`` variable. The possible |
| 74 | types are: |
| 75 | |
| 76 | - ``Debug`` |
| 77 | - ``Relwithdebinfo`` |
| 78 | - ``Release`` |
| 79 | - ``Minsizerel`` |
| 80 | |
| 81 | ``Release`` is default. |
| 82 | |
| 83 | Both ``Debug`` and ``Relwithdebinfo`` will include debug symbols in the output |
| 84 | files. ``Relwithdebinfo``, ``Release`` and ``Minsizerel`` have optimization |
| 85 | turned on and hence will produce smaller, faster code. ``Relwithdebinfo`` will |
| 86 | produce the smallest code, and hence is often a good idea on RAM or flash |
| 87 | constrained systems. |
| 88 | |
| 89 | Other cmake parameters |
| 90 | ---------------------- |
| 91 | |
| 92 | The full list of default options is in ``config/config_default.cmake``. Several |
| 93 | important options are listed below. |
| 94 | |
| 95 | |
| 96 | +---------------------+----------------------------------------+---------------+ |
| 97 | | Parameter | Description | Default value | |
| 98 | +=====================+========================================+===============+ |
| 99 | | BL2 | Build level 2 secure bootloader. | ON | |
| 100 | +---------------------+----------------------------------------+---------------+ |
| 101 | | NS | Build NS app. Required for test code. | ON | |
| 102 | +---------------------+----------------------------------------+---------------+ |
| 103 | | TFM_PSA_API | Use PSA api (IPC mode) instead of | OFF | |
| 104 | | | secure library mode. | | |
| 105 | +---------------------+----------------------------------------+---------------+ |
| 106 | | TFM_ISOLATION_LEVEL | Set TFM isolation level. | 1 | |
| 107 | +---------------------+----------------------------------------+---------------+ |
| 108 | | TFM_PROFILE | Set TFM profile. | | |
| 109 | +---------------------+----------------------------------------+---------------+ |
| 110 | | TEST_S | Build secure regression tests. | OFF | |
| 111 | +---------------------+----------------------------------------+---------------+ |
| 112 | | TEST_NS | Build non-secure regression tests. | OFF | |
| 113 | +---------------------+----------------------------------------+---------------+ |
| 114 | | TEST_PSA_API | Build PSA API TESTS for the given | | |
| 115 | | | suite. Takes a PSA api ``SUITE`` as an | | |
| 116 | | | argument (``CRYPTO`` etc). | | |
| 117 | +---------------------+----------------------------------------+---------------+ |
| 118 | |
| 119 | Regression test configuration |
| 120 | ----------------------------- |
| 121 | |
| 122 | Regression test configuration is controlled entirely by the ``TEST_S`` and |
| 123 | ``TEST_NS`` cmake variables. |
| 124 | |
| 125 | If regression testing is enabled, it will then enable all tests for the enabled |
| 126 | secure partitions. If IPC mode is enabled via ``TFM_PSA_API`` the IPC tests will |
| 127 | be enabled. QCBOR and T_COSE tests are linked to the Initial Attestation |
| 128 | partition, as they are only used there. Multicore tests will be enabled if |
| 129 | ``TFM_MULTI_CORE_TOPOLOGY`` is enabled. |
| 130 | |
| 131 | Some cryptographic tests can be enabled and disabled. This is done to prevent |
| 132 | false failures from being reported when a smaller Mbed Crypto config is being |
| 133 | used which does not support all features. |
| 134 | |
| 135 | +-----------------------------+-------------------------------------+---------------+ |
| 136 | | Parameter | Description | Default value | |
| 137 | +=============================+=====================================+===============+ |
| 138 | | TFM_CRYPTO_TEST_ALG_CBC | Test CBC cryptography mode | ON | |
| 139 | +-----------------------------+-------------------------------------+---------------+ |
| 140 | | TFM_CRYPTO_TEST_ALG_CCM | Test CCM cryptography mode | ON | |
| 141 | +-----------------------------+-------------------------------------+---------------+ |
| 142 | | TFM_CRYPTO_TEST_ALG_CFB | Test CFB cryptography mode | ON | |
| 143 | +-----------------------------+-------------------------------------+---------------+ |
| 144 | | TFM_CRYPTO_TEST_ALG_CTR | Test CTR cryptography mode | ON | |
| 145 | +-----------------------------+-------------------------------------+---------------+ |
| 146 | | TFM_CRYPTO_TEST_ALG_GCM | Test GCM cryptography mode | ON | |
| 147 | +-----------------------------+-------------------------------------+---------------+ |
| 148 | | TFM_CRYPTO_TEST_ALG_SHA_512 | Test SHA-512 cryptography algorithm | ON | |
| 149 | +-----------------------------+-------------------------------------+---------------+ |
| 150 | | TFM_CRYPTO_TEST_HKDF | Test SHA-512 cryptography algorithm | ON | |
| 151 | +-----------------------------+-------------------------------------+---------------+ |
| 152 | |
| 153 | |
| 154 | PSA test configuration |
| 155 | ---------------------- |
| 156 | |
| 157 | PSA tests are configured by using the ``TEST_PSA_API`` cmake variable. The |
| 158 | variable should be set to the name of the test suite that is desired. It is |
| 159 | _not_ supported to set both ``TEST_PSA_API`` and ``TEST_S`` or ``TEST_NS``. |
| 160 | |
Jamie Fox | 19c91c2 | 2019-02-10 18:04:58 +0000 | [diff] [blame^] | 161 | The Functional API tests are: |
Anton Komlev | b8e3af0 | 2020-08-28 10:23:57 +0100 | [diff] [blame] | 162 | - ``CRYPTO`` |
| 163 | - ``INITIAL_ATTESTATION`` |
| 164 | - ``STORAGE`` (INTERNAL_TRUSTED_STORAGE and PROTECTED_STORAGE) |
| 165 | - ``INTERNAL_TRUSTED_STORAGE`` |
| 166 | - ``PROTECTED_STORAGE`` |
| 167 | |
Jamie Fox | 19c91c2 | 2019-02-10 18:04:58 +0000 | [diff] [blame^] | 168 | The Firmware Framework test suites are: |
Anton Komlev | b8e3af0 | 2020-08-28 10:23:57 +0100 | [diff] [blame] | 169 | - ``IPC`` |
| 170 | |
| 171 | Note that these map directly to the ``SUITE`` cmake variable used in the |
| 172 | psa-arch-tests documentation. |
| 173 | |
| 174 | Migration from legacy buildsystem |
| 175 | --------------------------------- |
| 176 | |
| 177 | The previous (legacy) cmake buildsystem made use of separate configuration |
| 178 | files, where now build options are controlled by variables. For ease of |
| 179 | transition, a table below is provided that maps the legacy files to the current |
| 180 | variables, in the format of cmake command line parameters. |
| 181 | |
| 182 | +------------------------------------------+-----------------------------------+ |
| 183 | | File | Cmake command line | |
| 184 | +==========================================+===================================+ |
| 185 | | ConfigDefault.cmake | <No options> | |
| 186 | +------------------------------------------+-----------------------------------+ |
| 187 | | ConfigCoreIPC.cmake | -DTFM_PSA_API=ON | |
| 188 | +------------------------------------------+-----------------------------------+ |
| 189 | | ConfigCoreIPCTfmLevel2.cmake | -DTFM_PSA_API=ON | |
| 190 | | | -DTFM_ISOLATION_LEVEL=2 | |
| 191 | +------------------------------------------+-----------------------------------+ |
| 192 | | ConfigDefaultProfileS.cmake | -DTFM_PROFILE=profile_small | |
| 193 | +------------------------------------------+-----------------------------------+ |
| 194 | | ConfigDefaultProfileM.cmake | -DTFM_PROFILE=profile_medium | |
| 195 | +------------------------------------------+-----------------------------------+ |
| 196 | | ConfigRegression.cmake | -DTEST_NS=ON -DTEST_S=ON | |
| 197 | +------------------------------------------+-----------------------------------+ |
| 198 | | ConfigRegressionIPC.cmake | -DTEST_NS=ON -DTEST_S=ON | |
| 199 | | | -DTFM_PSA_API=ON | |
| 200 | +------------------------------------------+-----------------------------------+ |
| 201 | | ConfigRegressionIPCTfmLevel2.cmake | -DTEST_NS=ON -DTEST_S=ON | |
| 202 | | | -DTFM_PSA_API=ON | |
| 203 | | | -DTFM_ISOLATION_LEVEL=2 | |
| 204 | +------------------------------------------+-----------------------------------+ |
| 205 | | ConfigRegressionProfileS.cmake | -DTFM_PROFILE=profile_small | |
| 206 | | | -DTEST_NS=ON -DTEST_S=ON | |
| 207 | +------------------------------------------+-----------------------------------+ |
| 208 | | ConfigRegressionProfileM.cmake | -DTFM_PROFILE=profile_medium | |
| 209 | | | -DTEST_NS=ON -DTEST_S=ON | |
| 210 | +------------------------------------------+-----------------------------------+ |
| 211 | | ConfigPsaApiTest.cmake | -DTEST_PSA_API=<test_suite> | |
| 212 | +------------------------------------------+-----------------------------------+ |
| 213 | | ConfigPsaApiTestIPC.cmake | -DTEST_PSA_API=<test_suite> | |
| 214 | | | -DTFM_PSA_API=ON | |
| 215 | +------------------------------------------+-----------------------------------+ |
| 216 | | ConfigPsaApiTestIPCTfmLevel2.cmake | -DTEST_PSA_API=<test_suite> | |
| 217 | | | -DTFM_PSA_API=ON | |
| 218 | | | -DTFM_ISOLATION_LEVEL=2 | |
| 219 | +------------------------------------------+-----------------------------------+ |
| 220 | | ConfigDefaultProfileM.cmake | -DTFM_PROFILE=profile_medium | |
| 221 | | + profile_m_config_ext_ps_disabled.cmake | -DTFM_PARTITION_PS=OFF | |
| 222 | +------------------------------------------+-----------------------------------+ |
| 223 | |
| 224 | There has also been some changes to the PSA manifest file generation. The files |
| 225 | are now generated into a seperate tree in the ``<tfm build dir>/generated`` |
| 226 | directory. Therefore they have been removed from the source tree. Any changes |
| 227 | should be made only to the template files. |
| 228 | |
| 229 | The api for the ``tools/tfm_parse_manifest_list.py`` script has also changed |
| 230 | slightly. It is no longer required to be run manually as it is run as part of |
| 231 | cmake. |
| 232 | |
| 233 | ******************* |
| 234 | TF-M build examples |
| 235 | ******************* |
| 236 | |
| 237 | Example: building TF-M for AN521 platform using GCC: |
| 238 | ==================================================== |
| 239 | .. code-block:: bash |
| 240 | |
| 241 | cd <base folder> |
| 242 | cd trusted-firmware-m |
| 243 | cmake -S . -B cmake_build -DTFM_PLATFORM=mps2/an521 -DCMAKE_TOOLCHAIN_FILE=toolchain_GNUARM.cmake |
| 244 | cmake --build cmake_build -- install |
| 245 | |
| 246 | Alternately using traditional cmake syntax |
| 247 | |
Gyorgy Szing | db9783c | 2019-04-17 21:08:48 +0200 | [diff] [blame] | 248 | .. code-block:: bash |
| 249 | |
Leonardo Sandoval | d7f72d5 | 2020-07-28 18:02:34 -0500 | [diff] [blame] | 250 | cd <base folder> |
Gyorgy Szing | db9783c | 2019-04-17 21:08:48 +0200 | [diff] [blame] | 251 | cd trusted-firmware-m |
| 252 | mkdir cmake_build |
| 253 | cd cmake_build |
Anton Komlev | b8e3af0 | 2020-08-28 10:23:57 +0100 | [diff] [blame] | 254 | cmake .. -DTFM_PLATFORM=mps2/an521 -DCMAKE_TOOLCHAIN_FILE=../toolchain_GNUARM.cmake |
| 255 | make install |
| 256 | |
| 257 | .. Note:: |
| 258 | Unix Makefiles is the default generator. Ninja is also supported by setting |
| 259 | -GNinja |
| 260 | |
| 261 | .. Note:: |
| 262 | |
| 263 | It is recommended to build each different build configuration in a separate |
| 264 | build directory. |
Gyorgy Szing | db9783c | 2019-04-17 21:08:48 +0200 | [diff] [blame] | 265 | |
| 266 | Regression Tests for the AN521 target platform |
| 267 | ============================================== |
Anton Komlev | b8e3af0 | 2020-08-28 10:23:57 +0100 | [diff] [blame] | 268 | |
| 269 | Regression tests can be build by using the TEST_S and TEST_NS settings. Either |
| 270 | can be used in isolation or both can be used to enable both suites. All tests |
| 271 | for all enabled partitions are run, along with IPC and Multicore tests if those |
| 272 | features are enabled. |
Gyorgy Szing | db9783c | 2019-04-17 21:08:48 +0200 | [diff] [blame] | 273 | |
| 274 | .. code-block:: bash |
| 275 | |
Leonardo Sandoval | d7f72d5 | 2020-07-28 18:02:34 -0500 | [diff] [blame] | 276 | cd <base folder> |
Gyorgy Szing | db9783c | 2019-04-17 21:08:48 +0200 | [diff] [blame] | 277 | cd trusted-firmware-m |
Anton Komlev | b8e3af0 | 2020-08-28 10:23:57 +0100 | [diff] [blame] | 278 | cmake -S . -B cmake_build -DTFM_PLATFORM=mps2/an521 -DCMAKE_TOOLCHAIN_FILE=toolchain_GNUARM.cmake -DTEST_S=ON -DTEST_NS=ON |
| 279 | cmake --build cmake_build -- install |
Gyorgy Szing | db9783c | 2019-04-17 21:08:48 +0200 | [diff] [blame] | 280 | |
Anton Komlev | b8e3af0 | 2020-08-28 10:23:57 +0100 | [diff] [blame] | 281 | Alternately using traditional cmake syntax |
Gyorgy Szing | db9783c | 2019-04-17 21:08:48 +0200 | [diff] [blame] | 282 | |
| 283 | .. code-block:: bash |
| 284 | |
Leonardo Sandoval | d7f72d5 | 2020-07-28 18:02:34 -0500 | [diff] [blame] | 285 | cd <base folder> |
Gyorgy Szing | db9783c | 2019-04-17 21:08:48 +0200 | [diff] [blame] | 286 | cd trusted-firmware-m |
Anton Komlev | b8e3af0 | 2020-08-28 10:23:57 +0100 | [diff] [blame] | 287 | mkdir cmake_build |
| 288 | cd cmake_build |
| 289 | cmake .. -DTFM_PLATFORM=mps2/an521 -DCMAKE_TOOLCHAIN_FILE=../toolchain_GNUARM.cmake -DTEST_S=ON -DTEST_NS=ON |
| 290 | make install |
Gyorgy Szing | db9783c | 2019-04-17 21:08:48 +0200 | [diff] [blame] | 291 | |
Jamie Fox | 19c91c2 | 2019-02-10 18:04:58 +0000 | [diff] [blame^] | 292 | Build for PSA Functional API compliance tests |
| 293 | ============================================= |
Anton Komlev | b8e3af0 | 2020-08-28 10:23:57 +0100 | [diff] [blame] | 294 | The build system provides support for building and integrating the PSA API tests |
| 295 | from https://github.com/ARM-software/psa-arch-tests. PSA API tests are |
| 296 | controlled using the TEST_PSA_API variable. Enabling both regression tests and |
| 297 | PSA API tests simultaneously is **not** supported. |
Gyorgy Szing | db9783c | 2019-04-17 21:08:48 +0200 | [diff] [blame] | 298 | |
Anton Komlev | b8e3af0 | 2020-08-28 10:23:57 +0100 | [diff] [blame] | 299 | The value of the TEST_PSA_API variable is the suite to be run. |
Gyorgy Szing | db9783c | 2019-04-17 21:08:48 +0200 | [diff] [blame] | 300 | |
Anton Komlev | b8e3af0 | 2020-08-28 10:23:57 +0100 | [diff] [blame] | 301 | .. code-block:: |
| 302 | |
| 303 | -DTEST_PSA_API=INTERNAL_TRUSTED_STORAGE |
| 304 | -DTEST_PSA_API=PROTECTED_STORAGE |
| 305 | -DTEST_PSA_API=STORAGE |
| 306 | -DTEST_PSA_API=CRYPTO |
| 307 | -DTEST_PSA_API=INITIAL_ATTESTATION |
| 308 | |
| 309 | Respectively for the corresponding service. For example, to enable the PSA API |
| 310 | tests for the Crypto service: |
Gyorgy Szing | db9783c | 2019-04-17 21:08:48 +0200 | [diff] [blame] | 311 | |
| 312 | .. code-block:: bash |
| 313 | |
Leonardo Sandoval | d7f72d5 | 2020-07-28 18:02:34 -0500 | [diff] [blame] | 314 | cd <base folder> |
Gyorgy Szing | db9783c | 2019-04-17 21:08:48 +0200 | [diff] [blame] | 315 | cd trusted-firmware-m |
Anton Komlev | b8e3af0 | 2020-08-28 10:23:57 +0100 | [diff] [blame] | 316 | cmake -S . -B cmake_build -DTFM_PLATFORM=mps2/an521 -DCMAKE_TOOLCHAIN_FILE=toolchain_GNUARM.cmake -DTEST_PSA_API=CRYPTO |
| 317 | cmake --build cmake_build -- install |
| 318 | |
| 319 | Alternately using traditional cmake syntax |
| 320 | |
| 321 | .. code-block:: bash |
| 322 | |
| 323 | cd <base folder> |
| 324 | cd trusted-firmware-m |
| 325 | mkdir cmake_build |
| 326 | cd cmake_build |
| 327 | cmake .. -DTFM_PLATFORM=mps2/an521 -DCMAKE_TOOLCHAIN_FILE=../toolchain_GNUARM.cmake -DTEST_PSA_API=CRYPTO |
| 328 | make install |
Gyorgy Szing | db9783c | 2019-04-17 21:08:48 +0200 | [diff] [blame] | 329 | |
Jaykumar Pitambarbhai Patel | 6891b8b | 2020-01-23 14:32:20 +0530 | [diff] [blame] | 330 | Build for PSA FF (IPC) compliance tests |
| 331 | ======================================= |
| 332 | |
Anton Komlev | b8e3af0 | 2020-08-28 10:23:57 +0100 | [diff] [blame] | 333 | The build system provides support for building and integrating the PSA FF |
| 334 | compliance test. This support is controlled by the TEST_PSA_API variable: |
Jaykumar Pitambarbhai Patel | 6891b8b | 2020-01-23 14:32:20 +0530 | [diff] [blame] | 335 | |
Anton Komlev | b8e3af0 | 2020-08-28 10:23:57 +0100 | [diff] [blame] | 336 | .. code-block:: |
| 337 | |
| 338 | -DTEST_PSA_API=IPC |
Jaykumar Pitambarbhai Patel | 6891b8b | 2020-01-23 14:32:20 +0530 | [diff] [blame] | 339 | |
| 340 | .. code-block:: bash |
Minos Galanakis | fc6804e | 2020-03-10 11:03:34 +0000 | [diff] [blame] | 341 | |
Leonardo Sandoval | d7f72d5 | 2020-07-28 18:02:34 -0500 | [diff] [blame] | 342 | cd <base folder> |
Jaykumar Pitambarbhai Patel | 6891b8b | 2020-01-23 14:32:20 +0530 | [diff] [blame] | 343 | cd trusted-firmware-m |
Anton Komlev | b8e3af0 | 2020-08-28 10:23:57 +0100 | [diff] [blame] | 344 | cmake -S . -B cmake_build -DTFM_PLATFORM=mps2/an521 -DCMAKE_TOOLCHAIN_FILE=toolchain_GNUARM.cmake -DTEST_PSA_API=IPC |
| 345 | cmake --build cmake_build -- install |
Jaykumar Pitambarbhai Patel | 6891b8b | 2020-01-23 14:32:20 +0530 | [diff] [blame] | 346 | |
Anton Komlev | b8e3af0 | 2020-08-28 10:23:57 +0100 | [diff] [blame] | 347 | Alternately using traditional cmake syntax |
Jaykumar Pitambarbhai Patel | 6891b8b | 2020-01-23 14:32:20 +0530 | [diff] [blame] | 348 | |
| 349 | .. code-block:: bash |
| 350 | |
Leonardo Sandoval | d7f72d5 | 2020-07-28 18:02:34 -0500 | [diff] [blame] | 351 | cd <base folder> |
Jaykumar Pitambarbhai Patel | 6891b8b | 2020-01-23 14:32:20 +0530 | [diff] [blame] | 352 | cd trusted-firmware-m |
Anton Komlev | b8e3af0 | 2020-08-28 10:23:57 +0100 | [diff] [blame] | 353 | mkdir cmake_build |
| 354 | cd cmake_build |
| 355 | cmake .. -DTFM_PLATFORM=mps2/an521 -DCMAKE_TOOLCHAIN_FILE=../toolchain_GNUARM.cmake -DTEST_PSA_API=IPC |
| 356 | make install |
Jaykumar Pitambarbhai Patel | 6891b8b | 2020-01-23 14:32:20 +0530 | [diff] [blame] | 357 | |
Gyorgy Szing | db9783c | 2019-04-17 21:08:48 +0200 | [diff] [blame] | 358 | Location of build artifacts |
| 359 | =========================== |
Gyorgy Szing | db9783c | 2019-04-17 21:08:48 +0200 | [diff] [blame] | 360 | |
Anton Komlev | b8e3af0 | 2020-08-28 10:23:57 +0100 | [diff] [blame] | 361 | All build artifacts are provided in the ``<build_dir>/bin`` directory. It is |
| 362 | **not** required to run ``make install`` to generate artifacts in this location. |
Gyorgy Szing | db9783c | 2019-04-17 21:08:48 +0200 | [diff] [blame] | 363 | |
Gyorgy Szing | db9783c | 2019-04-17 21:08:48 +0200 | [diff] [blame] | 364 | |
Anton Komlev | b8e3af0 | 2020-08-28 10:23:57 +0100 | [diff] [blame] | 365 | For the purposes of maintaining compatibility with the legacy cmake build |
| 366 | system, they are also provided in |
| 367 | ``<build_dir>/install/outputs/<target_platform>/``. In order to generate the |
| 368 | artifacts in this location ``make install`` must be run. |
Gyorgy Szing | db9783c | 2019-04-17 21:08:48 +0200 | [diff] [blame] | 369 | |
| 370 | Building the documentation |
| 371 | ========================== |
Minos Galanakis | d19a19f | 2020-06-03 15:38:03 +0100 | [diff] [blame] | 372 | Please ensure the dependencies for building the documentation are installed |
| 373 | as explained in the :doc:`software requirements <tfm_sw_requirement>`. The |
| 374 | requirements to build the firmware, are only required when using the CMAKE |
| 375 | method |
| 376 | |
| 377 | There are currently two ways of building the documentation: |
| 378 | - Using the CMake build system as custom targets |
| 379 | - Manually using the appropriate tools (`sphinx-build`_/ `Doxygen`_) |
| 380 | |
| 381 | Using the CMake build-system |
| 382 | ---------------------------- |
Gyorgy Szing | db9783c | 2019-04-17 21:08:48 +0200 | [diff] [blame] | 383 | |
Minos Galanakis | dff2eae | 2020-07-21 15:13:52 +0100 | [diff] [blame] | 384 | Building PDF output can be requested by invoking `tfm_docs_userguide_pdf/ |
| 385 | tfm_docs_userguide_pdf` |
Gyorgy Szing | db9783c | 2019-04-17 21:08:48 +0200 | [diff] [blame] | 386 | |
| 387 | .. Note:: |
| 388 | For building the documentation all tools needed to build the firmware must |
| 389 | be available. |
| 390 | |
| 391 | Building the Reference Manual |
Minos Galanakis | d19a19f | 2020-06-03 15:38:03 +0100 | [diff] [blame] | 392 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ |
Gyorgy Szing | db9783c | 2019-04-17 21:08:48 +0200 | [diff] [blame] | 393 | .. code-block:: bash |
| 394 | |
| 395 | cd <TF-M base folder> |
Anton Komlev | b8e3af0 | 2020-08-28 10:23:57 +0100 | [diff] [blame] | 396 | cmake -S . -B cmake_doc -DTFM_PLATFORM=mps2/an521 -DCMAKE_TOOLCHAIN_FILE=toolchain_GNUARM.cmake |
| 397 | cmake --build cmake_doc -- tfm_docs_refman_html tfm_docs_refman_pdf |
Gyorgy Szing | db9783c | 2019-04-17 21:08:48 +0200 | [diff] [blame] | 398 | |
| 399 | The documentation files will be available under the directory:: |
| 400 | |
Minos Galanakis | dff2eae | 2020-07-21 15:13:52 +0100 | [diff] [blame] | 401 | cmake_doc/docs/reference_manual |
Gyorgy Szing | db9783c | 2019-04-17 21:08:48 +0200 | [diff] [blame] | 402 | |
| 403 | Building the User Guide |
Minos Galanakis | d19a19f | 2020-06-03 15:38:03 +0100 | [diff] [blame] | 404 | ^^^^^^^^^^^^^^^^^^^^^^^ |
Gyorgy Szing | db9783c | 2019-04-17 21:08:48 +0200 | [diff] [blame] | 405 | .. code-block:: bash |
| 406 | |
| 407 | cd <TF-M base folder> |
Anton Komlev | b8e3af0 | 2020-08-28 10:23:57 +0100 | [diff] [blame] | 408 | cmake -S . -B cmake_doc -DTFM_PLATFORM=mps2/an521 -DCMAKE_TOOLCHAIN_FILE=toolchain_GNUARM.cmake |
| 409 | cmake --build cmake_doc -- tfm_docs_userguide_html tfm_docs_userguide_pdf |
Gyorgy Szing | db9783c | 2019-04-17 21:08:48 +0200 | [diff] [blame] | 410 | |
| 411 | The documentation files will be available under the directory:: |
| 412 | |
Minos Galanakis | dff2eae | 2020-07-21 15:13:52 +0100 | [diff] [blame] | 413 | cmake_doc/docs/user_guide |
Gyorgy Szing | db9783c | 2019-04-17 21:08:48 +0200 | [diff] [blame] | 414 | |
Minos Galanakis | d19a19f | 2020-06-03 15:38:03 +0100 | [diff] [blame] | 415 | Manually using documentation generation tools |
| 416 | --------------------------------------------- |
| 417 | |
| 418 | Invoking Sphinx-build will build both user_guide and reference_manual |
| 419 | targets. |
| 420 | |
| 421 | .. code-block:: bash |
| 422 | |
| 423 | # Build the documentation from build_docs directory |
| 424 | cd <TF-M base folder>/ build_docs/ |
| 425 | sphinx-build ./ user_guide |
| 426 | |
| 427 | # Build the documentation from a custom location |
| 428 | # setting the build_docs as input |
| 429 | |
| 430 | # Note that using this method will still generate the reference manual |
| 431 | # to the <TF-M base folder>/build_docs/reference_manual |
| 432 | cd <TF-M base folder>/OTHER_DIR/OTHER_DIR2 |
| 433 | sphinx-build <TF-M base folder>/build_docs/ DESIRED_OUTPUT_DIR |
| 434 | |
Anton Komlev | b8e3af0 | 2020-08-28 10:23:57 +0100 | [diff] [blame] | 435 | **************************** |
| 436 | Manual dependency management |
| 437 | **************************** |
Galanakis, Minos | 757139a | 2019-11-11 15:00:11 +0000 | [diff] [blame] | 438 | |
Anton Komlev | b8e3af0 | 2020-08-28 10:23:57 +0100 | [diff] [blame] | 439 | TF-M build system will try to fetch all dependencies with appropriate versions |
| 440 | and store them inside the build tree. If you have local copies already, or wish |
| 441 | to avoid downloading whenever the build directory is completely cleaned, then |
| 442 | the following paths can be set. |
Galanakis, Minos | 757139a | 2019-11-11 15:00:11 +0000 | [diff] [blame] | 443 | |
Anton Komlev | b8e3af0 | 2020-08-28 10:23:57 +0100 | [diff] [blame] | 444 | +--------------+--------------------+-----------------------------------------------------+ |
| 445 | | Dependency | Cmake variable | Git repo URL | |
| 446 | +==============+====================+=====================================================+ |
| 447 | | mbedcrypto | MBEDCRYPTO_PATH | https://github.com/ARMmbed/mbedtls | |
| 448 | +--------------+--------------------+-----------------------------------------------------+ |
| 449 | | tf-m-tests | TFM_TEST_REPO_PATH | https://git.trustedfirmware.org/TF-M/tf-m-tests.git | |
| 450 | +--------------+--------------------+-----------------------------------------------------+ |
| 451 | | mcuboot | MCUBOOT_PATH | https://github.com/JuulLabs-OSS/mcuboot | |
| 452 | +--------------+--------------------+-----------------------------------------------------+ |
Galanakis, Minos | 757139a | 2019-11-11 15:00:11 +0000 | [diff] [blame] | 453 | |
Anton Komlev | b8e3af0 | 2020-08-28 10:23:57 +0100 | [diff] [blame] | 454 | For required versions of the dependencies, refer to ``config/config_default.cmake``. |
Galanakis, Minos | 757139a | 2019-11-11 15:00:11 +0000 | [diff] [blame] | 455 | |
| 456 | .. Note:: |
Anton Komlev | b8e3af0 | 2020-08-28 10:23:57 +0100 | [diff] [blame] | 457 | - Some patches are required to the mbedtls repo to allow building it as part of |
| 458 | TF-M. While these patches are being upstreamed they are stored in |
| 459 | lib/ext/mbedcrypo. In order to use a local copy of mbedcrypto it is required |
| 460 | to apply all patch files in this directory. |
Galanakis, Minos | 757139a | 2019-11-11 15:00:11 +0000 | [diff] [blame] | 461 | |
Anton Komlev | b8e3af0 | 2020-08-28 10:23:57 +0100 | [diff] [blame] | 462 | .. Note:: |
| 463 | - CMSIS 5 is provided by the TF-M tests repo. If you wish to use a different |
| 464 | source for CMSIS 5, it can be configured using CMSIS_5_PATH. |
David Hu | 2cbf5df | 2020-06-15 10:41:44 +0800 | [diff] [blame] | 465 | |
Minos Galanakis | d19a19f | 2020-06-03 15:38:03 +0100 | [diff] [blame] | 466 | .. _sphinx-build: https://www.sphinx-doc.org/en/master/man/sphinx-build.html |
| 467 | .. _Doxygen: https://www.doxygen.nl |
| 468 | |
Gyorgy Szing | db9783c | 2019-04-17 21:08:48 +0200 | [diff] [blame] | 469 | -------------- |
| 470 | |
Galanakis, Minos | dc6694b | 2020-01-06 13:54:56 +0000 | [diff] [blame] | 471 | *Copyright (c) 2017-2020, Arm Limited. All rights reserved.* |