1
0
mirror of https://github.com/RIOT-OS/RIOT.git synced 2024-12-29 04:50:03 +01:00
Commit Graph

42332 Commits

Author SHA1 Message Date
Benjamin Valentin
59f067171f core/init: call vfs_bind_stdio() in early_init() 2023-01-08 22:26:13 +01:00
Benjamin Valentin
124b849503 cpu: call early_init() 2023-01-08 22:26:12 +01:00
Benjamin Valentin
092b235845 core/init: add early_init()
Add a function to initialize LEDs and UART in early boot.
2023-01-08 22:25:10 +01:00
bors[bot]
441b69964c
Merge #19106
19106: core/lib: Add macros/utils.h header r=aabadie a=maribu

### Contribution description

The macros CONCAT(), MIN(), and MAX() are defined over and over again in RIOT's code base. This de-duplicates the code by moving the macros to a common place.

### Testing procedure

Generated binaries don't change, as this only a de-duplication of macros that doesn't change their definition.

### Issues/PRs references

None

Co-authored-by: Marian Buschsieweke <marian.buschsieweke@ovgu.de>
2023-01-07 21:16:51 +00:00
bors[bot]
07031d0239
Merge #19099
19099: dist/tools/usb-serial: Clean up legacy scripts r=aabadie a=maribu

### Contribution description

Refactor the old bash scripts to use `ttys.py` instead and update the documentation.

### Testing procedure

The pi fleet should still work without modification.

### Issues/PRs references

Fixes https://github.com/RIOT-OS/RIOT/issues/15814

Co-authored-by: Marian Buschsieweke <marian.buschsieweke@ovgu.de>
2023-01-07 16:24:51 +00:00
bors[bot]
d193988db2
Merge #19105
19105: Documentation: Document PWM and other Peripherals for Weact STM32F4x1Cx boards r=maribu a=jhaand

### Contribution description
The  Weact boards with STM32F4x1Cx MCU's have their PWM outputs enabled. But these currently do not show in the the documentation. This PR updates the documentation for these 3 boards.  

### Testing procedure
I rebuild the documentation with `make doc` and checked the resulting 3 html files. 

### Issues/PRs references
Fixes this issue: https://github.com/jhaand/RIOT/issues/1
Also referred to in this issue: https://github.com/RIOT-OS/RIOT/issues/19103

