blob: ff69df3f774e7e2960acc12dc1d232846ae4ff64 [file] [log] [blame]
Kevin Peng75b0b762022-10-25 18:00:27 +08001.. _Header_configuration:
2
3#############################
4The Header File Config System
5#############################
6
7The header file configurations system is used to fine-tune component options.
8
9The following diagram shows how the system works.
10
11.. figure:: header_file_system.png
12
13A ``config_tfm.h`` file collects customized configurations, including platform customized and
14project specific settings.
15Each component has a ``config_<comp_name>.h`` which includes the ``config_tfm.h`` first and then
16provides default values for each config option of the component as well as necessary validations
17on config dependencies.
18Source files then include component header files when necessary.
19
20The ``config_tfm.h`` includes a customized project config file provided via compile definition
21``PROJECT_CONFIG_HEADER_FILE``.
22Users set the corresponding CMake variable ``PROJECT_CONFIG_HEADER_FILE`` with the full path of the
23configuration header file.
24A platform can adjust or place restriction on config options by providing a ``config_tfm_target.h``
25under the root folder of their platforms.
26If the build system finds the file, it sets the ``TARGET_CONFIG_HEADER_FILE`` compile definition.
27
28.. code-block:: c
29
30 #ifdef PROJECT_CONFIG_HEADER_FILE
31 #include PROJECT_CONFIG_HEADER_FILE
32 #endif
33
34 #ifdef TARGET_CONFIG_HEADER_FILE
35 #include TARGET_CONFIG_HEADER_FILE
36 #endif
37
38The project config header file can be
39
40- Generated by the TF-M Kconfig system <kconfig_system>
41- One of the header files of Profiles <tf-m_profiles>, set via the ``TFM_PROFILE`` build option.
42- Manually customized profile based on pre-set profiles.
43
44It is expected that all Component options are included in the header file to explicitly set values
45for each option.
Anton Komlev5bc799f2022-11-10 18:22:48 +000046Refer to :ref:`Base_configuration` for details the base configurations.
Kevin Peng75b0b762022-10-25 18:00:27 +080047
48--------------
49
50*Copyright (c) 2022, Arm Limited. All rights reserved.*