Skip to content

Commit fa41f4b

Browse files
mbolivar-nordicnashif
authored andcommitted
doc: update devicetree sections
Reflect the removal of BOARD.dts.pre.tmp in favor of zephyr.dts.pre in SVG diagrams. Clean up adjacent text. Signed-off-by: Martí Bolívar <[email protected]>
1 parent 2b7c61e commit fa41f4b

File tree

4 files changed

+38
-28
lines changed

4 files changed

+38
-28
lines changed

doc/guides/build/build-config-phase.svg

Lines changed: 2 additions & 1 deletion
Loading

doc/guides/build/index.rst

Lines changed: 25 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -61,8 +61,8 @@ phase (driven by CMake) and a build phase (driven by Make or Ninja).
6161
Configuration Phase
6262
-------------------
6363

64-
The configuration phase begins when the user invokes *CMake*,
65-
specifying a source application directory and a board target.
64+
The configuration phase begins when the user invokes *CMake* to generate a
65+
build system, specifying a source application directory and a board target.
6666

6767
.. figure:: build-config-phase.svg
6868
:align: center
@@ -75,7 +75,10 @@ directory, which refers to the :file:`CMakeLists.txt` file in the Zephyr
7575
top-level directory, which in turn refers to :file:`CMakeLists.txt` files
7676
throughout the build tree (directly and indirectly). Its primary output is a
7777
set of Makefiles or Ninja files to drive the build process, but the CMake
78-
scripts also do some processing of their own:
78+
scripts also do some processing of their own, which is explained here.
79+
80+
Note that paths beginning with :file:`build/` below refer to the build
81+
directory you create when running CMake.
7982

8083
Devicetree
8184
:file:`*.dts` (*devicetree source*) and :file:`*.dtsi` (*devicetree source
@@ -86,32 +89,35 @@ Devicetree
8689
preprocessor (often abbreviated *cpp*, which should not be confused with
8790
C++). The C preprocessor is also used to merge in any devicetree
8891
:file:`*.overlay` files, and to expand macros in :file:`*.dts`,
89-
:file:`*.dtsi`, and :file:`*.overlay` files.
92+
:file:`*.dtsi`, and :file:`*.overlay` files. The preprocessor output is
93+
placed in :file:`build/zephyr/zephyr.dts.pre`.
94+
95+
The preprocessed devicetree sources are parsed by
96+
:zephyr_file:`gen_defines.py <scripts/dts/gen_defines.py>` to generate a
97+
:file:`build/zephyr/include/generated/devicetree_unfixed.h` header with
98+
preprocessor macros.
9099

91-
The preprocessed devicetree sources (stored in :file:`*.dts.pre.tmp`) are
92-
parsed by :zephyr_file:`gen_defines.py <scripts/dts/gen_defines.py>` to
93-
generate a :file:`devicetree_unfixed.h` header with preprocessor macros.
100+
Source code should access preprocessor macros generated from devicetree by
101+
including the :zephyr_file:`devicetree.h <include/devicetree.h>` header,
102+
which includes :file:`devicetree_unfixed.h`.
94103

95-
As a debugging aid, :file:`gen_defines.py` writes the final devicetree to
96-
:file:`zephyr.dts`. This file is just for reference. It is not used
97-
anywhere.
104+
:file:`gen_defines.py` also writes the final devicetree to
105+
:file:`build/zephyr/zephyr.dts` in the build directory. This file's contents
106+
may be useful for debugging.
98107

99-
The ``dtc`` devicetree compiler also gets run on the preprocessed devicetree
100-
sources to catch any extra warnings and errors generated by it. The output
101-
from ``dtc`` is unused otherwise.
108+
If the devicetree compiler ``dtc`` is installed, it is run on
109+
:file:`build/zephyr/zephyr.dts` to catch any extra warnings and errors
110+
generated by this tool. The output from ``dtc`` is unused otherwise, and
111+
this step is skipped if ``dtc`` is not installed.
102112

103113
The above is just a brief overview. For more information on devicetree, see
104114
:ref:`dt-guide`.
105115

106116
Devicetree fixups
107117
Files named :file:`dts_fixup.h` from the target’s architecture, SoC, board,
108118
and application directories are concatenated into a single
109-
:file:`devicetree_fixups.h` file. :file:`dts_fixup.h` files are used to
110-
rename generated macros to names expected by the source code.
111-
112-
Source code accesses preprocessor macros generated from devicetree by
113-
including the :zephyr_file:`devicetree.h <include/devicetree.h>` header,
114-
which includes :file:`devicetree_unfixed.h` and :file:`devicetree_fixups.h`.
119+
:file:`devicetree_fixups.h` file. :file:`dts_fixup.h` files are a legacy
120+
feature which should not be used in new code.
115121

116122
Kconfig
117123
:file:`Kconfig` files define available configuration options for for the

doc/guides/dts/intro.rst

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -630,6 +630,11 @@ These are created in your application's build directory.
630630
Don't include the header files directly. :ref:`dt-from-c` explains
631631
what to do instead.
632632

633+
:file:`<build>/zephyr/zephyr.dts.pre`
634+
The preprocessed DTS source. This is an intermediate output file, which is
635+
input to :file:`gen_defines.py` and used to create :file:`zephyr.dts` and
636+
:file:`devicetree_unfixed.h`.
637+
633638
:file:`<build>/zephyr/include/generated/devicetree_unfixed.h`
634639
The generated macros and additional comments describing the devicetree.
635640
Included by ``devicetree.h``.
@@ -639,10 +644,7 @@ These are created in your application's build directory.
639644
Included by ``devicetree.h``.
640645

641646
:file:`<build>/zephyr/zephyr.dts`
642-
The final merged devicetree. This file is output by :file:`gen_defines.py`
643-
as a debugging aid, and is unused otherwise.
644-
645-
:file:`<build>/zephyr/<BOARD>.dts.pre.tmp`
646-
The preprocessed and concatenated DTS sources and overlays. This is an
647-
intermediate output file, which is used to create :file:`zephyr.dts`
648-
and :file:`devicetree_unfixed.h`.
647+
The final merged devicetree. This file is output by :file:`gen_defines.py`.
648+
It is useful for debugging any issues. If the devicetree compiler ``dtc`` is
649+
installed, it is also run on this file, to catch any additional warnings or
650+
errors.

0 commit comments

Comments
 (0)