### Context
Discussed `@maribu` and `@benpicco` on matrix [link](https://matrix.to/#/!pqHdpanAvkJvlCwUDE:matrix.org/$lEMfOAG5rGGrkEjfJcsg0nC1Ebj4vlitvH9zm8uP-NM?via=matrix.org&via=rubdos.be&via=schleiser.de)


Co-authored-by: Jelle Haandrikman <jhaand@freedom.nl>
2023-01-07 10:28:49 +00:00
Marian Buschsieweke
86fdbd7054
core/lib: Add macros/utils.h header
The macros CONCAT(), MIN(), and MAX() are defined over and over again in
RIOT's code base. This de-duplicates the code by moving the macros to a
common place.
2023-01-07 09:47:44 +01:00
bors[bot]
949db03199
Merge #19107
19107: drivers/ws281x: fix out-of-bounds read on native r=aabadie a=benpicco



Co-authored-by: Benjamin Valentin <benjamin.valentin@bht-berlin.de>
2023-01-07 07:45:38 +00:00
Benjamin Valentin
7c61740346 drivers/ws281x: fix out-of-bounds read on native 2023-01-07 02:27:01 +01:00
Jelle Haandrikman
443cafd2d5 boards/stm32f4x1xx: Improve documentation 2023-01-06 23:10:26 +01:00
bors[bot]
4f1bb12720
Merge #18752 #19100 #19104
18752: nanocoap_sock: deprecate nanocoap_get() r=benpicco a=benpicco





19100: cpu/esp_common: allow configuration of UART0 r=benpicco a=gschorcht

### Contribution description

This PR
- fixes the issue for ESP32 SoCs that UART0 signals can't be routed to arbitrary GPIOs and
- allows the configuration of the UART device used by the bootloader.

The UART interface and its configuration used by the STDIO are defined in RIOT using the define `STDIO_UART_DEV` and the configuration of the corresponding UART device in `periph_conf.h`. 

However, the bootloader compiled directly in ESP-IDF uses its own definitions `CONFIG_ESP_CONSOLE_UART_*` for the UART configuration. To be able to use a consistent UART configuration in RIOT and the bootloader, e.g. to see the output of the 2nd stage bootloader, these `CONFIG_ESP_CONSOLE_UART_*` can be defined via a set of KConfig variables in RIOT (not yet implemented in Kconfig):
- `CONSOLE_CONFIG_UART_NUM` defines the UART device to be used by the bootloader and by `STDIO_UART_DEV`
- `CONSOLE_CONFIG_UART_RX` and `CONSOLE_CONFIG_UART_TX` define the GPIOs to be used by the bootloader and should be the GPIOs as defined in `periph_conf.h` for the corresponding UART device.

### Testing procedure

Any ESP32 node should still work with `stdio_uart` and the default configuration. To test an alternative configuration, use
```
CFLAGS='-DUART1_TXD=5 -DUART1_RXD=4 -DCONFIG_CONSOLE_UART_NUM=1 -DCONFIG_CONSOLE_UART_TX=5 -DCONFIG_CONSOLE_UART_RX=4' USEMODULE=esp_log_startup BOARD=esp32-wroom-32 make -C tests/shell flash
```
The bootloader output and the STDIO should be routed to UART1 at GPIO4 and GPIO5.

### Issues/PRs references

Prerequisite for PR ##18863

19104: tests/periph_uart: only exclude STDIO_UART_DEV if stdio_uart is used r=benpicco a=benpicco



Co-authored-by: Benjamin Valentin <benjamin.valentin@ml-pa.com>
Co-authored-by: Gunar Schorcht <gunar@schorcht.net>
Co-authored-by: Benjamin Valentin <benjamin.valentin@bht-berlin.de>
2023-01-06 21:15:36 +00:00
Benjamin Valentin
b44d360e49 tests/periph_uart: only exclude STDIO_UART_DEV if stdio_uart is used 2023-01-06 17:23:53 +01:00
Gunar Schorcht
7230299575 cpu/esp32: use same UART device in stdio_uart and bootloader 2023-01-06 16:43:51 +01:00
Gunar Schorcht
623660b399 cpu/esp32/bootloader: allow config of UART console
The UART interface and its configuration as used by the STDIO is defined in RIOT using `STDIO_UART_DEV` and the UART configuration in `periph_conf.h`.

However, the bootloader compiled directly in ESP-IDF uses its own definitions `CONFIG_ESP_CONSOLE_UART_*` for the UART configuration. To be able to use a consistent UART configuration in RIOT and the bootloader, e.g. to see the output of the 2nd stage bootloader, these `CONFIG_ESP_CONSOLE_UART_*` can be defined via a set of KConfig variables `CONSOLE_CONFIG_UART_*`. Here the variable `CONSOLE_CONFIG_UART_NUM` is then also used as `STDIO_UART_DEV` and the variables `CONSOLE_CONFIG_UART_RX` and `CONSOLE_CONFIG_UART_TX` of the configuration in `periph_conf.h` should be used accordingly.
f
2023-01-06 16:43:51 +01:00
Gunar Schorcht
fb8d521ac6 cpu/esp_common: allow configuration of UART0 2023-01-06 16:43:51 +01:00
bors[bot]
ed3e5de26e
Merge #19095
19095: boards/hamilton: Fix TMP00x parameters r=benpicco a=maribu

### Contribution description

The TMP006 driver has been renamed to TMP00x, as it (now) supports both TMP006 and TMP007 infrared thermopile sensors. However, the board configuration was never updated to match the new names. This fixes the issue.

### Testing procedure

Someone with the board could test if the TMP006 driver now starts to work again. Otherwise, it should be relatively straight forward to "test this by code review" (tm).

### Issues/PRs references

None

Co-authored-by: Marian Buschsieweke <marian.buschsieweke@ovgu.de>
2023-01-06 15:03:23 +00:00
Marian Buschsieweke
527f7be65b
boards/hamilton: Fix TMP00x parameters
The TMP006 driver has been renamed to TMP00x, as it (now) supports both
TMP006 and TMP007 infrared thermopile sensors. However, the board
configuration was never updated to match the new names. This fixes the
issue.
2023-01-06 15:53:25 +01:00
Marian Buschsieweke
2cc70027b0
dist/tools/usb-serial: Clean up legacy scripts
Refactor the old bash scripts to use `ttys.py` instead and update the
documentation.
2023-01-06 15:52:09 +01:00
bors[bot]
b03516dede
Merge #19096
19096: cpu/esp32c3: fix SDK configuration for USB PHY r=gschorcht a=gschorcht

### Contribution description

This PR provides a fix for the USB Serial/JTAG interface for ESP32C3.

When using USB Serial/JTAG/OTG/CDC, USB should be enabled in `phy_init`, otherwise the USB interface is not working properly. The problem was described https://github.com/espressif/esp-idf/issues/8046 and fixed with 93be7d5192:
```
#if CONFIG_ESP_PHY_ENABLE_USB
    phy_bbpll_en_usb(true);
#endif
```
However, to work correctly, `CONFIG_ESP_PHY_ENABLE_USB` which was not the case for ESP32-C3.

### Testing procedure

Without this PR the USB Serial/JTAG interface is not working correctly when WiFi is used:
```
CFLAGS='-DESP_WIFI_SSID=\"ssid\" -DESP_WIFI_PASS=\"pass\"' USEMODULE=esp_wifi BOARD=esp32c3-devkit make -j8 -C examples/gnrc_networking flash
```
Using OpenOCD then fails:
```
Open On-Chip Debugger  v0.11.0-esp32-20211220 (2021-12-20-15:42)
Licensed under GNU GPL v2
For bug reports, read
	http://openocd.org/doc/doxygen/bugs.html
Info : only one transport option; autoselect 'jtag'
Info : esp_usb_jtag: VID set to 0x303a and PID to 0x1001
Info : esp_usb_jtag: capabilities descriptor set to 0x2000
Warn : Transport "jtag" was already selected
Info : Listening on port 6666 for tcl connections
Info : Listening on port 4444 for telnet connections
Error: libusb_get_string_descriptor_ascii() failed with -9
```
Another effect is that
```
dist/tools/esptools/espreset.py --port /dev/ttyACM0
```
leads to endless warnings in `/var/log/syslog` and the board does not reset:
```
Jan  5 02:03:32 gunny8 kernel: [3466923.746827] xhci_hcd 0000:00:14.0: WARN Cannot submit Set TR Deq Ptr
Jan  5 02:03:32 gunny8 kernel: [3466923.746829] xhci_hcd 0000:00:14.0: A Set TR Deq Ptr command is pending.
```
With this PR, OpenOCD works also with WiFi and the board resets.

### Issues/PRs references


Co-authored-by: Gunar Schorcht <gunar@schorcht.net>
2023-01-06 12:07:26 +00:00
Gunar Schorcht
8b34d547ac cpu/esp32: fix SDK configuration for USB PHY
When using USB Serial/JTAG/OTG/CDC, USB should be enabled in `phy_init`, otherwise USB interface is not working properly.
2023-01-06 12:30:11 +01:00
bors[bot]
6cf2116ae8
Merge #18773
18773: nanocoap_sock: fix handling empty ACKs with separate response r=maribu a=benpicco



Co-authored-by: Benjamin Valentin <benjamin.valentin@ml-pa.com>
Co-authored-by: Benjamin Valentin <benjamin.valentin@bht-berlin.de>
2023-01-06 01:07:57 +00:00
bors[bot]
745973d594
Merge #19014 #19094
19014: boards/qn9080dk: add TTY_BOARD_FILTER r=kaspar030 a=maribu

### Contribution description

With `MOST_RECENT_PORT=1` the TTY interface of the most recently connected board with an embedded NXP debugger is selected. If only a single board with an embedded NXP debugger is selected, this will automatically connect to the correct board using:

```
make term MOST_RECENT_PORT=1
```

### Testing procedure

Run `make term MOST_RECENT_PORT=1` with a qn9080dk board and some non-NXP boards attached. It should reliably select the qn9080dk regardless of TTY names and order they were connected.

### Issues/PRs references

None

19094: dist/tools/doccheck: Reduce noise r=benpicco a=maribu

### Contribution description

This adds central documentation of driver initialization parameters in `driver/foo/include/foo_params.h` where missing for drivers used by the Hamilton board. In addition, the macros to overwrite the default parameters are no longer expected to be documented by adding generic exclude patterns. The reasoning is that having the macros documented once is sufficient.

### Testing procedure

Static tests should pass

### Issues/PRs references

Required to get https://github.com/RIOT-OS/RIOT/pull/19090 in

Co-authored-by: Marian Buschsieweke <marian.buschsieweke@ovgu.de>
2023-01-05 22:26:18 +00:00
bors[bot]
170dd0300f
Merge #17919
17919: board/microbit: increase testtimeout for emulated testing r=benpicco a=kfessel

### Contribution description

this increases the timeout for tests run by murdock on emulated microbit (accounting for startup of qemu)

### Testing procedure

murdock

### Issues/PRs references

#17894 

Co-authored-by: Karl Fessel <karl.fessel@ovgu.de>
2023-01-05 19:45:29 +00:00
bors[bot]
256da8e9b5
Merge #18869
18869: cpu/sam0_common/periph: Fix compilation with LLVM  r=benpicco a=Teufelchen1

Related to #18851 

This fixes an unused function error when compiling the gnrc_networking_mac example using LLVM as toolchain.
The fix works by only including the function when it is actually needed.


Co-authored-by: Teufelchen1 <bennet.blischke@haw-hamburg.de>
2023-01-05 16:17:53 +00:00
Marian Buschsieweke
5d93a485c5
drivers/hdc1000: Add missing doc and fix doccheck
This commits add documentation to the HDC1000 params and adds generic
exclude patters to the doc check, so that when boards provide custom
HDC1000 params they do not need to document them again. The reasoning
is that the documentation in the central place is sufficient.
2023-01-05 14:25:20 +01:00
Marian Buschsieweke
efbf6efdd3
drivers/fxos8700: Add missing doc and fix doccheck
This commits add documentation to the FXOS8700 params and adds generic
exclude patters to the doc check, so that when boards provide custom
FXOS8700 params they do not need to document them again. The reasoning
is that the documentation in the central place is sufficient.

In addition, a generic exclude patter is added to match FXOS8700_REG_*,
as the register names are relatively self-explaining and an
implementation detail of the driver that doesn't need public
documentation.
2023-01-05 14:25:20 +01:00
Marian Buschsieweke
479d5a311c
drivers/at86rf2xx: Add missing doc and fix doccheck
This commits add documentation to the AT86RF2xx params and adds generic
exclude patters to the doc check, so that when boards provide custom
AT86RF2xx params they do not need to document them again. The reasoning
is that the documentation in the central place is sufficient.
2023-01-05 14:25:19 +01:00
Marian Buschsieweke
404c8930da
sys/xtimer: Fix doccheck
Add generic patterns to allow XTIMER_DEV, XTIMER_HZ, XTIMER_WIDTH,
XTIMER_CHAN, XTIMER_BACKOFF, and XTIMER_ISR_BACKOFF to be undocumented.
The reasoning is that having them documented once is enough and warnings
for missing doc in every boards is just noise.
2023-01-05 14:25:19 +01:00
Marian Buschsieweke
fabb47bb93
drivers/tmp00x: Add missing doc and fix doccheck
This commits add documentation to the TMP00X params and adds generic
exclude patters to the doc check, so that when boards provide custom
TMP00X params they do not need to document them again. The reasoning is
that the documentation in the central place is sufficient.
2023-01-05 14:25:19 +01:00
Marian Buschsieweke
d6858a0ca4
drivers/pulse_counter: Add missing doc and fix doccheck
This commits add documentation to the pulse counter params and adds
generic exclude patters to the doc check, so that when boards provide
custom pulse counter params they do not need to document them again. The
reasoning is that the documentation in the central place is sufficient.
2023-01-05 14:25:19 +01:00
Marian Buschsieweke
395254af41
drivers/pir: Add missing doc and fix doccheck
This commits add documentation to the PIR params and adds generic
exclude patters to the doc check, so that when boards provide custom PIR
params they do not need to document them again. The reasoning is that
the documentation in the central place is sufficient.
2023-01-05 14:25:18 +01:00
bors[bot]
1be8e56852
Merge #19089
19089: .github/tools-buildtest: factorize and parallelize using matrix strategy r=aabadie a=aabadie



Co-authored-by: Alexandre Abadie <alexandre.abadie@inria.fr>
2023-01-05 12:37:30 +00:00
f18423330e
bors.toml: use aggregated tools-build-success in checks 2023-01-05 11:15:33 +01:00
dcc5ca7e83
.github/tools-buildtest: add job to aggregate all jobs results in one 2023-01-05 11:15:26 +01:00
15144fc10b
.github/tools-buildtest: factorize and parallelize using matrix strategy 2023-01-05 11:13:18 +01:00
bors[bot]
b9fa39a33c
Merge #19097
19097: cpu/esp8266/bootloader: remove compile time from banner r=kaspar030 a=gschorcht

### Contribution description

This PR fixes the problem with the compilation of the [nightlies](https://ci.riot-os.org/details/1f6a6179c0b74210940e84a6ea6e619d).

The compilation of the bootloader has been added with PR #19074. The compile time has been removed from the banner in the bootloader to fix the problem of different hashes when compiling with and without `TEST_KCONFIG`.

### Testing procedure

Green CI.

### Issues/PRs references

Co-authored-by: Gunar Schorcht <gunar@schorcht.net>
2023-01-05 08:44:48 +00:00
Gunar Schorcht
2b4e6523ee cpu/esp8266/bootloader: remove compile time from banner
The compile time has been removed from the banner to fix the problem of different hashes when compiling with and without `TEST_KONFIG`.
2023-01-05 07:59:05 +01:00
bors[bot]
e35c7adb73
Merge #19031
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 https://github.com/RIOT-OS/RIOT/pull/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>
2023-01-04 19:04:26 +00:00
bors[bot]
9a45f4bc49
Merge #18632
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 https://github.com/RIOT-OS/RIOT/issues/16908 maybe?

Co-authored-by: Marian Buschsieweke <marian.buschsieweke@ovgu.de>
2023-01-04 16:25:23 +00:00
bors[bot]
9f396d10a0
Merge #19087
19087: cpu/qn908x/periph_timer: Implement timer_set() r=kaspar030 a=maribu

### Contribution description

This fixes test failures in tests/periph_timer_short_relative_set.

Note: This differs a bit from the implementation in e.g. nRF5x or STM32 in that it always briefly pauses the timer. The issue is that when running the timer can take a few ticks to actually react to the new compare target. So even if the previously written target is still in the future, the timer may not fire anyway. Pausing the timer while setting and setting the target at least one higher than the current count reliably triggers the IRQ.

### Testing procedure

Run `tests/periph_timer_short_relative_set` at least a few dozen times (or use https://github.com/RIOT-OS/RIOT/pull/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>
2023-01-04 12:20:19 +00:00
bors[bot]
21af24729e
Merge #19030 #19085
19030: tests/periph_timer_short_relative_set: improve test r=benpicco a=maribu

### Contribution description

Reduce the number lines to output by only testing for intervals 0..15 to speed up the test.

In addition, run each test case 128 repetitions (it is still faster than before) to give some confidence the short relative set actually succeeded.

### Testing procedure

The test application should consistently fail or succeed, rather than occasionally passing.

### Issues/PRs references

None

19085: makefiles/tests/tests.inc.mk: fix test/available target r=benpicco a=maribu

### Contribution description

`dist/tools/compile_and_test_for_board/compile_and_test_for_board.py` relies on `make test/available` to check if a test if available. However, this so far did not take `TEST_ON_CI_BLACKLIST` and `TEST_ON_CI_WHITELIST` into account, resulting in tests being executed for boards which they are not available. This should fix the issue.

### Testing procedure


#### Expected to fail

```
$ make BOARD=nrf52840dk -C tests/gcoap_fileserver test/available
$ make BOARD=microbit -C tests/log_color test/available
```

(On `master`, they succeed, but fail in this PR.)

#### Expected to succeed

```
$ make BOARD=native -C tests/gcoap_fileserver test/available
$ make BOARD=nrf52840dk -C tests/pkg_edhoc_c test/available
$ make BOARD=nrf52840dk -C tests/log_color test/available
```

(Succeed in both `master` and this PR.)

### Issues/PRs references

None

Co-authored-by: Marian Buschsieweke <marian.buschsieweke@ovgu.de>
2023-01-04 01:20:19 +00:00
bors[bot]
096ed0048a
Merge #18950
18950: tests/unittests: add unit tests for core_mbox r=benpicco a=maribu

### Contribution description

As the title says

### Testing procedure

The test cases are run on `native` by Murdock anyway.

### Issues/PRs references

Split out of https://github.com/RIOT-OS/RIOT/pull/18949

Co-authored-by: Marian Buschsieweke <marian.buschsieweke@ovgu.de>
2023-01-03 22:19:39 +00:00
Marian Buschsieweke
94f9a56125
cpu/qn908x/periph_timer: Implement timer_set()
This fixes test failures in tests/periph_timer_short_relative_set.

Note: This differs a bit from the implementation in e.g. nRF5x or STM32
in that it always briefly pauses the timer. The issue is that when
running the timer can take a few ticks to actually react to the new
compare target. So even if the previously written target is still in
the future, the timer may not fire anyway. Pausing the timer while
setting and setting the target at least one higher than the current
count reliably triggers the IRQ.
2023-01-03 22:35:11 +01:00
Marian Buschsieweke
0835466498
tests/thread_float: do not overload slow MCUs with IRQs
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.
2023-01-03 22:17:51 +01:00
bors[bot]
e51d8285f3
Merge #19037
19037: sys/usb, pkg/tinyusb: move USB board reset from highlevel STDIO to CDC ACM r=dylad a=gschorcht

### Contribution description

The USB board reset function `usb_board_reset_coding_cb` can be used on any CDC-ACM interface, even if the CDC ACM interface is not used as high-level STDIO. Therefore, this PR provides the following changes:

- The call of the board reset function `usb_board_reset_coding_cb` from USBUS stack has been moved from the STDIO CDC ACM implementation to the CDC ACM implementation and is thus a feature of any USBUS CDC ACM interface which does not necessarily have to be used as highlevel STDIO.

- The call of the board reset function `usb_board_reset_coding_cb` from tinyUSB stack been moved from module `tinyusb_stdio_cdc_acm` to module `tinyusb_contrib` and is compiled in if the `tinyusb_class_cdc` module is used together the `tinyusb_device` module. Thus, it is now a feature of the tinyUSB CDC ACM interface, which does not necessarily have to be used as highlevel STDIO.
 
- The `usb_board_reset` module defines the `usb_board_reset_in_bootloader` function as a weak symbol to be used when reset in bootloader if no real implementation of this function is compiled in and the `riotboot_reset` module is not used. It only prints an error message that the reset in bootloader is not supported. This is necessary if the module `usb_board_reset` is used to be able to restart the board with an application via a USB CDC ACM interface, but the board's bootloader does not support the reset in bootloader feature.

- A test application has been added that either uses the highlevel STDIO `stdio_acm_cdc` or creates a CDC-ACM interface to enable board resets via USB. If the `usbus_dfu` module is used, it also initializes the DFU interface to be able to work together with the `riotboot_dfu` bootloader.

### Testing procedure

1. Use a board with a bootloader that supports the reset in bootloader via USB, but don't use the highlevel STDIO to check that it works with `usbus_cdc_acm`, for example:
   ```python
   USEMODULE=stdio_uart BOARD=arduino-mkr1000 make -C tests/usb_board_reset flash
   ```
   After reset in application with command
   ```python
   stty -F /dev/ttyACM0 raw ispeed 600 ospeed 600 cs8 -cstopb ignpar eol 255 eof 255
   ```
   command `dmesg` should give an output like the following with RIOT's test VID/PID:
   ```python
   dmesg
   [1745182.057403] usb 1-4.1.2: new full-speed USB device number 69 using xhci_hcd
   [1745182.160386] usb 1-4.1.2: New USB device found, idVendor=1209, idProduct=7d01, bcdDevice= 1.00
   [1745182.160390] usb 1-4.1.2: New USB device strings: Mfr=3, Product=2, SerialNumber=4
   [1745182.160392] usb 1-4.1.2: Product: arduino-mkr1000
   [1745182.160393] usb 1-4.1.2: Manufacturer: RIOT-os.org
   [1745182.160395] usb 1-4.1.2: SerialNumber: 6B6C2CA5229020D8
   [1745182.170982] cdc_acm 1-4.1.2:1.0: ttyACM0: USB ACM device
   ```
   After reset in bootloader with command
   ```python
   stty -F /dev/ttyACM0 raw ispeed 1200 ospeed 1200 cs8 -cstopb ignpar eol 255 eof 255
   ```
   command `dmesg` should give an output like the following with vendor VID/PID:
   ```python
   [1746220.443792] usb 1-4.1.2: new full-speed USB device number 70 using xhci_hcd
   [1746220.544705] usb 1-4.1.2: New USB device found, idVendor=2341, idProduct=024e, bcdDevice= 2.00
   [1746220.544708] usb 1-4.1.2: New USB device strings: Mfr=0, Product=0, SerialNumber=0
   [1746220.553471] cdc_acm 1-4.1.2:1.0: ttyACM0: USB ACM device
   ```
   
2. Test the same as in 1., but this time use the highlevel STDIO to check that there is no regression and it still works with `stdio_cdc_acm`, for example:
   ```python
   BOARD=arduino-mkr1000 make -C tests/usb_board_reset flash
   ```
   
3. Use a board that supports `riotboot_dfu` but doesn't use the highlevel STDIO and flash the `riotboot_dfu` bootloader, for example:
   ```python
   BOARD=stm32f429i-disc1 make -C bootloaders/riotboot_dfu flash term
   ```
   Once the bootloader is flashed, command `dfu-util --list` should give something like the following:
   ```python
   Found DFU: [1209:7d02] ver=0100, devnum=14, cfg=1, intf=0, path="1-2", alt=1, name="RIOT-OS Slot 1", serial="6591620BCB270283"
   Found DFU: [1209:7d02] ver=0100, devnum=14, cfg=1, intf=0, path="1-2", alt=0, name="RIOT-OS Slot 0", serial="6591620BCB270283"
   ```
   If the output gives only
   ```python
   Found Runtime: [1209:7d00] ver=0100, devnum=123, cfg=1, intf=0, path="1-2", alt=0, name="RIOT-OS bootloader", serial="6591620BCB270283"
   ```
   an application is already running in DFU Runtime mode. Use `dfu-util -e` to restart it in bootloader DFU mode.
   Then flash the test application, for example:
   ```python
   FEATURES_REQUIRED=riotboot USEMODULE='usbus_dfu riotboot_reset' \
   BOARD=stm32f429i-disc1 make -C tests/usbus_board_reset PROGRAMMER=dfu-util riotboot/flash-slot0
   ```
   Once the test application is flashed, command `dfu-util --list` should give:
   ```python
   Found Runtime: [1209:7d00] ver=0100, devnum=123, cfg=1, intf=0, path="1-2", alt=0, name="RIOT-OS bootloader", serial="6591620BCB270283"
   ```
   Now, use command
   ```python
   stty -F /dev/ttyACM1 raw ispeed 600 ospeed 600 cs8 -cstopb ignpar eol 255 eof 255
   ``` 
   to restart the board in application. Command `dfu-util --list` should give again the following:
   ```python
   Found Runtime: [1209:7d00] ver=0100, devnum=123, cfg=1, intf=0, path="1-2", alt=0, name="RIOT-OS bootloader", serial="6591620BCB270283"
   ```
   That is, the application is running in DFU Runtime mode. Then use command
   ```python
   stty -F /dev/ttyACM1 raw ispeed 1200 ospeed 1200 cs8 -cstopb ignpar eol 255 eof 255
   ```
   to restart the board in bootloader DFU mode. Command  `dfu-util --list` should now give the following:
   ```python
   Found DFU: [1209:7d02] ver=0100, devnum=50, cfg=1, intf=0, path="1-2", alt=1, name="RIOT-OS Slot 1", serial="7D156425A950A8EB"
   Found DFU: [1209:7d02] ver=0100, devnum=50, cfg=1, intf=0, path="1-2", alt=0, name="RIOT-OS Slot 0", serial="7D156425A950A8EB"
   ```
   That is, the bootloader is in DFU mode and another application can be flash.
   
4. After a hard reset of the board under 3., try the commands `reboot` and `bootloader`. 

5. To check the same for tinyUSB, use the existing tinyUSB application with a CDC ACM interface and add module `usb_board_reset`, for example:
   ```python
   USEMODULE=usb_board_reset BOARD=stm32f429i-disc1 make -C tests/pkg_tinyusb_cdc_msc flash term
   ```
   After flashing, it should be possible to restart the application with command:
   ```python
   stty -F /dev/ttyACM1 raw ispeed 600 ospeed 600 cs8 -cstopb ignpar eol 255 eof 255
   ```
   When using command
   ```python
   stty -F /dev/ttyACM1 raw ispeed 1200 ospeed 1200 cs8 -cstopb ignpar eol 255 eof 255
   ```
   the following error message should be shown in terminal
   ```python
   [cdc-acm] reset in bootloader is not supported
   ```
   
### Issues/PRs references


Co-authored-by: Gunar Schorcht <gunar@schorcht.net>
2023-01-03 19:36:16 +00:00
Marian Buschsieweke
b8cc222e76
cpu/stm32/periph_timer: implement timer_set()
The fallback implementation of timer_set() in `drivers/periph_common`
is known to fail on short relative sets. This adds a robust
implementation.
2023-01-03 15:51:06 +01:00
bors[bot]
0fed4c91f1
Merge #19084
19084: .github/tools-buildtest: use latest version of riot-action and fix build issue with mosquitto.rsmb r=aabadie a=aabadie



Co-authored-by: Alexandre Abadie <alexandre.abadie@inria.fr>
2023-01-03 14:19:09 +00:00
Marian Buschsieweke
6352e4cec0
makefiles/tests/tests.inc.mk: fix test/available target
dist/tools/compile_and_test_for_board/compile_and_test_for_board.py
relies on `make test/available` to check if a test if available.
However, this so far did not take `TEST_ON_CI_BLACKLIST` and
`TEST_ON_CI_WHITELIST` into account, resulting in tests being executed
for boards which they are not available. This should fix the issue.
2023-01-03 12:53:35 +01:00
d0319304ae
tools/mosquitto_rsmb: bump to latest version 2023-01-03 10:23:36 +01:00
762c98d78f
.github/tools-buildtest: use latest riot-action version 2023-01-03 10:23:19 +01:00