1
0
mirror of https://github.com/RIOT-OS/RIOT.git synced 2024-12-29 04:50:03 +01:00
RIOT/cpu
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
..
arm7_common cpu/arm7_common: drop cyclic include 2022-12-13 15:55:17 +01:00
atmega32u4 cpu/atmega_common: implement periph/gpio_ll{,_irq} 2022-05-02 14:44:55 +02:00
atmega128rfa1 cpu/atmega128rfa1/Kconfig: select default transceiver 2023-01-19 15:34:19 +01:00
atmega256rfr2 cpu/atmega256rfr2/Kconfig: select default transceiver 2023-01-19 15:34:19 +01:00
atmega328p cpu/atmega_common: implement periph/gpio_ll{,_irq} 2022-05-02 14:44:55 +02:00
atmega1281 cpu/atmega_common: implement periph/gpio_ll{,_irq} 2022-05-02 14:44:55 +02:00
atmega1284p cpu/atmega_common: implement periph/gpio_ll{,_irq} 2022-05-02 14:44:55 +02:00
atmega2560 cpu/atmega_common: implement periph/gpio_ll{,_irq} 2022-05-02 14:44:55 +02:00
atmega_common sys/flash_utils: add helpers for placing variables in flash 2023-02-27 12:31:03 +01:00
atxmega Merge pull request #18619 from maribu/core/mutex/cleanup 2022-10-03 10:58:07 +02:00
avr8_common cpu/avr8_common: Wrap stdio.h 2023-02-27 12:31:03 +01:00
cc26x0_cc13x0 cpu: call early_init() 2023-01-08 22:26:12 +01:00
cc26x2_cc13x2 cpu: call early_init() 2023-01-08 22:26:12 +01:00
cc26xx_cc13xx boards/common/cc26xx_cc13xx: Fix flashing with upstream OpenOCD 2023-01-10 22:39:35 +01:00
cc2538 cpu: call early_init() 2023-01-08 22:26:12 +01:00
cortexm_common cpu: Add TLS symbols for newer picolibc to linker scripts 2023-03-02 22:55:22 -08:00
efm32 cpu/efm32: add number of EPs provided by USB OTG peripheral 2023-03-12 13:15:44 +01:00
esp32 cpu/esp32: add number of EPs provided by USB OTG peripheral 2023-03-12 13:15:44 +01:00
esp8266 cpu/esp_common: use generic WIFI_SSID/WIFI_PASS defines 2023-02-17 15:32:03 +01:00
esp_common cpu/esp_common: rename ESP_WIFI_EAP_* -> WIFI_EAP_* 2023-02-17 16:59:29 +01:00
fe310 cpu: call early_init() 2023-01-08 22:26:12 +01:00
gd32v cpu/gd32v: add number of EPs provided by USB OTG peripheral 2023-03-12 13:15:44 +01:00
kinetis cpu: call early_init() 2023-01-08 22:26:12 +01:00
lm4f120 cpu: call early_init() 2023-01-08 22:26:12 +01:00
lpc23xx cpu: Add TLS symbols for newer picolibc to linker scripts 2023-03-02 22:55:22 -08:00
lpc1768 cpu: call early_init() 2023-01-08 22:26:12 +01:00
msp430_common cpu: call early_init() 2023-01-08 22:26:12 +01:00
msp430fxyz cpu/msp430: add Kconfig 2021-12-02 16:33:19 +01:00
native Merge #19343 #19349 #19353 #19361 #19363 2023-03-08 02:09:42 +00:00
nrf5x_common cpu/nrf5x_common: Implement timer_set() 2022-12-23 14:48:08 +01:00
nrf51 cpu: call early_init() 2023-01-08 22:26:12 +01:00
nrf52 cpu/nrf52: Add stall functions to usbdev 2023-02-28 11:00:05 +01:00
nrf9160 cpu: call early_init() 2023-01-08 22:26:12 +01:00
qn908x cpu: call early_init() 2023-01-08 22:26:12 +01:00
riscv_common Merge #19341 #19345 2023-03-04 22:00:55 +00:00
rpx0xx cpu: call early_init() 2023-01-08 22:26:12 +01:00
sam0_common sam0/usbdev: partial revert of #17086 2023-03-13 13:49:42 +01:00
sam3 cpu: call early_init() 2023-01-08 22:26:12 +01:00
sam_common cpu/sam_common: make use of cortexm.ld 2022-09-23 15:55:12 +02:00
samd5x cpu/sam0_common: move adc_res_t to common code 2023-01-17 17:18:07 +01:00
samd21 cpu/sam0_common: move adc_res_t to common code 2023-01-17 17:18:07 +01:00
saml1x cpu/sam0_common: move adc_res_t to common code 2023-01-17 17:18:07 +01:00
saml21 cpu/sam0_common: move adc_res_t to common code 2023-01-17 17:18:07 +01:00
stellaris_common
stm32 Merge #19371 #19382 2023-03-15 08:41:57 +00:00
doc.txt docs/doxygen : Add CPU section 2021-07-09 10:47:42 +02:00
Kconfig