net/grnc/sixlowpan/ctx: use ztimer_msec if available#16340
net/grnc/sixlowpan/ctx: use ztimer_msec if available#16340miri64 merged 2 commits intoRIOT-OS:masterfrom
Conversation
miri64
left a comment
There was a problem hiding this comment.
Code looks fine. However, when trying to compile the unittests with the USEMODULE as described above I get a linking error for samr21-xpro:
$ BOARD=samr21-xpro USEMODULE="ztimer_msec ztimer_periph_rtt" make -C tests/unittests/ -j tests-sixlowpan_ctx
[…]
/home/mlenders/Repositories/RIOT-OS/RIOT/tests/unittests/bin/samr21-xpro/gnrc_sixlowpan_ctx/gnrc_sixlowpan_ctx.o:/home/mlenders/Repositories/RIOT-OS/RIOT/sys/include/ztimer.h:459: undefined reference to `ZTIMER_MSEC'Also a suggestion below.
| static uint32_t _current_minute(void) | ||
| { | ||
| #if IS_USED(MODULE_ZTIMER_MSEC) | ||
| return ztimer_now(ZTIMER_MSEC) / (MS_PER_SEC * 60); |
There was a problem hiding this comment.
| return ztimer_now(ZTIMER_MSEC) / (MS_PER_SEC * 60); | |
| return ztimer_now(ZTIMER_MSEC) / (MS_PER_SEC * SEC_PER_MIN); |
(if you want you can also adapt the line below)
|
The reason seems to that the ztimer auto initialization is missing in this context. For xtimer this was 'sneaked' in by the main.c file for all unit tests :-) Will add the same for ztimer to fix this. |
|
Hm, not as trivial as I figured. For now you can build the unittest with |
|
That works at least for linking now. But the tests fail since it seems to hang on |
|
To be honest, I'd like to see |
I couldn't agree more! But as this is an issue on its own, this is one of this RIOT typical rats-tail problems, where a conceptional gap for a central module is blocking or triggering hacks for a number of potential simple issues :-) So from a practical perspective I propose that we split concerns and tackle the ztimer_msec dependency issue on its own, while going forward with PRs like this one, even if it meas that testing them requires some manual USEMODULE control. Makes sense? |
|
@miri64 The tests actually run fine, the missing piece was to also include |
miri64
left a comment
There was a problem hiding this comment.
@miri64 The tests actually run fine, the missing piece was to also include
auto_init(->USEMODULE="auto_init ztimer_auto_init auto_init_ztimer ztimer_msec ztimer_periph_rtt):2021-04-16 09:12:52,886 # main(): This is RIOT! (Version: 2021.04-devel-1357-ged467-opt_sixlowpanctx_ztimer) 2021-04-16 09:12:52,891 # Help: Press s to start test, r to print it is ready s 2021-04-16 09:12:54,059 # START 2021-04-16 09:12:54,061 # ............. 2021-04-16 09:12:54,063 # OK (13 tests)
Ok, so this is a dependency problem and I agree with you that this should be tackled separately. So ACK! Please squash.
ed4678c to
feeffb2
Compare
|
squashed. |
|
Then go :-) |
|
Thanks for porting this! |
Contribution description
This PR makes
gnrc_sixlowpan_ctxuseztimer_msecas time module wheneverztimer_msecis included in the build. This is one more step in running axtimer-free network application :-)Testing procedure
Run
gnrc_networkingexample build withUSEMODULE="ztimer_msec ztimer_periph_rtt" make ...and verify, that nodes still communicate as expected...Issues/PRs references
none