diff --git a/doc/guides/build/build-config-phase.svg b/doc/guides/build/build-config-phase.svg index b66d0836951..5d5b46d984b 100644 --- a/doc/guides/build/build-config-phase.svg +++ b/doc/guides/build/build-config-phase.svg @@ -1,3 +1,3 @@ -
C preprocessor
C preprocessor

*.dts/*.dtsi files

*.dts/*.dtsi files

Bindings in dts/bindings/

Bindings in dts/bindings/

Kconfig files

Kconfig files
*.dts.pre.tmp file
*.dts.pre.tmp file

devicetree_unfixed.h

devicetree_unfixed.h...
autoconf.h
autoconf.h

dts_fixup.h files

dts_fixup.h files
devicetree_fixups.h
devicetree_fixups.h

Configuration overview

(runs during the CMake configuration step)

Configuration overview...
Scripts in scripts/dts/
Scripts in scripts/d...
devicetree.h
(checked-in file with #include's)
devicetree.h...

prj.conf

and other configuration files

prj.conf...
Scripts in scripts/kconfig/
Scripts in scripts/kconf...
.config
.config
dtc compiler (just to catch warnings/errors)
dtc compiler (just to catc...
Kconfig can read devicetree data
Kconfig can rea...
Outputs
Outputs
Makefile or Ninja file (from CMake)
Makefile or Ninja file (...
\ No newline at end of file +
C preprocessor
C preprocessor

*.dts/*.dtsi files

*.dts/*.dtsi files

Bindings in dts/bindings/

Bindings in dts/bindings/

Kconfig files

Kconfig files
*.dts.pre.tmp file
*.dts.pre.tmp file

devicetree_unfixed.h

devicetree_unfixed.h...
autoconf.h
autoconf.h

dts_fixup.h files

dts_fixup.h files
devicetree_fixups.h
devicetree_fixups.h

Configuration overview

(runs during the CMake configuration step)

Configuration overview...
Scripts in scripts/dts/
Scripts in scripts/d...
devicetree.h
(checked-in file with #include's)
devicetree.h...

prj.conf

and other configuration files

prj.conf...
Scripts in scripts/kconfig/
Scripts in scripts/kconf...
.config
.config
dtc compiler (just to catch warnings/errors)
dtc compiler (just to catc...
Kconfig can read devicetree data
Kconfig can rea...
Outputs
Outputs
Makefile or Ninja file (from CMake)
Makefile or Ninja file (...

Merged devicetree in zephyr.dts (debugging aid)

Merged devicetree in zephyr.dts (debugging a...
\ No newline at end of file diff --git a/doc/guides/build/index.rst b/doc/guides/build/index.rst index 522ba9e1c86..2d1036b650d 100644 --- a/doc/guides/build/index.rst +++ b/doc/guides/build/index.rst @@ -41,6 +41,10 @@ Devicetree parsed by :zephyr_file:`gen_defines.py ` to generate a :file:`devicetree_unfixed.h` header with preprocessor macros. + As a debugging aid, :file:`gen_defines.py` writes the final devicetree to + :file:`zephyr.dts`. This file is just for reference. It is not used + anywhere. + The ``dtc`` devicetree compiler also gets run on the preprocessed devicetree sources to catch any extra warnings and errors generated by it. The output from ``dtc`` is unused otherwise. diff --git a/doc/guides/dts/index.rst b/doc/guides/dts/index.rst index f3a1d71cdc0..eb426ccd332 100644 --- a/doc/guides/dts/index.rst +++ b/doc/guides/dts/index.rst @@ -191,11 +191,16 @@ The first figure in the :ref:`device-tree-intro` shows how devicetree fits into the Zephyr build system. This section describes the input and output files in more detail. -.. figure:: zephyr_dt_inputs_outputs.png +.. figure:: zephyr_dt_inputs_outputs.svg :figclass: align-center Devicetree input (green) and output (yellow) files +.. note:: + + For a higher-level overview over of the build, see :ref:`the build overview + `. + DTS files usually have a :file:`.dts`, :file:`.dtsi` (*i* for *include*), or :file:`.overlay` extension. The C preprocessor is run on all devicetree files to expand macro references. :file:`.dts` files usually include :file:`.dtsi` @@ -203,8 +208,8 @@ files via the C preprocessor with ``#include``. .. note:: - DTS also also has a native mechanism, ``/include/ ""``, for - including other files, though it is less commonly used. + DTS also has a native mechanism, ``/include/ ""``, for including + other files, though it is less commonly used. Each board has a base devicetree, stored in the board's directory in :file:`boards/` as :file:`.dts`. This base devicetree can be extended or @@ -228,9 +233,15 @@ from the base devicetree, if needed. .. note:: - The preprocessed and concatenated DTS sources are stored in - :file:`zephyr/.dts.pre.tmp` in the build directory. Looking at this - file can be handy for debugging. + These files in the build directory can be useful as a debugging aid when + working with devicetree: + + zephyr/.dts.pre.tmp + The preprocessed and concatenated DTS sources + + zephyr/zephyr.dts + The final merged devicetree. This file is specifically output as a + debugging aid, and is unused otherwise. The merged devicetree, along with any :ref:`bindings ` referenced from it, is used to generate C preprocessor macros. This is handled by the diff --git a/doc/guides/dts/zephyr_dt_inputs_outputs.png b/doc/guides/dts/zephyr_dt_inputs_outputs.png deleted file mode 100644 index c6636cf3623..00000000000 Binary files a/doc/guides/dts/zephyr_dt_inputs_outputs.png and /dev/null differ diff --git a/doc/guides/dts/zephyr_dt_inputs_outputs.svg b/doc/guides/dts/zephyr_dt_inputs_outputs.svg index c4687116055..caba2002270 100644 --- a/doc/guides/dts/zephyr_dt_inputs_outputs.svg +++ b/doc/guides/dts/zephyr_dt_inputs_outputs.svg @@ -1,3 +1,3 @@ -
FILE1.overlay
...
FILE_n.overlay
FILE1.overlay...
Set by DTC_OVERLAY_FILE.
Optional DTS format files
which override BOARD.dts
Set...
In board directory.
The "base" devicetree.
Includes .dtsi files.
In...
dtc
dtc
BOARD.dts
BOARD.dts
BINDING_1.yaml
...
BINDING_n.yaml
BINDING_1.yaml...
In zephyr/dts/bindings.
Extensible with DTS_ROOT.
Contain rules for DTS to C
code generation step.
In z...
zephyr DTS
scripts
zephyr DTS...
BOARD.dts_compiled
BOARD.dts_compiled
In build/zephyr.
DTS file, combination of BOARD.dts and overlays.
Intermediate output.
In build/zephyr....
Final outputs
in build/zephyr/include/generated/

Include C headers via <devicetree.h>
Fina...
devicetree.conf,
generated C headers.
devicetree.conf,...
\ No newline at end of file +
FILE_1.overlay
...
FILE_n.overlay
FILE_1.overlay...
Set by DTC_OVERLAY_FILE.
Optional DTS format files
which override BOARD.dts.
Set...
In board directory.
The "base" devicetree.
Includes .dtsi files.
In...
<BOARD>.dts
<BOARD>.dts
BINDING_1.yaml
...
BINDING_n.yaml
BINDING_1.yaml...
In zephyr/dts/bindings/.
Extensible with DTS_ROOT.
Contain rules for macro
generation from devicetree.
In z...
Devicetree scripts in scripts/dts/
Devicetree scri...
Intermediate output in build/zephyr/. Combination of <BOARD>.dts and overlays.
Intermediate output in bu...
Final output
in build/zephyr/include/generated/.

Include C headers via <devicetree.h>
Fina...
 devicetree.h, devicetree.conf
 devicetree.h, devicetree.conf
<BOARD>.dts.pre.tmp
<BOARD>.dts.pre.tmp
zephyr.dts
zephyr.dts
Final merged devicetree in
build/zephyr/. Just a debugging aid. Not used.
Final merged devicetree i...
dtc compiler, just to catch errors/warnings 
dtc compiler, just t...
\ No newline at end of file