Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
18632: tests/thread_float: do not overload slow MCUs with IRQs r=kaspar030 a=maribu ### Contribution description If the regular context switches are triggered too fast, slow MCUs will be able to spent little time on actually progressing in the test. This will scale the IRQ rate with the CPU clock as a crude way too keep load within limits. ### Testing procedure The unit test should now pass on the Microduino CoreRF ``` $ make BOARD=microduino-corerf AVRDUDE_PROGRAMMER=dragon_jtag -C tests/thread_float flash test make: Entering directory '/home/maribu/Repos/software/RIOT/tests/thread_float' Building application "tests_thread_float" for "microduino-corerf" with MCU "atmega128rfa1". [...] text data bss dec hex filename 12834 520 3003 16357 3fe5 /home/maribu/Repos/software/RIOT/tests/thread_float/bin/microduino-corerf/tests_thread_float.elf avrdude -c dragon_jtag -p m128rfa1 -U flash:w:/home/maribu/Repos/software/RIOT/tests/thread_float/bin/microduino-corerf/tests_thread_float.hex [...] Welcome to pyterm! Type '/exit' to exit. READY s START main(): This is RIOT! (Version: 2022.10-devel-858-g18566-tests/thread_float) THREADS CREATED Context switch every 3125 µs { "threads": [{ "name": "idle", "stack_size": 192, "stack_used": 88 }]} { "threads": [{ "name": "main", "stack_size": 640, "stack_used": 220 }]} THREAD t1 start THREAD t2 start THREAD t3 start t1: 141.443770 t3: 141.466810 t1: 141.443770 t3: 141.466810 t1: 141.443770 t3: 141.466810 t1: 141.443770 t3: 141.466810 t1: 141.443770 t3: 141.466810 t1: 141.443770 t3: 141.466810 t1: 141.443770 make: Leaving directory '/home/maribu/Repos/software/RIOT/tests/thread_float' ``` (~~Note: The idle thread exiting is something that should never occur. I guess the culprit may be `cpu_switch_context_exit()` messing things up when the main thread exits. But that is not directly related to what this PR aims to fix. Adding a `thread_sleep()` at the end of `main()` does indeed prevent the idle thread from exiting.~~ Update: That's expected. The idle thread stats are printed on exit of the main thread, the idle thread does not actually exit.) ### Issues/PRs references Fixes #16908 maybe? 19031: cpu/stm32/periph_timer: implement timer_set() r=benpicco a=maribu ### Contribution description The fallback implementation of timer_set() in `drivers/periph_common` is known to fail on short relative sets. This adds a robust implementation. ### Testing procedure Run `tests/periph_timer_short_relative_set` at least a few dozen times (or use #19030 to have a few dozen repetitions of the test case in a single run of the test application). It should now succeed. ### Issues/PRs references None Co-authored-by: Marian Buschsieweke <marian.buschsieweke@ovgu.de>
- Loading branch information