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 |
| 18 | Profiles <profiles/index> |
| 19 | test_configuration.rst |
Anton Komlev | affe14f | 2022-11-01 00:07:41 +0000 | [diff] [blame] | 20 | |
Anton Komlev | 2cd9153 | 2022-11-17 13:36:55 +0000 | [diff] [blame^] | 21 | TF-M is highly configurable project with many configuration options to meet |
| 22 | a user needs. A user can select the desired set of services and fine-tune |
| 23 | them to their requirements. There are two types of configuration options |
Anton Komlev | affe14f | 2022-11-01 00:07:41 +0000 | [diff] [blame] | 24 | |
Anton Komlev | 2cd9153 | 2022-11-17 13:36:55 +0000 | [diff] [blame^] | 25 | Building configuration |
| 26 | Specifies which file or component to include into compilation and build. |
Anton Komlev | affe14f | 2022-11-01 00:07:41 +0000 | [diff] [blame] | 27 | These are options, usually used by a build system to enable/disable |
| 28 | modules, specify location of external dependency or other selection, |
| 29 | global to a project. These options shall be considered while adopting TF-M |
| 30 | to other build systems. |
| 31 | In the Base configuration table theses options have *Build* type. |
| 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. |
| 36 | Options are in C header file. The <Header_configuration> has more details about it. |
Anton Komlev | affe14f | 2022-11-01 00:07:41 +0000 | [diff] [blame] | 37 | In the Base configuration table theses options have *Component* type. |
| 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 |
| 44 | Header configuration and moved component options into a dedicated |
| 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 | |
Anton Komlev | 2cd9153 | 2022-11-17 13:36:55 +0000 | [diff] [blame^] | 55 | Use <Profiles>. |
| 56 | There are 4 sets of predefined configurations for a selected |
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 | |
Anton Komlev | 2cd9153 | 2022-11-17 13:36:55 +0000 | [diff] [blame^] | 67 | Use <Kconfig_system>. |
| 68 | This method is recommended for beginners. Starting from the |
| 69 | <base configuration> a user can enable necessary services and options. |
| 70 | KConfig ensurers that all selected options are consistent and valid. |
| 71 | This is new in v1.7.0 and it covers only SPM and PSA ervices. 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 |
| 86 | :ref:`tfm_cmake_configuration` or <Header_configuration> please |
| 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.* |