19110: boards/hifive1b: minor improvements r=kaspar030 a=maribu
### Contribution description
- Cleaning up flash config
- Only defaulting to J-Link as flasher when actually installed
- Add TTY_BOARD_FILTER to more reliably select the TTY of the HiFive1b board
### Testing procedure
- Flashing should still work
- Flashing should prefer J-Link over OpenOCD when both are available
- Flashing should prefer OpenOCD over J-Link when J-Link is not found
### Issues/PRs references
None
Co-authored-by: Marian Buschsieweke <marian.buschsieweke@ovgu.de>
For nRF52 J-Link was intended to be preferred as programmer over OpenOCD
when both are available, but falling back to OpenOCD when JLinkExe is
not found in `$PATH`. However, there was call the shell missing to
actually detect `JLinkExe`.
- OpenOCD and J-Link flash configuration can be provided
unconditionally, as those variables do not conflict with any others
- Only use J-Link as default flasher if actually installed
`CONFIG_BOARD_HAS_HXTAL` is used to indicate that the board has an HXTAL connected. If the HXTAL is present, it is used as PLL clock source. But if the HXTAL is not present, the half IRC8M clock should be used as PLL clock source and must not be disabled at the end of clock settings. Using IRC8M clock as PLL clock source also requires another PLL multiplication factor.
`CLOCK_HXTAL` is a value and not a flag, so that shifting to the left changes anything in the register but does not set the PLLSEL bit. `RCU_CFG0_PLLSEL_Msk` has to be used instead to set the PLLSEL bit.
Setting the `RCU_CTL` register just to the IRC8M bit also removes the IRC8M calibration and trim adjust value in this register. Therefore IRC8M calibration and trim adjust value have to be preserved and the IRC8M has to be set.
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>
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>
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.
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>
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
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>
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.
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>
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>
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>
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>
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>
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.
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.
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.
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.
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.
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.
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.
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>
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>
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>
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>