blob: 41a3d4f789f96c59a7b9e978c55860c027e897bc [file] [log] [blame]
Kevin Peng75b0b762022-10-25 18:00:27 +08001.. _Kconfig_system:
2
3##################
4The Kconfig System
5##################
6The Kconfig system is an additional tool for users to change configuration options of TF-M.
7
8.. figure:: kconfig_header_file_system.png
9
10It handles dependencies and validations automatically when you change configurations so that the
11generated configuration options are always valid.
12
13It consists of `The Kconfig tool`_ and the `The Kconfig files`_.
14
15****************
16The Kconfig tool
17****************
18The Kconfig tool is a python script based on `Kconfiglib <https://github.com/ulfalizer/Kconfiglib>`__
19to launch the menuconfig interfaces and generate the following config files:
20
21- CMake config file
22
23 Contains CMake cache variables of building options.
24 This file should be passed to the build system via command line option ``TFM_EXTRA_CONFIG_PATH``.
25
26- Header file
27
28 Contains component options in the header file system.
29 This file should be passed to the build system via the command line option ``PROJECT_CONFIG_HEADER_FILE``.
30
31- The .config file
32
33 The ``.config`` file which contains all the above configurations in the Kconfig format.
34 It is only used to allow users to make adjustments basing on the previous settings.
35 The Kconfig tool will load it if it exists.
36
37How To Use
38==========
39The script takes three arguments at maximum.
40
41- '-k', '--kconfig-file'
42
43 Required. The root Kconfig file.
44
45- '-u', '--ui'
46
47 Optional. The menuconfig interface to launch, ``gui`` or ``tui``.
48 Refer to `Menuconfig interfaces <https://github.com/ulfalizer/Kconfiglib#menuconfig-interfaces>`__
49 for interface details. Only the first two are supported.
50 If no UI is selected, the tool generates config files with default values.
51
52- '-o', '--output_path'
53
54 Required. The output directory to hold the generated files.
55
56The script can be used as a standalone tool.
57You can pass the config files to build system via command line option ``TFM_EXTRA_CONFIG_PATH`` and
58``PROJECT_CONFIG_HEADER_FILE`` respectively, as mentioned above.
59
60The TF-M build system has also integrated the tool.
61You only need to set ``USE_KCONFIG_TOOL`` to ``ON/TRUE/1`` and CMake will launch the GUI menuconfig
62for users to adjust configurations and automatically load the generated config files.
63
64.. note::
65
66 - Only GUI menuconfig can be launched by CMake for the time being.
67 - Due to the current limitation of the tool, you are not allowed to change the values of build
68 options that of which platforms have customized values. And there is no prompt messages either.
69
70*****************
71The Kconfig files
72*****************
73The Kconfig files are the files written in the
74`Kconfig language <https://www.kernel.org/doc/html/latest/kbuild/kconfig-language.html#kconfig-language>`__
75to describe config options.
76They also uses some Kconfiglib extensions such as ``osource`` and ``rsource`` so they can only work
77with the Kconfiglib.
78
79Component options are gathered together in a seperate menu ``TF-M component configs`` because these
80options are changed less frequently.
81
82--------------
83
84*Copyright (c) 2022, Arm Limited. All rights reserved.*