From fc169b98cd5b3fc2b9f7a1d0787a77e143e1b9ee Mon Sep 17 00:00:00 2001 From: Francisco Molina Date: Tue, 1 Mar 2022 16:55:48 +0100 Subject: [PATCH 1/4] sys/trickle: if ztimer_xtimer_compat is used, use ztimer_msec If already using the compat layer then just use ztimer_msec otherwise the 64bit compat layer would be needed for this module --- sys/Makefile.dep | 3 +++ 1 file changed, 3 insertions(+) diff --git a/sys/Makefile.dep b/sys/Makefile.dep index c42d9da876..55a81b1a7e 100644 --- a/sys/Makefile.dep +++ b/sys/Makefile.dep @@ -167,6 +167,9 @@ ifneq (,$(filter trickle,$(USEMODULE))) USEMODULE += random ifeq (,$(filter ztimer_msec,$(USEMODULE))) USEMODULE += xtimer + ifneq (,$(filter ztimer_xtimer_compat,$(USEMODULE))) + USEMODULE += ztimer_msec + endif endif endif From bf83387030578d43979e0c44f5d258f5247da305 Mon Sep 17 00:00:00 2001 From: Francisco Molina Date: Tue, 1 Mar 2022 16:41:30 +0100 Subject: [PATCH 2/4] sys: if xtimer_ztimer_compat, evtimer uses ztimer The xtimer based module was only there to avoid duplicate code, is the compat layer is used this does not make sense. --- sys/Makefile.dep | 3 +++ 1 file changed, 3 insertions(+) diff --git a/sys/Makefile.dep b/sys/Makefile.dep index 55a81b1a7e..570d7a450e 100644 --- a/sys/Makefile.dep +++ b/sys/Makefile.dep @@ -798,6 +798,9 @@ ifneq (,$(filter evtimer,$(USEMODULE))) USEMODULE += ztimer_msec else USEMODULE += xtimer + ifneq (,$(filter ztimer_xtimer_compat,$(USEMODULE))) + USEMODULE += evtimer_on_ztimer + endif endif endif From 6151895bfa2edd51a2407ad79accf4a6e6fd7f36 Mon Sep 17 00:00:00 2001 From: Francisco Molina Date: Tue, 1 Mar 2022 08:27:02 +0100 Subject: [PATCH 3/4] sys: use ztimer64_xtimer_compat when required --- cpu/native/Kconfig | 1 + cpu/native/Makefile.dep | 5 +++++ sys/Kconfig.newlib | 1 + sys/Makefile.dep | 31 +++++++++++++++++++++++++++++++ sys/net/gnrc/Makefile.dep | 4 ++++ 5 files changed, 42 insertions(+) diff --git a/cpu/native/Kconfig b/cpu/native/Kconfig index 268185bd0a..2b7faae06f 100644 --- a/cpu/native/Kconfig +++ b/cpu/native/Kconfig @@ -25,6 +25,7 @@ config CPU_ARCH_NATIVE # needed modules select MODULE_PERIPH if TEST_KCONFIG + select MODULE_ZTIMER64_XTIMER_COMPAT if MODULE_ZTIMER_XTIMER_COMPAT config CPU_CORE_NATIVE bool diff --git a/cpu/native/Makefile.dep b/cpu/native/Makefile.dep index e75b24467b..2beef965a0 100644 --- a/cpu/native/Makefile.dep +++ b/cpu/native/Makefile.dep @@ -40,6 +40,11 @@ ifneq (,$(filter socket_zep,$(USEMODULE))) endif endif +ifneq (,$(filter ztimer_xtimer_compat,$(USEMODULE))) + # requires 64bit for syscalls + USEMODULE += ztimer64_xtimer_compat +endif + USEMODULE += periph # UART is needed by startup.c diff --git a/sys/Kconfig.newlib b/sys/Kconfig.newlib index b1ba0e6a34..cd1f788a29 100644 --- a/sys/Kconfig.newlib +++ b/sys/Kconfig.newlib @@ -18,6 +18,7 @@ config MODULE_NEWLIB_SYSCALLS_DEFAULT default y depends on !HAVE_CUSTOM_NEWLIB_SYSCALLS select MODULE_DIV + select MODULE_ZTIMER64_XTIMER_COMPAT if MODULE_ZTIMER_XTIMER_COMPAT help Default implementation of newlib system calls. diff --git a/sys/Makefile.dep b/sys/Makefile.dep index 570d7a450e..82271037cc 100644 --- a/sys/Makefile.dep +++ b/sys/Makefile.dep @@ -135,6 +135,10 @@ endif ifneq (,$(filter sntp,$(USEMODULE))) USEMODULE += sock_udp USEMODULE += xtimer + ifneq (,$(filter ztimer_xtimer_compat,$(USEMODULE))) + # requires 64bit ftimestamps + USEMODULE += ztimer64_xtimer_compat + endif endif ifneq (,$(filter sock_%,$(USEMODULE))) @@ -229,6 +233,10 @@ ifneq (,$(filter newlib,$(USEMODULE))) endif ifneq (,$(filter newlib_syscalls_default,$(USEMODULE))) USEMODULE += div + ifneq (,$(filter ztimer_xtimer_compat,$(USEMODULE))) + # requires 64bit timestamps when using xtimer + USEMODULE += ztimer64_xtimer_compat + endif endif endif @@ -310,6 +318,10 @@ endif ifneq (,$(filter posix_semaphore,$(USEMODULE))) USEMODULE += sema USEMODULE += xtimer + ifneq (,$(filter ztimer_xtimer_compat,$(USEMODULE))) + # requires sema_timed that requires 64bit + USEMODULE += ztimer64_xtimer_compat + endif USEMODULE += posix_headers endif @@ -339,6 +351,9 @@ endif ifneq (,$(filter fib,$(USEMODULE))) USEMODULE += universal_address USEMODULE += xtimer + ifneq (,$(filter ztimer_xtimer_compat,$(USEMODULE))) + USEMODULE += ztimer64_xtimer_compat + endif USEMODULE += posix_headers endif @@ -353,6 +368,10 @@ ifneq (,$(filter cpp11-compat,$(USEMODULE))) USEMODULE += timex FEATURES_REQUIRED += cpp FEATURES_REQUIRED += libstdcpp + ifneq (,$(filter ztimer_xtimer_compat,$(USEMODULE))) + # requires 64bit for syscalls + USEMODULE += ztimer64_xtimer_compat + endif endif ifneq (,$(filter netstats_%, $(USEMODULE))) @@ -367,6 +386,10 @@ endif ifneq (,$(filter pthread,$(USEMODULE))) USEMODULE += xtimer USEMODULE += timex + ifneq (,$(filter ztimer_xtimer_compat,$(USEMODULE))) + # requires 64bit ftimestamps + USEMODULE += ztimer64_xtimer_compat + endif endif ifneq (,$(filter schedstatistics,$(USEMODULE))) @@ -580,6 +603,10 @@ endif ifneq (,$(filter dsm,$(USEMODULE))) USEMODULE += sock_dtls USEMODULE += xtimer + ifneq (,$(filter ztimer_xtimer_compat,$(USEMODULE))) + # requires 64bit timestamps when using xtimer + USEMODULE += ztimer64_xtimer_compat + endif endif ifneq (,$(filter gcoap,$(USEMODULE))) @@ -641,6 +668,10 @@ ifneq (,$(filter cord_lc cord_ep,$(USEMODULE))) ifneq (,$(filter shell_commands,$(USEMODULE))) USEMODULE += sock_util endif + ifneq (,$(filter ztimer_xtimer_compat,$(USEMODULE))) + # requires 64bit timestamps when using xtimer + USEMODULE += ztimer64_xtimer_compat + endif endif ifneq (,$(filter cord_epsim,$(USEMODULE))) diff --git a/sys/net/gnrc/Makefile.dep b/sys/net/gnrc/Makefile.dep index 36736af2fc..fedcca378d 100644 --- a/sys/net/gnrc/Makefile.dep +++ b/sys/net/gnrc/Makefile.dep @@ -20,6 +20,10 @@ ifneq (,$(filter gnrc_gomach,$(USEMODULE))) USEMODULE += gnrc_nettype_gomach USEMODULE += random USEMODULE += xtimer + ifneq (,$(filter ztimer_xtimer_compat,$(USEMODULE))) + # requires 64bit timestamps + USEMODULE += ztimer64_xtimer_compat + endif USEMODULE += gnrc_mac FEATURES_REQUIRED += periph_rtt endif From f1d4cc09245014451e4edd25cacf70f3dae21ee8 Mon Sep 17 00:00:00 2001 From: Francisco Molina Date: Wed, 2 Mar 2022 08:28:07 +0100 Subject: [PATCH 4/4] sys/ztimer/Kconfig: remv dep between ztimer64_compat and ztimer_compat This is done to avoid circular dependency, it will currently allow for ztimer64_xtimer_compat beeing selected as well as xtimer_on_ztimer. This altough incorrect mimics make, and will be fixed when making ztimer_xtimer_compat the default xtimer backend --- sys/ztimer/Kconfig | 1 - 1 file changed, 1 deletion(-) diff --git a/sys/ztimer/Kconfig b/sys/ztimer/Kconfig index 7483b1b230..c68a070378 100644 --- a/sys/ztimer/Kconfig +++ b/sys/ztimer/Kconfig @@ -166,7 +166,6 @@ config MODULE_ZTIMER64_XTIMER_COMPAT select MODULE_DIV select MODULE_ZTIMER64 select MODULE_ZTIMER64_USEC - depends on MODULE_ZTIMER_XTIMER_COMPAT help This is a wrapper of xtimer API on ztimer64_usec.