Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

cpu: do not auto-select ztimer_periph_rtt for sam0, fe310 #17395

Merged
merged 3 commits into from
Dec 15, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions cpu/fe310/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ config CPU_FAM_FE310
select MODULE_PERIPH_PLIC if TEST_KCONFIG
select MODULE_PERIPH_CORETIMER if MODULE_PERIPH_TIMER && HAS_PERIPH_CORETIMER
select MODULE_PERIPH_RTT if MODULE_PERIPH_RTC && HAS_PERIPH_RTT
select MODULE_ZTIMER_NO_PERIPH_RTT if TEST_KCONFIG && MODULE_ZTIMER

config CPU_MODEL_FE310_G000
bool
Expand Down
1 change: 1 addition & 0 deletions cpu/sam0_common/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ config CPU_COMMON_SAM0
select HAS_PERIPH_WDT_CB
select HAS_PERIPH_WDT_WARNING_PERIOD
select HAVE_SHARED_PERIPH_RTT_PERIPH_RTC
select MODULE_ZTIMER_NO_PERIPH_RTT if TEST_KCONFIG && MODULE_ZTIMER

if CPU_COMMON_SAM0

Expand Down
1 change: 1 addition & 0 deletions cpu/sam3/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ config CPU_FAM_SAM3
select HAS_CPU_SAM3
select HAS_PERIPH_CPUID
select HAS_PERIPH_HWRNG
select MODULE_ZTIMER_NO_PERIPH_RTT if TEST_KCONFIG && MODULE_ZTIMER

## CPU Models
config CPU_MODEL_SAM3X8E
Expand Down
4 changes: 2 additions & 2 deletions sys/ztimer/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ config MODULE_ZTIMER_SEC
choice
bool "Backend"
depends on MODULE_ZTIMER_SEC
default ZTIMER_SEC_BACKEND_RTT
default ZTIMER_SEC_BACKEND_RTT if !MODULE_ZTIMER_NO_PERIPH_RTT

config ZTIMER_SEC_BACKEND_TIMER
bool "Timer"
Expand All @@ -91,7 +91,7 @@ config ZTIMER_SEC_BACKEND_TIMER
config ZTIMER_SEC_BACKEND_RTT
bool "RTT"
depends on HAS_PERIPH_RTT
select MODULE_ZTIMER_PERIPH_RTT if !MODULE_ZTIMER_NO_PERIPH_RTT
select MODULE_ZTIMER_PERIPH_RTT

config ZTIMER_SEC_BACKEND_RTC
bool "RTC"
Expand Down
11 changes: 11 additions & 0 deletions sys/ztimer/Makefile.dep
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,17 @@ ifneq (,$(filter ztimer_usec,$(USEMODULE)))
USEMODULE += ztimer_periph_timer
endif

# NOTE: select the module here and not in the CPU so that order of inclusion
# does not have periph_rtt selected earlier that it should be while at the same
# time avoiding the module 'ztimer-no_periph_rtt' being included unecesarily.
# The sam0 rtt busy loops for 180us every time an alarm is set or
# the counter is read, this propagates and leads to timing errors
# on ztimer_msec that are higher than > +-1msec.
# The same goes for the fe310 rtt.
ifneq (,$(filter sam% fe310,$(CPU)))
USEMODULE += ztimer_no_periph_rtt
endif

ifneq (,$(filter ztimer_msec ztimer_sec,$(USEMODULE)))
USEMODULE += ztimer
ifeq (,$(filter ztimer_no_periph_rtt,$(USEMODULE)))
Expand Down
8 changes: 0 additions & 8 deletions tests/posix_sleep/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,4 @@ include ../Makefile.tests_common

USEMODULE += posix_sleep

# These CPU families have a non configurable RTT of 1Hz, not enough for
# ztimer_msec to run on periph_rtt
ifeq (,$(filter efm32 kinetis,$(CPU)))
# Pull-in periph-rtt on boards that provide this feature to switch to
# the RTT backend of ztimer
FEATURES_OPTIONAL += periph_rtt
endif

include $(RIOTBASE)/Makefile.include