From 38372867503e449832ebf8939a5447314e39dea5 Mon Sep 17 00:00:00 2001 From: Leandro Lanzieri Date: Mon, 8 Nov 2021 10:51:38 +0100 Subject: [PATCH 1/2] sys/{x,z}timer/Kconfig: fix compatibility modules --- sys/xtimer/Kconfig | 2 +- sys/ztimer/Kconfig | 5 +++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/sys/xtimer/Kconfig b/sys/xtimer/Kconfig index e324d136ba..8c6a8ab5e9 100644 --- a/sys/xtimer/Kconfig +++ b/sys/xtimer/Kconfig @@ -7,7 +7,7 @@ menuconfig MODULE_XTIMER bool "xtimer" - depends on HAS_PERIPH_TIMER || MODULE_XTIMER_ON_ZTIMER || MODULE_ZTIMER_XTIMER_COMPAT + depends on HAS_PERIPH_TIMER depends on TEST_KCONFIG # use timer peripheral unless ztimer compatibility module is used diff --git a/sys/ztimer/Kconfig b/sys/ztimer/Kconfig index c788ca8e49..a9d159f50f 100644 --- a/sys/ztimer/Kconfig +++ b/sys/ztimer/Kconfig @@ -132,15 +132,16 @@ menu "xtimer and evtimer compatibility" choice bool "xtimer compatibility" - optional - depends on MODULE_ZTIMER_USEC + depends on MODULE_XTIMER config MODULE_XTIMER_ON_ZTIMER bool "ztimer_usec as timer backend for xtimer" + select MODULE_ZTIMER_USEC config MODULE_ZTIMER_XTIMER_COMPAT bool "map xtimer calls to ztimer" select MODULE_DIV + select MODULE_ZTIMER_USEC help This is a wrapper of xtimer API on ztimer_usec and is currently incomplete. Unless doing testing, use xtimer on ztimer. From 703e66b4c1dc51345a2cda3cf68c32c1249a947f Mon Sep 17 00:00:00 2001 From: Leandro Lanzieri Date: Tue, 9 Nov 2021 11:40:38 +0100 Subject: [PATCH 2/2] sys/ztimer/kconfig: change entry point --- examples/twr_aloha/app.config.test | 2 +- sys/ztimer/Kconfig | 36 +++++++++++++------ tests/driver_sm_pwm_01c/app.config.test | 2 +- tests/pkg_umorse/app.config.test | 2 +- tests/posix_sleep/app.config.test | 2 +- tests/ztimer_msg/app.config.test | 2 +- .../ztimer_mutex_lock_timeout/app.config.test | 2 +- tests/ztimer_overhead/app.config.test | 2 +- tests/ztimer_periodic/app.config.test | 2 +- .../app.config.test | 2 +- tests/ztimer_underflow/app.config.test | 2 +- tests/ztimer_xsec/app.config.test | 3 +- 12 files changed, 36 insertions(+), 23 deletions(-) diff --git a/examples/twr_aloha/app.config.test b/examples/twr_aloha/app.config.test index ada0fffae1..47383cda5d 100644 --- a/examples/twr_aloha/app.config.test +++ b/examples/twr_aloha/app.config.test @@ -9,4 +9,4 @@ CONFIG_MODULE_SHELL=y CONFIG_MODULE_PS=y CONFIG_MODULE_SHELL_COMMANDS=y CONFIG_MODULE_ZTIMER=y -CONFIG_MODULE_ZTIMER_USEC=y +CONFIG_ZTIMER_USEC=y diff --git a/sys/ztimer/Kconfig b/sys/ztimer/Kconfig index a9d159f50f..daad9f11b1 100644 --- a/sys/ztimer/Kconfig +++ b/sys/ztimer/Kconfig @@ -5,15 +5,7 @@ # directory for more details. # -menuconfig MODULE_ZTIMER - bool "ztimer - High level timer abstraction layer" - depends on TEST_KCONFIG - select MODULE_ZTIMER_CORE - select MODULE_ZTIMER_CONVERT_FRAC - select MODULE_ZTIMER_CONVERT_SHIFT - select MODULE_ZTIMER_EXTEND - -if MODULE_ZTIMER +menu "ztimer - High level timer abstraction layer" config ZTIMER_CUSTOM_BACKEND_CONFIGURATION bool "Override default backend selection" @@ -45,12 +37,21 @@ endmenu # Backends menu "Clocks" -config MODULE_ZTIMER_USEC +# TODO: this extra indirection in the entry point for ztimer_usec is required +# to allow xtimer compatibility modules to depend on ztimer being there while +# still selecting ztimer_usec. +config ZTIMER_USEC bool "Microseconds" + select MODULE_ZTIMER_USEC + select MODULE_ZTIMER + +config MODULE_ZTIMER_USEC + bool select MODULE_ZTIMER_PERIPH_TIMER config MODULE_ZTIMER_MSEC bool "Milliseconds" + select MODULE_ZTIMER choice bool "Backend" @@ -70,6 +71,7 @@ endchoice config MODULE_ZTIMER_SEC bool "Seconds" + select MODULE_ZTIMER choice bool "Backend" @@ -95,6 +97,7 @@ endchoice endmenu # Clocks menu "Frequency conversion" + depends on MODULE_ZTIMER config MODULE_ZTIMER_CONVERT_MULDIV64 bool "64-bits arithmetic conversion" @@ -132,7 +135,7 @@ menu "xtimer and evtimer compatibility" choice bool "xtimer compatibility" - depends on MODULE_XTIMER + depends on MODULE_XTIMER && MODULE_ZTIMER config MODULE_XTIMER_ON_ZTIMER bool "ztimer_usec as timer backend for xtimer" @@ -158,6 +161,15 @@ config MODULE_EVTIMER_ON_ZTIMER endmenu # xtimer compatibility +config MODULE_ZTIMER + bool + depends on TEST_KCONFIG + select MODULE_ZTIMER_CORE + select MODULE_ZTIMER_CONVERT_FRAC + select MODULE_ZTIMER_CONVERT_SHIFT + select MODULE_ZTIMER_EXTEND + +if MODULE_ZTIMER # TODO: only use MODULE_ZTIMER_AUTO_INIT, for now we try to get the same modules # as the Makefile dependency resolution. See sys/ztimer/Makefile.dep for more @@ -192,3 +204,5 @@ config MODULE_ZTIMER_EXTEND bool endif # MODULE_ZTIMER + +endmenu diff --git a/tests/driver_sm_pwm_01c/app.config.test b/tests/driver_sm_pwm_01c/app.config.test index b91916cc53..d7d48bd0b2 100644 --- a/tests/driver_sm_pwm_01c/app.config.test +++ b/tests/driver_sm_pwm_01c/app.config.test @@ -2,5 +2,5 @@ # application configuration. This is only needed during migration. CONFIG_MODULE_SM_PWM_01C=y CONFIG_MODULE_ZTIMER=y -CONFIG_MODULE_ZTIMER_USEC=y +CONFIG_ZTIMER_USEC=y CONFIG_MODULE_PROGRESS_BAR=y diff --git a/tests/pkg_umorse/app.config.test b/tests/pkg_umorse/app.config.test index 3ce870d695..0080d6d2d6 100644 --- a/tests/pkg_umorse/app.config.test +++ b/tests/pkg_umorse/app.config.test @@ -1,5 +1,5 @@ CONFIG_MODULE_POSIX_SLEEP=y CONFIG_MODULE_ZTIMER=y -CONFIG_MODULE_ZTIMER_USEC=y +CONFIG_ZTIMER_USEC=y CONFIG_MODULE_ZTIMER_MSEC=y CONFIG_PACKAGE_UMORSE=y diff --git a/tests/posix_sleep/app.config.test b/tests/posix_sleep/app.config.test index adcda0cec0..1400000f78 100644 --- a/tests/posix_sleep/app.config.test +++ b/tests/posix_sleep/app.config.test @@ -1,4 +1,4 @@ CONFIG_MODULE_POSIX_SLEEP=y CONFIG_MODULE_ZTIMER=y -CONFIG_MODULE_ZTIMER_USEC=y +CONFIG_ZTIMER_USEC=y CONFIG_MODULE_ZTIMER_MSEC=y diff --git a/tests/ztimer_msg/app.config.test b/tests/ztimer_msg/app.config.test index 733646e663..2fc4266478 100644 --- a/tests/ztimer_msg/app.config.test +++ b/tests/ztimer_msg/app.config.test @@ -1,4 +1,4 @@ # this file enables modules defined in Kconfig. Do not use this file for # application configuration. This is only needed during migration. CONFIG_MODULE_ZTIMER=y -CONFIG_MODULE_ZTIMER_USEC=y +CONFIG_ZTIMER_USEC=y diff --git a/tests/ztimer_mutex_lock_timeout/app.config.test b/tests/ztimer_mutex_lock_timeout/app.config.test index 733646e663..2fc4266478 100644 --- a/tests/ztimer_mutex_lock_timeout/app.config.test +++ b/tests/ztimer_mutex_lock_timeout/app.config.test @@ -1,4 +1,4 @@ # this file enables modules defined in Kconfig. Do not use this file for # application configuration. This is only needed during migration. CONFIG_MODULE_ZTIMER=y -CONFIG_MODULE_ZTIMER_USEC=y +CONFIG_ZTIMER_USEC=y diff --git a/tests/ztimer_overhead/app.config.test b/tests/ztimer_overhead/app.config.test index 7819e81c5d..1245a93667 100644 --- a/tests/ztimer_overhead/app.config.test +++ b/tests/ztimer_overhead/app.config.test @@ -1,5 +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_ZTIMER=y -CONFIG_MODULE_ZTIMER_USEC=y +CONFIG_ZTIMER_USEC=y CONFIG_MODULE_ZTIMER_OVERHEAD=y diff --git a/tests/ztimer_periodic/app.config.test b/tests/ztimer_periodic/app.config.test index a049a205fd..063d9187d5 100644 --- a/tests/ztimer_periodic/app.config.test +++ b/tests/ztimer_periodic/app.config.test @@ -1,7 +1,7 @@ # this file enables modules defined in Kconfig. Do not use this file for # application configuration. This is only needed during migration. CONFIG_MODULE_ZTIMER=y -CONFIG_MODULE_ZTIMER_USEC=y +CONFIG_ZTIMER_USEC=y CONFIG_MODULE_ZTIMER_MSEC=y CONFIG_MODULE_FMT=y diff --git a/tests/ztimer_rmutex_lock_timeout/app.config.test b/tests/ztimer_rmutex_lock_timeout/app.config.test index 0d12371292..b35fac38a3 100644 --- a/tests/ztimer_rmutex_lock_timeout/app.config.test +++ b/tests/ztimer_rmutex_lock_timeout/app.config.test @@ -1,5 +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_ZTIMER=y -CONFIG_MODULE_ZTIMER_USEC=y +CONFIG_ZTIMER_USEC=y CONFIG_MODULE_SHELL=y diff --git a/tests/ztimer_underflow/app.config.test b/tests/ztimer_underflow/app.config.test index 733646e663..2fc4266478 100644 --- a/tests/ztimer_underflow/app.config.test +++ b/tests/ztimer_underflow/app.config.test @@ -1,4 +1,4 @@ # this file enables modules defined in Kconfig. Do not use this file for # application configuration. This is only needed during migration. CONFIG_MODULE_ZTIMER=y -CONFIG_MODULE_ZTIMER_USEC=y +CONFIG_ZTIMER_USEC=y diff --git a/tests/ztimer_xsec/app.config.test b/tests/ztimer_xsec/app.config.test index d39df143ba..bf645cb12e 100644 --- a/tests/ztimer_xsec/app.config.test +++ b/tests/ztimer_xsec/app.config.test @@ -1,7 +1,6 @@ # this file enables modules defined in Kconfig. Do not use this file for # application configuration. This is only needed during migration. -CONFIG_MODULE_ZTIMER=y CONFIG_MODULE_ZTIMER_PERIPH_TIMER=y -CONFIG_MODULE_ZTIMER_USEC=y +CONFIG_ZTIMER_USEC=y CONFIG_MODULE_ZTIMER_MSEC=y CONFIG_MODULE_ZTIMER_SEC=y