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: initial import #11874

Merged
merged 15 commits into from
Mar 6, 2020
Merged

sys/ztimer: initial import #11874

merged 15 commits into from
Mar 6, 2020

Conversation

kaspar030
Copy link
Contributor

@kaspar030 kaspar030 commented Jul 19, 2019

Contribution description

This PR contains a new timer subsystem meant to eventually replace xtimer. It has been in development for quite some time by @gebart and me.

Please refer to this document for a more detailed problem statement and implementation details.

The PR provides some unittests using a mock clock. This has been used successfully to find quite some bugs.

The PR does not enable or use ztimer for anything but tests. The idea is to get feedback on concept and API, fill the holes, see how it works. Eventually, if deemed better than xtimer, we can convert the codebase. There's an initial coccinelle script that can automatically do that (only fails on 64bit xtimer API calls for lack of ztimer alternative).

ztimer tries to re-use the same defaults and configuration as xtimer. With "USEMODULE += xtimer_on_ztimer", a large part of the code can be tested with ztimer as backend and xtimer on top. *update: this is selected automatically if xtimer and ztimer are in USEMODULE.

Update 2020-02-20

  • if both "xtimer" and "ztimer" are in USEMODULE, xtimer_on_ztimer will be used automatically.

Update 2019-12-09:

  • integrated ztimer_extend into the core ztimer code
  • re-integrated ztimer conversion using fractions (frac module)

Update 2019-12-10:

  • optimizations left for follow-ups:
    • convert_frac uses runtime calculation for determining the magic numbers. This could easily made static for the few we actually use (e.g., 32768/1000000, 32768/1000, 32768/1000, 1024/1000, ...)
    • some conversions require only simple shifts / multiplications, e.g., 250000/1000000. A specialized conversion module would save convert_frac's (little) overhead alltogether

Testing procedure

  • review API and concept

  • try "USEMODULE += xtimer_on_ztimer" "USEMODULE=ztimer make ..." on your board, with some of the xtimer tests

Issues/PRs references

@kaspar030 kaspar030 added State: WIP State: The PR is still work-in-progress and its code is not in its final presentable form yet Type: new feature The issue requests / The PR implemements a new feature for RIOT CI: ready for build If set, CI server will compile all applications for all available boards for the labeled PR Area: timers Area: timer subsystems CI: run tests If set, CI server will run tests on hardware for the labeled PR Discussion: RFC The issue/PR is used as a discussion starting point about the item of the issue/PR labels Jul 19, 2019
@kaspar030 kaspar030 force-pushed the ztimer branch 2 times, most recently from 10af470 to 4b12eb5 Compare July 21, 2019 19:55
maribu
maribu previously requested changes Sep 6, 2019
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.

The code is disabling type checking by force casting at many instances. Most of the casts are not needed and can be replaced by code that does not disable type checking. Converting from a generic to a specific (e.g. ztimer_dev_t * to ztimer_periph_t) could be moved to a static inline function. That will make refactoring easier, e.g. if the structure layout of ztimer_periph_t changed that ztimer_dev_t no longer is the first member.

Is there any case where a ztimer_base_t * does not point to a ztimer_t? If not, what is the reason to have ztimer_base_t?

sys/ztimer/periph.c Outdated Show resolved Hide resolved
sys/ztimer/periph.c Outdated Show resolved Hide resolved
sys/ztimer/periph.c Outdated Show resolved Hide resolved
sys/ztimer/periph.c Outdated Show resolved Hide resolved
sys/ztimer/rtc.c Outdated Show resolved Hide resolved
sys/ztimer/extend.c Outdated Show resolved Hide resolved
sys/ztimer/extend.c Outdated Show resolved Hide resolved
sys/ztimer/extend.c Outdated Show resolved Hide resolved
sys/ztimer/init.c Outdated Show resolved Hide resolved
sys/ztimer/init.c Outdated Show resolved Hide resolved
@bergzand
Copy link
Member

