1
0
mirror of https://github.com/RIOT-OS/RIOT.git synced 2024-12-29 04:50:03 +01:00

makefiles/dependency_resolution: add outer loop for DEFAULT_MODULE deps

Some DEFAULT_MODULEs in tree have dependencies of their own. This is
usually done for aliases of init modules, and do not have dependencies
themselves.

This adds the final stage to dependency resolutions where DEFAULT_MODULEs
dependencies MAY be included. These included modules MUST NOT have
dependencies themselves.

This allows for modules to disable DEFAULT_MODULEs during dependencies
resolution independent of the inclusion order.

auto_init and periph_init modules are moved to this outer-loop, allowing
therefore for modules to disable them during the dependency resolution
This commit is contained in:
Francisco Molina 2022-02-09 14:25:04 +01:00
parent 08dc06d5e0
commit 25e670e263
4 changed files with 41 additions and 33 deletions

View File

@ -0,0 +1,3 @@
# This files contains dependencies for default modules. They are parsed at the
# end of the dependency loop. They MAY inlcude new modules, but this modules
# MUST NOT have dependencies themselfs.

View File

@ -1,10 +1,5 @@
DEFAULT_MODULE += board cpu core core_init core_msg core_panic sys
DEFAULT_MODULE += auto_init
# Initialize all used peripherals by default
DEFAULT_MODULE += periph_init
# Include potentially added default modules by the board
-include $(BOARDDIR)/Makefile.default

View File

@ -35,15 +35,27 @@ NEW_STATE := $(USEMODULE) $(USEPKG) $(FEATURES_USED)
ifneq ($(OLD_STATE),$(NEW_STATE))
include $(RIOTMAKE)/dependency_resolution.inc.mk
else
# Include late allowing them to have been disabled during dependency resolution
DEFAULT_MODULE += auto_init periph_init
USEMODULE += $(filter-out $(DISABLE_MODULE),auto_init periph_init)
# If module auto_init is not used, silently disable all of its submodules
ifeq (,$(filter auto_init,$(USEMODULE)))
DISABLE_MODULE += auto_init_%
endif
# add default modules again, as $(DEFAULT_MODULE) might have been extended
# during dependency processing
# If module periph_init is not used, silently disable all of its submodules
ifeq (,$(filter periph_init,$(USEMODULE)))
DISABLE_MODULE += periph_init_%
endif
# Add default modules again, as $(DEFAULT_MODULE) might have been extended
# during dependency resolution
USEMODULE += $(filter-out $(DISABLE_MODULE),$(DEFAULT_MODULE))
# Include eventual dependencies for default modules
include $(RIOTMAKE)/default_modules.deps.mk
# Sort and de-duplicate used modules and default modules for readability
USEMODULE := $(sort $(USEMODULE))
DEFAULT_MODULE := $(sort $(DEFAULT_MODULE))

View File

@ -10,32 +10,30 @@ PERIPH_FEATURES := $(filter periph_%,$(FEATURES_USED))
USEMODULE += $(PERIPH_FEATURES)
# Add all USED periph_% init modules unless they are blacklisted
ifneq (,$(filter periph_init, $(USEMODULE)))
PERIPH_IGNORE_MODULES := \
periph_init% \
periph_common \
periph_flexcomm \
periph_gpio_mux \
periph_i2c_hw \
periph_i2c_sw \
periph_rtc_ms \
periph_mcg \
periph_wdog \
periph_flash \
periph_rtc_rtt \
periph_rtt_hw_rtc \
periph_rtt_hw_sys \
periph_clic \
periph_coretimer \
periph_plic \
periph_spi_on_qspi
#
PERIPH_MODULES := $(filter-out $(PERIPH_IGNORE_MODULES),\
$(filter periph_%,$(USEMODULE)))
# Use simple expansion to avoid USEMODULE referencing itself
PERIPH_INIT_MODULES := $(subst periph_,periph_init_,$(PERIPH_MODULES))
DEFAULT_MODULE += $(PERIPH_INIT_MODULES)
endif
PERIPH_IGNORE_MODULES := \
periph_init% \
periph_common \
periph_flexcomm \
periph_gpio_mux \
periph_i2c_hw \
periph_i2c_sw \
periph_rtc_ms \
periph_mcg \
periph_wdog \
periph_flash \
periph_rtc_rtt \
periph_rtt_hw_rtc \
periph_rtt_hw_sys \
periph_clic \
periph_coretimer \
periph_plic \
periph_spi_on_qspi
#
PERIPH_MODULES := $(filter-out $(PERIPH_IGNORE_MODULES),\
$(filter periph_%,$(USEMODULE)))
# Use simple expansion to avoid USEMODULE referencing itself
PERIPH_INIT_MODULES := $(subst periph_,periph_init_,$(PERIPH_MODULES))
DEFAULT_MODULE += $(PERIPH_INIT_MODULES)
# select cpu_check_address pseudomodule if the corresponding feature is used
USEMODULE += $(filter cpu_check_address, $(FEATURES_USED))