Skip to content

Commit

Permalink
doc: build: kconfig: Update preprocessor functions
Browse files Browse the repository at this point in the history
Split preprocessor functions into different categories and add newly
introduced functions.

Signed-off-by: Pieter De Gendt <[email protected]>
  • Loading branch information
pdgendt authored and carlescufi committed Aug 2, 2024
1 parent 555a56f commit 0e1a98c
Showing 1 changed file with 41 additions and 4 deletions.
45 changes: 41 additions & 4 deletions doc/build/kconfig/preprocessor-functions.rst
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@ These functions are defined in
The official Kconfig preprocessor documentation can be found `here
<https://www.kernel.org/doc/html/latest/kbuild/kconfig-macro-language.html>`__.

See the Python docstrings in :zephyr_file:`scripts/kconfig/kconfigfunctions.py`
for detailed documentation.
Most of the custom preprocessor functions are used to get devicetree
information into Kconfig. For example, the default value of a Kconfig symbol
can be fetched from a devicetree ``reg`` property.
Expand All @@ -20,9 +22,6 @@ Devicetree-related Functions
****************************

The functions listed below are used to get devicetree information into Kconfig.
See the Python docstrings in :zephyr_file:`scripts/kconfig/kconfigfunctions.py`
for detailed documentation.

The ``*_int`` version of each function returns the value as a decimal integer,
while the ``*_hex`` version returns a hexadecimal value starting with ``0x``.

Expand Down Expand Up @@ -75,11 +74,49 @@ while the ``*_hex`` version returns a hexadecimal value starting with ``0x``.
$(dt_nodelabel_reg_size_hex,<node label>[,<index>,<unit>])
$(dt_nodelabel_reg_size_int,<node label>[,<index>,<unit>])
$(dt_path_enabled,<node path>)
Integer functions
*****************

The functions listed below can be used to do arithmetic operations
on integer variables, such as addition, subtraction and more.

.. code-block:: none
$(add,<value>[,value]...)
$(dec,<value>[,value]...)
$(div,<value>[,value]...)
$(inc,<value>[,value]...)
$(max,<value>[,value]...)
$(min,<value>[,value]...)
$(mod,<value>[,value]...)
$(mul,<value>[,value]...)
$(sub,<value>[,value]...)
String functions
****************

The functions listed below can be used to modify string variables.

.. code-block:: none
$(normalize_upper,<string>)
$(shields_list_contains,<shield name>)
$(substring,<string>,<start>[,<stop>])
Other functions
***************

Functions to perform specific operations, currently only a check if a shield
name is specified.

.. code-block:: none
$(shields_list_contains,<shield name>)
Example Usage
=============

Expand Down

0 comments on commit 0e1a98c

Please sign in to comment.