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:
parent
f1a18022be
commit
8d8b02ef7d
28
doc/build/snippets/writing.rst
vendored
28
doc/build/snippets/writing.rst
vendored
|
@ -98,9 +98,31 @@ The build system looks for snippets in these places:
|
||||||
Processing order
|
Processing order
|
||||||
****************
|
****************
|
||||||
|
|
||||||
The order that snippets are processed is currently not defined.
|
Snippets are processed in the order they are listed in the :makevar:`SNIPPET`
|
||||||
Therefore, you should write your :file:`snippet.yml` file so that
|
variable, or in the order of the ``-S`` arguments if using west.
|
||||||
it is not dependent on other snippets.
|
|
||||||
|
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:
|
.. _snippets-devicetree-overlays:
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue