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

8285 Commits

Author SHA1 Message Date
Gunar Schorcht
760b80f068 cpu/stm32: move number of EP definition to periph_cpu.h 2023-03-12 13:15:44 +01:00
Gunar Schorcht
170ec09bc7 cpu/gd32v: add number of EPs provided by USB OTG peripheral 2023-03-12 13:15:44 +01:00
Gunar Schorcht
a235442b2b cpu/efm32: add number of EPs provided by USB OTG peripheral 2023-03-12 13:15:44 +01:00
Gunar Schorcht
dc9b3094dc cpu/esp32: add number of EPs provided by USB OTG peripheral 2023-03-12 13:15:44 +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
Gunar Schorcht
86808b690e cpu/stm32: Add stall functions to usbdev_fs 2023-03-09 17:21:56 +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
Joshua DeWeese
eeb359e80c 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.
2023-03-07 11:52:16 -05:00
Joshua DeWeese
6488fe7cb3 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.
2023-03-07 11:25:23 -05:00
MrKevinWeiss
66570cb0fb
cpu/native: Use ztimer instead of xtimer 2023-03-07 13:08:58 +01:00
Benjamin Valentin
ce36460b16 cpu/native: implement periph_rtc_ms 2023-03-05 02:56:28 +01:00
bors[bot]
a9310ed46c
Merge #19341 #19345
19341: Picolibc updates r=benpicco a=keith-packard

### Contribution description

Minor updates to picolibc support for newer versions of picolibc, including 1.8.


### Testing procedure

Here's the current build result for a board I happen to have on my bench right now:

```
$ make -C examples/blinky BOARD=nucleo-f103rb FEATURES_REQUIRED=picolibc
...
/home/keithp/src/RIOT/sys/picolibc_syscalls_default/syscalls.c:319:1: error: unknown type name '_READ_WRITE_RETURN_TYPE'
  319 | _READ_WRITE_RETURN_TYPE read(int fd, void *dest, size_t count)
      | ^~~~~~~~~~~~~~~~~~~~~~~
/home/keithp/src/RIOT/sys/picolibc_syscalls_default/syscalls.c:351:1: error: unknown type name '_READ_WRITE_RETURN_TYPE'
  351 | _READ_WRITE_RETURN_TYPE write(int fd, const void *src, size_t count)
      | ^~~~~~~~~~~~~~~~~~~~~~~
...
```

### Description of changes

 1. Fix the read/write return values (Picolibc 1.8 uses POSIX standard types now)
 2. Add new symbols to linker scripts (Picolibc needs help dealing with TLS alignment)
 3. Align stack and thread local storage block during thread setup.


19345: cpu/riscv_common: convert to uword_t usage r=benpicco a=dylad

### Contribution description

This PR makes use of `uword_t` type in a few places in `cpu/riscv_common`.
This should not have any effect on produced binaries.

### Testing procedure

CI should be enough. 

### Issues/PRs references
Quickly adapt from #16994. It will help for 64 bits support one day ;)



Co-authored-by: Keith Packard <keithp@keithp.com>
Co-authored-by: Dylan Laduranty <dylan.laduranty@mesotic.com>
2023-03-04 22:00:55 +00:00
Dylan Laduranty
5f699eeed3 cpu/riscv_common: convert to uword_t usage
Signed-off-by: Dylan Laduranty <dylan.laduranty@mesotic.com>
2023-03-03 22:16:25 +01:00
Keith Packard
fb01e6a3fb cpu: Add TLS symbols for newer picolibc to linker scripts
Newer picolibc versions require some additional symbols defined in the
linker script to correctly manage alignment constraints on thread
local storage.

Signed-off-by: Keith Packard <keithp@keithp.com>
2023-03-02 22:55:22 -08:00
10578c7895
cpu/sam0_common: Add stall functions to usbdev 2023-02-28 11:00:06 +01:00
98c31a7d58
cpu/nrf52: Add stall functions to usbdev 2023-02-28 11:00:05 +01:00
bors[bot]
302a809db0
Merge #19329 #19330
19329: MAINTAINING.md: add some notes on Bors r=benpicco a=benpicco



19330: native/stdio: Explicitly provide getchar r=chrysn a=chrysn

### Contribution description

This ensures that even when libc does not implement getchar through getc, any custom stdio is still in the loop when getchar is used.

Frankly, I don't know when this broke -- I'm pretty sure custom stdio worked just a few days ago -- but either way, without this patch RIOT on native currently bypasses a configured stdio for me.

### Testing procedure

* `make -C examples/saul all debug`
* `break stdio_read`
* `run`

Without this patch, observe how the shell runs w/o ever breaking. After, lots of breakpoint hits.

This is the way it behaves for me (Debian sid, libc6:i386 2.36-8). If it works for you before this patch, we might start bisecting the differences between the systems, but we may also accept that libcs may imlpement getchar in different ways, and not all of them pass by the getc which we're patching.

### Issues/PRs references

This is needed for testing #19289.

The implementation stems from the `fgetc(3)` man page, which states that "getchar() is equivalent to getc(stdin)".

Co-authored-by: Benjamin Valentin <benpicco@beuth-hochschule.de>
Co-authored-by: chrysn <chrysn@fsfe.org>
2023-02-27 21:45:59 +00:00
chrysn
494942b981 native/stdio: Explicitly provide getchar
This ensures that even when libc does not implement getchar through
getc, any custom stdio is still in the loop when getchar is used.
2023-02-27 20:43:15 +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
Marian Buschsieweke
e5d0f83696
cpu/atmega_common: store periph_timer prescalers in flash 2023-02-27 12:06:30 +01:00
chrysn
b04af7920c efm32/dac: Shift instead of masking
Closes: https://github.com/RIOT-OS/RIOT/issues/19317
2023-02-25 13:38:56 +01:00
bors[bot]
0dfc05c77c
Merge #19165 #19303
19165: cpu/sam0_common: adc: implement 16 bit mode by oversampling r=dylad a=benpicco



19303: dist/tools/insufficient_memory: Minor improvements r=benpicco a=maribu

### Contribution description

`create_makefile.sh`:
- address all shellcheck warnings
- make script POSIX shell compatible
- use nproc to set the number of parallel jobs to increase throughput
- print error messages when building fails
- run `make info-boards-supported` with `EXTERNAL_BOARD_DIRS=""` to avoid adding out-of-tree boards to `Makefile.ci`.
- classify output as "not supported" also when used features are blacklisted, not only when required features are missing

`add_insufficient_memory_board.sh`:
- classify output as "not supported" also when used features are blacklisted, not only when required features are missing

### Testing procedure

Run the script; it should still work.

### Issues/PRs references

None

Co-authored-by: Benjamin Valentin <benjamin.valentin@ml-pa.com>
Co-authored-by: Marian Buschsieweke <marian.buschsieweke@ovgu.de>
2023-02-23 23:58:02 +00:00
Benjamin Valentin
470bee59a7 cpu/sam0_common: implement 16 bit mode by oversampling 2023-02-23 22:17:48 +01:00
bors[bot]
37b64912d4
Merge #19256
19256: pkg/tinyusb: add GD32VF103 support r=gschorcht a=gschorcht

### Contribution description

This PR provides the tinyUSB support for GD32VF103 and enables the `tinyusb_device` feature as well as `stdio_tinyusb_cdc_acm` for GD32VF103 boards.

### Testing procedure

```
BOARD=sipeeed-longan-nano make -C tests/shell flash term
```
should work

### Issues/PRs references


Co-authored-by: Gunar Schorcht <gunar@schorcht.net>
2023-02-21 16:53:06 +00:00
bors[bot]
9998b7ac05
Merge #19269
19269: cpu/gd32v/periph_i2c: interrupt based driver r=gschorcht a=gschorcht

### Contribution description

This PR provides an interrupt-driven version of the I2C low-level driver.

The existing I2C low-level driver for GDVF103 uses a busy-waiting approach where the status register is continuously polled while waiting for a certain status when sending or receiving. The MCU is thus occupied the whole time during a send or receive operation.

The driver provided with this PR uses an interrupt-driven approach. This is, while waiting for a certain status when sending or receiving, the calling thread is suspended and woken up by interrupts.

Since the I2C controller allows to receive up to two bytes before the application has to react, receiving a single byte, two bytes or more than two bytes needs a different handling for correct receiption. This requires a tricky implementation which distinguish a number of different case. There the driver requires 860 byte more ROM and 8 byte more RAM.

### Testing procedure

The driver should work with any I2C sensor/actuator. It was tested with
- `tests/driver_bmp180`
   <details>
  
   ```
    main(): This is RIOT! (Version: 2023.04-devel-355-g940c7-cpu/gd32v/periph_i2c_interrupt_driven)
    BMP180 test application
    
    +------------Initializing------------+
    Initialization successful
    
    +------------Calibration------------+
    AC1: 8448
    AC2: -1208
    AC3: -14907
    AC4: 33310
    AC5: 24774
    AC6: 19213
    B1: 6515
    B2: 49
    MB: -32768
    MC: -11786
    MD: 2958
    
    +--------Starting Measurements--------+
    Temperature [°C]: 22.0
    Pressure [hPa]: 1006.49
    Pressure at see level [hPa]: 1025.55
    Altitude [m]: 157
    
    +-------------------------------------+
    Temperature [°C]: 22.0
    Pressure [hPa]: 1006.56
    Pressure at see level [hPa]: 1025.58
    Altitude [m]: 157
    
    +-------------------------------------+
   ```
   
   </details>
- `tests/driver_ccs811`
   <details>
  
   ```
    main(): This is RIOT! (Version: 2023.04-devel-355-g940c7-cpu/gd32v/periph_i2c_interrupt_driven)
    CCS811 test application
    
    +------------Initializing------------+
    
    +--------Starting Measurements--------+
    TVOC [ppb]: 0
    eCO2 [ppm]: 0
    +-------------------------------------+
    TVOC [ppb]: 0
    eCO2 [ppm]: 0
    +-------------------------------------+
    TVOC [ppb]: 0
    eCO2 [ppm]: 0
    +-------------------------------------+
    TVOC [ppb]: 0
    eCO2 [ppm]: 400
    +-------------------------------------+
    TVOC [ppb]: 0
    eCO2 [ppm]: 400
    +-------------------------------------+
    TVOC [ppb]: 0
    eCO2 [ppm]: 400
    +-------------------------------------+
    TVOC [ppb]: 7
    eCO2 [ppm]: 446
    +-------------------------------------+
    TVOC [ppb]: 7
    eCO2 [ppm]: 446
    +-------------------------------------+
    TVOC [ppb]: 7
    eCO2 [ppm]: 446
    +-------------------------------------+
    TVOC [ppb]: 7
    eCO2 [ppm]: 446
    +-------------------------------------+
    ```
   
   </details>
- `tests/driver_sht3x`
   <details>
  
    ```
    main(): This is RIOT! (Version: 2023.04-devel-355-g940c7-cpu/gd32v/periph_i2c_interrupt_driven)
    SHT3X test application
    
    +------------Initializing------------+
    Initialization successful
    
    
    +--------Starting Measurements--------+
    Temperature [°C]: 21.46
    Relative Humidity [%]: 54.50
    +-------------------------------------+
    Temperature [°C]: 21.47
    Relative Humidity [%]: 54.53
    +-------------------------------------+
    Temperature [°C]: 21.46
    Relative Humidity [%]: 54.48
    +-------------------------------------+
    Temperature [°C]: 21.46
    Relative Humidity [%]: 54.47
    +-------------------------------------+
    ```
   
   </details>
- `tests/driver_l3gxxxx`
   <details>
  
    ```
    main(): This is RIOT! (Version: 2023.04-devel-375-g75547-cpu/gd32v/periph_i2c_interrupt_driven)
    L3GXXXX gyroscope driver test application
    
    Initializing L3GXXXX sensor
    [OK]
    
    gyro [dps] x:    +0, y:    -1, z:    -2
    gyro [dps] x:    +0, y:    +0, z:    +0
    gyro [dps] x:    +0, y:    +0, z:    +0
    gyro [dps] x:    +0, y:    +0, z:    +0
    gyro [dps] x:    +0, y:    +0, z:    +0
    gyro [dps] x:    +0, y:    +0, z:    +0
    gyro [dps] x:    -1, y:    +0, z:    +4
    gyro [dps] x:    +0, y:    +0, z:   -21
    gyro [dps] x:    +0, y:    +0, z:    +6
    gyro [dps] x:   -43, y:    +0, z:   -13
    gyro [dps] x:   -21, y:    -2, z:    +0
    gyro [dps] x:    +0, y:    +1, z:    +3
    gyro [dps] x:   +25, y:    +0, z:    +0
    ```
   
   </details>
- `tests/driver_hd44780` with `pcf8574a` I2C interface

### Issues/PRs references



Co-authored-by: Gunar Schorcht <gunar@schorcht.net>
2023-02-18 07:54:59 +00:00
Gunar Schorcht
5433daca32 cpu/gd32v/periph_i2c: interrupt based driver 2023-02-17 18:52:38 +01:00
bors[bot]
b1be519107
Merge #19284 #19286
19284: boards: support for the LILYGO TTGO T8 ESP32-S2 board r=benpicco a=gschorcht

### Contribution description

This PR provides the support for the LILYGO TTGO T8 ESP32-S2 board which has a OLED display (not yet supported) and a SD-Card slot on board.

The board is equipped with a USB-C connector that connects either to a USB-to-UART bridge or to the USB-OTG/JTAG interface of the ESP32-S2 via some DIP switches.

The PR includes a very small fix of printf format string in `tests/malloc`. I can split it off.

### Testing procedure

t.b.d.

### Issues/PRs references


19286: cpu/esp_common: use generic WIFI_SSID/WIFI_PASS defines r=benpicco a=benpicco



Co-authored-by: Gunar Schorcht <gunar@schorcht.net>
Co-authored-by: Benjamin Valentin <benpicco@beuth-hochschule.de>
2023-02-17 17:00:56 +00:00
Benjamin Valentin
cebd768c08 cpu/esp_common: rename ESP_WIFI_EAP_* -> WIFI_EAP_* 2023-02-17 16:59:29 +01:00
Benjamin Valentin
50802b841d cpu/esp_common: use generic WIFI_SSID/WIFI_PASS defines 2023-02-17 15:32:03 +01:00
Gunar Schorcht
2ac4189784 cpu/esp32: fix DAC documentation for ESP32-S2 2023-02-17 12:39:10 +01:00
bors[bot]
5667814d2c
Merge #19270 #19271
19270: drivers/at24cxxx: implement _mtd_at24cxxx_read_page r=benpicco a=HendrikVE

### Contribution description

The function `read_page` was missing which lead to (from a user perspective) undefined behavior on the MTD layer.

### Testing procedure

Any application using MTD in conjunction with a board with an at24cxxx.


19271: core/xfa: disable asan on llvm r=benpicco a=Teufelchen1

### Contribution description
Hi! 🦎

When using llvm and address sanitation, the XFA trip the sanitizer.
This PR attempts to fix this by adding the `no_sanitize` attribute to the XFA macros. Sadly, this attribute is not known by gnu, a guard is hence needed. I'm open for alternatives as I dislike this solution but it is the best I could come up with.

### Testing procedure

Before this patch:

Go to `examples/gnrc_minimal` and run `TOOLCHAIN=llvm make all-asan` and then `make term`.
You should see an error similar to this:
```
==3374719==ERROR: AddressSanitizer: global-buffer-overflow on address 0x080774e0 at pc 0x0804af5e bp 0x0808eb88 sp 0x0808eb78
READ of size 4 at 0x080774e0 thread T0
    #0 0x804af5d in _auto_init_module /RIOT/sys/auto_init/auto_init.c:40
    #1 0x804af5d in auto_init /RIOT/sys/auto_init/auto_init.c:339
    #2 0x804b375 in main_trampoline /RIOT/core/lib/init.c:56
    #3 0xf76bc7b8 in makecontext (/lib32/libc.so.6+0x4a7b8)
...
``` 
After applying this PR, the example can be build and run with llvm or gcc, with or without asan.



Co-authored-by: Hendrik van Essen <hendrik.vanessen@ml-pa.com>
Co-authored-by: Teufelchen1 <bennet.blischke@haw-hamburg.de>
2023-02-15 17:03:30 +00:00
Hendrik van Essen
9b0cf96ecd cpu/sam0_common: add PERIPH_I2C_MAX_BYTES_PER_FRAME due to I2C limitations 2023-02-15 11:56:21 +01:00
Fabian Hüßler
26363e9da4 cpu/stm32/periph/i2c_1: export PERIPH_I2C_MAX_BYTES_PER_FRAME 2023-02-14 17:39:42 +01:00
bors[bot]
0607806caa
Merge #19263
19263: cpu/stm32/periph/timer: don't stop counter r=maribu a=Enoch247

### Contribution description

From the git comment msg:

If a timer's channel was set with a really small realtive duration from now, such that it would be missed (underflowed), the driver would stop the timer, potentially causing missed ticks. It was stopped to ensure that the channel's output-compare register could be set to the current counter value, before re-enabling the timer's counter. This is a condition that will ensure that the underflow won't happen again and the interrupt will fire, at the cost of losing some ticks for very high speed clocks.

This patch replaces the logic that stopped the timer. Instead it uses a register provided by the timer hardware to trigger timer interrupts via software.


### Testing procedure

1. do
    ``` bash
    $ cd tests/periph_timer_short_relative_set
    $ make BOARD=nucleo-f303ze flash term
    ```
1. follow prompts to run test
1. observe all tests pass
1. apply patch below to break test
1. rerun test
1. observe test fails, so new method is doing its job


##### patch to intentionally break test

```` diff
diff --git a/cpu/stm32/periph/timer.c b/cpu/stm32/periph/timer.c
index 64a6f3a656..7078c46ab4 100644
--- a/cpu/stm32/periph/timer.c
+++ b/cpu/stm32/periph/timer.c
`@@` -177,7 +177,7 `@@` int timer_set(tim_t tim, int channel, unsigned int timeout)
     if (value > timeout) {
         /* time till timeout is larger than requested --> timer already expired
          * ==> let's make sure we have an IRQ pending :) */
-        dev(tim)->EGR |= (TIM_EGR_CC1G << channel);
+        //dev(tim)->EGR |= (TIM_EGR_CC1G << channel);
     }
````


### Issues/PRs references

- none known


Co-authored-by: Joshua DeWeese <jdeweese@primecontrols.com>
2023-02-09 08:06:31 +00:00
Joshua DeWeese
289814edcf cpu/stm32/periph/timer: don't stop counter
If a timer's channel was set with a really small realtive duration from
now, such that it would be missed (underflowed), the driver would stop
the timer, potentially causing missed ticks. It was stopped to ensure
that the channel's output-compare register could be set to the current
counter value, before re-enabling the timer's counter. This is a
condition that will ensure that the underflow won't happen again and the
interrupt will fire, at the cost of losing some ticks for very high
speed clocks.

This patch replaces the logic that stopped the timer. Instead it uses a
register provided by the timer hardware to trigger timer interrupts via
software.
2023-02-08 14:08:56 -05: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]
dd2d336962
Merge #19240 #19248 #19255
19240: tools/doccheck: add simple exclude to doccheck r=benpicco a=kfessel

while doccheck runs for #19228 and #19220, i saw some spikes in memory consumption, turned out that was `grep -Evf dist/tools/doccheck/exclude_patterns` using about 2GB RAM. This PR changes that.

### Contribution description

add `exclude_simple`  to `doccheck` drived from `exclude patterns`
`sort`ed and `uniq`ued the simple excludes
removes no longer needed patterns from `exclude patterns`

simple excludes are string rules (no patterns just strings) 
how to apply these:
in this PR: 
*remove the path and line number from the rule
* that made some of them doubles of each other
* sorted and uniqued them. 
* this set of excludes is no longer path specific (an exception covers all paths but may of them still contain a file name)

another possible solution would be to have the excludes line number specific.

### Testing procedure

run `dist/tools/doccheck/check.sh`

compare memory consumption of 
master: `grep -Evf dist/tools/doccheck/exclude_patterns`
to 
this PR: `grep -Fvf dist/tools/doccheck/exclude_simple`

### Issues/PRs references



