doc: snippets: Clarify snippet processing order

This commit clarifies the snippet processing order when multiple
snippets are specified.

Signed-off-by: Stephanos Ioannidis <stephanos.ioannidis@nordicsemi.no>
This commit is contained in:
Stephanos Ioannidis 2023-05-03 22:44:36 +09:00 committed by Carles Cufí
parent f1a18022be
commit 8d8b02ef7d
1 changed files with 25 additions and 3 deletions

View File

@ -98,9 +98,31 @@ The build system looks for snippets in these places:
Processing order
****************
The order that snippets are processed is currently not defined.
Therefore, you should write your :file:`snippet.yml` file so that
it is not dependent on other snippets.
Snippets are processed in the order they are listed in the :makevar:`SNIPPET`
variable, or in the order of the ``-S`` arguments if using west.
To apply ``bar`` after ``foo``:
.. code-block:: console
cmake -Sapp -Bbuild -DSNIPPET="foo;bar" [...]
cmake --build build
The same can be achieved with west as follows:
.. code-block:: console
west build -S foo -S bar [...] app
When multiple snippets set the same configuration, the configuration value set
by the last processed snippet ends up in the final configurations.
For instance, if ``foo`` sets ``CONFIG_FOO=1`` and ``bar`` sets
``CONFIG_FOO=2`` in the above example, the resulting final configuration will
be ``CONFIG_FOO=2`` because ``bar`` is processed after ``foo``.
This principle applies to both Kconfig fragments (``.conf`` files) and
devicetree overlays (``.overlay`` files).
.. _snippets-devicetree-overlays: