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

sys/ztimer: auto_init react to possibly missing ztimer_periph_timer #16342

Closed
wants to merge 1 commit into from

Conversation

kfessel
Copy link
Contributor

@kfessel kfessel commented Apr 16, 2021

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

@kfessel kfessel added Area: sys Area: System Area: timers Area: timer subsystems Type: bug The issue reports a bug / The PR fixes a bug (including spelling errors) labels Apr 16, 2021
@kfessel kfessel force-pushed the p-patch-ztimer-auto branch from e7f2519 to 42ad3b4 Compare April 16, 2021 11:56
@kfessel kfessel changed the title sys/ztimer: auto_init reackt to possibly missing ztimer_periph_timer sys/ztimer: auto_init react to possibly missing ztimer_periph_timer Apr 16, 2021
@kfessel kfessel requested a review from maribu April 16, 2021 13:07
@kfessel
Copy link
Contributor Author

kfessel commented Apr 28, 2021

@maribu, @kasper may be you want to have a look at this

Copy link
Member

@maribu maribu left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

See inline comments

@@ -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)
Copy link
Member

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.

Copy link
Contributor Author

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

Comment on lines 136 to 140
# define INIT_ZTIMER_TIMER 1
# endif
# define ZTIMER_SEC_CONVERT_LOWER_FREQ ZTIMER_TIMER_FREQ
# endif
#endif
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
# 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

?

Copy link
Contributor Author

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

@fjmolinas
Copy link
Contributor

ping @maribu

@maribu
Copy link
Member

maribu commented Jun 7, 2021

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

@fjmolinas
Copy link
Contributor

I think #16553 can fix this as well

@MrKevinWeiss MrKevinWeiss added this to the Release 2021.07 milestone Jun 21, 2021
@fjmolinas
Copy link
Contributor

@kfessel with #16553 in I think htis is no longer needed, can you confirm?

@kfessel
Copy link
Contributor Author

kfessel commented Jun 28, 2021

@kfessel with #16553 in I think this is no longer needed, can you confirm?

#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.
Similar configuration issues may happen in future this provides a better hint.

@kfessel
Copy link
Contributor Author

kfessel commented Dec 10, 2021

#17372 would have been easier to solve if this had been in.

@kfessel kfessel force-pushed the p-patch-ztimer-auto branch from 42ad3b4 to 4598a11 Compare December 10, 2021 12:26
@benpicco benpicco added the CI: ready for build If set, CI server will compile all applications for all available boards for the labeled PR label Apr 19, 2022
@kfessel
Copy link
Contributor Author

kfessel commented Jun 6, 2023

#17654 got this in

@kfessel kfessel closed this Jun 6, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Area: sys Area: System Area: timers Area: timer subsystems CI: ready for build If set, CI server will compile all applications for all available boards for the labeled PR Type: bug The issue reports a bug / The PR fixes a bug (including spelling errors)
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants