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

10781 Commits

Author SHA1 Message Date
bors[bot]
67c011f5a4
Merge #19686 #19687
19686: sys/string_utils: add memchk() r=maribu a=benpicco



19687: tests/unittests: remove old workaround for SAML1X and gcc9.X bug r=maribu a=dylad

### Contribution description
This reverts #13462, this workaround is no longer needed with newer GCC version.

### Testing procedure

Try to compile tests/unittests for `saml11-xpro` or `saml10-xpro`

### Issues/PRs references

This is a revert of #13462.


Co-authored-by: Benjamin Valentin <benjamin.valentin@ml-pa.com>
Co-authored-by: Dylan Laduranty <dylan.laduranty@mesotic.com>
2023-05-30 23:26:16 +00:00
Benjamin Valentin
4476b2a024 sys/net/gnrc_pktbuf: make use of memchk() 2023-05-30 20:45:13 +02:00
Benjamin Valentin
c57b13f1e8 sys/string_utils: add memchk()
Check if all bytes in a buffer are set to s certain value - inverse
of memset().
2023-05-30 20:39:10 +02:00
Benjamin Valentin
23790a3f52 sys/string_utils: fix doxygen title 2023-05-30 20:11:17 +02:00
bors[bot]
00b5bc12a2
Merge #19610 #19670 #19678 #19679 #19680 #19681
19610: drivers/periph/rtc: improve doc on rtc_set_alarm r=maribu a=maribu

### Contribution description

- point out behavior on denormalized time stamps
- use errno codes to indicate errors (and adapt the few instances of actual error handling to use them)


19670: cpu/stm32: stm32f4 BRR from BSRR r=maribu a=kfessel

### Contribution description

sometimes one wants to save one instruction :) 
just write the bits we need to write.

### Testing procedure

tests/periph/gpio_ll tests this 

### Issues/PRs references

`@maribu` might know some reference

maybe #19407

19678: gnrc_sixlowpan_iphc: fix NULL pointer dereference r=maribu a=miri64



19679: gnrc_sixlowpan_frag_sfr: fix ARQ scheduler race-condition r=maribu a=miri64



19680: gnrc_sixlowpan_frag_rb: fix OOB write in _rbuf_add r=maribu a=miri64



19681: sys/xtimer: improve documentation r=maribu a=maribu

### Contribution description

- Add a warning that xtimer is deprecated, so that new code hopefully starts using ztimer
- Add a hint that `ztimer_xtimer_compat` can be used even after `xtimer` is gone


Co-authored-by: Marian Buschsieweke <marian.buschsieweke@ovgu.de>
Co-authored-by: Karl Fessel <karl.fessel@ovgu.de>
Co-authored-by: Martine Lenders <m.lenders@fu-berlin.de>
2023-05-30 17:11:06 +00:00
Marian Buschsieweke
9454a50df3
sys/xtimer: improve documentation
- Add a deprecation note to xtimer, so that new code hopefully
  starts using ztimer
- Add a hint that `ztimer_xtimer_compat` can be used even after `xtimer`
  is gone
2023-05-30 17:32:48 +02:00
Martine Lenders
1aeb90ee55
gnrc_sixlowpan_frag_rb: fix OOB write in _rbuf_add 2023-05-30 16:44:09 +02:00
Martine Lenders
31c6191f61
gnrc_sixlowpan_frag_sfr: fix ARQ scheduler race-condition 2023-05-30 16:42:35 +02:00
Martine Lenders
dc333463d8
gnrc_sixlowpan_frag_sfr: Mark feature as experimental 2023-05-30 14:51:07 +02:00
Martine Lenders
6ea04e19e7
gnrc_sixlowpan_frag_sfr: fix reference in documentation 2023-05-30 14:50:46 +02:00
Martine Lenders
c9d7863e56
gnrc_sixlowpan_iphc: fix NULL pointer dereference 2023-05-30 14:27:13 +02:00
bors[bot]
d58f2c8501
Merge #19268
19268: shell_lock: don't set CONFIG_SHELL_SHUTDOWN_ON_EXIT r=benpicco a=benpicco



Co-authored-by: Benjamin Valentin <benpicco@beuth-hochschule.de>
Co-authored-by: Benjamin Valentin <benjamin.valentin@ml-pa.com>
2023-05-27 22:23:54 +00:00
bors[bot]
1710650256
Merge #19601
19601: SUIT: Prepared manifests r=chrysn a=chrysn

### Contribution description

While SUIT can generally be used already with manifests that are "dropped into memory" (by any mechanism), the convenient SUIT worker thread mechanism so far could not be used with it.

This adds the suit_worker_try_prepare / suit_worker_trigger_prepared
pair for using the SUIT worker, and breaks suit_handle_manifest_buf out
of suit_handle_url (where the latter now calls the former).

#### By-catch

As part of factoring out reaping of the zombie worker thread, a locking
error that deadlocks the SUIT worker in case the race between the mutex
being unlocked and the thread being reaped hits the necessary handling
code is fixed (and mutex_unlock is called in the error path).

### Testing procedure

SUIT tests should pass.

https://github.com/RIOT-OS/RIOT/pull/19659 provides a demo of how the new API is used.

### Issues/PRs references

I think that the currently employed mechanism of having a resource to which a URL with the manifest gets posted is contrary to the design goals of SUIT -- the signed manifest should be what justifies the device to spend resources (eg. get data from a server), not a URI that is just *not* signed.

This PR makes it easier to implement a resource to which the manifest can be POSTed, rather than a CoAP URI that represents the manifest, as is proposed (but not mature) in 
https://github.com/RIOT-OS/RIOT/pull/19659.

[edit: Adjusted to reflect decisions made during review]

Co-authored-by: chrysn <chrysn@fsfe.org>
2023-05-27 19:14:05 +00:00
chrysn
8d6a375537 sys/suit: Fix missing include 2023-05-27 21:01:18 +02:00
chrysn
763474b485 sys/suit: Introduce functions to provide a manifest in memory
This adds the suit_worker_try_prepare / suit_worker_trigger_prepared
pair for using the SUIT worker, and breaks suit_handle_manifest_buf out
of suit_handle_url (where the latter now calls the former).

As part of factoring out reaping of the zombie worker thread, a locking
error that deadlocks the SUIT worker in case the race between the mutex
being unlocked and the thread being reaped hits the necessary handling
code is fixed (and mutex_unlock is called in the error path).
2023-05-27 21:01:18 +02:00
Benjamin Valentin
c0a4acf32d sys/shell_lock: lock shell on EOF 2023-05-26 15:04:36 +02:00
Benjamin Valentin
f58384832c shell_lock: don't set CONFIG_SHELL_SHUTDOWN_ON_EXIT 2023-05-26 15:04:35 +02:00
Benjamin Valentin
153dbd2495 usbus: don't trigger assertion in usbus_urb_submit() 2023-05-24 18:25:34 +02:00
bors[bot]
7d16a1b289
Merge #19636
19636: sys: model ecc, evtimer, pipe and shell_lock in kconfig r=aabadie a=aabadie



Co-authored-by: Alexandre Abadie <alexandre.abadie@inria.fr>
2023-05-24 10:00:26 +00:00
e9f040cc8c
sys/net: add missing timex.h include 2023-05-24 09:53:36 +02:00
5851db7c03
sys/shell_lock: model in Kconfig 2023-05-24 09:53:35 +02:00
cc789235f5
sys/pipe: model in Kconfig 2023-05-24 09:53:35 +02:00
89911043d0
sys/evtimer: model in Kconfig 2023-05-24 09:53:34 +02:00
08fdb23185
sys/evtimer: remove support for xtimer backend 2023-05-24 09:53:33 +02:00
7eb50c5f05
sys/ecc: model in Kconfig 2023-05-24 09:53:33 +02:00
bors[bot]
e93d597510
Merge #19658
19658: sys/posix/sockets: fix code style & set sin6_scope_id in _ep_to_sockaddr()  r=benpicco a=maribu

### Contribution description

- Fix double indent of switch cases to single indent, as per coding convention. (Whitespace only change.)
- Set sin6_scope_id to netif in `_ep_to_sockaddr()`


Co-authored-by: Marian Buschsieweke <marian.buschsieweke@ovgu.de>
2023-05-24 02:20:38 +00:00
Marian Buschsieweke
77afc5e637
sys/posix/sockets: set sin6_scope_id in _ep_to_sockaddr()
Fixes https://github.com/RIOT-OS/RIOT/issues/19486
2023-05-23 22:04:12 +02:00
Marian Buschsieweke
afa3b134f4
sys/posix/sockets: fix code style
Fix double indent of switch cases to single indent, as per coding
convention.
2023-05-23 22:03:51 +02:00
bors[bot]
a272abb15d
Merge #19618 #19639 #19644 #19649 #19656
19618: cpu/stm32: fix riotboot settings for L4 and WB r=benpicco a=gschorcht

### Contribution description

This PR fixes the `riotboot` configuration for L4 and WB.

The family is not called `stm32l4` or `stm32wb` but `l4` and `wb`. That is, the `riotboot` configuration didn't work at all. Furthermore, a minimum `RIOTBOOT_LEN` of `0x2000` is required for L4.

Found when investigating the compilation errors for `bootloaders/riotboot_serial` in PR #19576.

### Testing procedure

1. Green CI.
2. Use the following commands:
    ```
    BOARD=nucleo-l496zg make -C tests/riotboot info-debug-variable-RIOTBOOT_HDR_LEN
    BOARD=p-nucleo-wb55 make -C tests/riotboot info-debug-variable-RIOTBOOT_HDR_LEN
    ```
    In master these commands give
    ```
    0x400
    ```
    With this PR these commands give
    ```
    0x200
    ```
    as expected.
3. Use the following commands:
    ```
    BOARD=nucleo-l496zg make -C tests/riotboot info-debug-variable-RIOTBOOT_LEN
    BOARD=p-nucleo-wb55 make -C tests/riotboot info-debug-variable-RIOTBOOT_LEN
    ```
    In master these commands give
    ```
    0x1000
    ```
    With this PR these commands give
    ```
    0x2000
    ```
    as expected.

### Issues/PRs references


19639: tests/net/gnrc_mac_timeout: add automated test r=aabadie a=aabadie



19644: gnrc_ipv6_nib: include RIO with all subnets in downstream RA r=benpicco a=benpicco



19649: gnrc_sixlowpan_iphc: prefix bits outside context must be zero r=benpicco a=benpicco



19656: gnrc/ipv6_auto_subnets: allow to configure minimal prefix length r=benpicco a=benpicco



Co-authored-by: Gunar Schorcht <gunar@schorcht.net>
Co-authored-by: Alexandre Abadie <alexandre.abadie@inria.fr>
Co-authored-by: Benjamin Valentin <benjamin.valentin@ml-pa.com>
2023-05-23 20:02:58 +00:00
bors[bot]
3469fce248
Merge #19335 #19581 #19612 #19643 #19655
19335: ipv6/nib: 6LBR should not send RS on their downstream interface r=fabian18 a=fabian18



19581: cpu/samd5x: enable FDPLL1 at 200MHz r=benpicco a=dylad

### Contribution description

This PR allows to use the second FDPLL (the first one is used to generated the 120MHz frequency used by the core and some peripherals). The second FDPLL is setup to run at 200MHz which is the maximum allowed by this MCU.
In fact, I reused the existing function which setup FDPLL0 so it can be used in a generic way for both PLL (since they are the same IP).

I change the way the computation offset (left shift by 5)  is done because 200MHz << 5 wouldn't fit inside an `uint32_t` and I wanted to avoid using an `uint64_t` here

Two additional commits are present for a small cleanup and a fix.

This is currently unused in our codebase, so it shouldn't impact this platform too much as the `ONDEMAND` bit is set. the FDPLL will not be running out of the box. But `@gschorcht` might need it pretty soon.

### Testing procedure

This PR can be tested on a `same54-xpro` and an oscilloscope using the following the patch:
```
From 76490845ec72387b24116bdd364a61365c186aa1 Mon Sep 17 00:00:00 2001
From: Dylan Laduranty <dylan.laduranty@mesotic.com>
Date: Thu, 11 May 2023 17:42:16 +0200
Subject: [PATCH] removeme! for debug purpose

Signed-off-by: Dylan Laduranty <dylan.laduranty@mesotic.com>
---
 cpu/samd5x/cpu.c | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/cpu/samd5x/cpu.c b/cpu/samd5x/cpu.c
index f778991a5b..2866c8c9e5 100644
--- a/cpu/samd5x/cpu.c
+++ b/cpu/samd5x/cpu.c
`@@` -220,7 +220,7 `@@` static void fdpll_init(uint8_t idx, uint32_t f_cpu)
 }
 
 static void gclk_connect(uint8_t id, uint8_t src, uint32_t flags) {
-    GCLK->GENCTRL[id].reg = GCLK_GENCTRL_SRC(src) | GCLK_GENCTRL_GENEN | flags | GCLK_GENCTRL_IDC;
+    GCLK->GENCTRL[id].reg = GCLK_GENCTRL_SRC(src) | GCLK_GENCTRL_GENEN | flags | GCLK_GENCTRL_OE | GCLK_GENCTRL_IDC;
     while (GCLK->SYNCBUSY.reg & GCLK_SYNCBUSY_GENCTRL(id)) {}
 }
 
`@@` -384,6 +384,12 `@@` void cpu_init(void)
     dma_init();
 #endif
 
+    sam0_gclk_enable(SAM0_GCLK_200MHZ);
+    /* output both FDPLL (GCLK0 and GCLK4) to gpios */
+    gpio_init_mux(GPIO_PIN(PB, 14), GPIO_MUX_M);
+    gpio_init_mux(GPIO_PIN(PB, 10), GPIO_MUX_M);
+    /* PB14 -> EXT2    PB10 -> QSPI SCK */
+
     /* initialize stdio prior to periph_init() to allow use of DEBUG() there */
     early_init();
 
-- 
2.35.3
```

It will output both FDPLLs to PB14 and PB10. Their frequency can then be measured using an oscilloscope.


### Issues/PRs references
None.

19612: pkg/ndn-riot: drop unmaintained pkg r=benpicco a=maribu

### Contribution description