19248: cpu/gd32v: add periph_dac support r=benpicco a=gschorcht

### Contribution description

This PR provides the `periph_dac` support for GD32VF103.

### Testing procedure

`tests/periph_dac` should work on `sipeed-longan-nano` port on PA4 and PA5.

### Issues/PRs references

19255: boards/esp*: complete SD Card MTD config r=benpicco a=gschorcht

### Contribution description

This PR provides the remaining changes necessary to use the generic MTD SD Card configuration as described in PR #19216. 

This includes defining the MTD offset for SD cards, since the default `MTD_0` device always uses the internal flash device, and the completion of the configuration for the ESP32 boards with a SD card interface.

### Testing procedure

`tests/vfs_default` should work now with SD Cards:
```
main(): This is RIOT! (Version: 2023.04-devel-323-gfcc07)
mount points:
	/nvm0
	/sd0

data dir: /sd0
> vfs df 
Mountpoint              Total         Used    Available     Use%
/nvm0                3052 KiB        8 KiB     3044 KiB       0%
/sd0                 7580 MiB 3632148992 B   21089792 B      99%
```

### Issues/PRs references


Co-authored-by: Karl Fessel <karl.fessel@ovgu.de>
Co-authored-by: Gunar Schorcht <gunar@schorcht.net>
2023-02-07 14:55:44 +00:00
Gunar Schorcht
712b55e96b cpu/gd32v: fix a #endif comment in periph_cpu.h 2023-02-07 14:54:53 +01:00
Gunar Schorcht
0561e99b0a cpu/gd32v: add perip_gpio_ll_irq support 2023-02-07 12:19:49 +01:00
bors[bot]
af393878d1
Merge #19251 #19254
19251: tests/driver_dac_dds: fix output of sine and saw functions r=benpicco a=benpicco



19254: cpu/gd32v: add periph_rtc_mem support r=benpicco a=gschorcht

### Contribution description

This PR provides the `periph_rtc_mem` support for GD32VF103.

A modified version of this driver could also be used for STM32F1.

### Testing procedure

`tests/periph_rtt` should work on any GD32V board, for example:
```
BOARD=sipeed-longan-nano make -C tests/periph_rtt flash
```
```
Help: Press s to start test, r to print it is ready
START
main(): This is RIOT! (Version: 2023.04-devel-319-gebc86-cpu/gd32v/periph_rtc_mem)

RIOT RTT low-level driver test
RTT configuration:
RTT_MAX_VALUE: 0xffffffff
RTT_FREQUENCY: 32768

Testing the tick conversion
Trying to convert 1 to seconds and back
Trying to convert 256 to seconds and back
Trying to convert 65536 to seconds and back
Trying to convert 16777216 to seconds and back
Trying to convert 2147483648 to seconds and back
All ok

Initializing the RTT driver
RTC mem OK
This test will now display 'Hello' every 5 seconds

RTT now: 1
Setting initial alarm to now + 5 s (163841)
rtt_get_alarm() PASSED
RTC mem OK
```

### Issues/PRs references

Co-authored-by: Benjamin Valentin <benjamin.valentin@ml-pa.com>
Co-authored-by: Gunar Schorcht <gunar@schorcht.net>
2023-02-07 07:33:48 +00:00
Gunar Schorcht
64663ee743 cpu/gd32v: add periph_dac support 2023-02-07 02:41:06 +01:00
Gunar Schorcht
47e6136269 cpu/gd32v/vendor: add USB OTG definitions
This file contains the definitions for the DWC2 USB OTG FS IP Core from Synopsys as also defined in the CMSIS Device Peripheral Access Layer for each STM32 MCU and in the same way for ESP32x SoCs. GD32V MCUs use the same USB IP Core, but the vendor headers for these MCUs use a different register structure and different identifiers. To be able to use the same driver `usbdev_synopsys_dwc2`, the relevant USB IP core definitions have been extracted from `cmsis/f7/Include/stm32f767xx.h` which is under the copyright of STMicroelectronics, see below. This is the same file used by ESP32x SoCs but modified for GD32V MCUs.
2023-02-07 00:48:21 +01:00
bors[bot]
304245b328
Merge #19249
19249: boards/gd32v: improve board definitions r=benpicco a=gschorcht

### Contribution description

This PR provides some small improvements of the existing board definitions for GD32VF103 boards for more flexibel default configurations and documentation of the board peripherals:

- Allow the remapping of SPI0 pins in SPI configuration (ae984b0bea)
- More flexible I2C configuration (0c337583b4)
  The default I2C device configuration allows to define up to two I2C devices `I2C_DEV(0)` and `I2C_DEV(1)`. `I2C_DEV(0)` is always defined if the I2C peripheral is enabled by the module `periph_spi`. The second I2C device `I2C_DEV(1)` is only defined if `I2C_DEV_1_USED` is defined by the board. This allows to use the default configuration with one or two I2C devices depending on whether other peripherals are enabled that would collide with the I2C devices.
- More flexible SPI configuration (edbf59e37e)
  The default SPI device configuration allows to define up to two SPI devices `SPI_DEV(0)` and `SPI_DEV(1)`. `SPI_DEV(0)` is always defined if the SPI peripheral is enabled by the module `periph_spi`. The second SPI device `SPI_DEV(1)` is only defined if `SPI_DEV_1_USED` is defined by the board. This allows to use the default configuration with one or two SPI devices depending on whether other peripherals are enabled that would collide with the SPI devices.
Furthermore, the CS signal in the SPI configuration is given by a define that can be overriden with another pin if
the default CS signal is connected to an unused hardware.
- Improve ADC config for Sipeed-Longan-Nano (c9c587ee00)
  The ADC configuration was too complex. It was hard to follow when certain ADC lines are available. Furthermore, the order of ADC lines did depend on the use of other peripherals. Now, either the TFT display is not connected and all ADC lines are available or the TFT display is connected and the second SPI device is used so that only the first 4 ADC lines are available.
- Improve Kconfig for Sipeed-Longan-Nano (025f4fdf00)
  Board-specific configuration not shown any longer directly in the top level menu but within a submenu.
- Improve peripherals documentation (7f0d560dd8, e24abe495a)
 Available peripherals for the board are now documented in two tables ordered by RIOT peripheral names and by pins.

Although the different changes are small and mostly related to the documentation, I could split the PR if necessary.

### Testing

Green CI

### Issues/PRs references



Co-authored-by: Gunar Schorcht <gunar@schorcht.net>
2023-02-06 23:21:35 +00:00
Gunar Schorcht
dc5a1e9db0 cpu/gd32v: add periph_rtc_mem support 2023-02-06 22:22:01 +01:00
Gunar Schorcht
df46c458e6 boards: add support for ESP32 ProS3 board 2023-02-06 16:19:11 +01:00
Gunar Schorcht
ae984b0bea cpu/gd32v: allow SPI pin remapping in config 2023-02-06 07:45:59 +01:00
Gunar Schorcht
aa55e3a5a1 cpu/gd32v: add gpio_ll support 2023-02-04 12:07:35 +01:00
bors[bot]
7d1ef9d99b
Merge #18863
18863: boards/esp32s2-mini: add definition for ESP32 S2 Mini r=gschorcht a=benpicco



Co-authored-by: Benjamin Valentin <benjamin.valentin@bht-berlin.de>
Co-authored-by: Benjamin Valentin <benjamin.valentin@ml-pa.com>
2023-02-02 14:26:25 +00:00
Benjamin Valentin
ed5bfb7392 cpu/esp32: drop CONFIG_ESP_PHY_ENABLE_USB for ESP32S2 2023-02-02 10:56:40 +01:00
Benjamin Valentin
7607b9c0f5 cpu/esp32: add esp-bootloader-reset 2023-02-02 10:56:40 +01:00
Gunar Schorcht
f7949e42fd cpu/gd32v: add periph_adc support 2023-02-01 23:11:07 +01:00
Gunar Schorcht
42b683a89e cpu/gdv32: add SPI support 2023-02-01 02:37:54 +01:00
bors[bot]
718e4a8340
Merge #16782 #19201
16782: drivers/mfrc522: add new driver r=benpicco a=HendrikVE

### Contribution description

