Lines Matching +full:dts +full:- +full:bindings
1 # SPDX-License-Identifier: Apache-2.0
15 # - To Zephyr and application source code files, as a C macro API
18 # - To other arbitrary Python scripts (like twister) using a
22 # - To users as a final devicetree source (DTS) file which can
25 # - To CMake files, after this module has finished running, using
28 # - To Kconfig files, both using some Kconfig symbols we generate
36 # files in scripts/dts to make all this work. We also optionally will
44 # - The pre_dt module has been included; refer to its outcome
46 # - DTS_SOURCE: set to the path to the devicetree file which
48 # - ${BINARY_DIR_INCLUDE_GENERATED}/devicetree_generated.h exists
53 # - CACHED_DTS_ROOT_BINDINGS is set in the cache to the
55 # - DTS_ROOT_BINDINGS is set to a ;-list of locations where DT
56 # bindings were found
57 # - ${PROJECT_BINARY_DIR}/zephyr.dts exists
58 # - ${PROJECT_BINARY_DIR}/edt.pickle exists
59 # - ${KCONFIG_BINARY_DIR}/Kconfig.dts exists
60 # - DTS_INCLUDE_FILES is set to a ;-list of all devicetree files
63 # - the devicetree extensions in the extensions.cmake module
68 # - BINARY_DIR_INCLUDE_GENERATED: where to put generated include files
69 # - DTS_ROOT: a deduplicated list of places where devicetree
70 # implementation files (like bindings, vendor prefixes, etc.) are
72 # - DTS_ROOT_SYSTEM_INCLUDE_DIRS: set to "PATH1 PATH2 ...",
75 # - KCONFIG_BINARY_DIR: where to put generated Kconfig files
78 # - BOARD: board name to use when looking for DTS_SOURCE
79 # - BOARD_DIRECTORIES: list of board directories to use when looking for DTS_SOURCE
80 # - BOARD_REVISION_STRING: used when looking for a board revision's
82 # - CMAKE_DTS_PREPROCESSOR: the path to the preprocessor to use
84 # - DTC_OVERLAY_FILE: list of devicetree overlay files which will be
86 # - EXTRA_DTC_OVERLAY_FILE: list of extra devicetree overlay files.
90 # - EXTRA_DTC_FLAGS: list of extra command line options to pass to
93 # - DTS_EXTRA_CPPFLAGS: extra command line options to pass to the
95 # - DTS_SOURCE: the devicetree source file to use may be pre-set
97 # ${BOARD_DIRECTORIES}/<normalized_board_target>.dts
100 # use only, and may be removed, renamed, or re-purposed without prior notice.
103 set(DT_SCRIPTS ${ZEPHYR_BASE}/scripts/dts)
112 # The generated file containing the final DTS, for debugging.
113 set(ZEPHYR_DTS ${PROJECT_BINARY_DIR}/zephyr.dts)
117 set(DTS_POST_CPP ${PROJECT_BINARY_DIR}/zephyr.dts.pre)
118 set(DTS_DEPS ${PROJECT_BINARY_DIR}/zephyr.dts.d)
123 set(DTS_KCONFIG ${KCONFIG_BINARY_DIR}/Kconfig.dts)
129 set(DTS_CMAKE ${PROJECT_BINARY_DIR}/dts.cmake)
134 set(VENDOR_PREFIXES dts/bindings/vendor-prefixes.txt)
141 if(EXISTS ${dir}/${shortened_board_string}.dts AND NOT BOARD_${BOARD}_SINGLE_SOC)
143 "(${shortened_board_string}.dts) not allowed, use '<board>_<soc>.dts' naming"
145 elseif(EXISTS ${dir}/${board_string}.dts AND EXISTS ${dir}/${shortened_board_string}.dts)
147 "${board_string}.dts and ${shortened_board_string}.dts. "
148 "Please choose one naming style, ${board_string}.dts is recommended."
150 elseif(EXISTS ${dir}/${board_string}.dts)
151 set(DTS_SOURCE ${dir}/${board_string}.dts)
152 elseif(EXISTS ${dir}/${shortened_board_string}.dts)
153 set(DTS_SOURCE ${dir}/${shortened_board_string}.dts)
159 # We found a devicetree. Append all relevant dts overlays we can find...
160 zephyr_file(CONF_FILES ${BOARD_DIRECTORIES} DTS DTS_SOURCE)
164 DTS no_rev_suffix_dts_board_overlays
173 set(DTS_SOURCE ${ZEPHYR_BASE}/boards/common/stub.dts)
177 # Find all the DTS files we need to concatenate and preprocess, as
178 # well as all the devicetree bindings and vendor prefixes associated
182 zephyr_file(CONF_FILES ${BOARD_EXTENSION_DIRS} DTS board_extension_dts_files)
193 build_info(devicetree user-files PATH ${DTC_OVERLAY_FILE_AS_LIST})
203 build_info(devicetree extra-user-files PATH ${EXTRA_DTC_OVERLAY_FILE_AS_LIST})
213 message(STATUS "Found BOARD.dts: ${dts_file}")
223 set(bindings_path ${dts_root}/dts/bindings)
233 list(APPEND EXTRA_GEN_EDT_ARGS --vendor-prefixes ${vendor_prefixes})
237 # Cache the location of the root bindings so they can be used by
240 "DT bindings root directories")
249 # challenging is this? Can we cache the dts dependencies?
251 # Run the preprocessor on the DTS input files.
268 # Make sure we re-run CMake if any devicetree sources or transitive
279 # build system to re-run CMake.
295 --dts ${DTS_POST_CPP}
296 --dtc-flags '${EXTRA_DTC_FLAGS_RAW}'
297 --bindings-dirs ${DTS_ROOT_BINDINGS}
298 --dts-out ${ZEPHYR_DTS}.new # for debugging and dtc
299 --edt-pickle-out ${EDT_PICKLE}.new
311 message(STATUS "Generated zephyr.dts: ${ZEPHYR_DTS}")
319 --header-out ${DEVICETREE_GENERATED_H}.new
320 --edt-pickle ${EDT_PICKLE}
331 message(STATUS "Generated zephyr.dts: ${ZEPHYR_DTS}")
340 --kconfig-out ${DTS_KCONFIG}
341 --bindings-dirs ${DTS_ROOT_BINDINGS}
353 # cycle when sysbuild is used of configuring and building multiple times due to the dts.cmake file
361 --edt-pickle ${EDT_PICKLE}
362 --cmake-out ${dts_cmake_tmp}
372 message(STATUS "Including generated dts.cmake file: ${DTS_CMAKE}")
385 check_dtc_flag("-Wunique_unit_address_if_enabled" check)
387 set(DTC_WARN_UNIT_ADDR_IF_ENABLED "-Wunique_unit_address_if_enabled")
391 check_dtc_flag("-Wno-unique_unit_address" check)
393 set(DTC_NO_WARN_UNIT_ADDR "-Wno-unique_unit_address")
407 -O dts
408 -o - # Write output to stdout, which we discard below
409 -b 0
410 -E unit_address_vs_reg
431 build_info(devicetree include-dirs PATH ${DTS_ROOT_SYSTEM_INCLUDE_DIRS})
432 build_info(devicetree bindings-dirs PATH ${DTS_ROOT_BINDINGS})