Upstream [1] has seen no activity since 2018, so it safe to assume this is dead. It is reasonable to assume that any users - if there ever were any - have moved on.

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

[1]: https://github.com/named-data-iot/ndn-riot


19643: examples/suit_update: some test fixes r=aabadie a=kaspar030



19655: net/ipv6: make use of clz in ipv6_addr_match_prefix() r=benpicco a=benpicco



Co-authored-by: Fabian Hüßler <fabian.huessler@st.ovgu.de>
Co-authored-by: Dylan Laduranty <dylan.laduranty@mesotic.com>
Co-authored-by: Marian Buschsieweke <marian.buschsieweke@ovgu.de>
Co-authored-by: Kaspar Schleiser <kaspar@schleiser.de>
Co-authored-by: Benjamin Valentin <benjamin.valentin@ml-pa.com>
2023-05-23 16:23:19 +00:00
Benjamin Valentin
2a7691176b gnrc/ipv6_auto_subnets: allow to configure minimal prefix length 2023-05-23 17:46:39 +02:00
Benjamin Valentin
9358a4430d gnrc/ipv6_auto_subnets: remove superfluous newline 2023-05-23 17:46:39 +02:00
Benjamin Valentin
771e9e9a14 gnrc/ipv6_auto_subnets: remove superfluous newline 2023-05-23 16:48:17 +02:00
Benjamin Valentin
41f9c2593d gnrc_ipv6_nib: include RIO with all subnets in downstream RA 2023-05-23 16:46:41 +02:00
Benjamin Valentin
d8438c47cf net/ipv6: make use of bitarithm_clzb() in ipv6_addr_match_prefix() 2023-05-23 16:15:25 +02:00
Fabian Hüßler
e0d64b1a38 ipv6/nib: 6LBR should not send RS on their downstream interface 2023-05-23 15:44:48 +02:00
Benjamin Valentin
7e9308dd8c gnrc_sixlowpan_iphc: prefix bits outside context must be zero 2023-05-23 14:16:47 +02:00
Benjamin Valentin
8966c14f60 gnrc_ipv6_nib: set default RIO preference to zero
Linux will ignore RIOs with preference NONE, so set the preference
to zero instead.
2023-05-23 13:02:36 +02:00
bors[bot]
dc0fe5283f
Merge #19611 #19640
19611: sys/net/rpl: fix possible NULL dereference r=benpicco a=maribu

### Contribution description

As the title says


19640: core/thread: drop unused thread_arch_t r=benpicco a=maribu

### Contribution description

No architecture makes use of thread_arch_t anymore, so let's drop it.


Co-authored-by: Marian Buschsieweke <marian.buschsieweke@ovgu.de>
2023-05-22 14:10:24 +00:00
MrKevinWeiss
17ca5db1f5
sys/isrpipe: Replace xtimer with ztimer_usec 2023-05-22 13:27:44 +02:00
bors[bot]
eb10a5ccd8
Merge #19604
19604: gnrc/ipv6/nib: fix 6Lo ND options on non 6Lo interface r=fabian18 a=fabian18



Co-authored-by: Fabian Hüßler <fabian.huessler@ml-pa.com>
2023-05-22 09:48:14 +00:00
Marian Buschsieweke
28c1630f54
sys/usb/usbus_msc: fix typo in C expression
Rather than setting the correct blk_len, the code only wrote 1 and 0
into the three bytes due to the use of a logic and where a bitwise
and should be used.
2023-05-20 22:18:27 +02:00
bors[bot]
975f150383
Merge #19621 #19622 #19623 #19626 #19627
19621: sys: add Kconfig support for clif r=MrKevinWeiss a=aabadie



19622: sys: add some missing kconfig + adapt related tests when possible r=aabadie a=aabadie



19623: pkg/libbase58: add kconfig support r=MrKevinWeiss a=aabadie



19626: sys/gnrc_lorawan: remove deprecated tx port option r=aabadie a=aabadie



19627: makefiles/pseudomodules: remove deprecated event_thread_lowest module r=aabadie a=aabadie



Co-authored-by: Alexandre Abadie <alexandre.abadie@inria.fr>
2023-05-20 07:13:34 +00:00
bors[bot]
a46b49a24c
Merge #19605 #19624 #19625
19605: drivers/at86rf2xx: setting rx timestamp based on symbol counter for ATmega*RFR2 r=maribu a=chudov



19624: pkg/tensorflow-lite: remove deprecated package r=maribu a=aabadie

Use tflite-micro instead



19625: sys/hashes: remove deprecated aes cmac hashing r=maribu a=aabadie



Co-authored-by: chudov <chudov@gmail.com>
Co-authored-by: Alexandre Abadie <alexandre.abadie@inria.fr>
2023-05-19 17:05:02 +00:00
558d7dd8f2
makefiles/pseudomodules: remove deprecated event_thread_lowest module 2023-05-19 16:15:10 +02:00
889d753ed6
sys/ 2023-05-19 16:07:01 +02:00
cfb5000d5c
sys/gnrc/lorawan: remove handling of deprecated tx port 2023-05-19 16:06:53 +02:00
0eb5bac330
sys/hashes: remove deprecated ase cmac hashing 2023-05-19 16:01:12 +02:00
chudov
c52f6e71c2 drivers/at86rf2xx: rx timestamp generation for ATmegaRFR2
Signed-off-by: chudov <chudov@gmail.com>
2023-05-19 15:33:15 +02:00
27cf550f74
sys/ut_process: add missing Kconfig 2023-05-19 15:09:56 +02:00
d39af66176
sys/uuid: add missing Kconfig 2023-05-19 15:09:55 +02:00
67391afe1a
sys/ssp: add missing Kconfig 2023-05-19 15:09:55 +02:00
4c9d6c0b49
sys/sema_inv: add missing Kconfig 2023-05-19 15:09:55 +02:00
5d351632d1
sys/coding: add missing Kconfig 2023-05-19 15:09:54 +02:00
f28d0f1b7b
sys: add Kconfig support for clif 2023-05-19 15:03:42 +02:00
Marian Buschsieweke
273f92a411
sys/net/rpl: fix possible NULL dereference
fixes https://github.com/RIOT-OS/RIOT/issues/15006
2023-05-18 01:25:13 +02:00
Fabian Hüßler
ea9995ecca gnrc/ipv6/nib: fix 6Lo ND options on non 6Lo interface
If a 6Lo router sends and RA over a non-6Lo interface it should not include the options which are specifically for 6Lo ND
2023-05-17 15:49:46 +02:00
Marian Buschsieweke
0747f5816c
sys/shell: Add coreclk command to shell_cmd_sys
The coreclk shell command now prints the CPU frequency in Hz, which
can be useful for boards with RC generated CPU frequency (e.g.
RP2040, FE310, or MPS430Fx1xx MCUs allow this) which may quite a bit
off the target frequency.
2023-05-16 10:58:06 +02:00
bors[bot]
bbe952cb8c
Merge #19553
19553: nanocoap_sock: remove nanocoap_get() r=maribu a=benpicco



Co-authored-by: Benjamin Valentin <benjamin.valentin@ml-pa.com>
2023-05-15 20:47:28 +00:00
bors[bot]
951b83d08d
Merge #19594
19594: sys: drop broken and legacy Mac OS handling r=maribu a=maribu

### Contribution description

This drops special handling for Mac OS (X) `native`, which is not supported anymore anyway and causing issues when building for non-`native` targets on Mac OS.


Co-authored-by: Marian Buschsieweke <marian.buschsieweke@ovgu.de>
2023-05-15 17:28:08 +00:00
Marian Buschsieweke
8df1522a15
sys: drop broken and legacy Mac OS handling
This drops special handling for Mac OS (X) `native`, which is not
supported anymore anyway and causing issues when building for
non-`native` targets on Mac OS.
2023-05-15 15:35:50 +02:00
chudov
516df5cdb6 gnrc/gnrc_netif_hdr_print: printout timestamp if enabled
Signed-off-by: chudov <chudov@gmail.com>
2023-05-15 12:52:35 +02:00
c735b958cc
sys: fix remaining broken paths to tests 2023-05-13 19:08:39 +02:00
5f3a9de7fa
treewide: fix path to ztimer test applications 2023-05-13 19:08:38 +02:00
96271df7c6
sys/test_utils: fix path to rmutex test in doc 2023-05-13 18:27:58 +02:00
3989cd79ff
treewide: fix path to shell related tests in doc 2023-05-13 18:27:58 +02:00
Marian Buschsieweke
30ebacd784
sys/shell/cmd_gnrc_icmpv6_echo: fix format specifier
At a cast to `unsigned` so that the format specifier `%u` matches the
type. I think this won't have an impact on the generated machine code.
2023-05-10 13:00:41 +02:00
bors[bot]
cf7ef55b8d
Merge #19490
19490: sys/shell/gnrc_netif: don't always build lora options with ifconfig r=aabadie a=aabadie



Co-authored-by: Alexandre Abadie <alexandre.abadie@inria.fr>
2023-05-09 12:46:59 +00:00
Benjamin Valentin
82929ccea3 nanocoap_sock: remove nanocoap_get()
The function has been deprecated in favor of nanocoap_sock_get()
2023-05-05 15:17:34 +02:00
bors[bot]
26c61beda7
Merge #19477
19477: sys /cpp11-compat: remove pseudo anonymous namespaces r=MrKevinWeiss a=kfessel

### Contribution description

remove pseudo anonymous namespaces in favor of defines that are used thoughout the rest of riot 

### Testing procedure

cpp test do not fail 

### Issues/PRs references



Co-authored-by: Karl Fessel <karl.fessel@ovgu.de>
2023-05-04 12:35:45 +00:00
bors[bot]
718a4513b5
Merge #19368 #19529 #19531
19368: debug: add DEBUG_BREAKPOINT() macro, set breakpoint on failed assertion r=benpicco a=benpicco



19529: cpu/stm32/periph/dac: optimize setting DAC r=benpicco a=Enoch247

### Contribution description

The current implmentation right shifted the 16 bit value passed into `dac_set()` down to the 12 bits that the DAC is actually capable of. This patch drops the shift and instead writes the 16 bit value to the DAC's left aligned 12 bit wide data holding register.


### Testing procedure

do something like:
``` c
#include "perip/dac.h"

int main(void)
{
    dac_set(DAC_LINE(0), 0xffff/2);
    return 0;
}
```
- observe DAC's output is half of vref


### Issues/PRs references

- none known


19531: tests/unittests: allow passing `UNIT_TESTS` via env r=benpicco a=kaspar030



Co-authored-by: Benjamin Valentin <benpicco@beuth-hochschule.de>
Co-authored-by: Joshua DeWeese <jdeweese@primecontrols.com>
Co-authored-by: Kaspar Schleiser <kaspar@schleiser.de>
2023-05-02 18:08:42 +00:00
bors[bot]
c4b27d8241
Merge #19523 #19527 #19530 #19532 #19533 #19535
19523: boards/iotlab-m3: enable l3g4200d_ng r=benpicco a=benpicco



19527: drivers/sdcard_spi: small cleanup r=benpicco a=gschorcht

### Contribution description

This PR provides a small cleanup:
- the copy of `sdcard_spi_params_t` is removed (commit bfc2a51f70)
- the documentation was changed to fit the 100 characters per line. (commit 36f0162b34)

It is not necessary to hold a complete copy `sdcard_spi_params_t` in the device descriptor. Constant parameters can be used directly from ROM instead. This saves 24 bytes of RAM.

### Testing procedure

Use any board with SD Card SPI interface. The driver test should still work, for example:
```
BOARD=esp32-wrover-kit make -j8 -C tests/driver_sdcard_spi flash term
```
```
main(): This is RIOT! (Version: 2023.07-devel-176-g7213c-drivers/sdcard_spi_cleanup)
SD-card spi driver test application
insert SD-card and use 'init' command to set card to spi mode
WARNING: using 'write' or 'copy' commands WILL overwrite data on your sd-card and
almost for sure corrupt existing filesystems, partitions and contained data!
> init
Initializing SD-card at SPI_0...
[OK]
> 
```

### Issues/PRs references


19530: sys/xtimer: add missing "modules.h" include to `xtimer.h` r=benpicco a=kaspar030



19532: tests/unittests: tests-core-mbox: add missing `container.h` include r=benpicco a=kaspar030



19533: core: move macros/math.h to core/lib/include/macros r=benpicco a=kaspar030



19535: nanocoap_sock: defuse nanocoap_sock_get() API footgun 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: Kaspar Schleiser <kaspar@schleiser.de>
2023-05-02 13:37:57 +00:00
Benjamin Valentin
f6f5b13744 nanocoap_sock: don't use return buffer for request 2023-05-02 15:02:56 +02:00
16117566cc sys/xtimer: add missing "modules.h" include to xtimer.h 2023-05-02 13:52:48 +02:00
Marian Buschsieweke
8fbbc40b3e
sys/ztimer: fix typo in debug output 2023-05-02 09:53:16 +02:00
Marian Buschsieweke
c3500eb6e0
tree wide: fix typos in comments found by codespell
This will not change generated binaries, only the Doxygen output and
source code will have less typos.
2023-05-02 09:52:06 +02:00
Benjamin Valentin
b88c9c5f1f debug: add DEBUG_BREAKPOINT() macro 2023-04-27 13:19:17 +02:00
bors[bot]
23f7087845
Merge #19315
19315: cpu/native: add host fs access via VFS r=benpicco a=benpicco



Co-authored-by: Benjamin Valentin <benpicco@beuth-hochschule.de>
Co-authored-by: Benjamin Valentin <benjamin.valentin@ml-pa.com>
2023-04-25 23:14:45 +00:00
Benjamin Valentin
f78911ebf7 gcoap_fileserver: set permissions on create 2023-04-26 00:53:14 +02:00
Benjamin Valentin
5708ca1945 vfs: add auto_unmount_vfs() 2023-04-26 00:53:14 +02:00
Benjamin Valentin
c438c80548 cpu/native: add host fs access via VFS 2023-04-26 00:53:14 +02:00
bors[bot]
46af92d3a0
Merge #18620 #19296 #19504 #19506
18620: core: add core_mutex_debug to aid debugging deadlocks r=maribu a=maribu

### Contribution description

