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

ztimer: pull ztimer_periph_rtt for ZTIMER_MSEC if available

This commit is contained in:
Francisco Molina 2021-06-15 12:19:07 +02:00
parent 0c06948373
commit c80390f28b
No known key found for this signature in database
GPG Key ID: 3E94EAC3DBDEEDA8
6 changed files with 85 additions and 10 deletions

View File

@ -133,10 +133,8 @@ ifneq (,$(filter test_utils_result_output,$(USEMODULE)))
include $(RIOTBASE)/sys/test_utils/result_output/Makefile.include
endif
# Convert xtimer into a pseudo module if its API is already implemented by
# ztimer's compatibility wrapper
ifneq (,$(filter ztimer_xtimer_compat,$(USEMODULE)))
PSEUDOMODULES += xtimer
ifneq (,$(filter ztimer,$(USEMODULE)))
include $(RIOTBASE)/sys/ztimer/Makefile.include
endif
ifneq (,$(filter prng,$(USEMODULE)))

View File

@ -15,7 +15,11 @@ menuconfig MODULE_ZTIMER
if MODULE_ZTIMER
config ZTIMER_CUSTOM_BACKEND_CONFIGURATION
bool "Override default backend selection"
menu "Backends"
visible if ZTIMER_CUSTOM_BACKEND_CONFIGURATION
config MODULE_ZTIMER_PERIPH_RTC
bool "RTC peripheral"
@ -26,7 +30,6 @@ config MODULE_ZTIMER_PERIPH_RTT
bool "RTT peripheral"
depends on HAS_PERIPH_RTT
select MODULE_PERIPH_RTT
default y if !MODULE_ZTIMER_PERIPH_TIMER
config MODULE_ZTIMER_PERIPH_PTP
bool "PTP peripheral"
@ -37,7 +40,6 @@ config MODULE_ZTIMER_PERIPH_TIMER
bool "Timer peripheral"
depends on HAS_PERIPH_TIMER
select MODULE_PERIPH_TIMER
default y
endmenu # Backends
@ -45,19 +47,57 @@ menu "Clocks"
config MODULE_ZTIMER_USEC
bool "Microseconds"
depends on MODULE_ZTIMER_PERIPH_TIMER
select MODULE_ZTIMER_PERIPH_TIMER
config MODULE_ZTIMER_MSEC
bool "Milliseconds"
depends on MODULE_ZTIMER_PERIPH_TIMER || MODULE_ZTIMER_PERIPH_RTT
choice
bool "Backend"
depends on MODULE_ZTIMER_MSEC
default ZTIMER_MSEC_BACKEND_RTT
config ZTIMER_MSEC_BACKEND_TIMER
bool "Timer"
select MODULE_ZTIMER_PERIPH_TIMER
config ZTIMER_MSEC_BACKEND_RTT
bool "RTT"
depends on HAS_PERIPH_RTT
select MODULE_ZTIMER_PERIPH_RTT
endchoice
config MODULE_ZTIMER_SEC
bool "Seconds"
depends on MODULE_ZTIMER_PERIPH_TIMER || MODULE_ZTIMER_PERIPH_RTT || MODULE_ZTIMER_PERIPH_RTC
choice
bool "Backend"
depends on MODULE_ZTIMER_SEC
default ZTIMER_SEC_BACKEND_RTC if !BOARD_NATIVE && \
!CPU_COMMON_SAM0 && \
!CPU_COMMON_EFM32 && \
!CPU_COMMON_STM32F1
default ZTIMER_SEC_BACKEND_RTT
config ZTIMER_SEC_BACKEND_TIMER
bool "Timer"
select MODULE_ZTIMER_PERIPH_TIMER
config ZTIMER_SEC_BACKEND_RTT
bool "RTT"
depends on HAS_PERIPH_RTT
select MODULE_ZTIMER_PERIPH_RTT
config ZTIMER_SEC_BACKEND_RTC
bool "RTC"
depends on HAS_PERIPH_RTC
select MODULE_ZTIMER_PERIPH_RTC
endchoice
endmenu # Clocks
menu "Frequency conversion"
config MODULE_ZTIMER_CONVERT_MULDIV64

View File

@ -89,4 +89,22 @@ endif
ifneq (,$(filter ztimer_msec,$(USEMODULE)))
USEMODULE += ztimer
FEATURES_OPTIONAL += periph_rtt
# HACK: periph_rtt will get used only in the next iteration but an updated
# state for FEATURES_USED is needed here so include `features_check.inc.mk`
# here instead.
# An other option would be to check FEATURES_PROVIDED this would avoid the
# order of inclusion problem but it would no take into account possible conflicts
# and is also currently not allowed in the build system.
# An other alternative would be to delay to the next loop, but this produce a
# case where another loop is not executed and the conditional not evaluated
# If these kind of usecases pop up before Kconfig migration is completed
# then another alternative would be introduce a variable to require an extra
# loop independent of USEMODULE, FEATURES_REQUIRED and USEPKG
include $(RIOTMAKE)/features_check.inc.mk
ifneq (,$(filter periph_rtt,$(FEATURES_USED)))
USEMODULE += ztimer_periph_rtt
else
USEMODULE += ztimer_periph_timer
endif
endif

View File

@ -0,0 +1,15 @@
# Convert xtimer into a pseudo module if its API is already implemented by
# ztimer's compatibility wrapper
ifneq (,$(filter ztimer_xtimer_compat,$(USEMODULE)))
PSEUDOMODULES += xtimer
endif
# By defaul use highest possible RTT_FREQUENCY for platforms that allow it. This
# might not be the most optimized for conversion guarantees that ztimer_periph_rtt
# will have a capable backend.
ifneq (,$(filter ztimer_periph_rtt,$(USEMODULE)))
ifneq (,$(filter stm32 nrf52 sam% kinetis efm32,$(CPU)))
RTT_FREQUENCY ?= RTT_MAX_FREQUENCY
CFLAGS += -DRTT_FREQUENCY=$(RTT_FREQUENCY)
endif
endif

View File

@ -0,0 +1,2 @@
BOARD_INSUFFICIENT_MEMORY := \
nucleo-l011k4 \

View File

@ -0,0 +1,2 @@
BOARD_INSUFFICIENT_MEMORY := \
nucleo-l011k4 \