19193: rust: Update dependencies, use riot-wrappers from git r=benpicco a=chrysn
### Contribution description
As riot-wrappers has advanced a bit since it was last released, Rust modules are switched to using it from git again. (This is a regular ping-pong between testing the latest release in RIOT master, and using released support crates when they're current).
This primarily updates riot-wrappers, which has accumulated several compatible changes. Several other crates receive updates as well.
### Testing procedure
* Green CI
### Issues/PRs references
Changes on the riot-wrappers side:
* https://github.com/RIOT-OS/rust-riot-wrappers/pull/17
* https://github.com/RIOT-OS/rust-riot-wrappers/pull/22
* https://github.com/RIOT-OS/rust-riot-wrappers/pull/29
* https://github.com/RIOT-OS/rust-riot-wrappers/pull/30
[edit: added:]
This also serves to help preparing a 0.8.1 release of riot-wrappers, which performs some deprecations so that a breaking 0.9 change can be done more effortlessly later on.
19214: cpu/gd32v: add periph_spi support r=benpicco a=gschorcht
### Contribution description
This PR provides the `periph_spi` support and is one of a bunch of PRs that complete the peripheral drivers for GD32VF103.
The driver is a modified version of the driver for STM32F1 with some changes that were necessary to get it working on GD32V.
### Testing procedure
`tests/periph_spi` as well as a test with any SPI sensor should work. `tests/driver_sdcard_spi` should work on `sipeed-longan-nano`.
### Issues/PRs references
Depeneds on PR #19216
Co-authored-by: chrysn <chrysn@fsfe.org>
Co-authored-by: Gunar Schorcht <gunar@schorcht.net>
19219: doc/porting-boards.md: fix code snippets in Riot web page/doxygen r=benpicco a=krzysztof-cabaj
### Contribution description
PR #19206 fix issues with code snippets in the[ `porting-boards.md`](https://github.com/RIOT-OS/RIOT/blob/master/doc/doxygen/src/porting-boards.md) presented by GitHub. However, in Riot web page comments in code snippets are not presented and in effect section `doc.txt` shows empty area - see [dox.txt section](https://doc.riot-os.org/porting-boards.html).
This PR should fix this - it change for this code snippet C code to generic code.
### Testing procedure
Generation of doxygen documentation by CI process and manual check if this change fix the problem.
### Issues/PRs references
PR #19206
Co-authored-by: krzysztof-cabaj <kcabaj@gmail.com>
16782: drivers/mfrc522: add new driver r=benpicco a=HendrikVE
### Contribution description
This PR adds support for the MFRC522. It is quite common in the Arduino world and it is quite cheap. The driver connects to the MFRC522 via SPI and is heavily based on the Arduino driver available [here](https://github.com/miguelbalboa/rfid). Basically it was ported, but with several improvements in readability and documentation.
### Testing procedure
The given (manual) test provides single commands for some driver functions.
19201: cpu/gd32v: add periph_i2c support r=benpicco a=gschorcht
### Contribution description
This PR provides the `periph_i2c` support and is one of a bunch of PRs that complete the peripheral drivers for GD32VF103.
The driver is a modified version of the driver for STM32F1 with some changes that were necessary to get it working on GD32V. As for STM32F1, the driver is using polling instead of interrupts for now. It will be implemented interrupt-driven later.
### Testing procedure
`tests/periph_i2c` as well as a test with any I2C sensor should work. The driver was tested with `tests/driver_l3gxxxx` and `tests/driver_bmp180`.
### Issues/PRs references
Co-authored-by: Hendrik van Essen <hendrik.ve@fu-berlin.de>
Co-authored-by: Gunar Schorcht <gunar@schorcht.net>
19215: tests/periph_flashpage_unittest: enable periph_flashpage r=benpicco a=gschorcht
### Contribution description
This PR enables the `periph_flashpage` module for the unittest in `tests/periph_flashpage_unittest` so that it requires feature `periph_flashpage` and expects only correct calculation of flashpage indices if it is used.
Testing the correct calculation of flashpage indices without assuming the `periph_flashpage` feature and enabling the `periph_flashpage` module makes no sense. On ESP32x SoCs for example, the space in the flash is only reserved and `FLASHPAGE_NUMOF` is greater than 0 if `periph_flashpage` is used.
The PR fixes the unittest problem for ESP32x SoCs.
### Testing procedure
Green CI with label `CI: run test`.
### Issues/PRs references
Co-authored-by: Gunar Schorcht <gunar@schorcht.net>
Testing the correct calculation of flash page indices without assuming the `periph_flashpage` feature and enabling the `periph_flashpage` module makes no sense. On ESP32x SoCs for example, the space in the flash is only reserved and `FLASHPAGE_NUMOF` is greater than 0 if `periph_flashpage` is used.
19211: cpu/gd32v: move board dependent RTT configs to board config r=maribu a=gschorcht
### Contribution description
This PR fixes the problem that the RTT frequency is defined to be 40.0 kHz instead of 32.768 kHz if `TEST_KCONFIG=1` is not defined.
The problem was caused by the order in which the headers were included. In `cpu/gd32v/include/periph_cpu.h` the RTT frequency was defined to be 32.768 kHz or 40.0 kHz, depending on the `CONFIG_BOARD_HAS_LXTAL` configuration of the board. If `TEST_KCONFIG=1` is used, it is defined in `autoconfig.h` and is always known, but without `TEST_KCONFIG=1` it is defined in the `periph_conf.h` of the board. If `periph_cpu.h` is included but not `periph_conf.h`, `CONFIG_BOARD_HAS_LXTAL` is not defined without `TEST_KCONFIG=1` and the RTT frequency is defined to be 40.0 kHz.
The solution is to move board dependent RTT configurations to `periph_common.conf`.
### Testing procedure
```
BOARD=sipeed-longan-nano make -C tests/periph_rtt flash
```
should still work.
### Issues/PRs references
Co-authored-by: Gunar Schorcht <gunar@schorcht.net>
19206: doc/porting-boards.md: fix code snippets in md view r=benpicco a=krzysztof-cabaj
### Contribution description
Current version of the file [`porting-boards.md`](https://github.com/RIOT-OS/RIOT/blob/master/doc/doxygen/src/porting-boards.md) did not present correctly in the github preview two snippets, presented in the sections: `doc.txt` and `Using Common code`.
This PR fix this issue.
### Testing procedure
Check if these changes do not corrupt generated doxygen.
### Issues/PRs references
None
Co-authored-by: krzysztof-cabaj <kcabaj@gmail.com>
19209: cpu/gd32v: add periph_pwm support r=benpicco a=gschorcht
### Contribution description
This PR provides the `periph_pwm` support for GD32VF103.
It includes a bug fix (2c6e527339) of `periph_timer` which clears pending interrupts on setting the timer before the interrupt is enabled. This avoids that a pending interrupt is triggered immediately when the timer is set. The bug caused `tests/periph_timer` and `tests/periph_timer_periodic` to crash. (I could split-off this bug fix if necessary).
Furthermore, the default timer configuration has been extended and reordered. `TIMER0` can be used now as timer device (0dfbdebaf7). The default timer configuration has been changed (377b5b321c) so that `TIMER0` and `TIMER1` are always timer devices. `TIMER2` can only be used as timer device if it is not used for PWM devices. `TIMER3` and `TIMER4` are only available as timer devices if they are supported by the CPU model and not used for PWM devices.
### Testing procedure
- `tests/periph_timer` and `tests/periph_timer_periodic` should work now. Without the PR, these tests lead to kernel panic.
- `tests/periph_pwm` should work on any GD32VF103 board. Command `osci` should also let LED1 and LED2 oscillate.
### Issues/PRs references
Co-authored-by: Gunar Schorcht <gunar@schorcht.net>
The default timer configuration has been changed so that `TIMER0` and `TIMER1` are always timer devices. `TIMER2` can only be used as timer device if it is not used for PWM devices. `TIMER3` and `TIMER4` are only available as timer devices if they are supported by the CPU model and not used for PWM devices.
When a timer is set, any pending interrupts must be cleared before the interrupt is enabled for the channel. Otherwise the interrupt would be triggered immediately when the timer is set.
19199: sys/suit: Ensure previous thread is stopped before reusing its stack r=benpicco a=chrysn
### Contribution description
Closes: https://github.com/RIOT-OS/RIOT/issues/19195
If the thread has released the mutex but the thread has not terminated (which happens in the situation that would previously have overwritten a still active thread's state), then a warning is shown and the trigger is ignored.
### Testing procedure
This should work before and after:
* `make -C examples/suit_update BOARD=native all term`
* `aiocoap-client coap://'[fe80::3c63:beff:fe85:ca96%tapbr0]'/suit/trigger -m POST --payload 'coap://[2001:db8::]/foo'`
* In parallel, on the RIOT shell, run `suit fetch coap://[2001:db8::]/foo`
* After the first download fails, the second one starts right away ("suit_worker: update failed, hdr invalid" / "suit_worker: started").
Run again with the worker thread on low priority:
```patch
diff --git a/sys/suit/transport/worker.c b/sys/suit/transport/worker.c
index a54022fb28..e26701a64c 100644
--- a/sys/suit/transport/worker.c
+++ b/sys/suit/transport/worker.c
`@@` -70 +70 `@@`
-#define SUIT_COAP_WORKER_PRIO THREAD_PRIORITY_MAIN - 1
+#define SUIT_COAP_WORKER_PRIO THREAD_PRIORITY_MAIN + 1
```
Before, this runs the download once silently (no clue why it doesn't run it twice, but then again, I claim there's concurrent memory access from two thread, so who knows what happens). After, it runs a single download and shows an error message for the second one once the first is complete ("Ignoring SUIT trigger: worker is still busy.").
### Issues/PRs references
This may be made incrementally easier by https://github.com/RIOT-OS/RIOT/pull/19197 -- that PR as it is now would spare us the zombification (because returning would do that), and having a `wait` function would allow us to turn the new error case into a success.
19205: boards/common: add common timer config for GD32VF103 boards r=benpicco a=benpicco
19207: examples/gnrc_border_router: static: use router from advertisements by default r=benpicco a=benpicco
Co-authored-by: chrysn <chrysn@fsfe.org>
Co-authored-by: Benjamin Valentin <benjamin.valentin@bht-berlin.de>
Co-authored-by: Benjamin Valentin <benpicco@beuth-hochschule.de>
19202: cpu/gd32v: add periph_rtt support r=benpicco a=gschorcht
### Contribution description
This PR provides the `periph_rtt` support and is one of a bunch of PRs that complete the peripheral drivers for GD32VF103.
### Testing procedure
`tests/periph_rtt` should work and give the following results:
```
Help: Press s to start test, r to print it is ready
START
main(): This is RIOT! (Version: 2023.04-devel-199-g2d429-cpu/gd32v/periph_rtt)
RIOT RTT low-level driver test
RTT configuration:
RTT_MAX_VALUE: 0xffffffff
RTT_FREQUENCY: 32768
Testing the tick conversion
Trying to convert 1 to seconds and back
Trying to convert 256 to seconds and back
Trying to convert 65536 to seconds and back
Trying to convert 16777216 to seconds and back
Trying to convert 2147483648 to seconds and back
All ok
Initializing the RTT driver
This test will now display 'Hello' every 5 seconds
RTT now: 148
Setting initial alarm to now + 5 s (163988)
rtt_get_alarm() PASSED
Done setting up the RTT, wait for many Hellos
{ "threads": [{ "name": "idle", "stack_size": 256, "stack_used": 216 }]}
{ "threads": [{ "name": "main", "stack_size": 1280, "stack_used": 480 }]}
Hello
Hello
Hello
Hello
```
### Issues/PRs references
Co-authored-by: Gunar Schorcht <gunar@schorcht.net>
19204: boards/sipeed-longan-nano: default to flashing via DFU r=gschorcht a=benpicco
Co-authored-by: Benjamin Valentin <benjamin.valentin@bht-berlin.de>