Adding `USEMODULE += core_mutex_debug` to your `Makefile` results in
on log messages such as

    [mutex] waiting for thread 1 (pc = 0x800024d)

being added whenever `mutex_lock()` blocks. This makes tracing down
deadlocks easier.

### Testing procedure

Run e.g.

```sh
USEMODULE=core_mutex_debug BOARD=nucleo-f767zi make -C tests/mutex_cancel flash test
```

which should provide output such as

```
Welcome to pyterm!
Type '/exit' to exit.
READY
s
[mutex] waiting for thread 1 (pc = 0x8000f35)
START
main(): This is RIOT! (Version: 2022.10-devel-841-g5cc02-core/mutex/debug)
Test Application for mutex_cancel / mutex_lock_cancelable
=========================================================

Test without cancellation: OK
Test early cancellation: OK
Verify no side effects on subsequent calls: [mutex] waiting for thread 1 (pc = 0x800024d)
OK
Test late cancellation: [mutex] waiting for thread 1 (pc = 0x0)
OK
TEST PASSED
```

```sh
$ arm-none-eabi-addr2line -a 0x800024d -e tests/mutex_cancel/bin/nucleo-f767zi/tests_mutex_cancel.elf 
0x0800024d
/home/maribu/Repos/software/RIOT/tests/mutex_cancel/main.c:51
```

### Issues/PRs references

Depends on and includes https://github.com/RIOT-OS/RIOT/pull/18619

19296: nanocoap: allow to define CoAP resources as XFA r=maribu a=benpicco



19504: cpu/cc26xx_cc13xx: Fix bogus array-bound warning r=maribu a=maribu

### Contribution description

GCC 12 create a bogus array out of bounds warning as it assumes that because there is special handling for `uart == 0` and `uart == 1`, `uart` can indeed be `1`. There is an `assert(uart < UART_NUMOF)` above that would blow up prior to any out of bounds access.

In any case, optimizing out the special handling of `uart == 1` for when `UART_NUMOF == 1` likely improves the generated code and fixes the warning.

    /home/maribu/Repos/software/RIOT/cc2650/cpu/cc26xx_cc13xx/periph/uart.c:88:8: error: array subscript 1 is above array bounds of 'uart_isr_ctx_t[1]' [-Werror=array-bounds]
       88 |     ctx[uart].rx_cb = rx_cb;
          |     ~~~^~~~~~
    /home/maribu/Repos/software/RIOT/cc2650/cpu/cc26xx_cc13xx/periph/uart.c:52:23: note: while referencing 'ctx'
       52 | static uart_isr_ctx_t ctx[UART_NUMOF];
          |                       ^~~
    /home/maribu/Repos/software/RIOT/cc2650/cpu/cc26xx_cc13xx/periph/uart.c:89:8: error: array subscript 1 is above array bounds of 'uart_isr_ctx_t[1]' [-Werror=array-bounds]
       89 |     ctx[uart].arg = arg;
          |     ~~~^~~~~~
    /home/maribu/Repos/software/RIOT/cc2650/cpu/cc26xx_cc13xx/periph/uart.c:52:23: note: while referencing 'ctx'
       52 | static uart_isr_ctx_t ctx[UART_NUMOF];
          |                       ^~~

### Testing procedure

The actual change is a pretty obvious one-liner, so that code review and a green CI should be sufficient. If not, running any UART example app without regression should do.

### Issues/PRs references

None

19506: tools/openocd: Fix handling of OPENOCD_CMD_RESET_HALT r=maribu a=maribu

### Contribution description

The OPENOCD_CMD_RESET_HALT was not longer correctly passed to the script. This fixes the issue.

### Testing procedure

Flashing of e.g. the `cc2650-launchpad` with upstream OpenOCD should work again.

### Issues/PRs references

The change was added to https://github.com/RIOT-OS/RIOT/pull/19050 after testing the PR and before merging. I'm not sure if the fix never worked because of this, or if behavior of `target-export-variables` or GNU Make changed.