This PR adds support for the MFRC522. It is quite common in the Arduino world and it is quite cheap. The driver connects to the MFRC522 via SPI and is heavily based on the Arduino driver available [here](https://github.com/miguelbalboa/rfid). Basically it was ported, but with several improvements in readability and documentation.

### Testing procedure

The given (manual) test provides single commands for some driver functions.

19201: cpu/gd32v: add periph_i2c support r=benpicco a=gschorcht

### Contribution description

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

The driver is a modified version of the driver for STM32F1 with some changes that were necessary to get it working on GD32V. As  for STM32F1, the driver is using polling instead of interrupts for now. It will be implemented interrupt-driven later.

### Testing procedure

`tests/periph_i2c` as well as a test with any I2C sensor should work. The driver was tested with `tests/driver_l3gxxxx` and `tests/driver_bmp180`.

### Issues/PRs references


Co-authored-by: Hendrik van Essen <hendrik.ve@fu-berlin.de>
Co-authored-by: Gunar Schorcht <gunar@schorcht.net>
2023-01-31 23:15:41 +00:00
Gunar Schorcht
5355a2435c cpu/dg32v: add periph_i2c support 2023-01-31 20:12:04 +01:00
Gunar Schorcht
e387019076 cpu/gd32v: move board dependent RTT configs to board config 2023-01-29 18:51:59 +01:00
Gunar Schorcht
e9be9b4e75 cpu/gd32v: add periph_pwm support 2023-01-28 18:16:17 +01:00
Gunar Schorcht
0dfbdebaf7 cpu/gd32v: allow using TIMER0 as timer device 2023-01-28 17:46:45 +01:00
Gunar Schorcht
596d762806 cpu/gd32v: move TIMER_CHANNEL macros to header file 2023-01-28 17:39:06 +01:00
Gunar Schorcht
2c6e527339 cpu/gd32v: fix interrupt handling in periph_timer
When a timer is set, any pending interrupts must be cleared before the interrupt is enabled for the channel. Otherwise the interrupt would be triggered immediately when the timer is set.
2023-01-28 17:37:15 +01:00
Gunar Schorcht
4383e0ac6f cpu/gd32v: fix periph_flashpage doc group 2023-01-27 06:46:51 +01:00
Gunar Schorcht
0b6fc8833b cpu/gd32v: add periph_rtt support 2023-01-27 06:46:51 +01:00
bors[bot]
719787bd7f
Merge #19192
19192: cpu/esp32: fixes for boot issues and crashes on ESP32 r=kaspar030 a=Flole998

### Contribution description

In syscalls_init() there is a call to malloc(), which will return NULL if the heap is not initialized before, causing the entire board to fail booting if MODULE_ESP_IDF_HEAP is used.

API of [vTaskDelete()](https://www.freertos.org/a00126.html) says, that if NULL is passed to vTaskDelete the calling task should be deleted.

This PR needs a backport to 2023.01.

### Testing procedure

Just compiling on the ESP32S2 and running it with WiFi caused it to not start anymore, no output, nothing. When Null is written to that null-pointer it hangs.

The second commit fixed an issue/assertion fail that happens when the WiFi connection drops/disconnects.

### Issues/PRs references

Issue was introduced with PR #19146 

Co-authored-by: Flole998 <Flole998@users.noreply.github.com>
2023-01-24 20:36:34 +00:00
Flole998
56d2997d95 cpu/esp_common/freertos: Handle NULL being passed to vTaskDelete 2023-01-24 17:48:13 +00:00
Flole998
1a4af03a94 cpu/esp32: Make sure heap is initialized early enough
In syscalls_init() there is a call to malloc(), which will return NULL if the heap is not initialized before, causing the entire board to fail booting if MODULE_ESP_IDF_HEAP is used.
2023-01-24 16:46:22 +00:00
bors[bot]
f85366ae60
Merge #19185 #19187
19185: cpu/gd32v: add periph_gpio_irq support r=gschorcht a=gschorcht

### Contribution description

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

### Testing procedure

Use a GD32VF103 board and flash `tests/periph_gpio`. Note: The Sipeed Longan Nano works also with `seeedstudio-gd32` board defintion and could be used for testing.
```
BOARD=seeedstudio-gd32 make -C tests/periph_gpio flash  (until PR #19170 is merged only `seeedstudio
```
With the GPIO PB8 and PB9 connected, the following test sequence should work:
```
> init_out 1 8
> init_int 1 9 2 0
GPIO_PIN(1, 9) successfully initialized as ext int
> set 1 8
INT: external interrupt from pin 9
> clear 1 8
INT: external interrupt from pin 9
```


### Issues/PRs references


19187: cpu/gd32v: add pm_layered support in periph_pm r=gschorcht a=gschorcht

### Contribution description

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

Since the configuration of the deep sleep and the standby mode require the access CSR (control and status registers) of the MCU, the Nuclei-SDK NMSIS is added as package which provides a low-level interface for Nuclei-based RISC-V MCUs.

### Testing procedure

The best way to test it is to rebase this PR onto PR #19186 and to flash `tests/periph_pm` to any GD32VF103 board. Note: The Sipeed Longan Nano works also with `seeedstudio-gd32` board definition and could be used for testing.
```
BOARD=seeedstudio-gd32 make -C tests/periph_pm flash
```
The test output should be:
```
main(): This is RIOT! (Version: 2023.04-devel-174-g7dc91-cpu/gd32v/periph_pm_test)
...
mode 0 blockers: 1 
mode 1 blockers: 2 
mode 2 blockers: 0 
Lowest allowed mode: 2
```
Using command the `set_rtc 1 5` command should let the MCU deep sleep for 5 seconds
```
> set_rtc 1 5
Setting power mode 1 for 5 seconds.
␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀> 
```
while command `set_rtc 1 5` should set the MCU into the standby mode which is left with restart.
```
> set_rtc 0 5
Setting power mode 0 for 5 seconds.
main(): This is RIOT! (Version: 2023.04-devel-174-g7dc91-cpu/gd32v/periph_pm_test)
...
mode 0 blockers: 1 
mode 1 blockers: 2 
mode 2 blockers: 0 
Lowest allowed mode: 2
> 
```
The garbage on UART interface after deep sleep is caused by the clock synchronisation that becomes necessary after deep sleep and is the same as for other boards.

### Issues/PRs references

Co-authored-by: Gunar Schorcht <gunar@schorcht.net>
2023-01-24 14:38:28 +00:00
Gunar Schorcht
cfbda4022a cpu/gdv32: add pm_layered support 2023-01-24 00:52:02 +01:00
Gunar Schorcht
b02ffb21b8 cpu/gd32v: use NMSIS SDK package 2023-01-24 00:52:02 +01:00
Gunar Schorcht
ced6344651 cpu/gd32v: add periph_gpio_irq support 2023-01-23 22:51:35 +01:00
Gunar Schorcht
13e4ea4be1 boards/sipeed-longan-nano: initial support 2023-01-23 18:59:32 +01:00
Gunar Schorcht
31604da8fe boards/common: add common definitions for GD32VF103 boards 2023-01-23 18:59:32 +01:00
Gunar Schorcht
19420d6595 cpu/gd32v: add periph_rtc support 2023-01-22 17:53:44 +01:00
bors[bot]
d11a358b1d
Merge #18472 #19175
18472: drivers/mrf24j40: add support for IEEE 802.15.4 Radio HAL r=benpicco a=jia200x



19175: drivers/periph_common/flashpage: fix silent error r=benpicco a=Enoch247

### Contribution description

This patch removes a test that silently hides failed writes to NULL. Instead, assert is used to ensure that the address is not NULL.


### Testing procedure

I am not certain how to update the tests to catch asserts. If this is possible, I will add a test, if someone will point me to a good example to learn from.


### Issues/PRs references

- none


Co-authored-by: Jose Alamos <jose@alamos.cc>
Co-authored-by: Joshua DeWeese <jdeweese@primecontrols.com>
2023-01-19 18:17:13 +00:00
Jose Alamos
92f3a170af
cpu/atmega128rfa1/Kconfig: select default transceiver 2023-01-19 15:34:19 +01:00
Jose Alamos
48e8953beb
cpu/atmega256rfr2/Kconfig: select default transceiver 2023-01-19 15:34:19 +01:00
bors[bot]
d4d91492cd
Merge #18100 #19121 #19164 #19169
18100: core/assert: print backtrace on failed assertion r=kaspar030 a=benpicco



19121: socket_zep: only report size of single datagram r=kaspar030 a=benpicco



19164: cpu/sam0_common: move adc_res_t to common code r=dylad a=benpicco



19169: tests/driver_ws281x: don't overwrite board definition 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-01-18 23:59:58 +00:00
bors[bot]
7855aad7e4
Merge #19079
19079: cpu/esp32: add periph_flashpage support r=kaspar030 a=gschorcht

### Contribution description

This PR provides the `periph_flashpage` support for ESP32x SoCs.

For byte-aligned read access to constant data in the flash, the MMU of all ESP32x SoCs allows to map a certain number of 64 kByte pages of the flash into the data address space of the CPU. This address space is called DROM. Normally the whole DROM address space is assigned to the section `.rodata`. The default flash layout used by all ESP32x SoCs is:
| Address in Flash | Content |
|:-----------------------|:-----------|
| `0x0000` or `0x1000` | bootloader |
| `0x8000` | parition table |
| `0x9000` | `nvs` parition with WiFi data |
| `0xf000`  | `phy_init` partition with RF data |
| `0x10000` | `factory` partition with the app image |

The factory partition consists of a number of 64 kByte pages for the sections `.text`, `.rodata`, `.bss` and others. The `.text` and `rodata` sections are page-aligned and are simply mapped into the instruction address space (IROM) and the data address space (DROM), respectively. All other sections are loaded into RAM.

If the `periph_flashpage` module is used, the `periph_flashpage` driver
- decreases the size of the `.rodata` section in DROM address space by `CONFIG_ESP_FLASHPAGE_CAPACITY`,
- adds a section `.flashpage.writable` of size `CONFIG_ESP_FLASHPAGE_CAPACITY` at the end of DROM address space that is mapped into data address space of the CPU,
- reserves a region of size `CONFIG_ESP_FLASHPAGE_CAPACITY` starting from `0x10000` in front of the image partition `factory` and
- moves the image partition `factory` by  `CONFIG_ESP_FLASHPAGE_CAPACITY` to address `0x10000 + CONFIG_ESP_FLASHPAGE_CAPACITY`. 

The new flash layout is then:
| Address in Flash | Content |
|:-----------------------|:-----------|
| `0x0000` or `0x1000` | bootloader |
| `0x8000` | parition table |
| `0x9000` | `nvs` parition with WiFi data |
| `0xf000`  | `phy_init` partition with RF data |
| `0x10000` | flashpage region |
| `0x10000 + CONFIG_ESP_FLASHPAGE_CAPACITY` | `factory` partition with the app image |

This guarantees that the flash pages are not overwritten if a new app image with changed size is flashed. `CONFIG_ESP_FLASHPAGE_CAPACITY` has to be a multiple of 64 kBytes.

~The PR includes PR #19077 and PR #19078 for the moment to be compilable.~

### Testing procedure

The following tests should pass.
```
USEMODULE='esp_log_startup ps shell_cmds_default' BOARD=esp32-wroom-32 make -j8 -C tests/periph_flashpage flash term
```
```
USEMODULE='esp_log_startup ps shell_cmds_default' BOARD=esp32-wroom-32 make -j8 -C tests/mtd_flashpage flash term
```

### Issues/PRs references

Depends on PR #19077
Depends on PR #19078 


Co-authored-by: Gunar Schorcht <gunar@schorcht.net>
2023-01-18 17:48:29 +00:00
Benjamin Valentin
bfe2391148 cpu/sam0_common: fix static checks in periph_cpu_common.h 2023-01-18 01:54:34 +01:00
Benjamin Valentin
9dcb3991d2 cpu/sam0_common: move adc_res_t to common code 2023-01-17 17:18:07 +01:00
bors[bot]
9ff9704fe5
Merge #19010 #19149
19010: bootloaders/riotboot: add tinyUSB DFU support r=benpicco a=gschorcht

### Contribution description

This PR provides
- the tinyUSB DFU and DFU Runtime support and
- the `riotboot_tinyusb_dfu` bootloader that uses the tinyUSB DFU mode to flash new application images.

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

### Testing procedure

1. Use any board that supports the `riotboot´ and `tinyusb_device` features and flash the bootloader first, for example
   ```
   BOARD=nucleo-f767zi make -C bootloaders/riotboot_tinyusb_dfu flash
   ```
   and check that the `riotboot_tinyusb_dfu` bootloader is in DFU mode:
   ```
   dfu-util --list
   ```
3. Flash a first application using the following command:
    ```
   FEATURES_REQUIRED=riotboot USEMODULE=tinyusb_dfu BOARD=nucleo-f767zi \
   make -C tests/saul PROGRAMMER=dfu-util riotboot/flash-slot0
   ```
   and check that the application starts and is seen as upgradable:
   ```
   dfu-util --list
   ```
4. Restart the node in bootloader DFU mode by:
   ```
   dfu-util -e
   ```
   Flash a second application, for example
   ```
   FEATURES_REQUIRED=riotboot USEMODULE=tinyusb_dfu BOARD=nucleo-f767zi \
   make -C tests/shell PROGRAMMER=dfu-util riotboot/flash-slot1
   ```
   and check that the second application starts and is seen as upgradable:
   ```
   dfu-util --list
   ```
   
### Issues/PRs references

~Depends on PR #18983~

19149: SECURITY: Describe that declassification is an option r=benpicco a=chrysn

### Contribution description

Our security policy does not contain provisions for the case when what is reported is not what we consider an actual security issue. As it is described now, everything reported through security@ would go through the full treatment, including a point release.

I'm not sure it belongs into the text itself (as it's more about how security reporters interact with the project than internals), but declassification should IMO be backed at least by 3 maintainers, and no strong NACK.

### Issues/PRs references

#19141 followed that procedure after some chat on it on the maintainers channel. (In the discussion, I proposed declassification, with 2.5 people supporting it and one "I was about to, but can we be sure nobody is using it?" voice).

Co-authored-by: Gunar Schorcht <gunar@schorcht.net>
Co-authored-by: chrysn <chrysn@fsfe.org>
2023-01-15 23:31:00 +00:00
Gunar Schorcht
5b543692cd cpu/nrf52: handling RIOTBOOT_LEN for tinyusb_dfu 2023-01-15 18:09:55 +01:00
Gunar Schorcht
c46545d5a7 cpu/common_cortex: handling RIOTBOOT_LEN for tinyusb_dfu 2023-01-15 18:09:55 +01:00
bors[bot]
c8d60a2d31
Merge #18763
18763: sys/tiny_strerror: add missing error codes r=benpicco a=maribu

### Contribution description

When double-checking the error codes provided by newlib by default (without magic defines, such as `__LINUX_ERRNO_EXTENSIONS__` or `__CYGWIN__`), some where still missing in `tiny_strerror()`. This adds the missing ones.

This in turn showed that three errno codes were missing in the avr-libc compat `errno.h`, which are added as well.

### Testing procedure

Murdock should double check that the added errno codes indeed are defined by default.

### Issues/PRs references

None

Co-authored-by: Marian Buschsieweke <marian.buschsieweke@ovgu.de>
2023-01-14 22:41:37 +00:00
Gunar Schorcht
f933fde60c cpu/esp32: don't initialize the UART pins if already initialized
To avoid garbage on reconfiguring the UART console pins, e.g. in initialization of the `arduino` module, pins that are already configured as UART pins must not be initialized.
2023-01-14 14:38:18 +01:00
Gunar Schorcht
3085b92e8f cpu/esp32: improve UART initialization
The TX line is set and temporarily configured as a pull-up open-drain output before configuring it as a push-pull output to avoid a several msec long LOW pulse resulting in some garbage.
2023-01-14 14:38:18 +01:00
Gunar Schorcht
fe21e82079 cpu/esp32: improve initialization of UART pins
Since PR #19100 it is possible to define:
- other pins for `UART_DEV(0)` than the default pins
- different `UART_DEV(0)` pins for the bootloader and RIOT
To allow correct reinitialization of the UART pins used by the bootloader as well as their usage for other purposes, the pin usage for the default UART0 pins and the UART pins used by the bootloader are reset to `_GPIO`. This is done in `uart_system_init` which has to be called earlier in the startup procedure.
2023-01-14 14:38:18 +01:00
Gunar Schorcht
9004867fe0 cpu/esp32/bootloader: fix the UART pin configuration 2023-01-14 14:27:56 +01:00
Gunar Schorcht
d5a28ecd02 cpu/esp32: reorder the syscalls_init
If LOG_LEVEL >= 4, such as in `tests/log_printfnoformat`, the ESP-IDF config function called for the GPIO pins of the UART will output the configuration with `printf` before the `_GLOBAL_REENT` structure is initialized. This causes a crash during system startup. Therefore the initialization by `syscalls_init` must be called earlier in the startup procedure.
2023-01-14 14:27:56 +01:00
bors[bot]
fb603f2660
Merge #18459 #18724 #19081 #19082 #19136
18459: makefiles/suit: make it possible to accept multiple SUIT keys r=miri64 a=benpicco



18724: nanocoap_sock: implement DTLS socket r=miri64 a=benpicco



19081: sys/stdio_udp: add stdio over UDP r=benpicco a=benpicco



19082: core/init: add early_init() r=benpicco a=benpicco



19136: CI: re-add "synchronize" event to check-labels r=miri64 a=kaspar030



Co-authored-by: Benjamin Valentin <benjamin.valentin@ml-pa.com>
Co-authored-by: Benjamin Valentin <benjamin.valentin@bht-berlin.de>
Co-authored-by: Kaspar Schleiser <kaspar@schleiser.de>
2023-01-13 13:50:55 +00:00
Benjamin Valentin
81625fd5f2 doc: sort all stdio implementations into sys_stdio group 2023-01-13 11:08:22 +01:00
bors[bot]
89ef35f9c6
Merge #19050
19050: boards/common/cc26xx cc13xx: clean up and fix flash configs r=benpicco a=maribu

### Contribution description

- Add support for XDS110 debugger via `OPENOCD_DEBUG_ADAPTER=xds110`
- Clean up OpenOCD configs in `boards/common/cc26xx_cc13xx`
    - No longer hardcode the debugger to xds110, but use `OPENOCD_DEBUG_ADATER ?= xds110`
    - Add support for cc13x0, cc13x2, cc26x0
- `boards/cc2650*`: drop custom OpenOCD config in favor of shared one
- add variables needed to support flashing with `PROGRAMMER=jlink`
- allow specifying a custom OpenOCD command to bring the device to a halt state, as the default `reset halt` (which causes a second reset) is causing issues with the ICEPick JTAG routers in the CC26xx - CC13xx devices
- Use `halt` instead of `reset halt` for CC26xx / CC13xx boards in OpenOCD to avoid issues in flashing

### Testing procedure

```
make BOARD=cc2650-launchpad -C examples/default flash
```

Should now work. The same should still work for other cc26xx cc13xx boards.

### Issues/PRs references

Partially fixes: https://github.com/RIOT-OS/RIOT/issues/18750

Co-authored-by: Marian Buschsieweke <marian.buschsieweke@ovgu.de>
2023-01-13 00:51:31 +00:00
Marian Buschsieweke
b0ee095051
cpu/avr8_common/avr_libc_extra: add missing errno codes
Three standard POSIX errno codes somehow slipped through the cracks.
This adds the missing ones.
2023-01-12 08:39:30 +01:00
Marian Buschsieweke
c78c0056ea
boards/common/cc26xx_cc13xx: Fix flashing with upstream OpenOCD
This adds a work around that allows flashing with upstream OpenOCD,
most of the time.
2023-01-10 22:39:35 +01:00
Gunar Schorcht
9eff2958ee cpu/esp32: fix TOC in doc.txt regarding toolchain settings 2023-01-10 22:29:02 +01:00
Benjamin Valentin
913d72cb99 socket_zep: don't discard frames if not in RX mode 2023-01-10 17:36:30 +01:00
Benjamin Valentin
3dedfb7a17 socket_zep: only report size of single datagram 2023-01-10 17:36:30 +01:00
Benjamin Valentin
8a80e70e5e cpu/native: syscalls: provide real_recv() 2023-01-10 14:24:16 +01:00
bors[bot]
bb708e2f9c
Merge #19109
19109: cpu/gd32v: fix and extend Kconfig clock settings r=benpicco a=gschorcht

### Contribution description

This PR fixes the following issus of the clock configuration which led to highly deviating peripheral clocks so that the UART interface was not usable in my case:

1. Setting the `RCU_CTL` register just to the IRC8M bit also removes the IRC8M calibration and trim adjust value in this register. Therefore IRC8M calibration and trim adjust value have to be preserved and the IRC8M has to be set.
2. `CLOCK_HXTAL` is a value and not a flag, so that shifting to the left changes anything in the register but does not set the PLLSEL bit. `RCU_CFG0_PLLSEL_Msk` has to be used instead to set the PLLSEL bit.
3. `CONFIG_BOARD_HAS_HXTAL` is used to indicate that the board has an HXTAL connected. If the HXTAL is present, it is used as PLL clock source. But if the HXTAL is not present, the half IRC8M clock should be used as PLL clock source and must not be disabled at the end of clock settings. Using IRC8M clock as PLL clock source also requires another PLL multiplication factor.

Issues 1 and 2 led to the problem that IRC8M was used without calibration instead of HXTAL. With the fixes, the GD32V is working with as well as without HXTAL correctly.

Furthermore, the Kconfig configuration has been extended. It is now possible to configure the HXTAL frequency as well, since the GD32VF103 allows HXTAL clocks from 3 MHz to 25 MHz. This has currently been added directly to the board's Kconfig, as it is currently the only GD32VF103 board. It should be moved to a common Kconfig later when more GD32V boards are added.

### Testing procedure

`BOARD=seeedstudio-gd32 make -C tests/shell flash term` should still work.

### Issues/PRs references


Co-authored-by: Gunar Schorcht <gunar@schorcht.net>
2023-01-09 21:06:17 +00:00
Gunar Schorcht
72d11d84b8 boards/seeedstudio-gd32: extend Kconfig by clock configuration
The configuration whether a HXTAL is present and what its clock frequency is will be added to Kconfig. Since it is the only GD32V board at the moment, the configuration is added to the Kconfig of the board, but should be moved to a common Kconfig later when more GD32V boards are added.
2023-01-09 21:51:54 +01:00
bors[bot]
e2538a898a
Merge #19076
19076: boards/hip-badge: add HiP Badge board definition r=maribu a=benpicco



Co-authored-by: Benjamin Valentin <benpicco@beuth-hochschule.de>
2023-01-09 13:33:40 +00:00
Benjamin Valentin
55b5c47bc8 cpu/esp32: add stdio_usb_serial_jtag 2023-01-09 00:51:27 +01:00
Marian Buschsieweke
525751c33b
cpu/riscv_common/periph_timer: Fix timer_clear()
Previously, timer_clear() was a no-op, resulting in spurious IRQs from
already canceled timeouts. This fixes the issue.
2023-01-09 00:08:59 +01:00
Benjamin Valentin
59f067171f core/init: call vfs_bind_stdio() in early_init() 2023-01-08 22:26:13 +01:00
Benjamin Valentin
124b849503 cpu: call early_init() 2023-01-08 22:26:12 +01:00
Gunar Schorcht
f4d6b2d642 cpu/gd32v: fix clock setting
`CONFIG_BOARD_HAS_HXTAL` is used to indicate that the board has an HXTAL connected. If the HXTAL is present, it is used as PLL clock source. But if the HXTAL is not present, the half IRC8M clock should be used as PLL clock source and must not be disabled at the end of clock settings. Using IRC8M clock as PLL clock source also requires another PLL multiplication factor.
2023-01-08 11:32:28 +01:00
Gunar Schorcht
e4010f7445 cpu/gd32v: fix clock setting
`CLOCK_HXTAL` is a value and not a flag, so that shifting to the left changes anything in the register but does not set the PLLSEL bit. `RCU_CFG0_PLLSEL_Msk` has to be used instead to set the PLLSEL bit.
2023-01-08 10:42:01 +01:00
Gunar Schorcht
dd0593a3c8 cpu/gd32v: fix clock setting
Setting the `RCU_CTL` register just to the IRC8M bit also removes the IRC8M calibration and trim adjust value in this register. Therefore IRC8M calibration and trim adjust value have to be preserved and the IRC8M has to be set.
2023-01-08 10:42:01 +01:00
bors[bot]
441b69964c
Merge #19106
19106: core/lib: Add macros/utils.h header r=aabadie a=maribu

### Contribution description

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

### Testing procedure

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

### Issues/PRs references

None

Co-authored-by: Marian Buschsieweke <marian.buschsieweke@ovgu.de>
2023-01-07 21:16:51 +00:00
Gunar Schorcht
32168da8d6 cpu/esp32: add flashpage support
f
2023-01-07 14:49:36 +01:00
Gunar Schorcht
80833a74e8 cpu/esp32: add flashpage support to linker scripts 2023-01-07 10:38:52 +01:00
Gunar Schorcht
6f9c64c6cb cpu/esp32: add flashpage support to Kconfig 2023-01-07 10:38:52 +01:00
Gunar Schorcht
f4c0d7da71 cpu/esp32: add flashpage definitions in CPU config 2023-01-07 10:38:52 +01:00
Marian Buschsieweke
86fdbd7054
core/lib: Add macros/utils.h header
The macros CONCAT(), MIN(), and MAX() are defined over and over again in
RIOT's code base. This de-duplicates the code by moving the macros to a
common place.
2023-01-07 09:47:44 +01:00
bors[bot]
4f1bb12720
Merge #18752 #19100 #19104
18752: nanocoap_sock: deprecate nanocoap_get() r=benpicco a=benpicco





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

### Contribution description

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

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

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

### Testing procedure

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

### Issues/PRs references

Prerequisite for PR ##18863

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



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

However, the bootloader compiled directly in ESP-IDF uses its own definitions `CONFIG_ESP_CONSOLE_UART_*` for the UART configuration. To be able to use a consistent UART configuration in RIOT and the bootloader, e.g. to see the output of the 2nd stage bootloader, these `CONFIG_ESP_CONSOLE_UART_*` can be defined via a set of KConfig variables `CONSOLE_CONFIG_UART_*`. Here the variable `CONSOLE_CONFIG_UART_NUM` is then also used as `STDIO_UART_DEV` and the variables `CONSOLE_CONFIG_UART_RX` and `CONSOLE_CONFIG_UART_TX` of the configuration in `periph_conf.h` should be used accordingly.
f
2023-01-06 16:43:51 +01:00
Gunar Schorcht
fb8d521ac6 cpu/esp_common: allow configuration of UART0 2023-01-06 16:43:51 +01:00
Gunar Schorcht
8b34d547ac cpu/esp32: fix SDK configuration for USB PHY
When using USB Serial/JTAG/OTG/CDC, USB should be enabled in `phy_init`, otherwise USB interface is not working properly.
2023-01-06 12:30:11 +01:00
bors[bot]
256da8e9b5
Merge #18869
18869: cpu/sam0_common/periph: Fix compilation with LLVM  r=benpicco a=Teufelchen1

Related to #18851 

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


Co-authored-by: Teufelchen1 <bennet.blischke@haw-hamburg.de>
2023-01-05 16:17:53 +00:00
bors[bot]
e35c7adb73
Merge #19031
19031: cpu/stm32/periph_timer: implement timer_set() r=benpicco a=maribu

### Contribution description

The fallback implementation of timer_set() in `drivers/periph_common` is known to fail on short relative sets. This adds a robust implementation.

### Testing procedure

Run `tests/periph_timer_short_relative_set` at least a few dozen times (or use https://github.com/RIOT-OS/RIOT/pull/19030 to have a few dozen repetitions of the test case in a single run of the test application). It should now succeed.

### Issues/PRs references

None

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

Note: This differs a bit from the implementation in e.g. nRF5x or STM32
in that it always briefly pauses the timer. The issue is that when
running the timer can take a few ticks to actually react to the new
compare target. So even if the previously written target is still in
the future, the timer may not fire anyway. Pausing the timer while
setting and setting the target at least one higher than the current
count reliably triggers the IRQ.
2023-01-03 22:35:11 +01:00
Marian Buschsieweke
b8cc222e76
cpu/stm32/periph_timer: implement timer_set()
The fallback implementation of timer_set() in `drivers/periph_common`
is known to fail on short relative sets. This adds a robust
implementation.
2023-01-03 15:51:06 +01:00
bors[bot]
f7ef90d213
Merge #19074
19074: cpu/esp8266: build the SDK bootloader from source r=benpicco a=gschorcht

### Contribution description

This PR is a takeover of PR #17043, which is rebased to the current master and includes some corrections that became necessary after rebasing.

**Copied from description of PR #17043:**

We had four versions of pre-built bootloaders for the esp8266 with different settings of logging and color logging. These bootloaders were manually built from the SDK and shipped with RIOT-OS source code. However there are more settings that affect the bootloader build that are relevant to the app or final board that uses this bootloader. In particular, flash size and flash speed is important for the bootloader to be able to load an app from a large partition table at the fastest speed supported by the board layout and flash chip.

Another example is the UART baudrate of the logging output from the bootloader. The boot ROM will normally start at a baud rate of 74880 (depending on the crystal installed), so it might make sense to keep the UART output at the same speed so we can debug boot modes and bootloader with the same terminal.

This patch builds the `bootloader.bin` file from the ESP8266 SDK source code. The code is built as a module (`esp8266_bootloader`) which at the moment doesn't generate any object code for the application and only produces a `bootloader.bin` file set to the `BOOTLOADER_BIN` make variable for the `esptool.inc.mk` to flash.

The code needs to be compiled and linked with custom rules defined in the module's Makefile since the `bootloader.bin` is its own separate application.

The `BOOTLOADER_BIN` variable is changed from a path relative to the `$(RIOTCPU)/$(CPU)/bin/` directory to be full path. This makes it easier for applications or board to provide their own bootloader binary if needed.

As a result of building the bootloader from source we fixed the issue of having a large partition table.

### Testing procedure

Use following command to flash the application with STDIO UART baudrate of 115200 baud.
```
BAUD=74880 USEMODULE=esp_log_startup make -C tests/shell BOARD=esp8266-esp-12x flash
```
Connect with a terminal programm of your choice (unfortunatly `picocom` and `socat` don't support a baudrate close to 74880), for example:
```
python -m serial.tools.miniterm /dev/ttyUSB0 74880
```
On reset, the `esp8266-esp-12x` node shows the ROM bootloader log output
```
 ets Jan  8 2013,rst cause:2, boot mode:(3,7) 

load 0x40100000, len 6152, room 16 
tail 8
chksum 0x6f
load 0x3ffe8008, len 24, room 0 
tail 8
chksum 0x86
load 0x3ffe8020, len 3408, room 0 
tail 0
chksum 0x79
```
as well as the second-stage bootloader built by this PR (`ESP-IDF v3.1-51-g913a06a9ac3`) at 74880 baudrate.
```
I (42) boot: ESP-IDF v3.1-51-g913a06a9ac3 2nd stage bootloader
I (42) boot: compile time 11:25:03
I (42) boot: SPI Speed      : 26.7MHz
...
I (151) boot: Loaded app from partition at offset 0x10000
```
The application output is seen as garbage since the `esp8266-esp-12x` uses 115200 as baurate by default.

To see all output at a baudrate of 74880 baud, you can use the following command:
```
CFLAGS='-DSTDIO_UART_BAUDRATE=74880' BAUD=74880 USEMODULE=esp_log_startup make -C tests/shell BOARD=esp8266-esp-12x flash
```

If the application is built without options, the ROOM bootloader output will be 74880 baud and the second stage bootloader and application output will be 115200 baud.

### Issues/PRs references

Fixes issue #16402

Co-authored-by: iosabi <iosabi@protonmail.com>
Co-authored-by: Gunar Schorcht <gunar@schorcht.net>
2023-01-03 00:44:24 +00:00
bors[bot]
6b4b7542eb
Merge #19078
19078: cpu/esp32: define FLASHFILE_POS r=benpicco a=gschorcht

### Contribution description

Instead of using a fixed position of the image file in the flash, the variable `FLASHFILE_POS` is used which allows to override the default position of the image in the flash at 0x10000.

This PR is a prerequisite for the `periph_flashpage` implementation PR #19079.

### Testing procedure

Flashing a ESP32x SoC should work with `FLASHFILE_POS=0x20000`, for example:
```
USEMODULE=esp_log_startup FLASHFILE_POS=0x20000 BOARD=esp32-wroom-32 make -j8 -C tests/shell flash
```
The bootloader output should give `00020000` as offset for the `factory` partition
```
I (75) boot: Partition Table:
I (78) boot: ## Label            Usage          Type ST Offset   Length
I (84) boot:  0 nvs              WiFi data        01 02 00009000 00006000
I (91) boot:  1 phy_init         RF data          01 01 0000f000 00001000
I (97) boot:  2 factory          factory app      00 00 00020000 000199b0
I (104) boot: End of partition table
```
and
```
I (125) esp_image: segment 0: paddr=00020020 vaddr=3f400020 size=02140h (  8512) map
```
during the load of the image.

### Issues/PRs references

Prerequisite for PR #19079

Co-authored-by: Gunar Schorcht <gunar@schorcht.net>
2023-01-02 18:18:19 +00:00
bors[bot]
821acbe6fb
Merge #19077
19077: cpu/esp32: configurable linker scripts r=benpicco a=gschorcht

### Contribution description

This PR provides configurable linker scripts for ESP32x SoCs.

Using the vendor `memory.ld.in` file and a `sections.ld.in` file instead of the static versions of these files, from which the actual used `memory.ld` and  `sections.ld` are generated using the C preprocessor, allows to use the configuration in `sdkconfig.h` as well as Kconfig to define a custom memory layout. For example, it is no longer necessary to maintain different `memory.ld` files for the ESP32 BLE module, since the memory layout is now defined from the values of the configuration.

Note for the review: The `memory.ld.in` files are now simply copies of the manufacturer's `memory.ld.in` files. However, it is not possible to use the vendor's `memory.ld.in` files directly, because they have to be extended further on, e.g. for the `periph_flashpage` implementation.

This PR is prerequisite for the `periph_flashpage` support in PR #19079.

### Testing procedure

Green CI.

### Issues/PRs references

Prerequisite for PR #19079

Co-authored-by: Gunar Schorcht <gunar@schorcht.net>
2023-01-02 04:56:58 +00:00
Gunar Schorcht
8381cd3633 cpu/esp32: using configurable linker scripts in makefiles 2022-12-31 16:03:46 +01:00
Gunar Schorcht
409e609f46 cpu/esp32x: generate section.ld from section.ld.in
Using `sectoins.ld.in` instead of a static `sections.ld`, from which the actual used `sections.ld` is generated with the C preprocessor, allows to use the configuration in `sdkconfig.h` as well as Kconfig to use a custom section layout.
2022-12-31 15:30:34 +01:00
Gunar Schorcht
dc2dc801cc cpu/esp32x: generate memory.ld from vendor memory.ld.in
Using the vendor `memory.ld.in` instead of a static `memory.ld`, from which the actual used `memory.ld` is generated with the C preprocessor, allows to use the configuration in `sdkconfig.h` as well as Kconfig to use a custom memory layout. For example, it is no longer necessary to maintain different `memory.ld` files for the ESP32 BLE module, since the memory layout is now defined from the values of the configuration.
2022-12-31 15:30:34 +01:00
Gunar Schorcht
a0715b281b cpu/esp32: export FLASH_SIZE to SDK configuration 2022-12-31 14:10:57 +01:00
Gunar Schorcht
f23b20f91f cpu/esp: use FLASHFILE_POS for image position in flash
Instead of using a fixed position of the image file in the flash, the variable `FLASHFILE_POS` is used which allows to override the default position of the image in the flash at 0x10000.
2022-12-31 14:10:57 +01:00
bors[bot]
11d81d28f4
Merge #19064
19064: native: Remove code used for __MACH__ target r=benpicco a=Teufelchen1

### Contribution description

This PR removes code that was used to support macOS as native target. 
macOS / `__MACH__` is no longer supported by RIOT on master.

### Testing procedure

If murdock is happy, that should be enough.


Co-authored-by: Teufelchen1 <bennet.blischke@haw-hamburg.de>
2022-12-27 20:41:23 +00:00
Marian Buschsieweke
a8f1a7e007
cpu/nrf5x_common: Implement timer_set()
The fallback implementation of timer_set() in `drivers/periph_common`
is known to fail on short relative sets. This adds a robust
implementation.
2022-12-23 14:48:08 +01:00
Marian Buschsieweke
0a24d54bd5
cpu/nrf5x_common/periph_timer: Fix thread safety
Two threads using distinct sets of channels should be able to share a
timer. Hence, we need to make read-modify-write accesses on timer state
atomic.
2022-12-23 14:45:12 +01:00
Marian Buschsieweke
3ad897df2a
cpu/nrf5x_common/periph_timer: Clear periodic flag on set
A call to timer_set_absolute() should clear the periodic flag on the
specified timer and channel. This adds it.
2022-12-23 14:45:12 +01:00
Teufelchen1
c9e9a8d2f1 native: Remove code used for __MACH__ target 2022-12-22 17:57:25 +01:00
Gunar Schorcht
4f1b4ba0c9 cpu/esp_common: remove double defines from Makefile 2022-12-22 12:18:34 +01:00
iosabi
073b2209da cpu/esp8266: Build the SDK bootloader from source.
We had four versions of pre-built bootloaders for the esp8266 with
different settings of logging and color logging. These bootloaders were
manually built from the SDK and shipped with RIOT-OS source code.
However there are more settings that affect the bootloader build that
are relevant to the app or final board that uses this bootloader. In
particular, flash size and flash speed is important for the bootloader
to be able to load an app from a large partition table at the fastest
speed supported by the board layout and flash chip.

Another example is the UART baudrate of the logging output from the
bootloader. The boot ROM will normally start at a baud rate of 74880
(depending on the crystal installed), so it might make sense to keep
the UART output at the same speed so we can debug boot modes and
bootloader with the same terminal.

This patch builds the bootloader.bin file from the ESP8266 SDK source
code. The code is built as a module (esp8266_bootloader) which at the
moment doesn't generate any object code for the application and only
produces a bootloader.bin file set to the BOOTLOADER_BIN make variable
for the esptool.inc.mk to flash.

The code needs to be compiled and linked with custom rules defined in
the module's Makefile since the bootloader.bin is its own separate
application.

The `BOOTLOADER_BIN` variable is changed from a path relative to the
`$(RIOTCPU)/$(CPU)/bin/` directory to be full path. This makes it easier
for applications or board to provide their own bootloader binary if
needed.

As a result of building the bootloader from source we fixed the issue of
having a large partition table. Fixes #16402.
2022-12-22 12:18:34 +01:00
Teufelchen1
2629e81b3b cpu/sam0_common/periph: Fix compilation with LLVM 2022-12-19 15:19:51 +01:00
bors[bot]
f539035c86
Merge #18756
18756: drivers/usbdev_synopsys_dwc2: add EFM32 support r=chrysn a=gschorcht

### Contribution description

This PR provides the changes for the Synopsys USB OTG IP core DWC2 driver for EFM32 MCUs. It also provides the changes of the board definition for `stk3600` and `stk3700` for testing.

### Testing procedure

`tests/usbus_hid` should work on the EFM32 boards `stk3600` (EFM32LG family) and `stk3700` (EFM32GG family).

It is already tested for a `sltb009a` board (EFM32GG12 family).

### Issues/PRs references


Co-authored-by: Gunar Schorcht <gunar@schorcht.net>
2022-12-19 12:55:57 +00:00
Benjamin Valentin
a9120a38ca cpu/lm4f120: remove stdlib include 2022-12-14 00:22:02 +01:00
Benjamin Valentin
aa376f05c0 cpu/arm7_common: drop cyclic include 2022-12-13 15:55:17 +01:00
Joakim Nohlgård
b3d04d8270 riscv: Reduce reset trampoline code size by 2 bytes
`addi` with 20 bit immediate does not have a compressed representation,
so using `jalr` with immediate offset uncompressed is smaller than using
`addi`+`c.jr`
2022-12-08 13:26:07 +01:00
Gunar Schorcht
c6bae0b4bf cpu/efm32: increase RIOTBOOT_LEN for riotboot_dfu 2022-12-07 16:38:51 +01:00
Gunar Schorcht
4f47dc13fe cpu/efm32: add CPU_FAM_EFM32xx define 2022-12-07 16:38:51 +01:00
Gunar Schorcht
dd6c46e289 cpu/efm32: fix PM configuration
`cpu/cortexm_common/include/cpu.h` has to be included in `cpu/efm32/periph_cpu.h` so that `PROVIDES_PM_SET_LOWEST` is defined if only `periph_cpu.h` is included. Otherwise `pm_set_lowest` is defined multiple times if the `pm_layered` module is not used. `PROVIDES_PM_OFF` has to be defined in case `pm_layered` is not used, e.g. in riotboot.
2022-12-07 16:38:51 +01:00
Gunar Schorcht
6d233f1308 cpu/efm32: enable usbdev_synopsys_dwc2 driver as periph_usbdev 2022-12-07 16:34:34 +01:00
Gunar Schorcht
6146a3ea91 cpu/efm32: add support for Synopsys USB OTG FS IP core 2022-12-07 16:34:34 +01:00
Antonio Galea
ee76e21c33 sam0_common: use size_t len for I2C transfers, as declared (fixes #19008) 2022-12-04 16:57:00 +01:00
Marian Buschsieweke
0d85356180
cpu/qn908x: use bitarithm_test_and_clear() & fix cb
Previously, the callback was incorrectly passed a channel of zero as
argument regardless of the channel that triggered the IRQ. This fixes
the issue and also uses `bitarithm_test_and_clear()` to only iterate
over the channels that actually have an IRQ flag set, rather than
all channels.
2022-11-28 16:43:24 +01:00
Marian Buschsieweke
c95028655d
cpu/qn909x/periph_timer: make clangd happy
The linter was unhappy that `unsinged long` and `uint32_t` were used
inconsistency (in the `timer_init()` declaration, implementation, as
well as in the `DEBUG()` format specifiers).
2022-11-28 16:43:24 +01:00
Marian Buschsieweke
476dca2e8f
Merge pull request #18978 from maribu/cpu/atmega_common/periph_timer/spurious_irqs
cpu/atmega_common/periph_timer: fix spurious IRQs
2022-11-26 16:29:18 +01:00
benpicco
1a73fb0593
Merge pull request #18795 from benpicco/irq-track
debug_irq_disable: add module to debug time spent in irq_disable
2022-11-25 19:10:10 +01:00
Marian Buschsieweke
787884aa95
cpu/atmega_common/periph_timer: fix spurious IRQs 2022-11-25 14:46:16 +01:00
f1a8e1f636
Merge pull request #18970 from maribu/cpu/nrf5x_common/periph_timer/fix_spurious_irqs
cpu/nrf5x_common/periph_timer: fix spurious IRQs
2022-11-25 08:23:34 +01:00
Marian Buschsieweke
c89c75dbc9
Merge pull request #18971 from maribu/cpu/esp
cpu/esp{32,8266}/periph_timer: allow changing callback or freq
2022-11-25 08:22:26 +01:00
Marian Buschsieweke
03b7fe8f0c
cpu/esp8266/periph_timer: allow changing callback or freq
Allow multiple calls to timer_init(), as this is the only way to
change the timer frequency or the callback function.
2022-11-24 22:39:49 +01:00
Marian Buschsieweke
e8fd65566a
cpu/esp32/periph_timer: allow changing callback or freq
Allow multiple calls to timer_init(), as this is the only way to
change the timer frequency or the callback function.
2022-11-24 22:38:15 +01:00
Marian Buschsieweke
fbd7b77331
cpu/nrf5x_common/periph_timer: fix spurious IRQs 2022-11-24 22:36:42 +01:00
Marian Buschsieweke
20fc71dd65
cpu/stm32/periph_timer: fix spurious IRQs 2022-11-24 22:34:10 +01:00
Marian Buschsieweke
93c5755649
cpu/stm32/periph_timer: fix race conditions
Allow two threads to share the same timer - provided they use distinct
sets of timer channels - without occasionally corrupting registers or
state flags.
2022-11-24 22:34:03 +01:00
Benjamin Valentin
59a3e613fe cpu/cortexm_common: measure time spent with IRQ disabled 2022-11-24 21:27:20 +01:00
Marian Buschsieweke
020c6ff69c
Merge pull request #18954 from jue89/fix/nrf5x-uart-lowpower
cpu/nrf5x/uart: run STOPTX task after finished tx
2022-11-24 14:20:58 +01:00
Juergen Fitschen
a6ff838a4b
Merge pull request #18933 from jue89/feature/cpu_efm32_series_2_adc
cpu/efm32: add periph_adc support for Gecko Series 2
2022-11-24 11:32:56 +01:00
benpicco
86d72c7b85
Merge pull request #18940 from krzysztof-cabaj/nucleo-l496zg-ADC
boards/nucleo-l496zg: add ADC support
2022-11-23 20:34:08 +01:00
Marian Buschsieweke
cefef8fd1e
Merge pull request #18953 from jue89/fix/nrf5x-timer-lowpower
cpu/nrf5x/timer: fix high current consumption in powered off state
2022-11-23 17:03:33 +01:00
Marian Buschsieweke
232c70ba53
Merge pull request #18948 from maribu/boards/common/nrf52
boards/common/nrf52: fix timer config
2022-11-23 10:47:26 +01:00
Jue
3da1faca90 cpu/nrf5x/uart: run STOPTX task after finished tx
This reduces power consumption for UARTs that are configured in tx-only mode.
2022-11-22 21:33:14 +01:00
Jue
a7e2182bb0 cpu/nrf5x/timer: run task SHUTDOWN instead of STOP
This is a workaround for errata 78 that causes increased current consumption even in the stopped state.
2022-11-22 19:15:31 +01:00
Juergen Fitschen
97bc8252d9
Merge pull request #18920 from jue89/fix/sam0_rtt_rtc
sam0/rtc_rtt: optimizations to get around the painful long syncwaits
2022-11-22 18:12:06 +01:00
Juergen Fitschen
18e9167c73 cpu/efm32/adc: add support for Gecko Series 2
Series 2 features IADCs instead of ADCs.
2022-11-22 14:44:56 +01:00
Marian Buschsieweke
b533fcf543
cpu/nrf5x_common: improve doc on timer_conf_t::channels 2022-11-22 13:43:05 +01:00
Jue
2a81a2ab5c cpu/efm32: provide periph_uart_modecfg feature for every board 2022-11-21 23:20:19 +01:00
Jue
80b491d7dd cpu/efm32/uart: add modecfg support for Gecko Series 2 2022-11-21 23:17:52 +01:00
krzysztof-cabaj
afbb568306 cpu/stm32/l4: add ADC support for l496zg 2022-11-21 05:52:02 -05:00
Marian Buschsieweke
6b759c2a7d
Merge pull request #18935 from benpicco/makefiles/gnu-version
makefiles/gnu.inc.mk: set flags based on compiler version
2022-11-20 08:11:57 +01:00
Benjamin Valentin
b30efeeb65 makefiles/gnu.inc.mk: set flags based on compiler version 2022-11-19 23:14:54 +01:00
Benjamin Valentin
dd5c876034 cpu/native: replace RIOT_FILE_RELATIVE with __FILE__ 2022-11-19 01:48:42 +01:00
Benjamin Valentin
8777584ac8 cpu/lpc23xx: core: replace RIOT_FILE_RELATIVE with __FILE__ 2022-11-19 01:48:42 +01:00
benpicco
e1aa925c35
Merge pull request #18913 from benpicco/macro-prefix-map
makefiles/cflags.inc.mk: don't include absolute path in __FILE__ macro
2022-11-18 16:43:35 +01:00
benpicco
2f122769c3
Merge pull request #18921 from benpicco/cpu/stm32-bkup_heap
cpu/stm32: add unused backup RAM as extra heap
2022-11-18 15:48:36 +01:00
Benjamin Valentin
6f05daceb3 cpu/stm32: add unused backup RAM as extra heap 2022-11-18 12:19:10 +01:00
Gunar Schorcht
4b7578b2eb pkg/tinyusb: fix USB speed selection for STM32 2022-11-17 14:07:38 +01:00
Juergen Fitschen
268bdfec29 sam0/rtc_rtt: don't block until set_alarm has been propagated to periph
rtc_set_alarm() / rtt_set_alarm() are heavily used by ztimer during ISR. This will reduce time spent during ISR drastically. We trust that the peripheral is able to propagate the alarm asynchronously.
2022-11-16 17:02:19 +01:00
Juergen Fitschen
9c6f07f80a sam0/rtc_rtt: optimize pm_unblock/pm_block ping-pong during set alarm 2022-11-16 16:54:29 +01:00
benpicco
b33688dec4
Merge pull request #18919 from gschorcht/cpu/stm32/fix_ram_len_stm32f4{2,3}{7,9}
cpu/stm32: fix RAM_LEN for F427, F429, F437, F439 models
2022-11-16 11:32:13 +01:00
Gunar Schorcht
7b99a5152f cpu/stm32: fix RAM_LEN for F427, F429, F437, F439 models
These models have 256 kByte RAM, but the upper 64 kByte are used as CCM data RAM accessible at 0x1000:0000. The access to 0x2003:xxxx leads to a hard fault.
2022-11-15 22:29:34 +01:00
Benjamin Valentin
5b359108f7 cpu/esp8266: blacklist -fmacro-prefix-map
This requires at least GCC 8
2022-11-15 20:39:49 +01:00
Marian Buschsieweke
35149bd1c2
Merge pull request #18797 from MrKevinWeiss/pr/fixstmclk
cpu/stm32: Fix stm clock configuration
2022-11-15 11:39:25 +01:00
Benjamin Valentin
0bd67d98d9 cpu: always rely on stdio.inc.mk for default stdio selection 2022-11-09 10:42:47 +01:00
benpicco
8559472179
Merge pull request #18821 from jue89/feature/saml21_pheriph_pm
cpu/saml21: add interaction with pm_layered for peripheral drivers
2022-11-07 19:53:57 +01:00
benpicco
384e3ca534
Merge pull request #18847 from krzysztof-cabaj/nucleo-f207zg-ADC
boards/nucleo-f207zg:  support for ADC
2022-11-05 01:55:30 +01:00
krzysztof-cabaj
aa426bd3aa cpu/stm32/f2: add ADC support for f207zg 2022-11-04 18:02:28 -04:00
Jue
73e6886b2c cpu/saml21: define required power modes
We can get rid initially blocked pm modes \o/
2022-11-03 14:53:45 +01:00
Jue
24461b43f8 cpu/sam0/spi: generalize pm_layered interaction
In DMA mode SPI transfers are carried out by HW. We need to block certain pm modes during transfer.
2022-11-03 14:53:44 +01:00
Jue
db9263eeca cpu/sam0/rtc_rtt: integrate pm_layered 2022-11-03 14:53:43 +01:00
Jue
cc4e880aa8 cpu/sam0/rtc: remove overflow IRQ
Due to the RIOT_EPOCH of 2020 this overflow will happen in year 2084. It would be scary if IoT devices are still around then.

We can save RAM and ROM. Furthermore, this overflow handling should block BACKUP power mode in order to keep track of the reference year.
2022-11-03 14:52:38 +01:00
Jue
5866262122 cpu/sam0/usbdev: generalize pm_layered interaction
periph_cpu.h should define the required pm modes.
Additionally, some CPUs require a certain pm mode in USB IDLE mode.
2022-11-03 14:27:47 +01:00
Jue
220be1da7e cpu/sam0/gpio: integrate pm_layered 2022-11-03 14:27:47 +01:00
Jue
ae9190da30 cpu/sam0/uart: integrate pm_layered 2022-11-03 14:27:47 +01:00
Jue
aa5ad12f37 cpu/sam0/uart: skip uart_write() if uart isn't active
Otherwise we get stuck in an endless loop ...
2022-11-03 14:27:47 +01:00