Anton Komlev | 2cd9153 | 2022-11-17 13:36:55 +0000 | [diff] [blame] | 1 | .. _tf-m_configuration: |
| 2 | |
Anton Komlev | affe14f | 2022-11-01 00:07:41 +0000 | [diff] [blame] | 3 | ############# |
| 4 | Configuration |
| 5 | ############# |
| 6 | |
| 7 | .. Warning:: |
| 8 | |
| 9 | This is a temporay design document for review. |
| 10 | Once the design is settled down. |
| 11 | It will be converted to user/integration guides. |
| 12 | |
| 13 | .. toctree:: |
| 14 | :maxdepth: 1 |
| 15 | :glob: |
| 16 | |
Anton Komlev | 2cd9153 | 2022-11-17 13:36:55 +0000 | [diff] [blame] | 17 | build_configuration.rst |
Kevin Peng | 75b0b76 | 2022-10-25 18:00:27 +0800 | [diff] [blame^] | 18 | Component configuration <header_file_system> |
| 19 | Kconfig <kconfig_system> |
Anton Komlev | 2cd9153 | 2022-11-17 13:36:55 +0000 | [diff] [blame] | 20 | Profiles <profiles/index> |
| 21 | test_configuration.rst |
Anton Komlev | affe14f | 2022-11-01 00:07:41 +0000 | [diff] [blame] | 22 | |
Anton Komlev | 2cd9153 | 2022-11-17 13:36:55 +0000 | [diff] [blame] | 23 | TF-M is highly configurable project with many configuration options to meet |
| 24 | a user needs. A user can select the desired set of services and fine-tune |
| 25 | them to their requirements. There are two types of configuration options |
Anton Komlev | affe14f | 2022-11-01 00:07:41 +0000 | [diff] [blame] | 26 | |
Anton Komlev | 2cd9153 | 2022-11-17 13:36:55 +0000 | [diff] [blame] | 27 | Building configuration |
Kevin Peng | 75b0b76 | 2022-10-25 18:00:27 +0800 | [diff] [blame^] | 28 | Specifies which file or component to include into compilation and build. |
| 29 | These are options, usually used by a build system to enable/disable |
| 30 | modules, specify location of external dependency or other selection, global to |
| 31 | a project. Please check the corresponded section :ref:`tfm_cmake_configuration` |
Anton Komlev | affe14f | 2022-11-01 00:07:41 +0000 | [diff] [blame] | 32 | |
Anton Komlev | 2cd9153 | 2022-11-17 13:36:55 +0000 | [diff] [blame] | 33 | Component tuning |
| 34 | To adjust a particular parameter to a desired value. Those options are |
| 35 | local to a component or externally referenced when components are coupled. |
Kevin Peng | 75b0b76 | 2022-10-25 18:00:27 +0800 | [diff] [blame^] | 36 | Options are in C header file. The :ref:`Header_configuration` has more |
| 37 | details about it. |
Anton Komlev | affe14f | 2022-11-01 00:07:41 +0000 | [diff] [blame] | 38 | |
| 39 | .. Note:: |
Anton Komlev | 2cd9153 | 2022-11-17 13:36:55 +0000 | [diff] [blame] | 40 | Originally, TF-M used CMake variables for both building and component tuning |
| 41 | purposes. It was convenient to have a single system for both building and |
| 42 | component's configurations. To simplify and improve configurability and |
| 43 | better support build systems other than a CMake, TF-M introduced a |
Kevin Peng | 75b0b76 | 2022-10-25 18:00:27 +0800 | [diff] [blame^] | 44 | :ref:`Header_configuration` and moved component options into a dedicated |
Anton Komlev | 2cd9153 | 2022-11-17 13:36:55 +0000 | [diff] [blame] | 45 | config headers. |
Anton Komlev | affe14f | 2022-11-01 00:07:41 +0000 | [diff] [blame] | 46 | |
| 47 | **************** |
| 48 | How to configure |
| 49 | **************** |
| 50 | |
Anton Komlev | 2cd9153 | 2022-11-17 13:36:55 +0000 | [diff] [blame] | 51 | TF-M Project provides a base build, defined in config_base.cmake. It includes |
| 52 | SPM and platform code only. Starting from the base, users can enable required |
| 53 | services and features using several independent methods to configure TF-M. |
Anton Komlev | affe14f | 2022-11-01 00:07:41 +0000 | [diff] [blame] | 54 | |
Kevin Peng | 75b0b76 | 2022-10-25 18:00:27 +0800 | [diff] [blame^] | 55 | Use :ref:`tf-m_profiles`. |
| 56 | There are 4 sets of predefined configurations for a elected |
Anton Komlev | affe14f | 2022-11-01 00:07:41 +0000 | [diff] [blame] | 57 | use cases, called profiles. A user can select a profile by providing |
| 58 | -DTFM_PROFILE=<profile file name>. |
| 59 | Each profiles represented by a pair of configuration files for |
| 60 | Building (CMake) options and Component options (.h file) |
| 61 | |
Anton Komlev | 2cd9153 | 2022-11-17 13:36:55 +0000 | [diff] [blame] | 62 | Use a custom profile. |
| 63 | Another method is to take existing TF-M profile and adjust the desired |
| 64 | options manually editing CMake and config header files. This is for users |
| 65 | familiar with TF-M. |
Anton Komlev | affe14f | 2022-11-01 00:07:41 +0000 | [diff] [blame] | 66 | |
Kevin Peng | 75b0b76 | 2022-10-25 18:00:27 +0800 | [diff] [blame^] | 67 | Use :ref:`Kconfig_system`. |
Anton Komlev | 2cd9153 | 2022-11-17 13:36:55 +0000 | [diff] [blame] | 68 | This method is recommended for beginners. Starting from the |
Kevin Peng | 75b0b76 | 2022-10-25 18:00:27 +0800 | [diff] [blame^] | 69 | *base configuration* a user can enable necessary services and options. |
Anton Komlev | 2cd9153 | 2022-11-17 13:36:55 +0000 | [diff] [blame] | 70 | KConfig ensurers that all selected options are consistent and valid. |
Kevin Peng | 75b0b76 | 2022-10-25 18:00:27 +0800 | [diff] [blame^] | 71 | This is new in v1.7.0 and it covers only SPM and PSA services. As an output |
Anton Komlev | affe14f | 2022-11-01 00:07:41 +0000 | [diff] [blame] | 72 | KConfig produces a pair of configuration files, similar to a profile. |
| 73 | |
| 74 | .. Note:: |
| 75 | In contrast, before TF-M v1.7.0, the default build includes all possible |
| 76 | features. With growing functionality, such rich default build became |
| 77 | unpractical by not fitting into every platform and confusing of big |
| 78 | memory requirements. |
| 79 | |
| 80 | ********** |
| 81 | Priorities |
| 82 | ********** |
Anton Komlev | affe14f | 2022-11-01 00:07:41 +0000 | [diff] [blame] | 83 | |
Anton Komlev | 2cd9153 | 2022-11-17 13:36:55 +0000 | [diff] [blame] | 84 | A project configueration performed in multiple steps with priorities. |
| 85 | The list below explains the process but for the details specific to |
Kevin Peng | 75b0b76 | 2022-10-25 18:00:27 +0800 | [diff] [blame^] | 86 | :ref:`tfm_cmake_configuration` or :ref:`Header_configuration` please |
Anton Komlev | 2cd9153 | 2022-11-17 13:36:55 +0000 | [diff] [blame] | 87 | check the corresponded document. |
Anton Komlev | affe14f | 2022-11-01 00:07:41 +0000 | [diff] [blame] | 88 | |
Anton Komlev | 2cd9153 | 2022-11-17 13:36:55 +0000 | [diff] [blame] | 89 | #. The base configuration with default values is used as a starting point |
| 90 | #. A profile options applied on top of the base |
| 91 | #. A platform can check the selected configuration and apply restrictions |
| 92 | #. Finally, command line options can modify the composed set |
| 93 | |
| 94 | .. Note:: |
| 95 | To ensure a clear intention and conscious choice, all options must be |
| 96 | providede explicitly via a project configuration file. Default values |
| 97 | on step 1 will generate warnings which expected to break a build. |
Anton Komlev | affe14f | 2022-11-01 00:07:41 +0000 | [diff] [blame] | 98 | |
| 99 | -------------- |
| 100 | |
| 101 | *Copyright (c) 2022, Arm Limited. All rights reserved.* |