From b2520b09a78b86b982a659805e0c65b34e3112a5 Mon Sep 17 00:00:00 2001 From: Gerard Marull-Paretas Date: Thu, 4 Aug 2022 16:54:47 +0200 Subject: [PATCH] devicetree: drop support for dts_fixup.h files Devicetree fixup files existed previous to the current stable Devicetree API. While they served their purpose, they are no longer necessary nor used in-tree. This patch drops support for this legacy feature. Signed-off-by: Gerard Marull-Paretas --- CMakeLists.txt | 29 - cmake/modules/shields.cmake | 5 - doc/build/cmake/build-config-phase.svg | 1116 +++++++++++++++++++++++- doc/build/cmake/index.rst | 6 - doc/build/dts/intro.rst | 10 - doc/build/dts/macros.bnf | 3 +- doc/develop/application/index.rst | 1 - include/zephyr/devicetree.h | 1 - 8 files changed, 1114 insertions(+), 57 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index c8f716e3041300..bdf5e0c176fcdc 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -496,35 +496,6 @@ add_custom_command( ) add_custom_target(version_h DEPENDS ${PROJECT_BINARY_DIR}/include/generated/version.h) -set_ifndef( DTS_BOARD_FIXUP_FILE ${BOARD_DIR}/dts_fixup.h) -set_ifndef( DTS_SOC_FIXUP_FILE ${SOC_DIR}/${ARCH}/${SOC_PATH}/dts_fixup.h) -set( DTS_APP_FIXUP_FILE ${APPLICATION_SOURCE_DIR}/dts_fixup.h) - -set_ifndef(DTS_CAT_OF_FIXUP_FILES ${ZEPHYR_BINARY_DIR}/include/generated/devicetree_fixups.h) - -# Concatenate the fixups into a single header file for easy -# #include'ing -file(WRITE ${DTS_CAT_OF_FIXUP_FILES}.new "/* May only be included by devicetree.h */\n\n") -set(DISCOVERED_FIXUP_FILES) -foreach(fixup_file - ${DTS_BOARD_FIXUP_FILE} - ${DTS_SOC_FIXUP_FILE} - ${DTS_APP_FIXUP_FILE} - ${shield_dts_fixups} - ) - if(EXISTS ${fixup_file}) - file(READ ${fixup_file} contents) - file(APPEND ${DTS_CAT_OF_FIXUP_FILES}.new "${contents}") - string(APPEND DISCOVERED_FIXUP_FILES "- ${fixup_file}\n") - endif() -endforeach() -zephyr_file_copy(${DTS_CAT_OF_FIXUP_FILES}.new ${DTS_CAT_OF_FIXUP_FILES} ONLY_IF_DIFFERENT) -file(REMOVE ${DTS_CAT_OF_FIXUP_FILES}.new) - -if (DISCOVERED_FIXUP_FILES) - message(WARNING "One or more dts_fixup.h files detected:\n${DISCOVERED_FIXUP_FILES}Use of these files is deprecated; use the devicetree.h API instead.") -endif() - # Unfortunately, the order in which CMakeLists.txt code is processed # matters so we need to be careful about how we order the processing # of subdirectories. One example is "Compiler flags added late in the diff --git a/cmake/modules/shields.cmake b/cmake/modules/shields.cmake index 4c5de4dc02bfbf..ba21a4800d9346 100644 --- a/cmake/modules/shields.cmake +++ b/cmake/modules/shields.cmake @@ -80,11 +80,6 @@ foreach(root ${BOARD_ROOT}) ${SHIELD_DIR_${s}}/${s}.overlay ) - list(APPEND - shield_dts_fixups - ${SHIELD_DIR_${s}}/dts_fixup.h - ) - list(APPEND SHIELD_DIRS ${SHIELD_DIR_${s}} diff --git a/doc/build/cmake/build-config-phase.svg b/doc/build/cmake/build-config-phase.svg index 109d8dd64c509b..f2e234c2c4c096 100644 --- a/doc/build/cmake/build-config-phase.svg +++ b/doc/build/cmake/build-config-phase.svg @@ -1,4 +1,1114 @@ - + - -
C preprocessor
C preprocessor

*.dts/*.dtsi files

*.dts/*.dtsi files

Bindings (YAML files)

Bindings (YAML files)

Kconfig files

Kconfig files
Preprocessed devicetree,
zephyr.dts.pre
Preprocessed devicetree,...

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 (optional, for warnings/errors)
dtc (optional, for warning...
Kconfig can read devicetree data
Kconfig can rea...
Outputs
Outputs
Makefile or Ninja file (from CMake)
Makefile or Ninja file (...

Final devicetree, zephyr.dts

Final devicetree, zephyr.dts
Viewer does not support full SVG 1.1
\ No newline at end of file + + + + + + + + + + + + + + + + + + C preprocessor + + + + + + C preprocessor + + + + + + + + + + + + + + *.dts +/*.dtsi + files + + + + + + + + + *.dts/*.dtsi files + + + + + + + + + + + + + Bindings + + (YAML files) + + + + + + + + Bindings (YAML files) + + + + + + + + + + + + + + Kconfig + files + + + + + + Kconfig files + + + + + + + + + + + + + Preprocessed devicetree, + + + + zephyr.dts.pre + + + + + + + Preprocessed devicetree,... + + + + + + + + + + + + + + devicetree_unfixed.h + + + + + + + + devicetree_unfixed.h... + + + + + + + + + + + autoconf.h + + + + + + + autoconf.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 + (optional, for warnings/errors) + + + + + + dtc (optional, for warning... + + + + + + + + + + + Kconfig can read devicetree data + + + + Kconfig can rea... + + + + + + + + + + Outputs + + + + + Outputs + + + + + + + + + + + Makefile or Ninja file (from CMake) + + + + + + + Makefile or Ninja file (... + + + + + + + + + + + + Final devicetree, zephyr.dts + + + + + + + + Final devicetree, zephyr.dts + + + + + + + Viewer does not support full SVG 1.1 + + + diff --git a/doc/build/cmake/index.rst b/doc/build/cmake/index.rst index 01cdce66430461..72ec8b8a0bb913 100644 --- a/doc/build/cmake/index.rst +++ b/doc/build/cmake/index.rst @@ -107,12 +107,6 @@ Devicetree The above is just a brief overview. For more information on devicetree, see :ref:`dt-guide`. -Devicetree fixups - Files named :file:`dts_fixup.h` from the target’s architecture, SoC, board, - and application directories are concatenated into a single - :file:`devicetree_fixups.h` file. :file:`dts_fixup.h` files are a legacy - feature which should not be used in new code. - Kconfig :file:`Kconfig` files define available configuration options for for the target architecture, SoC, board, and application, as well as dependencies diff --git a/doc/build/dts/intro.rst b/doc/build/dts/intro.rst index 400e215a2e2b4d..798d76bef4d07d 100644 --- a/doc/build/dts/intro.rst +++ b/doc/build/dts/intro.rst @@ -589,12 +589,6 @@ the contents of devicetree sources, includes, and overlays in a way that allows the build system to generate C macros usable by device drivers and applications. The :file:`dts/bindings` directory contains bindings. -Zephyr currently uses :file:`dts_fixup.h` files to rename macros in -:file:`devicetree_unfixed.h` to names that are currently in use by C code. The -build system looks for fixup files in the :file:`zephyr/boards/` and -:file:`zephyr/soc/` directories by default. Fixup files exist for historical -reasons. New code should generally avoid them. - .. _dt-scripts: Scripts and tools @@ -648,10 +642,6 @@ These are created in your application's build directory. The generated macros and additional comments describing the devicetree. Included by ``devicetree.h``. -:file:`/zephyr/include/generated/devicetree_fixups.h` - The concatenated contents of any :file:`dts_fixup.h` files. - Included by ``devicetree.h``. - :file:`/zephyr/zephyr.dts` The final merged devicetree. This file is output by :file:`gen_defines.py`. It is useful for debugging any issues. If the devicetree compiler ``dtc`` is diff --git a/doc/build/dts/macros.bnf b/doc/build/dts/macros.bnf index 55077e44cf3840..ce61c5360aa518 100644 --- a/doc/build/dts/macros.bnf +++ b/doc/build/dts/macros.bnf @@ -2,8 +2,7 @@ ; ; This does *not* cover macros pulled out of DT via Kconfig, ; like CONFIG_SRAM_BASE_ADDRESS, etc. It only describes the -; ones that start with DT_ and are directly generated, not -; defined in a dts_fixup.h file. +; ones that start with DT_ and are directly generated. ; -------------------------------------------------------------------- ; dt-macro: the top level nonterminal for a devicetree macro diff --git a/doc/develop/application/index.rst b/doc/develop/application/index.rst index abedbeee2832ca..335138ca9cece5 100644 --- a/doc/develop/application/index.rst +++ b/doc/develop/application/index.rst @@ -1105,7 +1105,6 @@ Zephyr board, and provide the following files:: board.h CMakeLists.txt doc/ - dts_fixup.h Kconfig.board Kconfig.defconfig pinmux.c diff --git a/include/zephyr/devicetree.h b/include/zephyr/devicetree.h index 9df9f325f75d7f..25dfc9cc46c2f9 100644 --- a/include/zephyr/devicetree.h +++ b/include/zephyr/devicetree.h @@ -17,7 +17,6 @@ #define DEVICETREE_H #include -#include #include