50cd32fbbf
19397: drivers/usbdev_synopsys_dwc2: fix and reenable DMA mode r=benpicco a=gschorcht ### Contribution description This PR fixes the DMA mode for all STM32 USB OTG HS cores (including that for STM32F4xx CID 1.xxx) and reenables it. It fixes remaining problems in issue #19359. This PR includes also includes some changes that are needed to use the DMA mode: - EP number is used as defined in CMSIS (if defined) for STM32 - `periph_usbdev_hs` feature is added in Kconfig - `periph_usbdev_hs` feature is added in board definition of `stm32f429i-disc1` - largest number of available EPs is used for STM32 instead of the smallest number (to be able to use all EPs of HS peripheral) - `stm32f429i-disco` is removed from blacklist in `tests/usbus_cdc_ecm` since it uses the HS peripheral ### Testing procedure The following tests should work ```python USEMODULE=stdio_cdc_acm BOARD=stm32f429i-disc1 make -j8 -C tests/usbus_cdc_ecm flash ``` <details> <summary>Test results</summary> ```python [526755.875691] usb 1-2.2: new full-speed USB device number 106 using xhci_hcd [526755.977853] usb 1-2.2: config 1 interface 3 altsetting 1 endpoint 0x84 has invalid maxpacket 512, setting to 64 [526755.977856] usb 1-2.2: config 1 interface 3 altsetting 1 endpoint 0x2 has invalid maxpacket 512, setting to 64 [526755.978762] usb 1-2.2: New USB device found, idVendor=1209, idProduct=7d01, bcdDevice= 1.00 [526755.978764] usb 1-2.2: New USB device strings: Mfr=3, Product=2, SerialNumber=4 [526755.978766] usb 1-2.2: Product: stm32f429i-disc1 [526755.978768] usb 1-2.2: Manufacturer: RIOT-os.org [526755.978769] usb 1-2.2: SerialNumber: 7C156425A950A8EB [526755.991190] cdc_acm 1-2.2:1.0: ttyACM1: USB ACM device [526755.998131] cdc_ether 1-2.2:1.2 usb0: register 'cdc_ether' at usb-0000:00:14.0-2.2, CDC Ethernet Device, a6:f6:4a:85:1d:c9 [526756.044150] cdc_ether 1-2.2:1.2 enp0s20f0u2u2i2: renamed from usb0 ``` </details> ```python USEMODULE='stdio_cdc_acm periph_usbdev_hs_utmi' BOARD=stm32f723e-disco make -j8 -C tests/usbus_cdc_ecm flash ``` <details> <summary>Test results</summary> ```python [528733.480207] usb 1-4.3.4: reset high-speed USB device number 32 using xhci_hcd [528733.707800] usb 1-4.4: new high-speed USB device number 111 using xhci_hcd [528733.808257] usb 1-4.4: config 1 interface 0 altsetting 0 endpoint 0x81 has an invalid bInterval 255, changing to 11 [528733.808260] usb 1-4.4: config 1 interface 1 altsetting 0 bulk endpoint 0x1 has invalid maxpacket 64 [528733.808263] usb 1-4.4: config 1 interface 1 altsetting 0 bulk endpoint 0x82 has invalid maxpacket 64 [528733.808642] usb 1-4.4: New USB device found, idVendor=1209, idProduct=7d01, bcdDevice= 1.00 [528733.808645] usb 1-4.4: New USB device strings: Mfr=3, Product=2, SerialNumber=4 [528733.808647] usb 1-4.4: Product: stm32f723e-disco [528733.808649] usb 1-4.4: Manufacturer: RIOT-os.org [528733.808651] usb 1-4.4: SerialNumber: A6BAC4E1B1E0806B [528733.811988] cdc_acm 1-4.4:1.0: ttyACM1: USB ACM device [528733.814456] cdc_ether 1-4.4:1.2 usb0: register 'cdc_ether' at usb-0000:00:14.0-4.4, CDC Ethernet Device, e6:75:97:3a:74:ba [528733.854371] cdc_ether 1-4.4:1.2 enp0s20f0u4u4i2: renamed from usb0 ``` </details> ```python USEMODULE='stdio_cdc_acm periph_usbdev_hs_ulpi' BOARD=stm32f746g-disco make -j8 -C tests/usbus_cdc_ecm flash ``` <details> <summary>Test results</summary> ```python [529000.944482] usb 1-4.3.4: reset high-speed USB device number 32 using xhci_hcd [529003.728260] usb 1-4.4: new high-speed USB device number 114 using xhci_hcd [529003.833107] usb 1-4.4: config 1 interface 0 altsetting 0 endpoint 0x81 has an invalid bInterval 255, changing to 11 [529003.833111] usb 1-4.4: config 1 interface 1 altsetting 0 bulk endpoint 0x1 has invalid maxpacket 64 [529003.833113] usb 1-4.4: config 1 interface 1 altsetting 0 bulk endpoint 0x82 has invalid maxpacket 64 [529003.833743] usb 1-4.4: New USB device found, idVendor=1209, idProduct=7d00, bcdDevice= 1.00 [529003.833747] usb 1-4.4: New USB device strings: Mfr=3, Product=2, SerialNumber=4 [529003.833749] usb 1-4.4: Product: stm32f746g-disco [529003.833751] usb 1-4.4: Manufacturer: RIOT-os.org [529003.833753] usb 1-4.4: SerialNumber: 66FE8934D1A363E0 [529003.837143] cdc_acm 1-4.4:1.0: ttyACM1: USB ACM device [529003.839755] cdc_ether 1-4.4:1.2 usb0: register 'cdc_ether' at usb-0000:00:14.0-4.4, CDC Ethernet Device, 6a:88:1f:1f:b1:f0 [529003.879025] cdc_ether 1-4.4:1.2 enp0s20f0u4u4i2: renamed from usb0``` ``` </details> ### Issues/PRs references Fixes #19359 19416: cpu/rpx0xx/cmsis: Update vendor header files r=benpicco a=maribu ### Contribution description Generated new vendor header files from upstream SVD files using: ./SVDConv "$PICO_SDK_DIR"/src/rp2040/hardware_regs/rp2040.svd \ --generate=header --fields=macro --fields=enum Note: The missing `--fields=struct` flag resulted in the header no longer containing bit-fields to represent different fields within registers. While this would generally ease writing code, the RP2040 has the unpleasant feature of corrupting the remaining bits of the register when a write access that is not word-sized occurs in the memory mapped I/O area. This could happen e.g. when a bit field is byte-sized and byte-aligned. ### Testing procedure No binary changes (hopefully). ### Issues/PRs references This adds a few additional vendor defines, notably for USB. If anyone were to implement USB, this would be a requirement. 19418: cpu/gd32v: fix gpio_read in periph_gpio r=benpicco a=gschorcht ### Contribution description This PR fixes a bug in `gpio_read` which made `gpio_read` completely unusable! A small bug with big consequences. In `gpio_read` the combined port | pin_num parameter `pin` was used instead of the pin number `pin_num` for the call of `_pin_is_input`. This caused the problem that for example instead of accessing GPIOA->CTL0 with address 0x40010800, address 0x60018c00 was accessed. As a result, a pin was randomly detected as input or output and thus a result was arbitrarily returned. Approx. 50% of all inputs always returned LOW. I found this error by coincidence when I tried to find out why the BOOT0 button on a Sipeed Longan Nano is not usable as a button in RIOT. ### Testing procedure Flash `tests/periph_gpio` ``` BOARD=sipeed-longan-nano make -j8 -C tests/periph_gpio flash ``` and use commands ``` init_in 0 8 read 0 8 ``` Without this PR, the pin is always LOW. With the PR, the pin should be HIGH when the BOOT button is pressed. ### Issues/PRs references 19419: boards/sipeed-longan-nano: add BOOT as user button r=benpicco a=gschorcht ### Contribution description This PR makes the BOOT button usable as a user button. ### Testing procedure The test requires PR #19418 to work. Flash and test: ``` BOARD=sipeed-longan-nano make -j8 -C tests/saul flash term ``` The output ``` Dev: BOOT Type: SENSE_BTN Data: 0 ``` should change to ``` Dev: BOOT Type: SENSE_BTN Data: 1 ``` when the BOOT button is pressed. ### Issues/PRs references Depends on PR #19418 Co-authored-by: Gunar Schorcht <gunar@schorcht.net> Co-authored-by: Marian Buschsieweke <marian.buschsieweke@ovgu.de> |
||
---|---|---|
.. | ||
backtrace | ||
bench_msg_pingpong | ||
bench_mutex_pingpong | ||
bench_periph_gpio_ll | ||
bench_runtime_coreapis | ||
bench_sched_nop | ||
bench_sizeof_coretypes | ||
bench_sys_atomic_utils | ||
bench_sys_base64 | ||
bench_thread_flags_pingpong | ||
bench_thread_yield_pingpong | ||
bench_timers | ||
bench_xtimer | ||
bench_xtimer_load | ||
bench_ztimer | ||
bitarithm_timings | ||
blob | ||
bloom_bytes | ||
board_microbit | ||
build_system_cflags_spaces | ||
build_system_utils | ||
buttons | ||
c11_atomics_cpp_compat | ||
can_trx | ||
candev | ||
cb_mux | ||
cb_mux_bench | ||
cond_order | ||
congure_abe | ||
congure_quic | ||
congure_reno | ||
congure_test | ||
conn_can | ||
cortexm_common_ldscript | ||
cpp11_condition_variable | ||
cpp11_mutex | ||
cpp11_thread | ||
cpp_ctors | ||
cpp_exclude | ||
cpp_ext | ||
cpu_avr8_xmega_drivers | ||
cpu_cortexm_address_check | ||
cpu_efm32_drivers | ||
cpu_efm32_features | ||
dbgpin | ||
deferred_yield_higher | ||
devfs | ||
disp_dev | ||
driver_ad7746 | ||
driver_adcxx1c | ||
driver_ads101x | ||
driver_adt7310 | ||
driver_adxl345 | ||
driver_aip31068 | ||
driver_apa102 | ||
driver_apds99xx | ||
driver_apds99xx_full | ||
driver_at | ||
driver_at24cxxx | ||
driver_at24mac | ||
driver_at25xxx | ||
driver_at30tse75x | ||
driver_at86rf2xx | ||
driver_at86rf2xx_aes | ||
driver_at86rf215 | ||
driver_ata8520e | ||
driver_atwinc15x0 | ||
driver_bh1750 | ||
driver_bh1900nux | ||
driver_bme680 | ||
driver_bmp180 | ||
driver_bmx055 | ||
driver_bmx280 | ||
driver_bq2429x | ||
driver_cc110x | ||
driver_cc2420 | ||
driver_cc2538_rf | ||
driver_ccs811 | ||
driver_ccs811_full | ||
driver_cst816s | ||
driver_dac_dds | ||
driver_dcf77 | ||
driver_dfplayer | ||
driver_dht | ||
driver_dose | ||
driver_ds18 | ||
driver_ds75lx | ||
driver_ds1307 | ||
driver_ds3231 | ||
driver_ds3234 | ||
driver_dsp0401 | ||
driver_dynamixel | ||
driver_edbg_eui | ||
driver_enc28j60 | ||
driver_encx24j600 | ||
driver_epd_bw_spi | ||
driver_epd_bw_spi_disp_dev | ||
driver_esp_eth | ||
driver_ethos | ||
driver_feetech | ||
driver_ft5x06 | ||
driver_fxos8700 | ||
driver_gp2y10xx | ||
driver_grove_ledbar | ||
driver_hd44780 | ||
driver_hdc1000 | ||
driver_hih6130 | ||
driver_hm330x | ||
driver_hmc5883l | ||
driver_hsc | ||
driver_hts221 | ||
driver_ili9341 | ||
driver_ina2xx | ||
driver_ina3221 | ||
driver_io1_xplained | ||
driver_ir_nec | ||
driver_isl29020 | ||
driver_isl29125 | ||
driver_itg320x | ||
driver_jc42 | ||
driver_kw2xrf | ||
driver_l3g4200d | ||
driver_l3gxxxx | ||
driver_lc709203f | ||
driver_lis2dh12 | ||
driver_lis3dh | ||
driver_lis3mdl | ||
driver_lm75 | ||
driver_lpd8808 | ||
driver_lpsxxx | ||
driver_lsm6dsl | ||
driver_lsm303dlhc | ||
driver_ltc4150 | ||
driver_mag3110 | ||
driver_matrix_keypad | ||
driver_mcp47xx | ||
driver_mfrc522 | ||
driver_mhz19 | ||
driver_mma8x5x | ||
driver_mma7660 | ||
driver_motor_driver | ||
driver_mpl3115a2 | ||
driver_mpu9x50 | ||
driver_mq3 | ||
driver_mrf24j40 | ||
driver_my9221 | ||
driver_netdev_common | ||
driver_nrf24l01p_lowlevel | ||
driver_nrf24l01p_ng | ||
driver_nrf802154 | ||
driver_nrfmin | ||
driver_nvram_spi | ||
driver_opt3001 | ||
driver_pca9633 | ||
driver_pca9685 | ||
driver_pcd8544 | ||
driver_pcf857x | ||
driver_ph_oem | ||
driver_pir | ||
driver_pn532 | ||
driver_pulse_counter | ||
driver_qmc5883l | ||
driver_rn2xx3 | ||
driver_sam0_eth | ||
driver_scd30 | ||
driver_sdcard_spi | ||
driver_sdp3x | ||
driver_sds011 | ||
driver_seesaw_soil | ||
driver_servo | ||
driver_sgp30 | ||
driver_sht1x | ||
driver_sht2x | ||
driver_sht3x | ||
driver_shtcx | ||
driver_si70xx | ||
driver_si114x | ||
driver_si1133 | ||
driver_sm_pwm_01c | ||
driver_soft_spi | ||
driver_soft_uart | ||
driver_sps30 | ||
driver_srf02 | ||
driver_srf04 | ||
driver_srf08 | ||
driver_st7735 | ||
driver_stm32_eth | ||
driver_stmpe811 | ||
driver_sx126x | ||
driver_sx127x | ||
driver_sx1280 | ||
driver_tcs37727 | ||
driver_tmp00x | ||
driver_tps6274x | ||
driver_tsl2561 | ||
driver_tsl4531x | ||
driver_vcnl40x0 | ||
driver_veml6070 | ||
driver_vl6180x | ||
driver_w5100 | ||
driver_ws281x | ||
driver_xbee | ||
eepreg | ||
embunit | ||
emcute | ||
entropy_source | ||
event_periodic_callback | ||
event_source | ||
event_thread_shared | ||
event_threads | ||
event_wait_timeout | ||
event_wait_timeout_ztimer | ||
event_ztimer | ||
events | ||
evtimer_mbox | ||
evtimer_msg | ||
evtimer_underflow | ||
external_board_dirs | ||
external_board_native | ||
external_module_dirs | ||
external_pkg_dirs | ||
fault_handler | ||
float | ||
fmt_print | ||
frac-config | ||
gcoap_dns | ||
gcoap_fileserver | ||
gnrc_dhcpv6_client | ||
gnrc_dhcpv6_client_6lbr | ||
gnrc_dhcpv6_client_stateless | ||
gnrc_dhcpv6_relay | ||
gnrc_gomach | ||
gnrc_ipv6_ext | ||
gnrc_ipv6_ext_frag | ||
gnrc_ipv6_ext_opt | ||
gnrc_ipv6_fwd_w_sub | ||
gnrc_ipv6_nib | ||
gnrc_ipv6_nib_6ln | ||
gnrc_ipv6_nib_dns | ||
gnrc_lorawan | ||
gnrc_lorawan_11 | ||
gnrc_lwmac | ||
gnrc_mac_timeout | ||
gnrc_ndp | ||
gnrc_netif | ||
gnrc_netif_ieee802154 | ||
gnrc_netif_ipv6_wait_for_global_address | ||
gnrc_rpl | ||
gnrc_rpl_p2p | ||
gnrc_rpl_srh | ||
gnrc_sixlowpan | ||
gnrc_sixlowpan_frag | ||
gnrc_sixlowpan_frag_minfwd | ||
gnrc_sixlowpan_frag_sfr | ||
gnrc_sixlowpan_frag_sfr_congure | ||
gnrc_sixlowpan_frag_sfr_congure_impl | ||
gnrc_sixlowpan_iphc_w_vrb | ||
gnrc_sock_async_event | ||
gnrc_sock_dns | ||
gnrc_sock_dodtls | ||
gnrc_sock_ip | ||
gnrc_sock_neterr | ||
gnrc_sock_tcp | ||
gnrc_sock_udp | ||
gnrc_tcp | ||
gnrc_tx_sync | ||
gnrc_udp | ||
heap_cmd | ||
ieee802154_hal | ||
ieee802154_security | ||
ieee802154_submac | ||
irq | ||
irq_cpp | ||
irq_disable_restore | ||
isr_yield_higher | ||
kconfig | ||
kconfig_features | ||
l2util | ||
leds | ||
libc_newlib | ||
log_color | ||
log_printfnoformat | ||
lua_loader | ||
lwip | ||
lwip_sock_ip | ||
lwip_sock_tcp | ||
lwip_sock_udp | ||
malloc | ||
malloc_thread_safety | ||
mcuboot | ||
memarray | ||
minimal | ||
mpu_noexec_ram | ||
mpu_stack_guard | ||
msg_avail | ||
msg_queue_capacity | ||
msg_queue_print | ||
msg_send_receive | ||
msg_try_receive | ||
mtd_at24cxxx | ||
mtd_at25xxx | ||
mtd_flashpage | ||
mtd_mapper | ||
mtd_raw | ||
mutex_cancel | ||
mutex_order | ||
mutex_unlock_and_sleep | ||
nanocoap_cli | ||
netdev_test | ||
netstats_l2 | ||
netstats_neighbor | ||
netutils | ||
nimble_autoconn_ccnl | ||
nimble_autoconn_gnrc | ||
nimble_autoconn_gnrc_ext | ||
nimble_esp_wifi_coexist | ||
nimble_ext_adv | ||
nimble_l2cap | ||
nimble_l2cap_server | ||
nimble_netif_ext | ||
nimble_rpble_gnrc | ||
nimble_rpble_gnrc_ext | ||
nimble_statconn_gnrc | ||
nimble_statconn_gnrc_ext | ||
od | ||
pbkdf2 | ||
periph_adc | ||
periph_backup_ram | ||
periph_cpuid | ||
periph_dac | ||
periph_dma | ||
periph_eeprom | ||
periph_flashpage | ||
periph_flashpage_unittest | ||
periph_gpio | ||
periph_gpio_arduino | ||
periph_gpio_ll | ||
periph_hwrng | ||
periph_i2c | ||
periph_ltdc | ||
periph_pm | ||
periph_ptp_clock | ||
periph_ptp_timer | ||
periph_pwm | ||
periph_qdec | ||
periph_rtc | ||
periph_rtt | ||
periph_rtt_min | ||
periph_spi | ||
periph_spi_dma | ||
periph_timer | ||
periph_timer_periodic | ||
periph_timer_short_relative_set | ||
periph_uart | ||
periph_uart_mode | ||
periph_uart_nonblocking | ||
periph_vbat | ||
periph_wdt | ||
phydat_dump | ||
phydat_unix | ||
pipe | ||
pkg_arduino_adafruit_sensor | ||
pkg_arduino_sdi_12 | ||
pkg_c25519 | ||
pkg_cayenne-lpp | ||
pkg_cifra | ||
pkg_cmsis-dsp | ||
pkg_cmsis-nn | ||
pkg_cn-cbor | ||
pkg_corejson | ||
pkg_cryptoauthlib_compare_sha256 | ||
pkg_cryptoauthlib_internal-tests | ||
pkg_edhoc_c | ||
pkg_elk | ||
pkg_emlearn | ||
pkg_etl | ||
pkg_fatfs | ||
pkg_fatfs_vfs | ||
pkg_fff | ||
pkg_flashdb_mtd | ||
pkg_flashdb_vfs | ||
pkg_flatbuffers | ||
pkg_hacl | ||
pkg_heatshrink | ||
pkg_jsmn | ||
pkg_libb2 | ||
pkg_libbase58 | ||
pkg_libcose | ||
pkg_libcose_encrypt | ||
pkg_libfixmath | ||
pkg_libfixmath_unittests | ||
pkg_libhydrogen | ||
pkg_libschc | ||
pkg_littlefs | ||
pkg_littlefs2 | ||
pkg_lora-serialization | ||
pkg_lvgl | ||
pkg_lvgl_touch | ||
pkg_lz4 | ||
pkg_mbedtls | ||
pkg_micro-ecc | ||
pkg_micro-ecc-with-hwrng | ||
pkg_microcoap | ||
pkg_minmea | ||
pkg_monocypher | ||
pkg_nanocbor | ||
pkg_nanopb | ||
pkg_nanors | ||
pkg_openwsn | ||
pkg_openwsn_sock_udp | ||
pkg_qcbor | ||
pkg_qdsa | ||
pkg_qr-code-generator | ||
pkg_relic | ||
pkg_semtech-loramac | ||
pkg_spiffs | ||
pkg_tflite-micro | ||
pkg_tiny-asn1 | ||
pkg_tinycbor | ||
pkg_tinycrypt | ||
pkg_tinydtls_sock_async | ||
pkg_tinyusb_cdc_acm_stdio | ||
pkg_tinyusb_cdc_msc | ||
pkg_tinyusb_netdev | ||
pkg_tinyvcdiff | ||
pkg_tweetnacl | ||
pkg_u8g2 | ||
pkg_ubasic | ||
pkg_ucglib | ||
pkg_umorse | ||
pkg_utensor | ||
pkg_uzlib | ||
pkg_wolfcrypt-ed25519-verify | ||
pkg_wolfssl | ||
pkg_yxml | ||
posix_semaphore | ||
posix_sleep | ||
prng_sha1prng | ||
prng_sha256prng | ||
progress_bar | ||
ps_schedstatistics | ||
pthread | ||
pthread_barrier | ||
pthread_cleanup | ||
pthread_condition_variable | ||
pthread_cooperation | ||
pthread_flood | ||
pthread_rwlock | ||
pthread_tls | ||
puf_sram | ||
riotboot | ||
riotboot_flashwrite | ||
riotboot_hdr | ||
rmutex | ||
rmutex_cpp | ||
rng | ||
rust_libs | ||
rust_minimal | ||
saul | ||
saul_drivers | ||
sched_change_priority | ||
sched_testing | ||
sema | ||
senml_cbor | ||
senml_phydat | ||
senml_saul | ||
shell | ||
shell_ble | ||
shell_lock | ||
slip | ||
sntp | ||
sock_udp_aux | ||
socket_zep | ||
ssp | ||
stdin | ||
stm32_bootloader | ||
struct_tm_utility | ||
suit_manifest | ||
sys_architecture | ||
sys_arduino | ||
sys_arduino_analog | ||
sys_arduino_lib | ||
sys_atomic_utils | ||
sys_atomic_utils_unittests | ||
sys_crypto | ||
sys_crypto_aes_ccm | ||
sys_fido2_ctap | ||
sys_ptrtag | ||
sys_sched_round_robin | ||
sys_sema_inv | ||
sys_stdio_semihosting | ||
test_tools | ||
thread_basic | ||
thread_cooperation | ||
thread_exit | ||
thread_flags | ||
thread_flags_xtimer | ||
thread_float | ||
thread_flood | ||
thread_msg | ||
thread_msg_block_race | ||
thread_msg_block_w_queue | ||
thread_msg_block_wo_queue | ||
thread_msg_bus | ||
thread_msg_seq | ||
thread_priority_inversion | ||
thread_race | ||
thread_stack_alignment | ||
thread_zombie | ||
touch_dev | ||
trace | ||
trickle | ||
turo | ||
turo_txt | ||
unittests | ||
usbus | ||
usbus_board_reset | ||
usbus_cdc_acm_stdio | ||
usbus_cdc_ecm | ||
usbus_hid | ||
usbus_msc | ||
vfs_default | ||
vfs_iterate_mount | ||
vfs_plus_stdio | ||
warn_conflict | ||
xfa | ||
xtimer_drift | ||
xtimer_hang | ||
xtimer_longterm | ||
xtimer_msg | ||
xtimer_msg_receive_timeout | ||
xtimer_mutex_lock_timeout | ||
xtimer_now32_overflow | ||
xtimer_now64_continuity | ||
xtimer_now_irq | ||
xtimer_overhead | ||
xtimer_periodic_wakeup | ||
xtimer_remove | ||
xtimer_reset | ||
xtimer_rmutex_lock_timeout | ||
xtimer_usleep | ||
xtimer_usleep_short | ||
ztimer64_msg | ||
ztimer_msg | ||
ztimer_mutex_lock_timeout | ||
ztimer_ondemand_benchmark | ||
ztimer_overhead | ||
ztimer_periodic | ||
ztimer_rmutex_lock_timeout | ||
ztimer_underflow | ||
ztimer_xsec | ||
.gitignore | ||
Makefile.boards.netif | ||
Makefile.tests_common | ||
README.md | ||
riot_logo.h | ||
test_print_stack_usage.config | ||
test_utils.config |
Running and creating tests
There are a number of tests included in RIOT. They are located in the tests folder. These tests allow basic functionality to be verified as well as provide an example of usage.
Running automated tests
Some tests can be performed automatically. The test automation scripts are
defined in the <test_application>/tests/
folder. They are written in python
and interact through the serial (typically UART) with the test application code running on a
board to do the validation. It is recommended to flash the board with the
test just before running it because some platforms cannot be reset while
testing.
Running single test
From the test application directory run:
BOARD=<board_of_your_choice> make flash test
An automated way of knowing if a test is available is to execute the 'test/available' target from the test application directory. It executes without error if tests run by 'make test' are present.
make test/available
Running all test for particular board
If you would like execute all tests for given board, you could use dedicated
script compile_and_test_for_board.py
Go to main RIOT directory and execute command:
./dist/tools/compile_and_test_for_board/compile_and_test_for_board.py . <board_of_your_choice> --with-test-only --jobs=4
More details concerning other available parameters provided by this tool can be found in README.md file and directly in compile_and_test_for_board.py script.
Running tests that require a preliminary manual configuration
Some tests need active monitoring or manual setup steps but still have some
automated scripts. The test automation scripts are defined in the
<test_application>/tests-with-config/
folder.
For running them, follow the setup or analysis documentation and use the
test-with-config
target.
Running tests that require root privileges
Some tests require root privileges to launch their automated script. In this
case, the test automation scripts are defined in the
<test_application>/tests-as-root/
folder.
For running them, follow the setup or analysis documentation and use the
test-as-root
target.
Cleaning intermediate files
After test execution intermediate files are not automatically deleted. Execution of multiple tests, especially all for particular board could generate many files. For example, after execution of all test for stm32f469i-disco board (more than 230 tests) around 7.5 GB of intermediate files are created.
There are few methods for cleaning intermediate files.
If you would like to clean intermediate file only for particular board you should go to main RIOT directory and execute one from these commands:
./dist/tools/compile_and_test_for_board/compile_and_test_for_board.py . <board_of_your_choice> --compile-targets clean
or
make BOARD=<board_of_your_choice> clean
If you would like to clean intermediate files for all boards go to main RIOT directory and use this command.
@warning This command cleans all local files, for example, pkg downloads and locally generared docs.
make distclean
Implementing automated tests
The goal is to be able to run all tests in a sequential way for as many targets as possible.
As some board can't be reset without a manual trigger tests should be implemented
with some kind of synchronization
. This can be done in two ways:
- use
test_utils_interactive_sync
when uart input/output does not need to be disabled for the test. This is enabled by default. - set up the test in a loop so the test script will be able so sync with some kind of start condition in the test.
The module for the first option is test_utils_interactive_sync
and is set as a
default module in Makefile.tests_common
. It can be disabled by setting in the
application makefile DISABLE_MODULE += test_utils_interactive_sync
. The python
test script will adapt to it automatically.
When using the shell
module, test_utils_interactive_sync
will use the shell
itself to synchronize, and will not use test_utils_interactive_sync();
function
to synchronize. Some times you will want to synchronize before the start of the
script and use test_utils_interactive_sync();
function (e.g.:
tests/ps_schedstatistics). For these cases
you can disable test_utils_interactive_sync_shell
module in the application
Makefile
: DISABLE_MODULE += test_utils_interactive_sync_shell
.
Automated Tests Guidelines
When using pexpect
$
is useless for matching the end of a line, instead use
\r\n
(pexpect end-of-line).
Beware of +
and *
at the end of patterns. These patterns will always get
a minimal match (non-greedy).(pexpect end-of-patterns)
This can be an issue when matching groups and using the matched groups to verify
some kind of behavior since *
could return an empty match and +
only a subset.
This is especially prevalent since printf()
is buffered so the output might not
arrive in a single read to pexpect
.
To avoid this make sure to match a non-ambiguous character at the end of the
pattern like \r\n
, \s
, \)
, etc..
don't:
child.expect(r'some string: (\d+)')
do:
child.expect(r'some string: (\d+)\r\n')
child.expect(r'some string: (\d+)\s')
child.expect(r'some string: (\d+) ,')
Use expect() instead of assert()
In order to make a test application functional in all cases, use expect()
instead of assert()
. The former works like the latter, but will still be
compiled in if NDEBUG
is defined. This is useful to keep a test application
working even when compiling with -DNDEBUG, allowing for the code-under-test to
be compiled with that flag. Otherwise, the application would force compiling
all tested code with assertions enabled.
expect()
is defined in the header test_utils/expect.h
.
Interaction through the uart
Tests implemented with testrunner
use the cleanterm
target that
provides an interaction without adding extra text output or input handling.
It can currently be expected to have unmodified line based interaction with the
board.
The expected behavior is verified with the test in tests/test_tools
.
Tests cannot rely on having on all boards and terminal programs:
- unbuffered input
- allowing sending special characters like
ctrl+c/ctrl+d