diff --git a/cpu/efm32/periph/Kconfig b/cpu/efm32/periph/Kconfig index 1e9b41564278..5f8217d5feed 100644 --- a/cpu/efm32/periph/Kconfig +++ b/cpu/efm32/periph/Kconfig @@ -39,14 +39,14 @@ config MODULE_PERIPH_RTC_SERIES1 help RTC driver implementation for EFM32 series 1. -config MODULE_PERIPH_RTT_SERIES0 +config PERIPH_RTT_SERIES0 bool depends on CPU_EFM32_SERIES0 default MODULE_PERIPH_RTT help RTT driver implementation for EFM32 series 0. -config MODULE_PERIPH_RTT_SERIES1 +config PERIPH_RTT_SERIES1 bool depends on CPU_EFM32_SERIES1 default MODULE_PERIPH_RTT diff --git a/cpu/qn908x/periph/Kconfig b/cpu/qn908x/periph/Kconfig index a6cde8579087..84d2249a34e3 100644 --- a/cpu/qn908x/periph/Kconfig +++ b/cpu/qn908x/periph/Kconfig @@ -21,6 +21,4 @@ config MODULE_PERIPH_GPIO_MUX config MODULE_PERIPH_ADC bool "ADC peripheral driver" depends on HAS_PERIPH_ADC - select MODULE_ZTIMER - select MODULE_ZTIMER_USEC - select MODULE_ZTIMER_PERIPH_TIMER + select ZTIMER_USEC diff --git a/drivers/ccs811/Kconfig b/drivers/ccs811/Kconfig index 0a6fecb79f8f..a70f787c673f 100644 --- a/drivers/ccs811/Kconfig +++ b/drivers/ccs811/Kconfig @@ -14,9 +14,7 @@ menuconfig MODULE_CCS811 depends on TEST_KCONFIG select MODULE_PERIPH_GPIO select MODULE_PERIPH_I2C - select MODULE_ZTIMER - select MODULE_ZTIMER_USEC - select MODULE_ZTIMER_PERIPH_TIMER + select ZTIMER_USEC config MODULE_CCS811_FULL bool "Full functionalities" diff --git a/makefiles/boards/ztimer_only.dep.mk b/makefiles/boards/ztimer_only.dep.mk index f50810a051bd..e6e5e86b19f4 100644 --- a/makefiles/boards/ztimer_only.dep.mk +++ b/makefiles/boards/ztimer_only.dep.mk @@ -1,11 +1,11 @@ # Include this for boards whose timer periph cannot generate a clock frequency # suitable for xtimer with the available clock sources and dividers. # This will use ztimer to perform the required frequency conversion. -# By default, xtimer is still used with ztimer as backed, unless -# ztimer_xtimer_compat is used. +# By default, ztimer_xtimer_compat is used unless xtimer_on_ztimer is +# selected. ifneq (,$(filter xtimer,$(USEMODULE))) - ifeq (,$(filter ztimer_xtimer_compat ztimer64_xtimer_compat,$(USEMODULE))) - USEMODULE += xtimer_on_ztimer + ifeq (,$(filter xtimer_on_ztimer,$(USEMODULE))) + USEMODULE += ztimer_xtimer_compat endif endif diff --git a/makefiles/default_modules.deps.mk b/makefiles/default_modules.deps.mk index fa98d2c0ae87..b128a73292be 100644 --- a/makefiles/default_modules.deps.mk +++ b/makefiles/default_modules.deps.mk @@ -13,3 +13,9 @@ endif ifneq (,$(filter auto_init_saul,$(USEMODULE))) USEMODULE += saul_init_devs endif + +ifneq (,$(filter xtimer,$(USEMODULE))) + ifeq (,$(filter ztimer_xtimer_compat,$(USEMODULE))) + USEMODULE += div + endif +endif diff --git a/makefiles/pseudomodules.inc.mk b/makefiles/pseudomodules.inc.mk index 67a54b314cf2..fe812ef5c995 100644 --- a/makefiles/pseudomodules.inc.mk +++ b/makefiles/pseudomodules.inc.mk @@ -257,6 +257,7 @@ PSEUDOMODULES += vfs_default PSEUDOMODULES += wakaama_objects_% PSEUDOMODULES += wifi_enterprise PSEUDOMODULES += xtimer_on_ztimer +PSEUDOMODULES += xtimer_no_ztimer_default PSEUDOMODULES += zptr PSEUDOMODULES += ztimer PSEUDOMODULES += ztimer_% diff --git a/pkg/u8g2/Kconfig b/pkg/u8g2/Kconfig index 80ab54d0a4de..9f5db5ee775d 100644 --- a/pkg/u8g2/Kconfig +++ b/pkg/u8g2/Kconfig @@ -10,8 +10,7 @@ config PACKAGE_U8G2 depends on TEST_KCONFIG depends on HAS_PERIPH_GPIO select MODULE_PERIPH_GPIO - select MODULE_ZTIMER - select MODULE_ZTIMER_USEC + select ZTIMER_USEC select MODULE_U8G2_RIOT select MODULE_U8G2_CSRC diff --git a/pkg/ucglib/Kconfig b/pkg/ucglib/Kconfig index 5e40bcbe9b50..9d181b1d124a 100644 --- a/pkg/ucglib/Kconfig +++ b/pkg/ucglib/Kconfig @@ -10,8 +10,7 @@ config PACKAGE_UCGLIB depends on TEST_KCONFIG depends on HAS_PERIPH_GPIO select MODULE_PERIPH_GPIO - select MODULE_ZTIMER - select MODULE_ZTIMER_USEC + select ZTIMER_USEC select MODULE_UCGLIB_RIOT select MODULE_UCGLIB_CSRC diff --git a/sys/Makefile.dep b/sys/Makefile.dep index bade0af71982..beee33facf46 100644 --- a/sys/Makefile.dep +++ b/sys/Makefile.dep @@ -857,20 +857,7 @@ endif # handle xtimer's deps. Needs to be done *after* ztimer ifneq (,$(filter xtimer,$(USEMODULE))) - ifeq (,$(filter ztimer_xtimer_compat,$(USEMODULE))) - # xtimer is used, ztimer xtimer wrapper is not - DEFAULT_MODULE += auto_init_xtimer - USEMODULE += div - ifeq (,$(filter xtimer_on_ztimer,$(USEMODULE))) - # ztimer is not used, so use *periph_timer as low-level timer*. - FEATURES_REQUIRED += periph_timer - else - # will use *ztimer_usec as low-level timer* - endif - else - # ztimer_xtimer_compat is used, all of *xtimer's API will be mapped on ztimer - # or ztimer64 * - endif + include $(RIOTBASE)/sys/xtimer/Makefile.dep endif ifneq (,$(filter devfs_hwrng,$(USEMODULE))) diff --git a/sys/shell/commands/sc_gnrc_udp.c b/sys/shell/commands/sc_gnrc_udp.c index 4da0576e4556..db9cb2cef32c 100644 --- a/sys/shell/commands/sc_gnrc_udp.c +++ b/sys/shell/commands/sc_gnrc_udp.c @@ -31,9 +31,10 @@ #include "net/utils.h" #include "timex.h" #include "utlist.h" -#if IS_USED(MODULE_ZTIMER) +#if IS_USED(MODULE_ZTIMER_USEC) || IS_USED(MODULE_ZTIMER_MSEC) #include "ztimer.h" -#else +#endif +#if IS_USED(MODULE_XTIMER) #include "xtimer.h" #endif diff --git a/sys/trace/Kconfig b/sys/trace/Kconfig index e9f7edcc3cc0..db3ebce9be76 100644 --- a/sys/trace/Kconfig +++ b/sys/trace/Kconfig @@ -8,6 +8,4 @@ config MODULE_TRACE bool "Trace program flows" depends on TEST_KCONFIG - select MODULE_ZTIMER - select MODULE_ZTIMER_USEC - select MODULE_ZTIMER_PERIPH_TIMER + select ZTIMER_USEC diff --git a/sys/xtimer/Kconfig b/sys/xtimer/Kconfig index fdfeebb5b724..b4de1eb6e582 100644 --- a/sys/xtimer/Kconfig +++ b/sys/xtimer/Kconfig @@ -8,17 +8,22 @@ menuconfig MODULE_XTIMER bool "xtimer" depends on HAS_PERIPH_TIMER - depends on TEST_KCONFIG - # use timer peripheral unless ztimer compatibility module is used - select MODULE_PERIPH_TIMER if HAS_PERIPH_TIMER && !MODULE_XTIMER_ON_ZTIMER && !MODULE_ZTIMER_XTIMER_COMPAT && !MODULE_ZTIMER64_XTIMER_COMPAT - + select MODULE_PERIPH_TIMER select MODULE_DIV if !MODULE_ZTIMER_XTIMER_COMPAT + select ZTIMER_USEC if !MODULE_XTIMER_NO_ZTIMER_DEFAULT help Include xtimer module. xtimer requires a low-level timer implementation that can be provided either by a peripheral timer or the ztimer module when MODULE_XTIMER_ON_ZTIMER is enabled. +if MODULE_XTIMER + +config MODULE_XTIMER_NO_ZTIMER_DEFAULT + bool "xtimer does not select ztimer" + default y + config MODULE_AUTO_INIT_XTIMER bool "Auto-init xtimer" default y if MODULE_AUTO_INIT && !MODULE_ZTIMER_XTIMER_COMPAT - depends on MODULE_XTIMER + +endif # MODULE_XTIMER diff --git a/sys/xtimer/Makefile.dep b/sys/xtimer/Makefile.dep new file mode 100644 index 000000000000..4d141a49aadf --- /dev/null +++ b/sys/xtimer/Makefile.dep @@ -0,0 +1,31 @@ +DEFAULT_MODULE += auto_init_xtimer +# In whatever combination of backends periph_timer will be required +# - xtimer (only) -> periph_timer +# - xtimer_on_ztimer -> ztimer_usec -> ztimer_periph_timer -> periph_timer +# - ztimer_xtimer_compat -> ztimer_usec -> ztimer_periph_timer -> periph_timer +# But requesting it here avoid an ifeq dependency that would be subject to +# dependency inclusion order issues +FEATURES_REQUIRED += periph_timer + +USEMODULE += xtimer_no_ztimer_default +ifeq (,$(filter xtimer_no_ztimer_default,$(USEMODULE))) + ifeq (,$(filter xtimer_on_ztimer,$(USEMODULE))) + USEMODULE += ztimer_xtimer_compat + endif +else + ifneq (,$(filter ztimer,$(USEMODULE))) + ifeq (,$(filter xtimer_on_ztimer,$(USEMODULE))) + USEMODULE += ztimer_xtimer_compat + endif + endif +endif + +ifneq (,$(filter ztimer_xtimer_compat,$(USEMODULE))) + DISABLE_MODULE += auto_init_xtimer + USEMODULE += div +endif + +# make xtimer use ztimer_usec as low level timer +ifneq (,$(filter xtimer_on_ztimer,$(USEMODULE))) + USEMODULE += ztimer_usec +endif diff --git a/sys/ztimer/Kconfig b/sys/ztimer/Kconfig index c68a070378a8..f1ab66248ee9 100644 --- a/sys/ztimer/Kconfig +++ b/sys/ztimer/Kconfig @@ -143,22 +143,18 @@ choice bool "xtimer compatibility" depends on MODULE_XTIMER && MODULE_ZTIMER -config MODULE_XTIMER_ON_ZTIMER - bool "ztimer_usec as timer backend for xtimer" - select MODULE_ZTIMER_USEC - select MODULE_ZTIMER_PERIPH_TIMER - config MODULE_ZTIMER_XTIMER_COMPAT bool "map xtimer calls to ztimer" select MODULE_DIV select MODULE_ZTIMER_USEC + select MODULE_ZTIMER_PERIPH_TIMER help - This is a wrapper of xtimer API on ztimer_usec and is currently - incomplete. Unless doing testing, use xtimer on ztimer. - -comment "The ztimer xtimer compatibility module is incomplete, consider using MODULE_ZTIMER64_XTIMER_COMPAT instead." - depends on MODULE_ZTIMER_XTIMER_COMPAT + This is a wrapper of xtimer API on ztimer_usec. +config MODULE_XTIMER_ON_ZTIMER + bool "ztimer_usec as timer backend for xtimer" + select MODULE_ZTIMER_USEC + select MODULE_ZTIMER_PERIPH_TIMER endchoice config MODULE_ZTIMER64_XTIMER_COMPAT diff --git a/sys/ztimer/Makefile.dep b/sys/ztimer/Makefile.dep index fdbfc39799d6..de64c76c1e95 100644 --- a/sys/ztimer/Makefile.dep +++ b/sys/ztimer/Makefile.dep @@ -13,13 +13,6 @@ endif # unless ztimer_xtimer_compat is used, make xtimer use ztimer_usec as backend. ifneq (,$(filter ztimer,$(USEMODULE))) - ifneq (,$(filter xtimer,$(USEMODULE))) - ifeq (,$(filter ztimer_xtimer_compat ztimer64_xtimer_compat,$(USEMODULE))) - USEMODULE += xtimer_on_ztimer - else - USEMODULE += div - endif - endif ifneq (,$(filter evtimer,$(USEMODULE))) USEMODULE += evtimer_on_ztimer endif @@ -34,11 +27,6 @@ ifneq (,$(filter ztimer64_xtimer_compat,$(USEMODULE))) USEMODULE += ztimer_xtimer_compat endif -# make xtimer use ztimer_usec as low level timer -ifneq (,$(filter xtimer_on_ztimer,$(USEMODULE))) - USEMODULE += ztimer_usec -endif - # make evtimer use ztimer_msec as low level timer ifneq (,$(filter evtimer_on_ztimer,$(USEMODULE))) USEMODULE += ztimer_msec diff --git a/tests/xtimer_now32_overflow/Makefile b/tests/xtimer_now32_overflow/Makefile index 7f8b991ddf94..a1079e38f2bd 100644 --- a/tests/xtimer_now32_overflow/Makefile +++ b/tests/xtimer_now32_overflow/Makefile @@ -1,7 +1,23 @@ include ../Makefile.tests_common USEMODULE += xtimer +USEMODULE += xtimer_no_ztimer_default DISABLE_MODULE += auto_init_xtimer +# Boards that can't run only on xtimer or that always select ztimer +BOARD_BLACKLIST += \ + feather-nrf52840 \ + hamilton \ + mulle \ + pinetime \ + ruuvitag \ + stm32f429i-disco \ + thingy52 \ + waspmote-pro \ + weact-f401cc \ + weact-f401ce \ + weact-f411ce \ + # + include $(RIOTBASE)/Makefile.include diff --git a/tests/xtimer_now32_overflow/app.config.test b/tests/xtimer_now32_overflow/app.config.test index 396443c12fe8..9fc59457d0ba 100644 --- a/tests/xtimer_now32_overflow/app.config.test +++ b/tests/xtimer_now32_overflow/app.config.test @@ -1,4 +1,5 @@ # this file enables modules defined in Kconfig. Do not use this file for # application configuration. This is only needed during migration. CONFIG_MODULE_XTIMER=y +CONFIG_MODULE_XTIMER_NO_ZTIMER_DEFAULT=y CONFIG_MODULE_AUTO_INIT_XTIMER=n diff --git a/tests/xtimer_now64_continuity/Makefile b/tests/xtimer_now64_continuity/Makefile index 6c3bc23fa14a..d1a7cfc56d5e 100644 --- a/tests/xtimer_now64_continuity/Makefile +++ b/tests/xtimer_now64_continuity/Makefile @@ -2,8 +2,23 @@ include ../Makefile.tests_common USEMODULE += fmt USEMODULE += xtimer +USEMODULE += xtimer_no_ztimer_default # This test randomly fails on `native` so disable it from CI TEST_ON_CI_BLACKLIST += native +# Boards that can't run only on xtimer or that always select ztimer +BOARD_BLACKLIST += \ + feather-nrf52840 \ + hamilton \ + mulle \ + pinetime \ + ruuvitag \ + stm32f429i-disco \ + thingy52 \ + waspmote-pro \ + weact-f401cc \ + weact-f401ce \ + weact-f411ce \ + # include $(RIOTBASE)/Makefile.include diff --git a/tests/xtimer_now64_continuity/app.config.test b/tests/xtimer_now64_continuity/app.config.test index 8f28e0ef2eb3..c0c51bf4c546 100644 --- a/tests/xtimer_now64_continuity/app.config.test +++ b/tests/xtimer_now64_continuity/app.config.test @@ -1,4 +1,5 @@ # this file enables modules defined in Kconfig. Do not use this file for # application configuration. This is only needed during migration. CONFIG_MODULE_XTIMER=y +CONFIG_MODULE_XTIMER_NO_ZTIMER_DEFAULT=y CONFIG_MODULE_FMT=y