diff --git a/Kconfig.zephyr b/Kconfig.zephyr index 42d2d163cfb..e195ed31c72 100644 --- a/Kconfig.zephyr +++ b/Kconfig.zephyr @@ -14,9 +14,17 @@ # precedence over SoC defaults, so include them in that order. # # $ARCH and $BOARD_DIR will be glob patterns when building documentation. -source "$(KCONFIG_BINARY_DIR)/Kconfig.shield.defconfig" +# This loads custom shields defconfigs (from BOARD_ROOT) +osource "$(KCONFIG_BINARY_DIR)/Kconfig.shield.defconfig" +# This loads Zephyr base shield defconfigs +source "boards/shields/*/Kconfig.defconfig" + source "$(BOARD_DIR)/Kconfig.defconfig" -source "$(KCONFIG_BINARY_DIR)/Kconfig.soc.defconfig" + +# This loads custom SoC root defconfigs +osource "$(KCONFIG_BINARY_DIR)/Kconfig.soc.defconfig" +# This loads Zephyr base SoC root defconfigs +osource "soc/$(ARCH)/*/Kconfig.defconfig" menu "Modules" diff --git a/boards/Kconfig b/boards/Kconfig index 23bb55591ae..650ea3144c0 100644 --- a/boards/Kconfig +++ b/boards/Kconfig @@ -25,7 +25,10 @@ endchoice # Parse shields references # Don't do it as a menuconfig, as shield selection is a CMake feature. -source "$(KCONFIG_BINARY_DIR)/Kconfig.shield" +# This loads custom shields Kconfig (from BOARD_ROOT) +osource "$(KCONFIG_BINARY_DIR)/Kconfig.shield" +# This loads Zephyr base shield defconfigs +rsource "shields/*/Kconfig.shield" menu "Board Options" config QEMU_ICOUNT diff --git a/cmake/kconfig.cmake b/cmake/kconfig.cmake index c290d684a69..979aa164fe1 100644 --- a/cmake/kconfig.cmake +++ b/cmake/kconfig.cmake @@ -5,9 +5,11 @@ file(MAKE_DIRECTORY ${PROJECT_BINARY_DIR}/kconfig/include/generated) file(MAKE_DIRECTORY ${PROJECT_BINARY_DIR}/kconfig/include/config) -# Support multiple SOC_ROOT +# Support multiple SOC_ROOT, remove ZEPHYR_BASE as that is always sourced. +set(kconfig_soc_root ${SOC_ROOT}) +list(REMOVE_ITEM kconfig_soc_root ${ZEPHYR_BASE}) set(OPERATION WRITE) -foreach(root ${SOC_ROOT}) +foreach(root ${kconfig_soc_root}) file(${OPERATION} ${KCONFIG_BINARY_DIR}/Kconfig.soc.defconfig "osource \"${root}/soc/$(ARCH)/*/Kconfig.defconfig\"\n" ) @@ -21,9 +23,11 @@ foreach(root ${SOC_ROOT}) set(OPERATION APPEND) endforeach() -# Support multiple shields in BOARD_ROOT +# Support multiple shields in BOARD_ROOT, remove ZEPHYR_BASE as that is always sourced. +set(kconfig_board_root ${BOARD_ROOT}) +list(REMOVE_ITEM kconfig_board_root ${ZEPHYR_BASE}) set(OPERATION WRITE) -foreach(root ${BOARD_ROOT}) +foreach(root ${kconfig_board_root}) file(${OPERATION} ${KCONFIG_BINARY_DIR}/Kconfig.shield.defconfig "osource \"${root}/boards/shields/*/Kconfig.defconfig\"\n" ) diff --git a/doc/CMakeLists.txt b/doc/CMakeLists.txt index 4d0f90a4364..a17bf9dab6b 100644 --- a/doc/CMakeLists.txt +++ b/doc/CMakeLists.txt @@ -118,23 +118,6 @@ set(FIX_TEX_SCRIPT ${ZEPHYR_BASE}/doc/_scripts/fix_tex.py) # Generated Kconfig .rst documents # -file(WRITE ${KCONFIG_BINARY_DIR}/Kconfig.soc.defconfig - "osource \"${ZEPHYR_BASE}/soc/$(ARCH)/*/Kconfig.defconfig\"\n" -) -file(WRITE ${KCONFIG_BINARY_DIR}/Kconfig.soc - "osource \"${ZEPHYR_BASE}/soc/$(ARCH)/*/Kconfig.soc\"\n" -) -file(WRITE ${KCONFIG_BINARY_DIR}/Kconfig.shield.defconfig - "osource \"${ZEPHYR_BASE}/boards/shields/*/Kconfig.defconfig\"\n" -) -file(WRITE ${KCONFIG_BINARY_DIR}/Kconfig.shield - "osource \"${ZEPHYR_BASE}/boards/shields/*/Kconfig.shield\"\n" -) -file(WRITE ${KCONFIG_BINARY_DIR}/Kconfig.soc.arch - "osource \"${ZEPHYR_BASE}/soc/$(ARCH)/Kconfig\"\n" - "osource \"${ZEPHYR_BASE}/soc/$(ARCH)/*/Kconfig\"\n" -) - foreach(module_name ${ZEPHYR_MODULE_NAMES}) zephyr_string(SANITIZE TOUPPER MODULE_NAME_UPPER ${module_name}) list(APPEND diff --git a/soc/Kconfig b/soc/Kconfig index dd472f31807..da9febef2ce 100644 --- a/soc/Kconfig +++ b/soc/Kconfig @@ -3,13 +3,19 @@ choice prompt "SoC/CPU/Configuration Selection" -source "$(KCONFIG_BINARY_DIR)/Kconfig.soc" +# This loads custom SoC root Kconfig (only available if custom SoC root are defined) +osource "$(KCONFIG_BINARY_DIR)/Kconfig.soc" +# This loads Zephyr base SoC root Kconfig +osource "soc/$(ARCH)/*/Kconfig.soc" endchoice menu "Hardware Configuration" -source "$(KCONFIG_BINARY_DIR)/Kconfig.soc.arch" - +# This loads custom SoC root Kconfig (only available if custom SoC root are defined) +osource "$(KCONFIG_BINARY_DIR)/Kconfig.soc.arch" +# This loads Zephyr base SoC Kconfigs +osource "soc/$(ARCH)/Kconfig" +osource "soc/$(ARCH)/*/Kconfig" module = SOC module-str = SOC