From 80f63ba1fa379aefd4b974cae45da80c435e25e3 Mon Sep 17 00:00:00 2001 From: Francisco Molina Date: Tue, 1 Feb 2022 10:22:13 +0100 Subject: [PATCH 1/2] makefiles.kconfig.mk: use EXTERNAL_MODULE_DIRS in Kconfig resolution Using EXTERNAL_MODULE_PATHS works fine when only using Kconfig for configuratio, but when using it for dependencies this value is not set since it depends on Kconfig. Instead use EXTERNAL_MODULE_DIRS and filter matching on Kconfig files. --- Makefile.include | 2 ++ makefiles/kconfig.mk | 4 ++-- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/Makefile.include b/Makefile.include index e590eabef9..1c043743e7 100644 --- a/Makefile.include +++ b/Makefile.include @@ -431,6 +431,8 @@ ifeq (1,$(TEST_KCONFIG)) # Locate used packages in $(RIOTPKG). PKG_PATHS := $(sort $(foreach dir,$(RIOTPKG),\ $(foreach pkg,$(USEPKG),$(dir $(wildcard $(dir)/$(pkg)/Makefile))))) + + EXTERNAL_MODULE_PATHS := $(dir $(EXTERNAL_MODULE_KCONFIGS)) else # always select provided architecture features FEATURES_REQUIRED += $(filter arch_%,$(FEATURES_PROVIDED)) diff --git a/makefiles/kconfig.mk b/makefiles/kconfig.mk index 189d13c685..c64f1f6ebb 100644 --- a/makefiles/kconfig.mk +++ b/makefiles/kconfig.mk @@ -179,8 +179,8 @@ $(KCONFIG_GENERATED_ENV_CONFIG): FORCE | $(GENERATED_DIR) | $(LAZYSPONGE) $(LAZYSPONGE_FLAGS) $@ # All directories in EXTERNAL_MODULES_PATHS which have a Kconfig file -EXTERNAL_MODULE_KCONFIGS ?= $(sort $(foreach dir,$(EXTERNAL_MODULE_PATHS),\ - $(wildcard $(dir)/Kconfig))) +EXTERNAL_MODULE_KCONFIGS ?= $(sort $(foreach dir,$(EXTERNAL_MODULE_DIRS),\ + $(wildcard $(dir)/*/Kconfig))) # Build a Kconfig file that source all external modules configuration # files. Every EXTERNAL_MODULE_DIRS with a Kconfig file is written to # KCONFIG_EXTERNAL_CONFIGS as 'osource dir/Kconfig' From de325cdfe8bc475e73c278b5f1d299bdfb89587c Mon Sep 17 00:00:00 2001 From: Francisco Molina Date: Tue, 1 Feb 2022 10:23:52 +0100 Subject: [PATCH 2/2] tests/kconfig: also add external module dependencies --- tests/kconfig/Makefile | 4 ++++ tests/kconfig/app.config.test | 2 ++ tests/kconfig/external_modules/external_module_1/Kconfig | 4 ++++ tests/kconfig/external_modules/external_module_2/Kconfig | 4 ++++ 4 files changed, 14 insertions(+) create mode 100644 tests/kconfig/app.config.test diff --git a/tests/kconfig/Makefile b/tests/kconfig/Makefile index 5e73126239..89da973e17 100644 --- a/tests/kconfig/Makefile +++ b/tests/kconfig/Makefile @@ -4,4 +4,8 @@ USEMODULE += external_module_1 USEMODULE += external_module_2 EXTERNAL_MODULE_DIRS += external_modules +ifeq (1, $(TEST_KCONFIG)) + KCONFIG_ADD_CONFIG += $(APPDIR)/app.config +endif + include $(RIOTBASE)/Makefile.include diff --git a/tests/kconfig/app.config.test b/tests/kconfig/app.config.test new file mode 100644 index 0000000000..5cf8111726 --- /dev/null +++ b/tests/kconfig/app.config.test @@ -0,0 +1,2 @@ +CONFIG_MODULE_EXTERNAL_MODULE_1=y +CONFIG_MODULE_EXTERNAL_MODULE_2=y diff --git a/tests/kconfig/external_modules/external_module_1/Kconfig b/tests/kconfig/external_modules/external_module_1/Kconfig index 6f3306d486..d15ced618c 100644 --- a/tests/kconfig/external_modules/external_module_1/Kconfig +++ b/tests/kconfig/external_modules/external_module_1/Kconfig @@ -11,3 +11,7 @@ config EXTERNAL_MODULE_1_MESSAGE default "External Message 1 defined in Kconfig file" endif # KCONFIG_EXTERNAL_MODULE_1 + +config MODULE_EXTERNAL_MODULE_1 + bool "Select external module 2" + depends on TEST_KCONFIG diff --git a/tests/kconfig/external_modules/external_module_2/Kconfig b/tests/kconfig/external_modules/external_module_2/Kconfig index 011963dcc4..a3d36cce87 100644 --- a/tests/kconfig/external_modules/external_module_2/Kconfig +++ b/tests/kconfig/external_modules/external_module_2/Kconfig @@ -11,3 +11,7 @@ config EXTERNAL_MODULE_2_MESSAGE default "External Message 2 defined in Kconfig file" endif # KCONFIG_EXTERNAL_MODULE_2 + +config MODULE_EXTERNAL_MODULE_2 + bool "Select external module 2" + depends on TEST_KCONFIG