-
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
tests/periph_timer: Cleanup #14808
tests/periph_timer: Cleanup #14808
Conversation
Abusing the volatile qualifier for synchronization doesn't work, instead C11 atomics must be used.
static volatile uint32_t timeouts[MAX_CHANNELS]; | ||
static volatile unsigned args[MAX_CHANNELS]; | ||
#ifndef XTIMER_HZ | ||
#define XTIMER_HZ MHZ(1) |
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.
Just a minor style improvement.
#define XTIMER_HZ MHZ(1) | |
#define XTIMER_HZ MHZ(1) |
I can try on usb-kw41z, remote, hifive1b.
The test now fails on usb-kw41z (but works on master):
|
#include <stdlib.h> | ||
|
||
#include "macros/units.h" |
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.
#include "macros/units.h" | |
#include "board.h" | |
#include "macros/units.h" |
This fixes the failing test on usb-kw41z (and probably on other boards)
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.
Thanks. I'll fix tonight. (Feel free to (force) push instead, of you want.)
It's also broken on remote (cc2538) based boards: they don't define XTIMER_HZ but requires CLOCK_CORECLOCK instead of MHZ(1). We can set XTIMER_HZ for them, but I'm not sure if that makes sense to enable it globally this way. fix for usb-kw41z, hifive1b and remotediff --git a/boards/common/remote/include/board_common.h b/boards/common/remote/include/board_common.h
index acb1d8a6fa..6eef086471 100644
--- a/boards/common/remote/include/board_common.h
+++ b/boards/common/remote/include/board_common.h
@@ -78,6 +78,7 @@
* @name xtimer configuration
* @{
*/
+#define XTIMER_HZ (CLOCK_CORECLOCK)
#define XTIMER_WIDTH (16)
#define XTIMER_BACKOFF (50)
#define XTIMER_ISR_BACKOFF (40)
diff --git a/tests/periph_timer/main.c b/tests/periph_timer/main.c
index 806ea8dc30..660661f0b4 100644
--- a/tests/periph_timer/main.c
+++ b/tests/periph_timer/main.c
@@ -23,6 +23,8 @@
#include <stdatomic.h>
#include <stdlib.h>
+#include "board.h"
+
#include "macros/units.h"
#include "periph/timer.h"
|
@fjmolinas any opinion on #14808 (comment) ? (you know cc2538 boards quite well). |
I don't think I like 752c6da:
|
I agree. But that would be consistent with the other timer tests. Manually maintaining lists for each test is IMO not an option either; at least we should deduplicate this to only maintain one list for all tests. |
I wonder if |
@@ -2,42 +2,4 @@ include ../Makefile.tests_common | |||
|
|||
FEATURES_REQUIRED = periph_timer | |||
|
|||
BOARDS_TIMER_25kHz := \ |
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.
BTW this should have been 250kHz :)
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.
BTW this should have been 250kHz :)
Also noticed that and even opened a PR until I noticed that #14799 was removing it...
I'm unaware if for all platforms the timer speed can be the same as the core clock speed. |
If you want to try it out I can run the test on a series of boards. |
Needs rebase. What's the state of this PR btw ? |
I dislike the approach in this PR. I think it would be better to extend the API of Most importantly however, this would allow to iterate over supported frequencies and verify that the timer implementation indeed works for every supported frequency. E.g. currently running |
Contribution description
XTIMER_HZ
instead of a manual list for timer frequenciesvolatile
Testing procedure
Test should still work as previously. In fact, the manual list of timer frequencies seems to be identical to the definition of
XTIMER_HZ
for every board.Issues/PRs references
Split out of #14799