diff --git a/cmake/modules/dts.cmake b/cmake/modules/dts.cmake index e0edb90b568..df378b4d704 100644 --- a/cmake/modules/dts.cmake +++ b/cmake/modules/dts.cmake @@ -35,6 +35,10 @@ set(DTS_DEPS ${PROJECT_BINARY_DIR}/zephyr.dts.d) # This is relative to each element of DTS_ROOT. set(VENDOR_PREFIXES dts/bindings/vendor-prefixes.txt) +# Devicetree in Kconfig. +set(GEN_DRIVER_KCONFIG_SCRIPT ${ZEPHYR_BASE}/scripts/dts/gen_driver_kconfig_dts.py) +set(DTS_KCONFIG ${KCONFIG_BINARY_DIR}/Kconfig.dts) + # Devicetree in CMake. set(DTS_CMAKE_SCRIPT ${ZEPHYR_BASE}/scripts/dts/gen_dts_cmake.py) set(DTS_CMAKE ${PROJECT_BINARY_DIR}/dts.cmake) @@ -196,6 +200,7 @@ if(SUPPORTS_DTS) CMAKE_CONFIGURE_DEPENDS ${include_files} ${GEN_DEFINES_SCRIPT} + ${GEN_DRIVER_KCONFIG_SCRIPT} ${DTS_CMAKE_SCRIPT} ) @@ -233,6 +238,18 @@ if(SUPPORTS_DTS) message(STATUS "Generated device_extern.h: ${DEVICE_EXTERN_H}") endif() + + execute_process( + COMMAND ${PYTHON_EXECUTABLE} ${GEN_DRIVER_KCONFIG_SCRIPT} + --kconfig-out ${DTS_KCONFIG} + --bindings-dirs ${DTS_ROOT_BINDINGS} + WORKING_DIRECTORY ${PROJECT_BINARY_DIR} + RESULT_VARIABLE ret + ) + if(NOT "${ret}" STREQUAL "0") + message(FATAL_ERROR "gen_driver_kconfig_dts.py failed with return code: ${ret}") + endif() + execute_process( COMMAND ${PYTHON_EXECUTABLE} ${DTS_CMAKE_SCRIPT} --edt-pickle ${EDT_PICKLE} diff --git a/dts/Kconfig b/dts/Kconfig index 5d2c9d90571..21bc7020326 100644 --- a/dts/Kconfig +++ b/dts/Kconfig @@ -5,3 +5,9 @@ config HAS_DTS help This option specifies that the target platform supports device tree configuration. + +menu "Devicetree Info" + +source "$(KCONFIG_BINARY_DIR)/Kconfig.dts" + +endmenu