-
Notifications
You must be signed in to change notification settings - Fork 2k
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
sys/ztimer: auto_init react to possibly missing ztimer_periph_timer #16342
Conversation
e7f2519
to
42ad3b4
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
See inline comments
sys/ztimer/auto_init.c
Outdated
@@ -109,7 +106,7 @@ | |||
# if ZTIMER_RTT_FREQ != FREQ_1KHZ | |||
# define ZTIMER_MSEC_CONVERT_LOWER_FREQ ZTIMER_RTT_FREQ | |||
# endif | |||
# else | |||
# elif defined(ZTIMER_TIMER) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think there should be an #else
clause added that gives an #error
in cause ztimer_msec
is used, but neither the periph_rtt
nor the periph_timer
backend is selected. This might not be possible to configure, but better be safe than sorry.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
error messages for no Backend selected (e.g.: cause there is non) happen in step 3
sys/ztimer/auto_init.c
Outdated
# define INIT_ZTIMER_TIMER 1 | ||
# endif | ||
# define ZTIMER_SEC_CONVERT_LOWER_FREQ ZTIMER_TIMER_FREQ | ||
# endif | ||
#endif |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
# define INIT_ZTIMER_TIMER 1 | |
# endif | |
# define ZTIMER_SEC_CONVERT_LOWER_FREQ ZTIMER_TIMER_FREQ | |
# endif | |
#endif | |
# define INIT_ZTIMER_TIMER 1 | |
# endif | |
# define ZTIMER_SEC_CONVERT_LOWER_FREQ ZTIMER_TIMER_FREQ | |
# else | |
# error "No backend available to implement ZTIMER_SEC" | |
# endif | |
#endif |
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this error message is in l 207 ante commit l 202 post commit
in step 1 a backend is selected (step 1 has all the precedence logic)
if non is (could be) selected a error message is printed in step 3
we can have extra error message in step one but we don't need them there
ping @maribu |
The code looks good to me. But I guess it's not a bad idea to test this with all combinations. I think I might have some time for that tomorrow |
I think #16553 can fix this as well |
#16553 make the problem not appear: The configuration is as it should be, But since the ztimer auto_init is kind of long and errors may show up in lines that may not show the most simple issue that might cause them. It also improves the ZTIMER_SEC/MSEC/USEC similarity which makes it more easy to read. I still would like to see this merged. #16322 would have been easier to solve if this had been in. |
#17372 would have been easier to solve if this had been in. |
42ad3b4
to
4598a11
Compare
#17654 got this in |
Contribution description
In #16172 I assumed ztimer_periph_timer to always be available (it was always configured in config.h) but some recent PR by @haukepetersen (#16322 identified by @jue89) showed this is no always the case.
This adapts ztimers auto_init.c to that case.
(if somehow ztimer_periph_timer is not included but required an error message will be shown)
Testing procedure
read and tests/ztimer_xsec
Issues/PRs references
#16172