Build: Refine Kconfig system and doc
Kconfig choice supports 'optional' key word to allow
the whole choice to be toggled off to select none of the
symbols.
It is necessary to abort the kconfig tool when platform
path doesn't exist.
Add usages of Kconfig tool in the documents.
Signed-off-by: Jianliang Shen <jianliang.shen@arm.com>
Change-Id: I6c38b0bde6a5a6d099d8ea606be5e9b359216efa
diff --git a/docs/configuration/kconfig_system.rst b/docs/configuration/kconfig_system.rst
index 41a3d4f..f4fa257 100644
--- a/docs/configuration/kconfig_system.rst
+++ b/docs/configuration/kconfig_system.rst
@@ -27,16 +27,20 @@
Contains component options in the header file system.
This file should be passed to the build system via the command line option ``PROJECT_CONFIG_HEADER_FILE``.
+ Component options are gathered together in a seperate menu ``TF-M component configs`` in
+ `The Kconfig files`_.
-- The .config file
+- The .config and .config.old files
The ``.config`` file which contains all the above configurations in the Kconfig format.
- It is only used to allow users to make adjustments basing on the previous settings.
- The Kconfig tool will load it if it exists.
+ It will be created after the first execution of the script. It is only used to allow
+ users to make adjustments basing on the previous settings.
+ The Kconfig tool will load it if it exists and ``.config.old`` will be created to
+ save the previous configurations.
How To Use
==========
-The script takes three arguments at maximum.
+The script takes four arguments at maximum.
- '-k', '--kconfig-file'
@@ -53,13 +57,34 @@
Required. The output directory to hold the generated files.
-The script can be used as a standalone tool.
-You can pass the config files to build system via command line option ``TFM_EXTRA_CONFIG_PATH`` and
+- '-p', '--platform-path'
+
+ Optional. The platform specific Kconfig or defconfig files.
+
+Here is an example:
+
+.. code-block:: bash
+
+ cd trusted-firmware-m
+ python3 tools/kconfig/tfm_kconfig.py -k Kconfig -o <output_path> -u tui
+
+ # If the platform path has defconfig or Kconfig, use '-p' to load them.
+ python3 tools/kconfig/tfm_kconfig.py -k Kconfig -o <output_path> -p platform/ext/target/arm/mps2/an521
+
+The script can be used as a standalone tool. You can pass the config files to
+build system via command line option ``TFM_EXTRA_CONFIG_PATH`` and
``PROJECT_CONFIG_HEADER_FILE`` respectively, as mentioned above.
+.. code-block:: bash
+
+ # Pass the files generated by script.
+ <cmake build command> -DTFM_EXTRA_CONFIG_PATH=<output_path>/project_config.cmake \
+ -DPROJECT_CONFIG_HEADER_FILE=<output_path>/project_config.h
+
The TF-M build system has also integrated the tool.
-You only need to set ``USE_KCONFIG_TOOL`` to ``ON/TRUE/1`` and CMake will launch the GUI menuconfig
-for users to adjust configurations and automatically load the generated config files.
+You only need to set ``USE_KCONFIG_TOOL`` to ``ON/TRUE/1`` in commande line and CMake will launch
+the GUI menuconfig for users to adjust configurations and automatically load the generated config
+files.
.. note::
@@ -70,14 +95,11 @@
*****************
The Kconfig files
*****************
-The Kconfig files are the files written in the
+The Kconfig files are the files written by the
`Kconfig language <https://www.kernel.org/doc/html/latest/kbuild/kconfig-language.html#kconfig-language>`__
to describe config options.
-They also uses some Kconfiglib extensions such as ``osource`` and ``rsource`` so they can only work
-with the Kconfiglib.
-
-Component options are gathered together in a seperate menu ``TF-M component configs`` because these
-options are changed less frequently.
+They also uses some Kconfiglib extensions such as optional source ``osource`` and relative source ``rsource``
+so they can only work with the Kconfiglib.
--------------