boards: provide RTC feature for boards with the RTT feature#14496
boards: provide RTC feature for boards with the RTT feature#14496benpicco wants to merge 4 commits intoRIOT-OS:masterfrom
Conversation
aabadie
left a comment
There was a problem hiding this comment.
Tested on iot-lab on nrf52832-mdk, nrf51dk, nrf52840dk. All are working.
I haven't followed all this in detail but can you explain why it is working although there's no rtc.c for nrf ?
|
We now have a RTT based software RTC implementation in |
|
It seems this has something related to the rtt_rtc module and greping it I found: Line 672 in 8e74bfa in a Apparently for nrf, there's already some logic to add the rtt_rtc module when the rtc feature is used: RIOT/cpu/nrf5x_common/Makefile.dep Lines 1 to 3 in 8e74bfa |
Can you point to the original PR ? |
Now I remember this works with
|
|
Both rtc and rtt are based on the same peripheral so I think the features should at least be declared as conflicting features on nrf (it's the case on sam0). |
which way ? |
That won't work as
The way it is without this PR: RTC is available with |
Do you think that both rtt and rtc could be used at the same time ? If it's not the case, then there's an issue in the build system. If they can be used together, then I'm fine with this PR. |
No that's not possible.
Yes, it's the old issue that an interface can have multiple implementations. AFAIK we don't have a clean solution for that. |
|
I just realized I have opened a can of works 😩 Now in theory this would be easy with but |
|
nvm this actualy does print all boards and esp8266/esp32 already provide the feature on CPU level |
If we start providing the rtc feature for boards/cpus which already provide rtt, there will be spurious issues for users. If we can't find a clean solution in the build system to warn the users, I'm not sure I want this in. |
|
Hm but without this I wouldn't want #14497 in |
As I understand the rtt_rtc module, it provides a software wrapper that mimics the periph/rtc.h API but on top of an RTT hardware component. So yes, somehow the module act as if the periph_rtc feature is provided. The problem is that in the build system, features can only be determined from the hardware itself (cpu or board). The list of features provided should be known (with Makefile.features files) before starting the dependency resolution (with Makefile.dep files). So #14497 is completely valid alone. It's just that if someone wants to use periph_rtc on a board that is already providing periph_rtt but has no hardware RTC, then this person just has to add Here we are facing the same issue we already have for the possible So as a conclusion, I wouldn't add now |
I tested a build of diff --git a/tests/periph_rtc/Makefile b/tests/periph_rtc/Makefile
index ecb6a6a796..54df5bdee3 100644
--- a/tests/periph_rtc/Makefile
+++ b/tests/periph_rtc/Makefile
@@ -1,7 +1,8 @@
include ../Makefile.tests_common
-FEATURES_REQUIRED = periph_rtc
+# FEATURES_REQUIRED = periph_rtc
+USEMODULE += rtt_rtc
USEMODULE += xtimer
include $(RIOTBASE)/Makefile.include=> no build error |
Contribution description
If those boards all provide the RTT feature, they will also provide the RTC feature.
Testing procedure
Run
tests/periph_rtcon a nrf51/nrf52 board.Issues/PRs references