Co-authored-by: Marian Buschsieweke <marian.buschsieweke@ovgu.de>
Co-authored-by: Benjamin Valentin <benjamin.valentin@bht-berlin.de>
Co-authored-by: Benjamin Valentin <benjamin.valentin@ml-pa.com>
2023-04-25 15:46:11 +00:00
chrysn
6724e851ca Rust: Update riot-wrappers
This fixes a regression by merging https://github.com/RIOT-OS/rust-riot-wrappers/pull/55
(the "G" unit has been deprecated, but that deprecation was done wrong
in https://github.com/RIOT-OS/rust-riot-wrappers/pull/50).
2023-04-25 09:20:58 +02:00
chrysn
5f91bd8812 Rust: Update non-RIOT dependencies 2023-04-24 11:38:59 +02:00
chrysn
de410314a3 Rust: Update riot-sys and riot-wrappers
This pulls in several fixes from these repositories:

* riot-sys:
    * Add `random` module to `riot-headers` (https://github.com/RIOT-OS/rust-riot-sys/pull/26)
    * README: fix 2 typos (https://github.com/RIOT-OS/rust-riot-sys/pull/31)
    * bindgen: Use 0.64 (https://github.com/RIOT-OS/rust-riot-sys/pull/30)
    * wolfSSL support added (https://github.com/RIOT-OS/rust-riot-sys/pull/28)
    * extern-types: Generate replacement types dynamically (https://github.com/RIOT-OS/rust-riot-sys/pull/27)
    * Extern types: Add netq_t, make them large (https://github.com/RIOT-OS/rust-riot-sys/pull/25)
    * doc: Suppress warnings about things C2Rust does not uphold (https://github.com/RIOT-OS/rust-riot-sys/pull/23)
    * export macro_DAC_LINE (https://github.com/RIOT-OS/rust-riot-sys/pull/22)
    * Add BINDGEN_OUTPUT_FILE export (https://github.com/RIOT-OS/rust-riot-sys/pull/21)
* riot-wrappers:
    * DAC: Add wrapper around RIOTs DAC-interface (https://github.com/RIOT-OS/rust-riot-wrappers/pull/36)
    * saul: Compatibly rename G* variants (https://github.com/RIOT-OS/rust-riot-wrappers/pull/50)
    * tests: Add test for auto-init when auto-init debug is active (https://github.com/RIOT-OS/rust-riot-wrappers/pull/48)
    * gcoap: Provide link encoder (https://github.com/RIOT-OS/rust-riot-wrappers/pull/47)
    * Drop SUIT support in riot-wrappers (https://github.com/RIOT-OS/rust-riot-wrappers/pull/44)
    * Add an auto init module (https://github.com/RIOT-OS/rust-riot-wrappers/pull/45)
    * gcoap: Allow registration without scope for 'static listeners (https://github.com/RIOT-OS/rust-riot-wrappers/pull/43)

Through direct dependency changes (the bindgen update), the number of
transitive dependencies could be reduced.
2023-04-24 11:29:52 +02:00
bors[bot]
0101663e39
Merge #19485
19485: sys/shell: Fix missing dependency r=aabadie a=maribu

### Contribution description

The shell commands depend on the shell module being use. This was already the case in KConfig, but was overlooked in the shell's `Makefile.dep`.

In addition, this uncovered that `tests/memarray` had a bogus dependency on shell commands without every using the shell.

### Testing procedure

Ideally binaries should not differ (except for debug section).

### Issues/PRs references

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

Co-authored-by: Marian Buschsieweke <marian.buschsieweke@ovgu.de>
2023-04-22 06:21:38 +00:00
ba92b3f3af
sys/shell: fix Kconfig description of shell_cmd_gnrc_netif_lorawan 2023-04-22 08:17:45 +02:00
ea1c1c84ab
sys/shell: add shell_cmd_gnrc_netif_lora to Kconfig support 2023-04-22 08:17:45 +02:00
fc82153385
sys/shell/gnrc_netif: don't always build lora options
Just build them if the shell_cmd_gnrc_netif_lora module is pulled in
2023-04-22 08:17:44 +02:00
bors[bot]
ca4be42d88
Merge #19488
19488: usbus: remove deprecated USBUS_HANDLER_FLAG_TR_FAIL flag r=gschorcht a=dylad

### Contribution description

This PR removes the deprecated `USBUS_HANDLER_FLAG_TR_FAIL` flag.

### Testing procedure

CI should be enough.

### Issues/PRs references

Was deprecated by #17046

Co-authored-by: Dylan Laduranty <dylan.laduranty@mesotic.com>
2023-04-21 10:17:28 +00:00
0c52207544
Merge pull request from GHSA-xqm8-xj74-fjw2
gnrc_sixlowpan_iphc: check IPHC dispatch for truncation
2023-04-21 11:56:49 +02:00
287f030af2
Merge pull request from GHSA-xfj4-9g7w-f4gh
fixes for CVE-2023-24826
2023-04-21 11:54:57 +02:00
Martine Lenders
709ddd2ba7 gnrc_sixlowpan_iphc: check IPHC dispatch for truncation 2023-04-21 11:45:27 +02:00
Martine Lenders
4f1e2a3709 gnrc_rpl_srh: check header fields consistency before substraction 2023-04-21 11:40:47 +02:00
Martine Lenders
eb9e50aafe gnrc_sixlowpan_frag_sfr: move timer initialization to init function 2023-04-21 11:30:59 +02:00
Marian Buschsieweke
69b3e05f01
sys/shell: restructure deps
Move deps on sys/shell to sys/Makefile.dep and only keep deps of
sys/shell in sys/shell/Makefile.dep
2023-04-21 09:45:45 +02:00
Dylan Laduranty
b1ffce3ccd usbus: remove deprecated USBUS_HANDLER_FLAG_TR_FAIL flag
Signed-off-by: Dylan Laduranty <dylan.laduranty@mesotic.com>
2023-04-19 20:54:30 +02:00
Marian Buschsieweke
6448258aac
sys/shell: Add missing dependency
The shell_cmds module depends on the shell module. This was correctly
added to KConfig, but the Makefile dependencies missed this one. This
commit adds the missing dep.
2023-04-19 12:25:00 +02:00
Karl Fessel
da17ebbde7 sys /cpp11-compat: remove pseudo anonymous namespaces 2023-04-18 16:30:43 +02:00
Gunar Schorcht
3b2da3e9e0 sys: define CPU_RAM_SIZE as hex number
Some platforms such as RISC-V don't support numbers given with unit (32K)
2023-04-18 06:20:14 +02:00
Gunar Schorcht
2e32d4ee8b sys/riotboot: uses SLOT1_OFFSET in hex format
Using hex number for addresses and address offsets improves the readability.
2023-04-18 06:20:14 +02:00
Gunar Schorcht
06426c41b0 sys/riotboot: common default NUM_SLOT, SLOT_* config 2023-04-18 06:20:14 +02:00
Gunar Schorcht
f4f716a062 sys/riotboot: fix compilation error of riotboot_slot
`riotboot_slot` uses `ARRAY_SIZE` which is defined in `container.h` but not yet included on some plattforms.
2023-04-18 06:20:14 +02:00
bors[bot]
2b6dc6471e
Merge #19436
19436: cpp11-compat: thread::sleep_for in microseconds r=benpicco a=kfessel

### Contribution description

after reviewing #19369  i found that there is a conversion to nanoseconds just to convert it to microseconds some instrunctions later for ztimer64_usec to handle it this removes one of the conversions (convert once direct to microseconds)

### Testing procedure

run the cpp tests

### Issues/PRs references

#19369

Co-authored-by: Karl Fessel <karl.fessel@ovgu.de>
2023-04-17 18:20:28 +00:00
bors[bot]
a87634cf91
Merge #19475
19475: gnrc_netif/lorawan: fix setting nwkskey via NETOPT r=MrKevinWeiss a=jia200x



Co-authored-by: Jose Alamos <jose@alamos.cc>
2023-04-17 13:04:37 +00:00
Karl Fessel
90d2ae83fb cpp11-compat: thread::sleep_for in microseconds 2023-04-17 13:27:14 +02:00
Jose Alamos
3c1f5a0dbd
gnrc_netif/lorawan: fix setting nkskey via NETOPT 2023-04-17 12:40:42 +02:00
Gunar Schorcht
e46fa4a0b2 sys/usbus: use USBDEV_SET_ADDR_AFTER_STATUS
Use symbol `USBDEV_SET_ADDR_AFTER_STATUS` to determine whether the device address has to be set directly after SETUP stage or after the associated STATUS stage.
2023-04-16 17:14:08 +02:00
d733314ebe
sys/shell: fix missing generic lora settings in ifconfig 2023-04-13 10:55:23 +02:00
7b2db7bf2b
usbus: Implement GET STATUS and SET/CLEAR FEATURE requests
This extends support for the GET STATUS requests to support endpoints
and interfaces as recipient. It also adds the SET and CLEAR FEATURE
requests for the endpoints with support to set and clear the halt
condition on an endpoint.
2023-04-11 11:12:53 +02:00
13b4f8de2c
usbus: Implement endpoint halt condition.
Instead of directly stalling an endpoint, handlers should enable the
halt condition on an usbus endpoint to signal error condition.
This can then be cleared via a CLEAR FEATURE request from the host.
2023-04-11 11:12:49 +02:00
Gunar Schorcht
44e9db86c0 sys/usbus/msc: fix EP sizes and buffer alignment for HS in DMA-mode 2023-04-07 19:06:24 +02:00
Dylan Laduranty
608d49c51a usbus/msc: ready MSC bulk OUT endpoint in USB_MSC_SETUP_REQ_GML request
Signed-off-by: Dylan Laduranty <dylan.laduranty@mesotic.com>
2023-04-05 20:16:53 +02:00
Dylan Laduranty
9e88db7f50 usbus/msc: remove call to usbdev_control_slicer_ready()
This function should not be called by the driver as USBUS will handle it already. So remove this call to prevent duplication

Signed-off-by: Dylan Laduranty <dylan.laduranty@mesotic.com>
2023-04-05 20:14:59 +02:00
8044e578b5
cdc_ecm: Update max supported transfer size after reset 2023-03-31 16:43:44 +02:00
8b41443913
usbus: Add functions to query max packet sizes 2023-03-31 16:43:44 +02:00
86e2953470
usbopt: add USBOPT_ENUMERATED_SPEED 2023-03-31 16:43:44 +02:00
bors[bot]
7f95ee7558
Merge #19373
19373: examples/suit_update: improve default module selection r=bergzand a=benpicco



Co-authored-by: Benjamin Valentin <benjamin.valentin@ml-pa.com>
2023-03-29 09:44:59 +00:00
MrKevinWeiss
4f6448ed05
sys/cpp11-compat: Use ztimer64_usec instead of xtimer 2023-03-24 12:36:45 +01:00
Benjamin Valentin
9495dc4e2e nanocoap_server: add nanocoap_server_auto_init 2023-03-22 14:43:19 +01:00
bors[bot]
189d1c598c
Merge #19400
19400: sys/bitfield: don't touch unrelated bits in bf_{set, clear}_all() r=kaspar030 a=benpicco



Co-authored-by: Benjamin Valentin <benjamin.valentin@ml-pa.com>
2023-03-20 11:30:53 +00:00
bors[bot]
2fcedf923f
Merge #19402 #19404 #19405
19402: sys/net/gnrc/netif: fixing no global address wait r=benpicco a=jan-mo

### Contribution description

The function `gnrc_netif_ipv6_wait_global_address()` will always return true, even if no global address is attached to the interface.
Currently the function only waits for any message and does not check if it was from the bus or not. So in `msg.content.ptr` is no valid address and therefore it returns true.

I added just the check, if the message is from the bus of any interface and then checking the address. We could also first check if the address in `msg.content.ptr` is valid, but this will just hide the bug. Also the timeout was never checked. It was just assuming that no other message will be received during the wait.


### Testing procedure

Use two devices, one works as a border router and supports the global address, the other will wait for the global address. You can call the function `gnrc_netif_ipv6_wait_global_address()` on the waiting node and see whether it returns true and finds the global address in the given time-range.


19404: sys/trickle: cleanup deps r=benpicco a=MrKevinWeiss

### Contribution description

Cleans the dependencies of the `trickle` module. This removes the deprecated xtimer and models kconfig.

### Testing procedure

Green murdock

### Issues/PRs references


19405: cpu/efm32: pwm_init errors are zeros r=benpicco a=chrysn

### Contribution description

pwm_init is documented to return 0 on errors, and has an unsigned return value.

EFM32's initialization function returned negative values, which through implicit casting become 0xffffffff or 0xfffffffe, which are successful by the documentation.

This makes all the EFM32 error paths return 0 as they should.

Also, it fixes a variable name and the corresponding error message that used to talk of "initiation" (which would be the start of a process) rather than "initialization" (which is a process that is completed before something else can happen).

### Testing procedure

* on stk3700, tests/periph_pwm, run `init 0 0 10 1000` / `set 0 0 500`
* The init used to respond with "The pwm frequency is set to 4294967294", and the set does nothing.
* The init now responds with "Error: device is not <del>initiated</del><ins>initialized</ins>". The set still does nothing, but then one doesn't expect it to any more.

(But really, looking at the patch and the docs should suffice).

### Issues/PRs references

By-catch from testing the Rust wrappers provided by `@remmirad` at https://github.com/RIOT-OS/rust-riot-wrappers/pull/38

Co-authored-by: Jan Mohr <jan.mohr@ml-pa.com>
Co-authored-by: MrKevinWeiss <weiss.kevin604@gmail.com>
Co-authored-by: chrysn <chrysn@fsfe.org>
2023-03-17 13:06:11 +00:00
Jan Mohr
72107a0873 sys/net/gnrc/netif: fixing no global address wait 2023-03-17 13:45:35 +01:00
MrKevinWeiss
c309f21e97
sys/trickle: Model kconfig 2023-03-17 12:09:01 +01:00
MrKevinWeiss
cbde66f610
sys/trickle: Remove xtimer and only use ztimer 2023-03-17 12:04:44 +01:00
Benjamin Valentin
2d704a2c59 sys/bitfield: don't set unrelated bits in bf_{set, clear}_all() 2023-03-17 00:08:10 +01:00
bors[bot]
1a787d4669
Merge #19392 #19398 #19399
19392: ztimer: Fix doc on ztimer_remove r=benpicco a=bergzand

### Contribution description

See the subject 


### Testing procedure

Read the modified docs


### Issues/PRs references

None

19398: gnrc_ipv6_static_addr: fix build with only static address r=benpicco a=benpicco



19399: drivers/usbdev_synopsys_dwc2: add ESP32x power management r=benpicco a=gschorcht

### Contribution description

This PR adds power management handling for ESP32x SoCs.

### Testing procedure

Use and ESP32-S2 or ESP32-S3 board and flash `tests/periph_pm` using the `stdio_cdc_acm`
```
USEMODULE=stdio_cdc_acm BOARD=esp32s3-devkit make -j8 -C tests/periph_pm flash
```
Connect the terminal to the board and execute command:
```
set_rtc 1 1
```
The console should continue to work after the 1-s light sleep.

### Issues/PRs references


Co-authored-by: Koen Zandberg <koen@bergzand.net>
Co-authored-by: Benjamin Valentin <benpicco@beuth-hochschule.de>
Co-authored-by: Gunar Schorcht <gunar@schorcht.net>
2023-03-16 12:09:46 +00:00
Benjamin Valentin
a473ca9ed5 gnrc_static: auto-select interface if there is only one 2023-03-16 12:28:00 +01:00
Benjamin Valentin
3f2d36d14f gnrc_static: fix build if only static address is set 2023-03-16 11:19:53 +01:00
Martine Lenders
dd969745ab
ztimer/ztimer64: uncrustify code 2023-03-15 15:13:48 +01:00
bors[bot]
fd38db6b38
Merge #19371 #19382
19371: sys/usbus: check for the number of required and provided EPs in static configurations r=dylad a=gschorcht

### Contribution description

This PR provides a static check at compile time whether the number of EPs required in a static configuration does not exceed the number of EPs provided by the USB device.

#### Background

In issue #19359 the problem was reported that `usbus_cdc_ecm` didn't work together with `stdio_cdc_acm` on some STM32 boards. The reason for some of the boards was simply that the application tried to allocate more EPs than available and simply ignored this and just didn't work.

#### Solution

Since `auto_init_usb` uses a static configuration with exactly one USBUS stack instance and one USB device, at least in case `auto_init` is used a static check can be carried out to make sure that the number of EPs required by the application doesn't exceed the number of EPs provided by the USB device. For this purpose, each `usbus_*` module defines the number of IN and OUT EPs required by that module. Each USB device driver defines the number of EPs provided by USB device if it differs from the default of 8 EPs. During the auto initialization the total number of required IN and OUT EPs is then compared with the number of EPs provided by the USB device using a static assert.

### Testing procedure

1. Green CI
2. Compilation of
   ```python
   USEMODULE='stdio_cdc_acm' BOARD=nucleo-f439zi make -j8 -C tests/usbus_cdc_ecm
   ```
   should lead to compilation error
   ```python
   sys/auto_init/usb/auto_init_usb.c:81:1: error: static assertion failed: "Number of required IN endpoints exceeded"
    _Static_assert(USBUS_EP_IN_REQUIRED_NUMOF <= USBDEV_NUM_ENDPOINTS,
    ^~~~~~~~~~~~~~
   Makefile.base:146: recipe for target 'tests/usbus_cdc_ecm/bin/nucleo-f439zi/auto_init_usbus/auto_init_usb.o' failed
   ```
   while compilation of
   ```
   USEMODULE='stdio_cdc_acm' BOARD=nucleo-f767zi make -j8 -C tests/usbus_cdc_ecm
   ```
   should work.

### Issues/PRs references

Fixes issue #19359 partially.

19382: tests/pkg_nanors: use static allocation r=benpicco a=benpicco



Co-authored-by: Gunar Schorcht <gunar@schorcht.net>
Co-authored-by: Benjamin Valentin <benpicco@beuth-hochschule.de>
2023-03-15 08:41:57 +00:00
fa0ab40920
ztimer: Fix doc on ztimer_remove 2023-03-14 18:16:47 +01:00
5205151876
cord: convert to ztimer 2023-03-14 18:15:21 +01:00
bors[bot]
5b61449d75
Merge #19386
19386: usbus/dfu: do not create alt interface if NUM_SLOTS=1 r=benpicco a=dylad

### Contribution description

In some cases, it is really useful to build `riotboot` with `NUM_SLOTS=1`.
When use in combination with `riotboot_dfu`, there is no need to export the second slot if `riotboot` is built with `NUM_SLOTS=1`.
Thus, prevent the alt interface declaration in dfu if `NUM_SLOTS=1` so that only slot0 can be used to flash.


### Testing procedure
Add `NUM_SLOTS=1` to `bootloaders/riotboot_dfu/Makefile`
Flash the riotboot DFU bootloader to any board supported by USBUS:
`make BOARD=xxx -C bootloaders/riotboot_dfu flash`
and run
`dfu-util -l`

With NUM_SLOTS=2 you will get:
```
dfu-util -l  
dfu-util 0.11

Copyright 2005-2009 Weston Schmidt, Harald Welte and OpenMoko Inc.
Copyright 2010-2021 Tormod Volden and Stefan Schmidt
This program is Free Software and has ABSOLUTELY NO WARRANTY
Please report bugs to http://sourceforge.net/p/dfu-util/tickets/

Found DFU: [1209:7d02] ver=0100, devnum=11, cfg=1, intf=0, path="1-4", alt=1, name="RIOT-OS Slot 1", serial="AB88DCAE80893484"
Found DFU: [1209:7d02] ver=0100, devnum=11, cfg=1, intf=0, path="1-4", alt=0, name="RIOT-OS Slot 0", serial="AB88DCAE80893484"
```

with NUM_SLOTS=1 you will get:
```
dfu-util -l 
dfu-util 0.11

Copyright 2005-2009 Weston Schmidt, Harald Welte and OpenMoko Inc.
Copyright 2010-2021 Tormod Volden and Stefan Schmidt
This program is Free Software and has ABSOLUTELY NO WARRANTY
Please report bugs to http://sourceforge.net/p/dfu-util/tickets/

Found DFU: [1209:7d02] ver=0100, devnum=14, cfg=1, intf=0, path="1-4", alt=0, name="RIOT-OS Slot 0", serial="AB88DCAE80893484"
```





### Issues/PRs references



Co-authored-by: Dylan Laduranty <dylan.laduranty@mesotic.com>
2023-03-14 01:50:31 +00:00
Dylan Laduranty
65475af1bb usbus/dfu: do not create alt interface if not needed
If riotboot is built with NUM_SLOTS=1, there is no reason to advertise a second slot in the bootloader

Signed-off-by: Dylan Laduranty <dylan.laduranty@mesotic.com>
2023-03-13 21:52:06 +01:00
bors[bot]
9142d9c375
Merge #19383 #19385
19383: cord: include gcoap_req_send returning 0 in error r=benpicco a=bergzand

### Contribution description

gcoap_req_send returns 0 if it was unable to send the CoAP request. CoRD did not include that case in the return code checks. This changes CoRD to include it and drop the registration if CoAP could not send the request. The old behaviour made the CoRD thread lock up.

### Testing procedure

- Check with the gcoap API docs.
- I can reliable trigger the issue with a RIOT application including both the `cord_ep_standalone` module and some measurement reported both sending requests to the same application. If at some point the application is shut down, gcoap has all its memo's occupied with the measurement reporting and can't add the CoRD update request. Thus the CoRD update request fails with a zero code and the thread (previously) would lock up.

### Issues/PRs references

None

19385: cpu/stm32/periph/timer: fix clobered IRQ flag r=benpicco a=Enoch247

### Contribution description

From the git commit:

> The STM32 periph_timer driver reads the timer's status flags, then clears them all. It is possible that a timer interrupt could occur between reading the flag and clearing it. This would lead to a lost interrupt.
> 
> The timer's status flags can be cleared by software, but can only be set by the hardware. This patch takes advantage of this by only clearing the flags it knows are set. The rest of the flags are set, which doesn't actually change their state.

I had trouble finding anything in ST's datasheet saying that software could not set the timer's status flags, but testing showed that this is how it works in practice. Further, [ST's own HAL ](https://github.com/STMicroelectronics/STM32CubeF4/blob/master/Drivers/STM32F4xx_HAL_Driver/Inc/stm32f4xx_hal_tim.h#L1258)confirms this. If the hardware didn't work this way, it would be impossible to atomically read-modify-write the flags.

### Testing procedure

I tested by doing the following:

1. `make -C tests/periph_timer BOARD=nucleo-f767zi all flash term`
2. press s
3. press [ENTER]
4. observe test passes
5. `make -C tests/periph_timer_periodic BOARD=nucleo-f767zi all flash term`
6. press s
7. press [ENTER]
8. observe test passes
9. `make -C tests/periph_timer_short_relative_set BOARD=nucleo-f767zi all flash term`
10. press s
11. press [ENTER]
12. observe test passes


### Issues/PRs references

- none known

Co-authored-by: Koen Zandberg <koen@bergzand.net>
Co-authored-by: Joshua DeWeese <jdeweese@primecontrols.com>
2023-03-13 20:25:27 +00:00
Gunar Schorcht
af0eaa99ce sys/auto_init/usb: add a check for the number EPs
Since `auto_init_usb` provides a static auto configuration for a single USBUS stack instance using a single USB device, a static assert can be used here to check whether the number of EPs required by the configuration does not exceed the number of EPs provided by the USB device.
2023-03-13 12:58:33 +01:00
19ff949404
cord: include gcoap_req_send returning 0 in error
gcoap_req_send returns 0 if it was unable to send the CoAP request. CoRD
did not include that case in the return code checks. This changes CoRD
to include it and drop the registration if CoAP could not send the
request. The old behaviour made the CoRD thread lock up.
2023-03-13 11:49:37 +01:00
Gunar Schorcht
6d273e7966 sys/usbus: define the number of required EPs for each class
To be able to check during compilation that the number of endpoints provided by a USB peripheral is not exceeded, each interface class has to define the number of IN and OUT endpoints it requires.
2023-03-12 13:15:44 +01:00
Gunar Schorcht
1fa988d135 sys/usbus: handle exceeding of number of endpoints
If the number of endpoints is not sufficient for an application, it should not be silently ignored and cause a non-working application. Rather, should cause an assertion as it is a configuration issue.
2023-03-10 07:59:14 +01:00
Benjamin Valentin
d16d8f362a sys/suit: drop superfluous ')' in output 2023-03-10 02:27:43 +01:00
bors[bot]
513676f6e0
Merge #17086
17086: usbdev: Add dedicated stall functions r=benpicco a=bergzand

### Contribution description

This PR adds dedicated stall functions for usbdev peripherals. Two
functions are added. The first function (usbdev_ep_stall) to enable and
disable the stall condition on generic endpoints. The second function is
a dedicated function to set the stall condition on endpoint zero in both
directions. This status can only be set and should automatically be
cleared by the usbdev implementation (or hardware) after a new setup
request is received from the host.

### Testing procedure

- examples/usbus_minimal should still enumerate correctly on the host side.
- #17085 can be used to demonstrate the ep0_stall function with the `tests/usbus_cdc_acm_stdio/` test

### Issues/PRs references

None

Co-authored-by: Koen Zandberg <koen@bergzand.net>
Co-authored-by: Gunar Schorcht <gunar@schorcht.net>
2023-03-10 00:12:40 +00:00
bors[bot]
bdecf57516
Merge #19356
19356: usbus/msc: add CONFIG_USBUS_MSC_AUTO_MTD option to create LUNs on init r=dylad a=benpicco



Co-authored-by: Benjamin Valentin <benjamin.valentin@bht-berlin.de>
2023-03-09 19:49:51 +00:00
Benjamin Valentin
73400cb248 tests/usbus_msc: don't use custom usbus 2023-03-09 16:57:17 +01:00
Benjamin Valentin
bbda85221e usbus/msc: add CONFIG_USBUS_MSC_AUTO_MTD option to create LUNs on init 2023-03-09 16:57:17 +01:00
Benjamin Valentin
cc30b819eb gcoap: include CoAP resrouces from NANOCOAP_RESOURCE() XFA 2023-03-09 14:09:15 +01:00
bors[bot]
1a5cc2acbb
Merge #19365 #19366 #19367
19365: bootloaders: fix bootloader button logic r=benpicco a=dylad

### Contribution description

In lastest master, the `BTN_BOOTLOADER_INVERTED` logic doesn't work as expected.
This PR fixes the underlying logic by replacing the `BTN_BOOTLOADER_INVERTED` macro definition by a runtime function.
In fact the current code:
```
#ifndef BTN_BOOTLOADER_INVERTED
#if (BTN0_MODE == GPIO_IN_PD)
#define BTN_BOOTLOADER_INVERTED false
#else
#define BTN_BOOTLOADER_INVERTED true
#endif
#endif
```
cannot work because both `BTN0_MODE` and `GPIO_IN_PD` are not known by the precompiler as they are enum values defined at cpu level.
Thus, replaces it by a runtime function in our bootloader applications.
I've also add `GPIO_OD_PU` along side `GPIO_IN_PU` and add a new define (which can be override at board level or app level) in case an external pullup is used.

### Testing procedure
Flash the riotboot_dfu bootloader:
`make BOARD=saml21-xpro -C bootloaders/riotboot_dfu flash`
Then, flash any test app:
`PROGRAMMER=dfu-util USEMODULE=usbus_dfu make BOARD=saml21-xpro -C tests/shell riotboot/flash-slot0`

With master, the application will not start.
With this PR, the application will start after flashing.

### Issues/PRs references
Fixes #19364 


19366: nanocoap_sock: don't include token in empty ACK response r=benpicco a=benpicco



19367: cord: bump reference from draft to rfc r=benpicco a=bergzand

### Contribution description

The draft is an RFC, this bumps the "see also" in the docs to the rfc.

### Testing procedure

Check that the correct RFC is linked in the docs.

### Issues/PRs references

None


Co-authored-by: Dylan Laduranty <dylan.laduranty@mesotic.com>
Co-authored-by: Benjamin Valentin <benjamin.valentin@ml-pa.com>
Co-authored-by: Koen Zandberg <koen@bergzand.net>
2023-03-08 12:23:24 +00:00
Dylan Laduranty
48b07eb991 bootloaders: fix bootloader button logic
Signed-off-by: Dylan Laduranty <dylan.laduranty@mesotic.com>
2023-03-08 13:07:42 +01:00
b3439fc800
cord: bump reference from draft to rfc 2023-03-08 11:50:55 +01:00
Benjamin Valentin
d6e05dae7f nanocoap_sock: don't include token in empty ACK response 2023-03-08 11:38:09 +01:00
bors[bot]
fae992e82b
Merge #19343 #19349 #19353 #19361 #19363
19343: ztimer: add ztimer_stopwatch convenience functions r=benpicco a=benpicco



19349: cpu/native: Switch to ztimer for gettimeofday r=benpicco a=MrKevinWeiss

### Contribution description

A xtimer is somewhat taken over by ztimer this explicitly uses ztimer instead of relying on the compatibility layer.

### Testing procedure

`make all test -C tests/cpp11_mutex/`

and green murdock I guess.

### Issues/PRs references


19353: doc: add quicklink to boards in navbar r=benpicco a=OlegHahm

### Contribution description

Finding a list of supported boards and how to use them is an essential information. Currently this list is somewhat hidden under "Modules" which is not very intuitive. Hence, I propose to (at least) put a link in the side menu to this overview page.

### Testing procedure

1. Call `make doc`
2. Check the sidebar `${RIOT_BASE}/doc/doxygen/html/index.html` for an entry "Supported Boards"

19361: nanocoap_sock: ensure response address is the same as request address r=benpicco a=benpicco



19363: Fix stm32 timer periodic r=benpicco a=Enoch247

### Contribution description

From the commit msg:

>     cpu/stm32/periph/timer: remove unneeded header
>     
>     I see no reason this header should be included. It does not exist in
>     RIOT's source tree. This patch removes the include.

and 

>     cpu/stm32/periph/timer: fix execution flow
>     
>     The implmentation of `timer_set_absolute()` has The following problems.
>     First, it attempts to restore the auto reload register (ARR) to it's
>     default if the ARR was previosly set by `timer_set_periodic()` by
>     comparing it to the channel's capture compare (CC) register _after_ it
>     has already set the CC register. Secondly, it clears spurious IRQs
>     _after_ the CC register has been set. If the value being set is equal to
>     the timer's current count (or the two become equal before the supurios
>     IRQ clearing happens), this could cause a legitimate IRQ to be cleared.
>     
>     The implmentation of `timer_set()` has the same error in handling the
>     ARR as described above.
>     
>     This patch reorders the operations of both functions to do:
>     
>     1. handle ARR
>     2. clear spurious IRQs
>     3. set channel's CC
>     4. enable IRQ
>     
>     Additionally, the calulation of `value` in `timer_set()` is moved
>     earlier in the function's exec path as a pedantic measure.


### Testing procedure

I tested by doing the following:

1. `make -C tests/periph_timer BOARD=nucleo-f767zi all flash term`
2. press s
3. press [ENTER]
4. observe test passes
5. `make -C tests/periph_timer_periodic BOARD=nucleo-f767zi all flash term`
6. press s
7. press [ENTER]
8. observe test passes
9. `make -C tests/periph_timer_short_relative_set BOARD=nucleo-f767zi all flash term`
10. press s
11. press [ENTER]
12. observe test passes


### Issues/PRs references

- none known


Co-authored-by: Benjamin Valentin <benpicco@beuth-hochschule.de>
Co-authored-by: MrKevinWeiss <weiss.kevin604@gmail.com>
Co-authored-by: Oleg Hahm <oleg@hobbykeller.org>
Co-authored-by: Benjamin Valentin <benjamin.valentin@bht-berlin.de>
Co-authored-by: Joshua DeWeese <jdeweese@primecontrols.com>
2023-03-08 02:09:42 +00:00
bors[bot]
6c1de71606
Merge #19358
19358: sys/usbus/cdc/ecm: fix High-Speed mode r=dylad a=gschorcht

### Contribution description

This PR provides some changes to fix the USBUS CDC ECM interface in High-Speed mode.

In High-Speed mode, the EP data size has to be at least 512 bytes instead of 64 Byte in Full-Speed mode. To be able to define configurations like EP data sizes depending on whether Full-Speed or High-Speed USB device peripherals are used, the feature `periph_usbdev_hs`/`HAD_PERIPH_USBDEV_HS` is introduced.

### Testing procedure

Use `tests/usbus_cdc_ecm`  and any board with USB HS connector, for example:
```
USEMODULE=periph_usbdev_hs_utmi BOARD=stm32f723e-disco make -j8 -C tests/usbus_cdc_ecm flash
```
`ping` command works with this PR but doesn't work without this PR.

### Issues/PRs references

Co-authored-by: Gunar Schorcht <gunar@schorcht.net>
2023-03-07 20:17:01 +00:00
Benjamin Valentin
ad8dd8d061 nanocoap_sock: ensure response address is the same as request address 2023-03-07 16:58:17 +01:00
Benjamin Valentin
a7866f78a1 gcoap: make use of sock_udp_ep_is_multicast() 2023-03-07 16:58:17 +01:00
Benjamin Valentin
15fd7a9a1c net/sock/udp: add sock_udp_ep_is_multicast() 2023-03-07 16:58:17 +01:00
MrKevinWeiss
66570cb0fb
cpu/native: Use ztimer instead of xtimer 2023-03-07 13:08:58 +01:00
Gunar Schorcht
4f49fc817c usbus/cdc/ecm: increase EP data size in HS mode
CDC ECM driver/netdev is only working in High-Speed mode if the EP data size is at least 512 byte.
2023-03-07 11:29:39 +01:00
Benjamin Valentin
b6d2209e9a sys/auto_init: add support for USB MSC 2023-03-07 00:08:17 +01:00
Benjamin Valentin
d91c0e8bd4 sys/benchmark: make use of ztimer stopwatch 2023-03-06 14:31:09 +01:00
Benjamin Valentin
fef20d4f04 ztimer: add ztimer_stopwatch convenience functions 2023-03-06 14:25:09 +01:00
Keith Packard
698abbaa04 sys/picolibc_syscalls_default: Fix read/write return for picolibc >= 1.8
Picolibc switched to standard posix types for read/write return in
version 1.8.

Signed-off-by: Keith Packard <keithp@keithp.com>
2023-03-03 12:04:48 -08:00
bors[bot]
743ae3f095
Merge #19242
19242: usbus/msc: add initial Mass Storage Class support r=benpicco a=dylad

### Contribution description

This PR adds the initial support for Mass Storage Class in USBUS. This PR relies on the RIOT MTD implementation to implement the Mass Storage Class support. With the provided test application, a MTD device will be accessible as a normal storage device on your host computer.
Read and Write operations are allowed.
Multiple LUNs are supported so several MTD devices can be exported through USB.
The MSC relies on SCSI protocol to operate.

Currently there are some limitations:
    Supported host : Linux & Windows (macOS is untested)
    MSC cannot be used if MTD page size > 4096
    MTD device must have at least 512 bytes of memory to be exported.

Please be aware that performance are not so great.

### Testing procedure
Flash `tests/usbus_msc` application on a board with at least one MTD device.
Once the shell has started, prepare one or several MTD devices to be exported using `add_lun` command.
Once ready, start the USB connection with `usb_attach`

All MTD exported should appear as` /dev/sdX` on Linux.

### Issues/PRs references
Supersede #15941 


Co-authored-by: Dylan Laduranty <dylan.laduranty@mesotic.com>
2023-03-02 22:19:41 +00:00
Dylan Laduranty
a7e16536ab Kconfig: add Kconfig for USB MSC
Signed-off-by: Dylan Laduranty <dylan.laduranty@mesotic.com>
2023-03-02 22:04:08 +01:00
bors[bot]
b0626401d8
Merge #19331
19331: pkg/tinydtls: Adjust defaults r=miri64 a=chrysn

### Contribution description

This adjusts two defaults in tinydtls:

* Default verbosity is set to warning. At the info level, this module produces way more output (several lines per new connection, and even per message) than is common in RIOT.
* If gcoap is used, the buffer size is adjusted to the gcoap buffer size plus overhead. Otherwise, CoAP-over-DTLS works fine until one happens to request larger resources.

### Testing procedure

* Run examples/gcoap_dtls
* Send a CoAP request from outside, eg. with `aiocoap-client 'coaps://[fe80::3c63:beff:fe85:ca96%tapbr0]/.well-known/core' --credentials testserver.json` (where testserver.json is `{"coaps://[fe80::3c63:beff:fe85:ca96%tapbr0]/*": {"dtls": {"psk": {"ascii": "secretPSK"}, "client-identity": {"ascii": "Client_identity"}}}}`).

Before, there are messages shown for every request; now there are none.

Modify `examples/gcoap/server.c` as follows:

```patch
diff --git a/examples/gcoap/server.c b/examples/gcoap/server.c
index bf2315cd01..28e1faac27 100644
--- a/examples/gcoap/server.c
+++ b/examples/gcoap/server.c
`@@` -68,7 +68,7 `@@` static const coap_resource_t _resources[] = {
 };
 
 static const char *_link_params[] = {
-    ";ct=0;rt=\"count\";obs",
+    ";ct=0;rt=\"count\";obs;looooooooooooooooooooooong-attribute=\"loooooooooooooooooooooooooooooong\"",
     NULL
 };
```

The request passes; without this patch, it is stuck in retransmissions until "Network error: Retransmissions exceeded".

### Issues/PRs references

This contributes to making #19289 usable with a minimum level of security. (That module fills up the gcoap buffer to the brim). While the module handles the verbosity as well as it can (occasionally admitting that it lost bytes of output), the previous verbosity produces an infinite stream of stdout data. (But the default should be quiet immaterial of that particular PR).

Co-authored-by: chrysn <chrysn@fsfe.org>
2023-03-02 15:40:31 +00:00
chrysn
f2d5928ee5 dtls, tinydtls: Raise default number of connections 2023-03-02 09:16:22 +01:00
Benjamin Valentin
9faa323c83 gnrc_netif: set lower bound for IEEE802154_STACKSIZE_DEFAULT
Since it was ported to the radio HAL, at86rf2xx requires more stack:

2023-03-02 01:00:52,637 # 	pid | name                 | state    Q | pri | stack  ( used) ( free) | base addr  | current
2023-03-02 01:00:52,646 # 	  1 | idle                 | pending  Q |  15 |    192 (  130) (   62) |     0x263a |     0x269f
2023-03-02 01:00:52,655 # 	  2 | main                 | running  Q |   7 |   2560 ( 1732) (  828) |     0x26fa |     0x2cb1
2023-03-02 01:00:52,663 # 	  3 | 6lo                  | bl rx    _ |   3 |    512 (  276) (  236) |     0x5446 |     0x559b
2023-03-02 01:00:52,672 # 	  4 | ipv6                 | bl rx    _ |   4 |    512 (  372) (  140) |     0x318e |     0x32c4
2023-03-02 01:00:52,681 # 	  5 | udp                  | bl rx    _ |   5 |    256 (  214) (   42) |     0x5648 |     0x569d
2023-03-02 01:00:52,689 # 	  6 | at86rf2xx            | bl anyfl _ |   2 |    520 (  514) (    6) |     0x3582 |     0x371f
2023-03-02 01:00:52,697 # 	    | SUM                  |            |     |   4552 ( 3238) ( 1314)
2023-03-02 01:01:30 +01:00
Dylan Laduranty
d49ed218ab usbus/msc: add initial support for Mass Storage Class
Signed-off-by: Dylan Laduranty <dylan.laduranty@mesotic.com>
2023-03-01 21:50:13 +01:00
Martine Lenders
13f613429d gnrc_sixlowpan_frag_sfr_congure: add congure_abe support 2023-03-01 20:23:32 +01:00
Martine Lenders
33402296d3
gnrc_sixlowpan_frag_sfr_congure: add congure_reno support 2023-03-01 16:32:31 +01:00
Martine Lenders
d0986caf03
gnrc_sixlowpan_frag_sfr_congure: add congure_quic support 2023-03-01 13:08:17 +01:00
bors[bot]
04ef37274f
Merge #16158
16158: gnrc_sixlowpan_frag_sfr_congure_sfr: initial import r=miri64 a=miri64



Co-authored-by: Martine Lenders <m.lenders@fu-berlin.de>
2023-03-01 08:32:45 +00:00
Benjamin Valentin
44c267c84a nanocoap: allow to define CoAP resources as XFA 2023-02-28 20:13:18 +01:00
bors[bot]
4ccf0af0b1
Merge #19320
19320: sys/vfs: add force option to vfs_umount() r=miri64 a=benpicco



Co-authored-by: Benjamin Valentin <benjamin.valentin@ml-pa.com>
Co-authored-by: Martine Lenders <m.lenders@fu-berlin.de>
2023-02-28 16:55:56 +00:00
Benjamin Valentin
3b587d9268 sys/vfs: add force option to vfs_umount() 2023-02-28 17:24:03 +01:00
5f43e07c06
usbus: Use new usbdev ep0 stall function 2023-02-28 11:00:06 +01:00
Benjamin Valentin
b05292f5e4 sys/tiny_strerror: make use of flash_utils.h 2023-02-27 23:25:13 +01:00
bors[bot]
6b501f74c6
Merge #19321 #19325 #19327 #19328
19321: examples/gnrc_border_router: add BLE as downlink option r=benpicco a=benpicco



19325: esptools/install.sh: Fix shellcheck issues r=benpicco a=bergzand

### Contribution description

Quote all the things!


### Testing procedure

The script should still work as before


### Issues/PRs references

None

19327: shell/cmds: GNRC: replace puts() with printf() r=benpicco a=benpicco



19328: pkg/u8g2: bump version r=benpicco a=benpicco



Co-authored-by: Benjamin Valentin <benjamin.valentin@ml-pa.com>
Co-authored-by: Koen Zandberg <koen@bergzand.net>
Co-authored-by: Benjamin Valentin <benpicco@beuth-hochschule.de>
2023-02-27 16:30:53 +00:00
Benjamin Valentin
69989d3c5f sixlowpan: replace puts() with printf() 2023-02-27 15:43:00 +01:00
Benjamin Valentin
1be2cbd6ef shell/cmds: GNRC: replace puts() with printf() 2023-02-27 15:43:00 +01:00
Benjamin Valentin
31534fcb84 sys/doc.txt: add sys_compression doxygen group 2023-02-27 15:09:08 +01:00
bors[bot]
f0b60d5a0d
Merge #17091 #18148
17091: USBUS: Add URB support r=benpicco a=bergzand

### Contribution description

This commit adds support for URBs (USB Request/Response Blocks). These
allow for submitting multi-transfer sized buffers with USBUS handling
the individual usbdev xmits. Multiple URBs can be queued at once for a
single endpoint and USBUS will handle them in the order of submission.

OUT endpoint URBs must always consist of a whole number of full-sized
transfers (N x MaxEndpointSize). They will automatically finish after
the endpoint received a transfer less than the endpoint size.

IN endpoints can be arbitrary-sized and do not have to consist of a
whole number of full-sized transmissions. They support a flag to
indicate that the last transfer in the sequence must be less than a full
sized transfer (USBUS_URB_FLAG_AUTO_ZLP) and this adds a zero length
transfer at the end of the transmissions if the last transfer was equal
to the maximum transfer size.

URBs can be cancelled, but if the URB is already being processed it will
be cancelled after the current transmission within the URB is finished.
If it is still in the queue it will immediately be removed from the
queue.

### Testing procedure

- `tests/usbus_cdc_ecm` should still work. Testing one of the usbdev-supported platform should be sufficient here.

### Issues/PRs references

Needs #17064 


18148: sys/flash_utils: helpers to store data in flash r=benpicco a=maribu

### Contribution description

This helpers that allow storing, accessing, and working with data in flash that works for both classical Harvard architectures (which do not map flash also into the address space) as well as modern Harvard architectures and von-Neumann architectures.

With this, `examples/default` again runs on the Arduino Uno / Nano. Since this board is still the "entry kit" for many people to embedded hardware, it would be nice to support it with our default example.

### Testing procedure

`examples/default` should run and work on ATmega boards (especially ATmega328P and ATmega32U4 based boards) as well on all other boards now.

### Issues/PRs references

None

Co-authored-by: Koen Zandberg <koen@bergzand.net>
Co-authored-by: Marian Buschsieweke <marian.buschsieweke@ovgu.de>
2023-02-27 11:57:20 +00:00
Marian Buschsieweke
cdcec5b3f9
drivers/saul: use flash_utils 2023-02-27 12:31:04 +01:00
Marian Buschsieweke
29cfeb752e
sys/phydat: use flash_utils 2023-02-27 12:31:03 +01:00
Marian Buschsieweke
2825f5f2ae
sys/shell: use flash_utils 2023-02-27 12:31:03 +01:00
Marian Buschsieweke
c406f7ef42
cpu/avr8_common: Wrap stdio.h
This allows automatically moving format strings to flash, provided that
code previously compiled fine with `-Wformat-nonliteral` (which in RIOT
is the case due to `-Wformat=2`).
2023-02-27 12:31:03 +01:00
Marian Buschsieweke
4e3c0777fc
sys/flash_utils: add helpers for placing variables in flash
This adds a layer of convenience abstraction over classical Harvard
architectures (like most AVRs) that do not map the flash memory into
the data address space and modern Harvard architectures or von-Neumann
architectures that do so. The motivation is to safe a lot of RAM for
AVR by storing constant strings into flash.
2023-02-27 12:31:03 +01:00
ba88608749
usbus/cdc_ecm: Make use of URBs for inbound frames 2023-02-27 10:09:55 +01:00
7bfdd73818
usbus: Add URB support
This commit adds support for URBs (USB Request/Response Blocks). These
allow for submitting multi-transfer sized buffers with USBUS handling
the individual usbdev xmits. Multiple URBs can be queued at once for a
single endpoint and USBUS will handle them in the order of submission.

OUT endpoint URBs must always consist of a whole number of full-sized
transfers (N x MaxEndpointSize). They will automatically finish after
the endpoint received a transfer less than the endpoint size.

IN endpoints can be arbitrary-sized and do not have to consist of a
whole number of full-sized transmissions. They support a flag to
indicate that the last transfer in the sequence must be less than a full
sized transfer (USBUS_URB_FLAG_AUTO_ZLP) and this adds a zero length
transfer at the end of the transmissions if the last transfer was equal
to the maximum transfer size.

URBs can be cancelled, but if the URB is already being processed it will
be cancelled after the current transmission within the URB is finished.
If it is still in the queue it will immediately be removed from the
queue.
2023-02-27 10:09:53 +01:00
bors[bot]
d4422a074a
Merge #18682
18682: pkg/lwext4: add lightweight implementation of the ext2/3/4 filesystem r=benpicco a=benpicco



Co-authored-by: Benjamin Valentin <benjamin.valentin@ml-pa.com>
2023-02-25 18:59:07 +00:00
Benjamin Valentin
e798d21b3b pkg/lwext4: add lwEXT4 2023-02-25 14:01:20 +01:00
bors[bot]
9d1d4bb1b2
Merge #19119 #19313
19119: makefiles/tools/serial.inc.mk: Allow detection of debug adapter r=benpicco a=maribu

### Contribution description

This PR adds the ability to automatically detect the debug adapter for boards with an integrated programmer/debugger, if that debugger also provides the TTY.

This extends the TTY detection that can be enabled with `MOST_RECENT_PORT=1` to set `DEBUG_ADAPTER_ID` to the TTY's serial, but only if `DEBUG_ADAPTER_ID_IS_TTY_SERIAL` is set to `1` by the board (as not all boards have an integrated programmer/debugger).

### Testing procedure

Connect a HiFive-1B and a nRF52840DK at the same time and try `make BOARD=<nrf52840dk|hifive1b> MOST_RECENT_PORT=1 -C examples/default flash term` for both. The programmer will not reliably select the correct programmer in `master`. With this PR, it will.

### Issues/PRs references

None

19313: gnrc_static: don't parse address as prefix r=benpicco a=benpicco



Co-authored-by: Marian Buschsieweke <marian.buschsieweke@ovgu.de>
Co-authored-by: Benjamin Valentin <benpicco@beuth-hochschule.de>
2023-02-24 17:46:10 +00:00
Benjamin Valentin
4e642451c8 gnrc_static: don't parse address as prefix 2023-02-24 16:03:16 +01:00
bors[bot]
4809b687b6
Merge #19292 #19307
19292: sys/phydat: Fix unit confusion r=miri64 a=maribu

### Contribution description

Previously, `UNIT_G` was used for g-force with the correct symbol `g`, `UNIT_GR` for gram (as in kilogram) with the incorrect symbol `G` (which would be correct for Gauss), and `UNIT_GS` for Gauss with symbol `Gs` (which is an alternative correct symbol).

To avoid confusion between G-Force, Gauss, and Gram the units have been renamed to `UNIT_G_FORCE`, `UNIT_GRAM`, and `UNIT_GAUSS`. In addition, gram now uses the correct symbol `g`; which sadly is the same as for g-force. But usually there is enough context to tell them apart.

### Testing procedure

Green CI

### Issues/PRs references

None

19307: nanocoap_link_format: fix off-by-one error r=miri64 a=benpicco



Co-authored-by: Marian Buschsieweke <marian.buschsieweke@ovgu.de>
Co-authored-by: Benjamin Valentin <benpicco@beuth-hochschule.de>
2023-02-23 21:25:12 +00:00
bors[bot]
72a0f1972d
Merge #18746 #19161
18746: sys/clif: Fixing out of bounds read under certain conditions r=maribu a=Teufelchen1

Hi 😈

This fixes a potential out of bounds read in clif_encode_link. There is no code in RIOT that can be exploited.
The fix does not break the current API but alters the behaviour slightly. Before the change, the length attributes of `clif_attr_t` where optional. If missing, the length was deduced using `strlen()`. This fix makes those parameters required and if they are `0` it operates as if the length really is `0`. This might not be ideal but it is the only non api breaking fix I could think off. 
```c
typedef struct {
    char *value;                  
    unsigned value_len;    NO LONGER OPTIONAL
    const char *key;               
    unsigned key_len;       NO LONGER OPTIONAL
} clif_attr_t;
```
Depends on #18744

cc `@leandrolanzieri` 

19161: bors.yaml: re-activate labels check + add block_labels r=miri64 a=miri64



Co-authored-by: Teufelchen1 <bennet.blischke@haw-hamburg.de>
Co-authored-by: Martine Lenders <m.lenders@fu-berlin.de>
2023-02-23 16:39:44 +00:00
Marian Buschsieweke
3c287c058d
sys/phydat: Fix unit confusion
Previously, `UNIT_G` was used for g-force with the correct symbol `g`,
`UNIT_GR` for gram (as in kilogram) with the incorrect symbol `G` (which
would be correct for Gauss), and `UNIT_GS` for Gauss with symbol `Gs`
(which is an uncommon but correct symbol).

To avoid confusion between G-Force, Gauss, and Gram the units have been
renamed to `UNIT_G_FORCE`, `UNIT_GRAM`, and `UNIT_GAUSS`. In addition,
gram now uses the correct symbol `g` and Gauss uses `G`.
2023-02-23 16:44:24 +01:00
Benjamin Valentin
7468c6272b nanocoap_link_format: fix off-by-one error 2023-02-23 16:34:56 +01:00
Teufelchen1
8c295ab7cf sys/clif: Fixing out of bounds read under certain conditions 2023-02-23 15:45:03 +01:00
Benjamin Valentin
c09ad471a1 nanocoap: whitespace fixes 2023-02-22 18:03:04 +01:00
bors[bot]
0cce1bc067
Merge #19299 #19301
19299: Add missing newline to output of telnet example r=benpicco a=Enoch247

### Contribution description

From the commit msg:

> The telnet example prints a line to the console, but it is not ended with a newline. When using pyterm, the last line is then never shown as it reads the console line by line and is waiting for the end of the line.
> 
> This patch swaps use of `printf` for `puts` for the last line printed. This means the missing newline character gets added. This is also done to be consistent with the rest of the file, where puts is used whenever possible instead of printf.


### Testing procedure

1. `cd examples/telnet`
2. `make all flash term`
3. observe the final line "Local shell disabled" is printed, but would not have without this patch


### Issues/PRs references

- none known


19301: fib: document unused state r=benpicco a=benpicco



Co-authored-by: Joshua DeWeese <jdeweese@primecontrols.com>
Co-authored-by: Benjamin Valentin <benjamin.valentin@bht-berlin.de>
2023-02-22 15:50:59 +00:00
Benjamin Valentin
378e5e2382 fib: document unused state 2023-02-22 16:47:14 +01:00
bors[bot]
cf540a2648
Merge #19294 #19295
19294: sys/shell: don't include suit command by default r=benpicco a=benpicco



19295: gcoap: Finish the gcoap_get_resource_list_tl -> gcoap_get_resource_list renaming r=benpicco a=chrysn

### Contribution description

In #16688, an argument was added to the `gcoap_get_resource_list` function by creating a new function `gcoap_get_resource_list_tl` with a deprecation and roll-over plan.

This plan has not been acted on so far.

This PR shortens the original plan by just adding the argument to `gcoap_get_resource_list` and removing `gcoap_get_resource_list_tl` in a single go. The rationale for this deviation is that while it's a public API, its only two practical consumers are the (built-in) well-known/core implementation, and the (built-in) CoRE Resource Directory (cord) endpoint. Moreover, a further change to this API (switching over to `coap_block_slicer_t`) is expected to happen within this release cycle, which would take something like 4 total releases to get through otherwise, which is unrealistic for an API that there are no known external users of.

A second commit clean up ToDo items (in the changed function's documentation) that referred to a IETF draft that has long been abandoned by the CoRE WG.

### Testing procedure

Plain inspection and CI passing should suffice.

### AOB

There is a second analogous pair left over from #16688, `gcoap_req_send` / `gcoap_req_send_tl`. As that *is* expected to be used widely, I prefer not to mix these two concerns, and get the present one through without unnecessary hold-up.

Co-authored-by: Benjamin Valentin <benjamin.valentin@bht-berlin.de>
Co-authored-by: chrysn <chrysn@fsfe.org>
2023-02-21 23:15:06 +00:00
chrysn
86e6898fa5 doc/gcoap: Update ToDo item referencing abandoned document 2023-02-21 20:22:46 +01:00
chrysn
5db24d4f51 gcoap: Rename gcoap_get_resource_list_tl to gcoap_get_resource_list
This is an API change in the latter, which would typically now take an
extra argument GCOAP_SOCKET_TYPE_UNDEF.

Follow-Up-For: https://github.com/RIOT-OS/RIOT/pull/16688
2023-02-21 20:22:46 +01:00
Benjamin Valentin
e2cb3d13ea sys/shell: don't include suit command by default 2023-02-21 17:34:00 +01:00
bors[bot]
be29a00d74
Merge #19278 #19290
19278: gnrc_dhcpv6_client_simple_pd: select upstream based on type/index r=benpicco a=benpicco



19290: sys/crypto: make AES_KEY struct private & rename it r=benpicco a=benpicco



Co-authored-by: Benjamin Valentin <benjamin.valentin@ml-pa.com>
Co-authored-by: Benjamin Valentin <benjamin.valentin@bht-berlin.de>
2023-02-20 19:09:03 +00:00
Benjamin Valentin
2285961810 sys/crypto: make AES_KEY struct private 2023-02-20 18:22:00 +01:00
bors[bot]
523a39acd3
Merge #19288
19288: rust: Update riot-sys and riot-wrappers r=kaspar030 a=chrysn

### Contribution description

rust: Update riot-sys and riot-wrappers

* riot-wrappers:
  * Fix infinite loop when using a Mutex
  * Make ValueInThread Copy/Clone
* riot-sys:
  * Export xxx_DEV (eg. I2C_DEV) C macros as functions
  * Add auto_init_utils.h

### Testing procedure

CI checks should suffice.

### Issues/PRs references

This pulls in fixes from

* https://github.com/RIOT-OS/rust-riot-sys/pull/18
* https://github.com/RIOT-OS/rust-riot-sys/pull/17 / https://github.com/RIOT-OS/rust-riot-wrappers/issues/37
* https://github.com/RIOT-OS/rust-riot-wrappers/pull/42 / https://github.com/RIOT-OS/rust-riot-wrappers/issues/41


Co-authored-by: chrysn <chrysn@fsfe.org>
2023-02-20 08:34:11 +00:00
chrysn
bcea914338 rust: Update riot-sys and riot-wrappers
* riot-wrappers:
  * Fix infinite loop when using a Mutex
  * Make ValueInThread Copy/Clone
* riot-sys:
  * Export xxx_DEV (eg. I2C_DEV) C macros as functions
  * Add auto_init_utils.h
2023-02-20 09:06:33 +01:00
bors[bot]
96a7d0d466
Merge #19142
19142: sock_dtls: move common code into sock_dtls_establish_session() r=benpicco a=benpicco



Co-authored-by: Benjamin Valentin <benpicco@beuth-hochschule.de>
2023-02-19 22:11:05 +00:00
Benjamin Valentin
df4ef80790 sock_dodtls: make use of sock_dtls_establish_session() 2023-02-19 15:10:46 +01:00
Benjamin Valentin
28289a13cb gnrc_dhcpv6_client_simple_pd: check result of _find_upstream_netif() 2023-02-18 23:59:42 +01:00
bors[bot]
8c2a4b43b3
Merge #19027
19027: sys/fmt: optimize scn_u32_dec scn_u32_hex r=benpicco a=kfessel

### Contribution description

Improves the compilation result for `scn_u32_dec` `scn_u32_hex` especially on `cortex-m` reducing either stack usage and or code size.

This makes use of unsigned int overflow (slightly less better without doing that `hexn`).

See godbolt (original versions got an `o` attached, modified versions got `k`s) all functions are  marked `_S_` defined to `static`

by assigning the global at end the compiled function can be changed (`deco deck  hexo hexk hexkk hexn`)

this PR is `hexkk` and `deck` 

### Testing procedure

run unit-test/test-fmt

```
<RIOT>/tests/unittests$ make tests-fmt
<RIOT>/tests/unittests$ make term
```

### Issues/PRs references

[godbolt](https://godbolt.org/z/MzT1zh4q1)

Co-authored-by: Karl Fessel <karl.fessel@ovgu.de>
2023-02-17 20:09:53 +00:00
Karl Fessel
18a783d21c sys/fmt: optimize scn_u32_dec scn_u32_hex 2023-02-17 16:20:19 +01:00
Benjamin Valentin
3173150ef7 gnrc_dhcpv6_client_simple_pd: select upstream based on type/index 2023-02-14 17:45:19 +01:00
bors[bot]
f78c3751b9
Merge #19272
19272: gcoap: Do not send responses from multicast addresses r=benpicco a=chrysn

### Contribution description

Since https://github.com/RIOT-OS/RIOT/pull/18026, CoAP requests to multicast addresses (eg. `ff02::1`) came back from that exact address, which Linux rightfully just drops.

The fix uses the existing multicast check from https://github.com/RIOT-OS/RIOT/pull/17978 (thanks `@benpicco` for making me write this as dedicated function, I just had to generalize it removing one struct layer), and foregoes setting the source address when responding to multicasts.

### Testing procedure

* Run the gcoap example
* Send a CoAP request to a multicast address RIOT listens to, eg. `./aiocoap-client coap://'[ff02::1%tapbr0]'/.well-known/core --non`

Before, this got no response (while you see it arrive on wireshark). After, you get a correct response with two lines of note:

```
WARNING:coap:Sending request to multicast via unicast request method
Response arrived from different address; base URI is coap://[fe80::3c63:beff:fe85:ca96%tapbr0]/.well-known/core
```

(The former is aiocoap telling us that we're not using the nonexistent multicast API so it's really more of an anycast, the latter is useful factual information).

Co-authored-by: chrysn <chrysn@fsfe.org>
2023-02-14 00:28:46 +00:00
bors[bot]
1c55118bd8
Merge #18257
18257: drivers/wdt: add periph_wdt_auto_start for early watchdog r=benpicco a=benpicco



Co-authored-by: Benjamin Valentin <benjamin.valentin@ml-pa.com>
2023-02-13 21:09:07 +00:00
chrysn
ac3a9cdf83 gcoap: Do not send responses from multicast addresses 2023-02-13 21:46:12 +01:00
chrysn
54037f5c2d gcoap: Alter indirection level of _memo_ep_is_multicast 2023-02-13 20:32:29 +01:00
Benjamin Valentin
80fe4e5f26 sys/auto_init: add auto_init_wdt_{event, thread} modules 2023-02-13 15:06:24 +01:00
bors[bot]
ea300c3d15
Merge #18758
18758: sys/event: add event sources r=kaspar030 a=benpicco



Co-authored-by: Benjamin Valentin <benjamin.valentin@ml-pa.com>
2023-02-10 16:03:41 +00:00
Benjamin Valentin
5134b5c7d5 nanocoap_sock: make use of sock_dtls_establish_session() 2023-02-08 15:57:28 +01:00
Benjamin Valentin
46764727ab sys/net/sock_util: add sock_dtls_establish_session() 2023-02-08 15:57:22 +01:00
c77b104c2d sys/test_utils/print_stack_usage: reduce MIN_SIZE for fmt 2023-02-07 22:42:43 +01:00
f31d5a93b5 sys/fmt: print(): use fflush(); stdio_write() vs. fwrite() 2023-02-07 22:42:43 +01:00
bors[bot]
f341ad6c9c
Merge #17045 #19243
17045: sys/coding: add XOR based coding module r=benpicco a=benpicco



19243: cpu/gd32v: add periph_gpio_ll and periph_gpio_ll_irq support r=benpicco a=gschorcht

### Contribution description

This PR provides the `periph_gpio_ll` and `periph_gpio_ll_irq` support for GD32VF103. Level triggered interrupts are emulated.

`periph_gpio_ll_irq` could be split off from this PR as a separate PR if necessary.

### Testing procedure

Use any GD32V board and connect PA0 -> PB0 and PA1 -> PB1 where PA is the output port and PB the input port. With these connections `tests/periph_gpio_ll` should work.
```
BOARD=sipeed-longan-nano make -j8 -C tests/periph_gpio_ll flash term
```

If necessary, change the input and output pins by setting the environment variables and connect the corresponding pins, for example for `seeedstudio-gd32` PA1 -> PB8 and PA8 -> PB9:
```
PIN_OUT_0=1 PIN_OUT_1=8  PIN_IN_0=8 PIN_IN_1=9 BOARD=seedstudio-gd32 make -j8 -C tests/periph_gpio_ll flash term
```

### Issues/PRs references


Co-authored-by: Benjamin Valentin <benjamin.valentin@ml-pa.com>
Co-authored-by: Gunar Schorcht <gunar@schorcht.net>
2023-02-07 17:39:20 +00:00
bors[bot]
fcc07a5248
Merge #19088
19088: boards: add esp32s3-pros3 support r=benpicco a=gschorcht

### Contribution description

This PR provides the support for [ESP32 ProS3](https://esp32s3.com/pros3.html#home) board from Unexpected Maker.

This board doesn't have a USB-to-Serial chip on board. Therefore, USB Serial/JTAG is used for STDIO and the board is flashed via the USB Seral/JTAG interface by default.

### Testing procedure

Flashing `tests/shell` should work.

### Issues/PRs references

Co-authored-by: Gunar Schorcht <gunar@schorcht.net>
2023-02-06 15:30:15 +00:00
Benjamin Valentin
d18a304267 sys/coding: add XOR based coding module
This implements the XOR based error-correction code described by
Jürgen Fitschen (@jue89) at the RIOT Summit.

A parity byte is generated for each 3 payload bytes, then the payload array
is transposed by interpreting it as a 2D matrix with height of 3.

This is to reduce the chance of consecutive bytes ending up in the same
packet.

This allows to recover one in 3 lost data packets (if parity packets are received).

[0] https://summit.riot-os.org/2021/wp-content/uploads/sites/16/2021/09/s02-01.pdf
2023-02-06 16:21:57 +01:00
Gunar Schorcht
e3b1c81603 sys/usb_board_reset: allow to enable it also for stdio_usb_serial_jtag
Even if only `stdio_usb_serial_jtag` is enabled as STDIO, `usb_board_reset` is enabled since there should be a CDC ACM interface in any case. This is necessary, for example, to reset the board into bootloader if `stdio_cdc_acm` or `stdio_tinyusb_cdc_acm` was previously used.
2023-02-06 16:19:11 +01:00
bors[bot]
ebc869a83f
Merge #19216
19216: drivers/mtd_sdcard: add mtd_sdcard_default module r=benpicco a=benpicco



Co-authored-by: Benjamin Valentin <benpicco@beuth-hochschule.de>
Co-authored-by: Benjamin Valentin <benjamin.valentin@ml-pa.com>
2023-02-05 20:30:12 +00:00
bb878f64da
sys/stdio_rtt: move documentation in doc.txt 2023-02-05 15:49:20 +01:00
Benjamin Valentin
4e3151406c sys/vfs_default: make include save with !vfs module
This allows to remove #ifdefs on the board level.
2023-02-04 15:35:05 +01:00
bors[bot]
0fb6a09598
Merge #18903
18903: pkg/tinyusb: add tinyUSB netdev driver r=dylad a=gschorcht

### Contribution description

This PR adds the tinyUSB netdev driver.

The tinyUSB netdev driver is part of the tinyUSB package and is enabled by module `tinyusb_netdev`. It is available for boards that provide the `tinyusb_device` feature.

**Please note** Since the tinyUSB package is distinct from (and incompatible with) the USB stack provided around USBUS in RIOT (see USB), the tinyUSB netdev driver cannot be used together with with any USBUS device class.

The tinyUSB netdev driver uses Ethernet over USB and supports the following protocols:
- CDC ECM (Ethernet Control Model)
- CDC NCM (Network Control Model)
- RNDIS (Microsoft Remote NDIS)

While Linux and macOS support all these protocols, Microsoft Windows only supports the RNDIS protocol and since Windows version 11 also the CDC NCM protocol. macOS supports the RNDIS protocol since version 10.15 (Catalina).

Which protocol is used is selected by the corresponding pseudomodules `tinyusb_class_net_cdc_ecm`, `tinyusb_class_net_cdc_ncm` and `tinyusb_class_net_rndis`.

The CDC ECM protocol (`tinyusb_class_net_cdc_ecm`) and the RNDIS protocol (`tinyusb_class_net_rndis`) can be used simultaneously to support all operating systems, for example :
```
USEMODULE='tinyusb_netdev tinyusb_class_net_rndis tinyusb_class_net_cdc_ecm' \
BOARD=... make -C ... flash
 ```
In this case, the CDC ECM protocol is the default protocol and the RNDIS protocol the alternative protocol defined as second device configuration. The CDC NCM protocol cannot be used together with the CDC ECM or the RNDIS protocol.

This PR includes PR #18983 for now to be compilable. 

Comparison with USBUS CDC ECM (`nucleo-f767zi` board):
```
   text	   data	    bss	    dec	    hex	filename
  65916	    596	  18728	  85240	  14cf8	tests_pkg_tinyusb_netdev.elf
```
```
   text	   data	    bss	    dec	    hex	filename
  63120	    544	  15444	  79108	  13504	tests_usbus_cdc_ecm.elf

```

### Testing procedure

Use a board that is supported by tinyUSB. Compile and flash the test application for each protocol:

1. RNDIS
    ```
    BOARD=... make -j8 -C tests/pkg_tinyusb_netdev flash
    ```
2. CDC ECM
    ```
    CLASS=tinyusb_class_net_cdc_ecm BOARD=... make -j8 -C tests/pkg_tinyusb_netdev flash
    ```
3. CDC NCM
    ```
    CLASS=tinyusb_class_net_cdc_ncm BOARD=... make -j8 -C tests/pkg_tinyusb_netdev flash
    ```
For each test, a network interface should be added on the host. Use command `ifconfig` on USB device and on the host and check that both have a link local address. In syslog there should be an output like the following:
<details>

```
Nov 13 18:14:46 gunny8 kernel: [4611465.480025] usb 1-2.2: new full-speed USB device number 28 using xhci_hcd
Nov 13 18:14:47 gunny8 kernel: [4611465.581641] usb 1-2.2: New USB device found, idVendor=1209, idProduct=7d01, bcdDevice= 1.00
Nov 13 18:14:47 gunny8 kernel: [4611465.581646] usb 1-2.2: New USB device strings: Mfr=1, Product=2, SerialNumber=3
Nov 13 18:14:47 gunny8 kernel: [4611465.581650] usb 1-2.2: Product: nucleo-f767zi
Nov 13 18:14:47 gunny8 kernel: [4611465.581653] usb 1-2.2: Manufacturer: RIOT-os.org
Nov 13 18:14:47 gunny8 kernel: [4611465.581654] usb 1-2.2: SerialNumber: 6591620BCB270283
Nov 13 18:14:47 gunny8 vmnetBridge: RTM_NEWLINK: name:usb0 index:508 flags:0x00001002
Nov 13 18:14:47 gunny8 vmnet-natd: RTM_NEWLINK: name:usb0 index:508 flags:0x00001002
Nov 13 18:14:47 gunny8 NetworkManager[24229]: <info>  [1668359687.1066] manager: (usb0): new Ethernet device (/org/freedesktop/NetworkManager/Devices/528)
Nov 13 18:14:47 gunny8 kernel: [4611465.594604] rndis_host 1-2.2:1.0 usb0: register 'rndis_host' at usb-0000:00:14.0-2.2, RNDIS device, fa:db:7c:1b:58:80
Nov 13 18:14:47 gunny8 mtp-probe: checking bus 1, device 28: "/sys/devices/pci0000:00/0000:00:14.0/usb1/1-2/1-2.2"
Nov 13 18:14:47 gunny8 mtp-probe: bus: 1, device: 28 was not an MTP device
Nov 13 18:14:47 gunny8 systemd-udevd[17796]: link_config: autonegotiation is unset or enabled, the speed and duplex are not writable.
Nov 13 18:14:47 gunny8 vmnet-natd: RTM_NEWLINK: name:usb0 index:508 flags:0x00001002
Nov 13 18:14:47 gunny8 kernel: [4611465.643852] rndis_host 1-2.2:1.0 enp0s20f0u2u2: renamed from usb0
Nov 13 18:14:47 gunny8 vmnetBridge: RTM_NEWLINK: name:usb0 index:508 flags:0x00001002
Nov 13 18:14:47 gunny8 vmnet-natd: RTM_NEWLINK: name:enp0s20f0u2u2 index:508 flags:0x00001002
Nov 13 18:14:47 gunny8 vmnetBridge: RTM_NEWLINK: name:enp0s20f0u2u2 index:508 flags:0x00001002
Nov 13 18:14:47 gunny8 NetworkManager[24229]: <info>  [1668359687.1833] device (usb0): interface index 508 renamed iface from 'usb0' to 'enp0s20f0u2u2'
Nov 13 18:14:47 gunny8 upowerd[2845]: unhandled action 'bind' on /sys/devices/pci0000:00/0000:00:14.0/usb1/1-2/1-2.2/1-2.2:1.1
Nov 13 18:14:47 gunny8 NetworkManager[24229]: <info>  [1668359687.2037] device (enp0s20f0u2u2): state change: unmanaged -> unavailable (reason 'managed', sys-iface-state: 'external')
Nov 13 18:14:47 gunny8 vmnet-natd: RTM_NEWLINK: name:enp0s20f0u2u2 index:508 flags:0x00011043
Nov 13 18:14:47 gunny8 vmnetBridge: RTM_NEWLINK: name:enp0s20f0u2u2 index:508 flags:0x00011043
Nov 13 18:14:47 gunny8 vmnetBridge: Adding interface enp0s20f0u2u2 index:508
Nov 13 18:14:47 gunny8 NetworkManager[24229]: <info>  [1668359687.2075] device (enp0s20f0u2u2): carrier: link connected
Nov 13 18:14:47 gunny8 upowerd[2845]: unhandled action 'bind' on /sys/devices/pci0000:00/0000:00:14.0/usb1/1-2/1-2.2/1-2.2:1.0
Nov 13 18:14:47 gunny8 NetworkManager[24229]: <info>  [1668359687.2129] settings: (enp0s20f0u2u2): created default wired connection 'Kabelgebundene Verbindung 2'
Nov 13 18:14:47 gunny8 NetworkManager[24229]: <warn>  [1668359687.2142] device (enp0s20f0u2u2): connectivity: "/proc/sys/net/ipv4/conf/enp0s20f0u2u2/rp_filter" is set to "1". This might break connectivity checking for IPv4 on this device
Nov 13 18:14:47 gunny8 NetworkManager[24229]: <info>  [1668359687.2151] device (enp0s20f0u2u2): state change: unavailable -> disconnected (reason 'none', sys-iface-state: 'managed')
Nov 13 18:14:47 gunny8 vmnetBridge: RTM_NEWLINK: name:enp0s20f0u2u2 index:508 flags:0x00011043
Nov 13 18:14:47 gunny8 vmnet-natd: RTM_NEWLINK: name:enp0s20f0u2u2 index:508 flags:0x00011043
Nov 13 18:14:47 gunny8 upowerd[2845]: unhandled action 'bind' on /sys/devices/pci0000:00/0000:00:14.0/usb1/1-2/1-2.2
Nov 13 18:14:47 gunny8 systemd-udevd[17796]: link_config: autonegotiation is unset or enabled, the speed and duplex are not writable.
Nov 13 18:14:47 gunny8 NetworkManager[24229]: <info>  [1668359687.2403] policy: auto-activating connection 'Kabelgebundene Verbindung 2' (0b1ae45e-c76e-3efb-a2cd-138ca2b2a59c)
Nov 13 18:14:47 gunny8 NetworkManager[24229]: <info>  [1668359687.2414] device (enp0s20f0u2u2): Activation: starting connection 'Kabelgebundene Verbindung 2' (0b1ae45e-c76e-3efb-a2cd-138ca2b2a59c)
Nov 13 18:14:47 gunny8 NetworkManager[24229]: <info>  [1668359687.2419] device (enp0s20f0u2u2): state change: disconnected -> prepare (reason 'none', sys-iface-state: 'managed')
Nov 13 18:14:47 gunny8 NetworkManager[24229]: <info>  [1668359687.2429] device (enp0s20f0u2u2): state change: prepare -> config (reason 'none', sys-iface-state: 'managed')
Nov 13 18:14:47 gunny8 NetworkManager[24229]: <info>  [1668359687.2440] device (enp0s20f0u2u2): state change: config -> ip-config (reason 'none', sys-iface-state: 'managed')
Nov 13 18:14:47 gunny8 NetworkManager[24229]: <info>  [1668359687.2445] dhcp4 (enp0s20f0u2u2): activation: beginning transaction (timeout in 45 seconds)
Nov 13 18:14:47 gunny8 vmnetBridge: RTM_NEWLINK: name:enp0s20f0u2u2 index:508 flags:0x00011043
Nov 13 18:14:47 gunny8 vmnet-natd: RTM_NEWLINK: name:enp0s20f0u2u2 index:508 flags:0x00011043
Nov 13 18:14:47 gunny8 avahi-daemon[1464]: Joining mDNS multicast group on interface enp0s20f0u2u2.IPv6 with address fe80::dba4:adb8:9ffe:d93e.
Nov 13 18:14:47 gunny8 avahi-daemon[1464]: New relevant interface enp0s20f0u2u2.IPv6 for mDNS.
Nov 13 18:14:47 gunny8 avahi-daemon[1464]: Registering new address record for fe80::dba4:adb8:9ffe:d93e on enp0s20f0u2u2.*.
Nov 13 18:14:47 gunny8 kernel: [4611465.895046] userif-1: sent link down event.
Nov 13 18:14:47 gunny8 kernel: [4611465.895052] userif-1: sent link up event.
```

</details>

Ping from and to the host.

### Issues/PRs references

Depends on PR https://github.com/RIOT-OS/RIOT/pull/18983

Co-authored-by: Gunar Schorcht <gunar@schorcht.net>
2023-02-03 09:32:29 +00:00
bors[bot]
247b8d0a47
Merge #19235 #19236 #19237 #19238
19235: pkg/nimble/autoadv: fix flag comparisons r=benpicco a=kaspar030



19236: sys/vfs: vfs.c missing includes r=benpicco a=kaspar030



19237: sys/net/crosslayer/inet_csum: add missing "modules.h" include r=benpicco a=kaspar030



19238: sys/net/grnc/netreg: avoid creating an infinite loop r=benpicco a=benpicco



Co-authored-by: Kaspar Schleiser <kaspar@schleiser.de>
Co-authored-by: Benjamin Valentin <benjamin.valentin@ml-pa.com>
2023-02-02 17:52:10 +00:00
Benjamin Valentin
b7a5261508 sys/net/grnc/netreg: avoid creating an infinite loop 2023-02-02 17:56:19 +01:00
1db6c4a9de sys/net/crosslayer/inet_csum: add missing "modules.h" include 2023-02-02 16:37:21 +01:00
177b50dfc2 sys/vfs: vfs.c: add missing "container.h" include 2023-02-02 16:34:28 +01:00
47a610e732 sys/vfs: vfs.c: add missing modules.h include 2023-02-02 16:34:28 +01:00
bors[bot]
a9dbf8bc36
Merge #19055 #19188 #19225
19055: shell/gnrc_icmpv6_echo: acquire ZTIMER_USEC clock for time measurement r=benpicco a=jue89



19188: cpu/gd32v: add periph_adc support r=benpicco a=gschorcht

### Contribution description

This PR provides the `periph_adc` support and is one of a bunch of follow up PRs that complete the peripheral drivers for GD32VF103.

This PR depends on PR #19170 and includes this PR to be compilable since includes the ADC configuration also for Sipeed Longan Nano board.

### Testing procedure

`tests/periph_adc` should work on any GD32VF103 board.

### Issues/PRs references

Depends on PR #19170 

19225: sys/net/dhcpv6: include IA Prefix Option in SOLICIT r=benpicco a=benpicco





Co-authored-by: Jue <me@jue.yt>
Co-authored-by: Gunar Schorcht <gunar@schorcht.net>
Co-authored-by: Benjamin Valentin <benjamin.valentin@ml-pa.com>
2023-02-02 00:04:14 +00:00
Benjamin Valentin
0a453ae679 sys/net/dhcpv6: let dhcpv6_client_req_ia_pd() return error 2023-02-01 23:25:22 +01:00
Benjamin Valentin
54fe031705 sys/net/dhcpv6: add IA Prefix Option in SOLICIT
Add the IA Prefix Option when soliciting a prefix so we can tell the
server what prefix length we want.
2023-02-01 23:25:22 +01:00
Gunar Schorcht
e7d0fbbc71 sys/net/gnrc/netif: add tinyUSB netdev to auto_init 2023-02-01 21:58:01 +01:00
bors[bot]
cf2d66ede8
Merge #19193 #19214
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>
2023-02-01 11:13:05 +00:00
2a960f95ba test_utils/print_stack_usage: use thread.h API 2023-01-31 15:48:32 +01:00
Benjamin Valentin
349b8b8367 shell/rtc: use rtc_tm_normalize() to sanitize input 2023-01-29 22:28:45 +01:00
bors[bot]
c6c84cccc9
Merge #19199 #19205 #19207
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>
2023-01-27 21:01:39 +00:00
Benjamin Valentin
ff52d35584 gnrc_ipv6_nib: use static DNS server from auto_init_sock_dns if present 2023-01-27 19:15:13 +01:00
Benjamin Valentin
acf2074369 examples/gnrc_border_router: static: use router from advertisements by default 2023-01-27 18:01:00 +01:00
chrysn
2c716d3ede sys/suit: Ensure previous thread is stopped before reusing its stack
Closes: https://github.com/RIOT-OS/RIOT/issues/19195
2023-01-25 18:04:28 +01:00
chrysn
3779abca36 rust: Update riot-wrappers 2023-01-25 02:07:49 +01:00
chrysn
5981079782 rust: Update dependencies, use riot-wrappers from git
This primarily updates riot-wrappers, which has accumulated several
compatible changes.
2023-01-24 20:12:58 +01:00