bergzand commented Sep 6, 2019

Converting from a generic to a specific (e.g. ztimer_dev_t * to ztimer_periph_t) could be moved to a static inline function. That will make refactoring easier, e.g. if the structure layout of ztimer_periph_t changed that ztimer_dev_t no longer is the first member.

Would the already existing container_of macro be the solution here? It keeps working when the structure layout of ztimer_periph_t changes.

uint32_t period);

/**
* @brief Put the calling thread to sleep for the specified number of ticks
Copy link
Member

Choose a reason for hiding this comment

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

Probably also valid for the other functions: This probably doesn't sleep exactly the number of ticks (or seconds) on every platform. Does this sleep at least ticks or at most ticks. Furthermore, is there a way to get the other behaviour, for example, sleep at least $duration to allow for a peripheral to initialize or sleep at most $duration to not miss a deadline.

Copy link
Member

Choose a reason for hiding this comment

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

I bet that this is impossible, as e.g. a thread with higher priority might get the CPU at the very moment the caller wants to wake up. As far as I know, RIOT never had the goal to provide hard real time features, but soft real time features instead.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Does this sleep at least ticks or at most ticks.

Well, the implementation sleeps "at least x ticks". I guess this information has to be added everywhere.

As far as I know, RIOT never had the goal to provide hard real time features, but soft real time features instead.

I think that is what the website states. Actually, it is more complicated. Parts of RIOT are fully hard real-time capable, some parts are not, some parts are only if certain constraints are honored. With care, it is perfectly possible to do hard real time with RIOT. but, you really have to know the internals, as documentation on the matter is severley lacking.
Still, I like that doing hard real-time with RIOT is possible.

@maribu
Copy link
Member

maribu commented Sep 6, 2019

Converting from a generic to a specific (e.g. ztimer_dev_t * to ztimer_periph_t) could be moved to a static inline function. That will make refactoring easier, e.g. if the structure layout of ztimer_periph_t changed that ztimer_dev_t no longer is the first member.

Would the already existing container_of macro be the solution here? It keeps working when the structure layout of ztimer_periph_t changes.

The good thing with the static inline funcitons is, if e.g. ztimer_dev_t * and ztimer_periph_t * will at some point no longer be convertible, removing the inline function would break (at compile time) all code that still tries to convert - including some out of tree code of RIOT users. That would be much better than hard to trace runtime bugs. (But using container_of() in that static inline function sounds like a very good idea to me.)

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.

OK. The general architecture and the user facing API are fine. It adds no more complexity than required to allow different timer bases, and the advantages of this are obvious and outweigh the cost of one additional parameter by means.

Having the proposed plan in mind to bring this to master, so that it can be tested and gradually improved to the point it can replace xtimer, I'd say this PR is generally in the shape to get merged. (One exception: The TODO in the user facing API, see comment below. The function should also be documented properly, as it is part of the user facing API.)

sys/include/ztimer.h Outdated Show resolved Hide resolved
@kaspar030
Copy link
Contributor Author

The code is disabling type checking by force casting at many instances. Most of the casts are not needed and can be replaced by code that does not disable type checking.

Please let's not have this discussion here. As implemented here, this is idiomatic C. I'd rather keep the style as is, and concentrate on more pressing issues. (I will fix all the unnececessary void * -> specific_t * casts.)

Copy link
Member

@bergzand bergzand left a comment

Choose a reason for hiding this comment

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

Minor issues I've found so far

Makefile.dep Show resolved Hide resolved
sys/include/ztimer.h Show resolved Hide resolved
@maribu
Copy link
Member

maribu commented Sep 17, 2019

I think only four things are left so that this can be merged:

  1. The missing include @bergzand pointed out
  2. The unrelated change @bergzand pointed out
  3. The TODO / missing doc for ztimer_diff()
  4. The unnecessary casts from void *

Copy link
Member

@SemjonWilke SemjonWilke left a comment

Choose a reason for hiding this comment

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

I just found some documentation that's not to clear to me. I did not read the corresponding code yet.

sys/include/ztimer.h Outdated Show resolved Hide resolved
sys/include/ztimer.h Outdated Show resolved Hide resolved
sys/include/ztimer.h Outdated Show resolved Hide resolved
@kaspar030 kaspar030 removed Discussion: RFC The issue/PR is used as a discussion starting point about the item of the issue/PR State: WIP State: The PR is still work-in-progress and its code is not in its final presentable form yet labels Dec 9, 2019
@kaspar030
Copy link
Contributor Author

I've put quite some work into this. Please see the updated PR description.

There's also a more detailed document on why we actually started this and why I think it should replace xtimer: https://github.com/RIOT-OS/RIOT/wiki/ztimer-problem-statement-and-design-document

@miri64
Copy link
Member

miri64 commented Dec 9, 2019

There's also a more detailed document on why we actually started this and why I think it should replace xtimer: https://github.com/RIOT-OS/RIOT/wiki/ztimer-problem-statement-and-design-document

Maybe also advertise this on the devel mailinglist.

@kaspar030
Copy link
Contributor Author

Maybe also advertise this on the devel mailinglist.

ok

@jue89
Copy link
Contributor

jue89 commented Mar 4, 2020

The SAMR30 looks fine!

./compile_and_test_for_board.py ../../.. samr30-xpro --with-test-only -j0 --applications="tests/xtimer* tests/ztimer*":

Results
INFO:samr30-xpro:Saving toolchain
INFO:samr30-xpro.tests/xtimer_drift:Board supported: True
INFO:samr30-xpro.tests/xtimer_drift:Board has enough memory: True
INFO:samr30-xpro.tests/xtimer_drift:Application has test: False
INFO:samr30-xpro.tests/xtimer_hang:Board supported: True
INFO:samr30-xpro.tests/xtimer_hang:Board has enough memory: True
INFO:samr30-xpro.tests/xtimer_hang:Application has test: True
INFO:samr30-xpro.tests/xtimer_hang:Run compilation
INFO:samr30-xpro.tests/xtimer_hang:Run test
INFO:samr30-xpro.tests/xtimer_hang:Run test.flash
INFO:samr30-xpro.tests/xtimer_hang:Success
INFO:samr30-xpro.tests/xtimer_longterm:Board supported: True
INFO:samr30-xpro.tests/xtimer_longterm:Board has enough memory: True
INFO:samr30-xpro.tests/xtimer_longterm:Application has test: False
INFO:samr30-xpro.tests/xtimer_msg:Board supported: True
INFO:samr30-xpro.tests/xtimer_msg:Board has enough memory: True
INFO:samr30-xpro.tests/xtimer_msg:Application has test: True
INFO:samr30-xpro.tests/xtimer_msg:Run compilation
INFO:samr30-xpro.tests/xtimer_msg:Run test
INFO:samr30-xpro.tests/xtimer_msg:Run test.flash
INFO:samr30-xpro.tests/xtimer_msg:Success
INFO:samr30-xpro.tests/xtimer_msg_receive_timeout:Board supported: True
INFO:samr30-xpro.tests/xtimer_msg_receive_timeout:Board has enough memory: True
INFO:samr30-xpro.tests/xtimer_msg_receive_timeout:Application has test: True
INFO:samr30-xpro.tests/xtimer_msg_receive_timeout:Run compilation
INFO:samr30-xpro.tests/xtimer_msg_receive_timeout:Run test
INFO:samr30-xpro.tests/xtimer_msg_receive_timeout:Run test.flash
INFO:samr30-xpro.tests/xtimer_msg_receive_timeout:Success
INFO:samr30-xpro.tests/xtimer_mutex_lock_timeout:Board supported: True
INFO:samr30-xpro.tests/xtimer_mutex_lock_timeout:Board has enough memory: True
INFO:samr30-xpro.tests/xtimer_mutex_lock_timeout:Application has test: True
INFO:samr30-xpro.tests/xtimer_mutex_lock_timeout:Run compilation
INFO:samr30-xpro.tests/xtimer_mutex_lock_timeout:Run test
INFO:samr30-xpro.tests/xtimer_mutex_lock_timeout:Run test.flash
INFO:samr30-xpro.tests/xtimer_mutex_lock_timeout:Success
INFO:samr30-xpro.tests/xtimer_now64_continuity:Board supported: True
INFO:samr30-xpro.tests/xtimer_now64_continuity:Board has enough memory: True
INFO:samr30-xpro.tests/xtimer_now64_continuity:Application has test: True
INFO:samr30-xpro.tests/xtimer_now64_continuity:Run compilation
INFO:samr30-xpro.tests/xtimer_now64_continuity:Run test
INFO:samr30-xpro.tests/xtimer_now64_continuity:Run test.flash
INFO:samr30-xpro.tests/xtimer_now64_continuity:Success
INFO:samr30-xpro.tests/xtimer_periodic_wakeup:Board supported: True
INFO:samr30-xpro.tests/xtimer_periodic_wakeup:Board has enough memory: True
INFO:samr30-xpro.tests/xtimer_periodic_wakeup:Application has test: True
INFO:samr30-xpro.tests/xtimer_periodic_wakeup:Run compilation
INFO:samr30-xpro.tests/xtimer_periodic_wakeup:Run test
INFO:samr30-xpro.tests/xtimer_periodic_wakeup:Run test.flash
INFO:samr30-xpro.tests/xtimer_periodic_wakeup:Success
INFO:samr30-xpro.tests/xtimer_remove:Board supported: True
INFO:samr30-xpro.tests/xtimer_remove:Board has enough memory: True
INFO:samr30-xpro.tests/xtimer_remove:Application has test: True
INFO:samr30-xpro.tests/xtimer_remove:Run compilation
INFO:samr30-xpro.tests/xtimer_remove:Run test
INFO:samr30-xpro.tests/xtimer_remove:Run test.flash
INFO:samr30-xpro.tests/xtimer_remove:Success
INFO:samr30-xpro.tests/xtimer_reset:Board supported: True
INFO:samr30-xpro.tests/xtimer_reset:Board has enough memory: True
INFO:samr30-xpro.tests/xtimer_reset:Application has test: True
INFO:samr30-xpro.tests/xtimer_reset:Run compilation
INFO:samr30-xpro.tests/xtimer_reset:Run test
INFO:samr30-xpro.tests/xtimer_reset:Run test.flash
INFO:samr30-xpro.tests/xtimer_reset:Success
INFO:samr30-xpro.tests/xtimer_usleep:Board supported: True
INFO:samr30-xpro.tests/xtimer_usleep:Board has enough memory: True
INFO:samr30-xpro.tests/xtimer_usleep:Application has test: True
INFO:samr30-xpro.tests/xtimer_usleep:Run compilation
INFO:samr30-xpro.tests/xtimer_usleep:Run test
INFO:samr30-xpro.tests/xtimer_usleep:Run test.flash
INFO:samr30-xpro.tests/xtimer_usleep:Success
INFO:samr30-xpro.tests/xtimer_usleep_short:Board supported: True
INFO:samr30-xpro.tests/xtimer_usleep_short:Board has enough memory: True
INFO:samr30-xpro.tests/xtimer_usleep_short:Application has test: True
INFO:samr30-xpro.tests/xtimer_usleep_short:Run compilation
INFO:samr30-xpro.tests/xtimer_usleep_short:Run test
INFO:samr30-xpro.tests/xtimer_usleep_short:Run test.flash
INFO:samr30-xpro.tests/xtimer_usleep_short:Success
INFO:samr30-xpro.tests/ztimer_msg:Board supported: True
INFO:samr30-xpro.tests/ztimer_msg:Board has enough memory: True
INFO:samr30-xpro.tests/ztimer_msg:Application has test: True
INFO:samr30-xpro.tests/ztimer_msg:Run compilation
INFO:samr30-xpro.tests/ztimer_msg:Run test
INFO:samr30-xpro.tests/ztimer_msg:Run test.flash
INFO:samr30-xpro.tests/ztimer_msg:Success
INFO:samr30-xpro.tests/ztimer_overhead:Board supported: True
INFO:samr30-xpro.tests/ztimer_overhead:Board has enough memory: True
INFO:samr30-xpro.tests/ztimer_overhead:Application has test: True
INFO:samr30-xpro.tests/ztimer_overhead:Run compilation
INFO:samr30-xpro.tests/ztimer_overhead:Run test
INFO:samr30-xpro.tests/ztimer_overhead:Run test.flash
INFO:samr30-xpro.tests/ztimer_overhead:Success
INFO:samr30-xpro:Tests successful

@kaspar030
Copy link
Contributor Author

The SAMR30 looks fine!

Thanks for running these! Did you somehow export USEMODULE="ztimer ztimer_xtimer_compat"? If not, the xtimer tests just test xtimer. Using "ztimer_xtimer_compat" will make use of the API wrapper. (some tests might not compile due to the incomplete wrapper).

@jue89
Copy link
Contributor

jue89 commented Mar 4, 2020

Thanks for running these! Did you somehow export USEMODULE="ztimer ztimer_xtimer_compat"? If not, the xtimer tests just test xtimer. Using "ztimer_xtimer_compat" will make use of the API wrapper. (some tests might not compile due to the incomplete wrapper).

Good to know. I set an environment variable accordingly. (BTW: Good test if the compat layer is actually used :D)

env PORT=/dev/ttyACM1 USEMODULE="ztimer_xtimer_compat" ./compile_and_test_for_board.py ../../.. samr30-xpro --with-test-only -j0 --applications="tests/xtimer*"
Results
INFO:samr30-xpro:Saving toolchain
INFO:samr30-xpro.tests/xtimer_drift:Board supported: True
INFO:samr30-xpro.tests/xtimer_drift:Board has enough memory: True
INFO:samr30-xpro.tests/xtimer_drift:Application has test: False
INFO:samr30-xpro.tests/xtimer_hang:Board supported: True
INFO:samr30-xpro.tests/xtimer_hang:Board has enough memory: True
INFO:samr30-xpro.tests/xtimer_hang:Application has test: True
INFO:samr30-xpro.tests/xtimer_hang:Run compilation
INFO:samr30-xpro.tests/xtimer_hang:Run test
INFO:samr30-xpro.tests/xtimer_hang:Run test.flash
INFO:samr30-xpro.tests/xtimer_hang:Success
INFO:samr30-xpro.tests/xtimer_longterm:Board supported: True
INFO:samr30-xpro.tests/xtimer_longterm:Board has enough memory: True
INFO:samr30-xpro.tests/xtimer_longterm:Application has test: False
INFO:samr30-xpro.tests/xtimer_msg:Board supported: True
INFO:samr30-xpro.tests/xtimer_msg:Board has enough memory: True
INFO:samr30-xpro.tests/xtimer_msg:Application has test: True
INFO:samr30-xpro.tests/xtimer_msg:Run compilation
INFO:samr30-xpro.tests/xtimer_msg:Run test
INFO:samr30-xpro.tests/xtimer_msg:Run test.flash
INFO:samr30-xpro.tests/xtimer_msg:Success
INFO:samr30-xpro.tests/xtimer_msg_receive_timeout:Board supported: True
INFO:samr30-xpro.tests/xtimer_msg_receive_timeout:Board has enough memory: True
INFO:samr30-xpro.tests/xtimer_msg_receive_timeout:Application has test: True
INFO:samr30-xpro.tests/xtimer_msg_receive_timeout:Run compilation
INFO:samr30-xpro.tests/xtimer_msg_receive_timeout:Run test
INFO:samr30-xpro.tests/xtimer_msg_receive_timeout:Run test.flash
INFO:samr30-xpro.tests/xtimer_msg_receive_timeout:Success
INFO:samr30-xpro.tests/xtimer_mutex_lock_timeout:Board supported: True
INFO:samr30-xpro.tests/xtimer_mutex_lock_timeout:Board has enough memory: True
INFO:samr30-xpro.tests/xtimer_mutex_lock_timeout:Application has test: True
INFO:samr30-xpro.tests/xtimer_mutex_lock_timeout:Run compilation
WARNING:samr30-xpro.tests/xtimer_mutex_lock_timeout:make RIOT_CI_BUILD=1 CC_NOCOLOR=1 --no-print-directory -C ../../../tests/xtimer_mutex_lock_timeout clean all --jobs
Building application "tests_xtimer_mutex_lock_timeout" for "samr30-xpro" with MCU "saml21".

/home/jfi/Projects/RIOT/tests/xtimer_mutex_lock_timeout/main.c: In function 'cmd_test_xtimer_mutex_lock_timeout_long_unlocked':
/home/jfi/Projects/RIOT/tests/xtimer_mutex_lock_timeout/main.c:125:9: error: implicit declaration of function 'xtimer_mutex_lock_timeout' [-Werror=implicit-function-declaration]
  125 |     if (xtimer_mutex_lock_timeout(&test_mutex, LONG_MUTEX_TIMEOUT) == 0) {
      |         ^~~~~~~~~~~~~~~~~~~~~~~~~
cc1: all warnings being treated as errors
make[1]: *** [/home/jfi/Projects/RIOT/Makefile.base:110: /home/jfi/Projects/RIOT/tests/xtimer_mutex_lock_timeout/bin/samr30-xpro/application_tests_xtimer_mutex_lock_timeout/main.o] Error 1
make[1]: *** Waiting for unfinished jobs....
make: *** [/home/jfi/Projects/RIOT/tests/xtimer_mutex_lock_timeout/../../Makefile.include:541: /home/jfi/Projects/RIOT/tests/xtimer_mutex_lock_timeout/bin/samr30-xpro/application_tests_xtimer_mutex_lock_timeout.a] Error 2

Return value: 2

ERROR:samr30-xpro.tests/xtimer_mutex_lock_timeout:Error during compilation, writing to results/samr30-xpro/tests/xtimer_mutex_lock_timeout/compilation.failed
ERROR:samr30-xpro.tests/xtimer_mutex_lock_timeout:Failed during: compilation
INFO:samr30-xpro.tests/xtimer_now64_continuity:Board supported: True
INFO:samr30-xpro.tests/xtimer_now64_continuity:Board has enough memory: True
INFO:samr30-xpro.tests/xtimer_now64_continuity:Application has test: True
INFO:samr30-xpro.tests/xtimer_now64_continuity:Run compilation
WARNING:samr30-xpro.tests/xtimer_now64_continuity:make RIOT_CI_BUILD=1 CC_NOCOLOR=1 --no-print-directory -C ../../../tests/xtimer_now64_continuity clean all --jobs
Building application "tests_xtimer_now64_continuity" for "samr30-xpro" with MCU "saml21".

/home/jfi/Projects/RIOT/tests/xtimer_now64_continuity/main.c: In function 'main':
/home/jfi/Projects/RIOT/tests/xtimer_now64_continuity/main.c:41:33: error: implicit declaration of function 'xtimer_diff64'; did you mean 'xtimer_now64'? [-Werror=implicit-function-declaration]
   41 |         xtimer_ticks64_t diff = xtimer_diff64(now, before);
      |                                 ^~~~~~~~~~~~~
      |                                 xtimer_now64
/home/jfi/Projects/RIOT/tests/xtimer_now64_continuity/main.c:42:17: error: request for member 'ticks64' in something not a structure or union
   42 |         if (diff.ticks64 > diff_max) {
      |                 ^
/home/jfi/Projects/RIOT/tests/xtimer_now64_continuity/main.c:43:28: error: request for member 'ticks64' in something not a structure or union
   43 |             diff_max = diff.ticks64;
      |                            ^
/home/jfi/Projects/RIOT/tests/xtimer_now64_continuity/main.c:45:17: error: request for member 'ticks64' in something not a structure or union
   45 |         if (diff.ticks64 < diff_min) {
      |                 ^
/home/jfi/Projects/RIOT/tests/xtimer_now64_continuity/main.c:46:28: error: request for member 'ticks64' in something not a structure or union
   46 |             diff_min = diff.ticks64;
      |                            ^
/home/jfi/Projects/RIOT/tests/xtimer_now64_continuity/main.c:48:25: error: request for member 'ticks64' in something not a structure or union
   48 |         diff_sum += diff.ticks64;
      |                         ^
/home/jfi/Projects/RIOT/tests/xtimer_now64_continuity/main.c:41:26: error: variable 'diff' set but not used [-Werror=unused-but-set-variable]
   41 |         xtimer_ticks64_t diff = xtimer_diff64(now, before);
      |                          ^~~~
cc1: all warnings being treated as errors
make[1]: *** [/home/jfi/Projects/RIOT/Makefile.base:110: /home/jfi/Projects/RIOT/tests/xtimer_now64_continuity/bin/samr30-xpro/application_tests_xtimer_now64_continuity/main.o] Error 1
make[1]: *** Waiting for unfinished jobs....
make: *** [/home/jfi/Projects/RIOT/tests/xtimer_now64_continuity/../../Makefile.include:541: /home/jfi/Projects/RIOT/tests/xtimer_now64_continuity/bin/samr30-xpro/application_tests_xtimer_now64_continuity.a] Error 2

Return value: 2

ERROR:samr30-xpro.tests/xtimer_now64_continuity:Error during compilation, writing to results/samr30-xpro/tests/xtimer_now64_continuity/compilation.failed
ERROR:samr30-xpro.tests/xtimer_now64_continuity:Failed during: compilation
INFO:samr30-xpro.tests/xtimer_periodic_wakeup:Board supported: True
INFO:samr30-xpro.tests/xtimer_periodic_wakeup:Board has enough memory: True
INFO:samr30-xpro.tests/xtimer_periodic_wakeup:Application has test: True
INFO:samr30-xpro.tests/xtimer_periodic_wakeup:Run compilation
INFO:samr30-xpro.tests/xtimer_periodic_wakeup:Run test
INFO:samr30-xpro.tests/xtimer_periodic_wakeup:Run test.flash
INFO:samr30-xpro.tests/xtimer_periodic_wakeup:Success
INFO:samr30-xpro.tests/xtimer_remove:Board supported: True
INFO:samr30-xpro.tests/xtimer_remove:Board has enough memory: True
INFO:samr30-xpro.tests/xtimer_remove:Application has test: True
INFO:samr30-xpro.tests/xtimer_remove:Run compilation
INFO:samr30-xpro.tests/xtimer_remove:Run test
INFO:samr30-xpro.tests/xtimer_remove:Run test.flash
INFO:samr30-xpro.tests/xtimer_remove:Success
INFO:samr30-xpro.tests/xtimer_reset:Board supported: True
INFO:samr30-xpro.tests/xtimer_reset:Board has enough memory: True
INFO:samr30-xpro.tests/xtimer_reset:Application has test: True
INFO:samr30-xpro.tests/xtimer_reset:Run compilation
INFO:samr30-xpro.tests/xtimer_reset:Run test
INFO:samr30-xpro.tests/xtimer_reset:Run test.flash
INFO:samr30-xpro.tests/xtimer_reset:Success
INFO:samr30-xpro.tests/xtimer_usleep:Board supported: True
INFO:samr30-xpro.tests/xtimer_usleep:Board has enough memory: True
INFO:samr30-xpro.tests/xtimer_usleep:Application has test: True
INFO:samr30-xpro.tests/xtimer_usleep:Run compilation
INFO:samr30-xpro.tests/xtimer_usleep:Run test
INFO:samr30-xpro.tests/xtimer_usleep:Run test.flash
INFO:samr30-xpro.tests/xtimer_usleep:Success
INFO:samr30-xpro.tests/xtimer_usleep_short:Board supported: True
INFO:samr30-xpro.tests/xtimer_usleep_short:Board has enough memory: True
INFO:samr30-xpro.tests/xtimer_usleep_short:Application has test: True
INFO:samr30-xpro.tests/xtimer_usleep_short:Run compilation
INFO:samr30-xpro.tests/xtimer_usleep_short:Run test
INFO:samr30-xpro.tests/xtimer_usleep_short:Run test.flash
INFO:samr30-xpro.tests/xtimer_usleep_short:Success
ERROR:samr30-xpro:Tests failed: 2
Failures during compilation:
- [tests/xtimer_mutex_lock_timeout](tests/xtimer_mutex_lock_timeout/compilation.failed)
- [tests/xtimer_now64_continuity](tests/xtimer_now64_continuity/compilation.failed)

@fjmolinas
Copy link
Contributor

Re ran with USEMODULE+="ztimer ztimer_xtimer_compat"

compile_and_test_for_board.py . BOARD --with-test-only --incremental -j0 --applications="tests/xtimer*

pba-d-01-kw2x/failuresummary

Failures during compilation:

nucleo-f207zg/failuresummary

Failures during compilation:

hifive1b/failuresummary

Failures during compilation:

nrf52dk/failuresummary

Failures during compilation:

nrf52840dk/failuresummary

Failures during compilation:

iotlab-m3/failuresummary

Failures during compilation:

frdm-k64f/failuresummary

Failures during compilation:

nucleo-l152re/failuresummary

Failures during compilation:

b-l475e-iot01a/failuresummary

Failures during compilation:

nucleo-f410rb/failuresummary

Failures during compilation:

arduino-uno/failuresummary

Failures during compilation:

nucleo-f767zi/failuresummary

Failures during compilation:

arduino-mega2560/failuresummary

Failures during compilation:

i-nucleo-lrwan1/failuresummary

Failures during compilation:

openmote-b/failuresummary

Failures during compilation:

z1/failuresummary

Failures during compilation:

nucleo-f091rc/failuresummary

Failures during compilation:

arduino-zero/failuresummary

Failures during compilation:

nucleo-f103rb/failuresummary

Failures during compilation:

b-l072z-lrwan1/failuresummary

Failures during compilation:

nucleo-f303re/failuresummary

Failures during compilation:

slstk3402a/failuresummary

Failures during compilation:

nucleo-l073rz/failuresummary

Failures during compilation:

Only compilation failures for:

    tests/xtimer_mutex_lock_timeout
    tests/xtimer_now64_continuity

@kaspar030
Copy link
Contributor Author

Only compilation failures for:

    tests/xtimer_mutex_lock_timeout
    tests/xtimer_now64_continuity

So the other xtimer tests pass. They don't really check for quality of the results. This basically means that the difficult corner cases that are checked don't hang or crash with ztimer (which is nice).

Copy link
Member

@bergzand bergzand left a comment

Choose a reason for hiding this comment

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

ztimer is fully optional and not intrusive. Default RIOT behavior is not affected. Tests showed no issues and the code is in good shape. Documentation is in good enough shape for this to be merged.

ACK!

@bergzand bergzand merged commit ed31630 into RIOT-OS:master Mar 6, 2020
@leandrolanzieri leandrolanzieri added this to the Release 2020.04 milestone Mar 6, 2020
@kaspar030 kaspar030 deleted the ztimer branch March 30, 2020 19:28
@leandrolanzieri leandrolanzieri added the Area: sys Area: System label Apr 24, 2020
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: new feature The issue requests / The PR implemements a new feature for RIOT
Projects
None yet
Development

Successfully merging this pull request may close these issues.