Merge commit '3390ee87be2cba79d7bcccf3dd58ae0672daf728' into pull/fca7ed39434b4f7386110050314f29a21181e40f/3390ee87be2cba79d7bcccf3dd58ae0672daf728

This commit is contained in:
riot 2022-02-08 09:53:53 +00:00
commit 331c04976d
152 changed files with 3610 additions and 698 deletions

View File

@ -33,6 +33,10 @@ jobs:
fail-fast: false
matrix:
boards:
- riot: dwm1001
iotlab:
archi: dwm1001:dw1000
site: saclay
- riot: iotlab-m3
iotlab:
archi: m3:at86rf231
@ -49,18 +53,22 @@ jobs:
iotlab:
archi: nrf52840dk:multi
site: saclay
- riot: dwm1001
iotlab:
archi: dwm1001:dw1000
site: saclay
- riot: nrf52832-mdk
iotlab:
archi: nrf52832mdk:ble
site: saclay
- riot: nucleo-wl55jc
iotlab:
archi: nucleo-wl55jc:stm32wl
site: grenoble
- riot: samr21-xpro
iotlab:
archi: samr21:at86rf233
site: saclay
- riot: samr34-xpro
iotlab:
archi: samr34:sx1276
site: grenoble
- riot: b-l072z-lrwan1
iotlab:
archi: st-lrwan1:sx1276
@ -74,10 +82,6 @@ jobs:
env:
IOTLAB_NODE: auto
BUILD_IN_DOCKER: 1
# Force .bin files generation because these files are used to flash on IoT-LAB and
# because compile_and_test_for_board forces RIOT_CI_BUILD which skip .bin
# files generation
DOCKER_ENVIRONMENT_CMDLINE: -e BUILD_FILES=\$$\(BINFILE\)
COMPILE_AND_TEST_FOR_BOARD: ./dist/tools/compile_and_test_for_board/compile_and_test_for_board.py
COMPILE_AND_TEST_ARGS: --with-test-only --jobs=2 --report-xml
# Exclude applications that are expected to fail or cannot run on iotlab

View File

@ -1,7 +1,7 @@
#!/bin/sh
# uncomment and change this to limit builds, e.g.,
#export BOARDS="samr21-xpro native"
export BOARDS="samr21-xpro native"
# and / or
#export APPS="examples/hello-world tests/unittests"
@ -105,27 +105,21 @@ tests/ieee802154_hal
# As a rule of thumb, only add boards here if there are not differences in
# modules or packages.
# Eventually this list will be removed...
#
# msbiot and pyboard are on the list as kconfig tunes the pll due to different
# HSE values from the standard, this is not the case in makefile.
: ${TEST_KCONFIG_BOARD_BLOCKLIST:="
6lowpan-clicker
esp32-wrover-kit
esp8266-esp-12x
esp8266-olimex-mod
esp8266-sparkfun-thing
limifrog-v1
lora-e5-dev
msbiot
msb-430h
nucleo-l011k4
nucleo-wl55jc
omote
openmote-b
pic32-wifire
esp32-wrover-kit
esp8266-olimex-mod
msbiot
pyboard
remote-pa
samd10-xmini
stk3200
stm32f030f4-demo
stm32f3discovery
lora-e5-dev
nucleo-wl55jc
stm32mp157c-dk2
"}
@ -382,7 +376,7 @@ get_compile_jobs() {
get_apps | \
maybe_filter_changed_apps | \
dwqc ${DWQ_ENV} -s \
dwqc ${DWQ_ENV} --queue default-first -s \
${DWQ_JOBID:+--subjob} \
"$0 get_app_board_toolchain_pairs \${1} $0 compile"
}

View File

@ -97,8 +97,8 @@ compile-commands: | $(DIRS:%=COMPILE-COMMANDS--%)
$(file >>$(BINDIR)/$(MODULE)/compile_cmds.txt,TARGET_ARCH: $(TARGET_ARCH))
$(file >>$(BINDIR)/$(MODULE)/compile_cmds.txt,TARGET_ARCH_LLVM: $(TARGET_ARCH_LLVM))
# include makefile snippets for packages in $(USEPKG) that modify GENSRC:
-include $(USEPKG:%=$(RIOTPKG)/%/Makefile.gensrc)
# include makefile snippets for packages in $(PKG_PATHS) that modify GENSRC:
-include $(PKG_PATHS:%=%Makefile.gensrc)
GENOBJC := $(GENSRC:%.c=%.o)
OBJC_LTO := $(SRC:%.c=$(BINDIR)/$(MODULE)/%.o)

View File

@ -10,7 +10,7 @@
# include external modules dependencies
# processed before RIOT ones to be evaluated before the 'default' rules.
-include $(EXTERNAL_MODULE_PATHS:%=%/Makefile.dep)
-include $(EXTERNAL_MODULE_PATHS:%=%Makefile.dep)
# pull dependencies from sys and drivers
include $(RIOTBASE)/sys/Makefile.dep
@ -20,7 +20,7 @@ include $(RIOTBASE)/drivers/Makefile.dep
-include $(sort $(USEMODULE:%=$(RIOTBASE)/drivers/%/Makefile.dep))
# pull dependencies from packages
-include $(USEPKG:%=$(RIOTPKG)/%/Makefile.dep)
-include $(PKG_PATHS:%=%Makefile.dep)
ifneq (,$(filter mpu_stack_guard,$(USEMODULE)))
FEATURES_REQUIRED += cortexm_mpu

View File

@ -386,6 +386,17 @@ ifneq (,$(IOTLAB_NODE))
PROGRAMMER ?= iotlab
# iotlab uses ELFFILE by default for flashing boards.
FLASHFILE ?= $(ELFFILE)
# RIOT_CI_BUILD disables the build of BINFILE which is required for flashing
# on IoT-LAB
ifeq (1,$(RIOT_CI_BUILD))
BUILD_FILES += $(BINFILE)
endif
# Disable IOTLAB_NODE if inside Docker to avoid including the
# iotlab.single.inc.mk file which is useless there: it's only useful for
# flashing and this is done outside of Docker.
ifeq (1,$(INSIDE_DOCKER))
IOTLAB_NODE :=
endif
endif
# Add standard include directories
@ -416,6 +427,12 @@ ifeq (1,$(TEST_KCONFIG))
USEMODULE := $(KCONFIG_MODULES)
KCONFIG_PACKAGES := $(call lowercase,$(patsubst CONFIG_PACKAGE_%,%,$(filter CONFIG_PACKAGE_%,$(.VARIABLES))))
USEPKG := $(KCONFIG_PACKAGES)
# Locate used packages in $(RIOTPKG).
PKG_PATHS := $(sort $(foreach dir,$(RIOTPKG),\
$(foreach pkg,$(USEPKG),$(dir $(wildcard $(dir)/$(pkg)/Makefile)))))
EXTERNAL_MODULE_PATHS := $(dir $(EXTERNAL_MODULE_KCONFIGS))
else
# always select provided architecture features
FEATURES_REQUIRED += $(filter arch_%,$(FEATURES_PROVIDED))
@ -559,11 +576,11 @@ include $(RIOTBASE)/sys/Makefile.include
# include Makefile.includes of each driver modules if they exist
-include $(USEMODULE:%=$(RIOTBASE)/drivers/%/Makefile.include)
# include Makefile.includes for packages in $(USEPKG)
-include $(USEPKG:%=$(RIOTPKG)/%/Makefile.include)
# include Makefile.includes for packages in $(PKG_PATHS)
-include $(PKG_PATHS:%=%Makefile.include)
# include external modules configuration
-include $(EXTERNAL_MODULE_PATHS:%=%/Makefile.include)
-include $(EXTERNAL_MODULE_PATHS:%=%Makefile.include)
# Deduplicate includes without sorting them
# see https://stackoverflow.com/questions/16144115/makefile-remove-duplicate-words-without-sorting
@ -760,31 +777,30 @@ endif
# The `clean` needs to be serialized before everything else.
all $(BASELIBS) $(ARCHIVES) $(BUILDDEPS) ..in-docker-container: | $(CLEAN)
.PHONY: pkg-prepare pkg-build pkg-build-%
.PHONY: pkg-prepare pkg-build
pkg-prepare:
-@for i in $(USEPKG) ; do "$(MAKE)" -C $(RIOTPKG)/$$i prepare ; done
-@$(foreach dir,$(PKG_PATHS),"$(MAKE)" -C $(dir) prepare $(NEWLINE))
pkg-build: $(USEPKG:%=pkg-build-%)
pkg-build-%: $(BUILDDEPS)
$(QQ)"$(MAKE)" -C $(RIOTPKG)/$*
pkg-build: $(BUILDDEPS)
$(foreach dir,$(PKG_PATHS),$(QQ)"$(MAKE)" -C $(dir) $(NEWLINE))
clean:
ifndef MAKE_RESTARTS
-@for i in $(USEPKG) ; do "$(MAKE)" -C $(RIOTPKG)/$$i clean ; done
-@$(foreach dir,$(PKG_PATHS),"$(MAKE)" -C $(dir) clean $(NEWLINE))
-@rm -rf $(BINDIR)
-@rm -rf $(SCANBUILD_OUTPUTDIR)
endif
# Remove intermediates, but keep the .elf, .hex and .map etc.
clean-intermediates:
-@for i in $(USEPKG) ; do "$(MAKE)" -C $(RIOTPKG)/$$i distclean ; done
-@$(foreach dir,$(PKG_PATHS),"$(MAKE)" -C $(dir) distclean $(NEWLINE))
-@rm -rf $(BINDIR)/*.a $(BINDIR)/*/
clean-pkg:
-@for i in $(USEPKG) ; do "$(MAKE)" -C $(RIOTPKG)/$$i distclean ; done
-@$(foreach dir,$(PKG_PATHS),"$(MAKE)" -C $(dir) distclean $(NEWLINE))
distclean:
-@for i in $(USEPKG) ; do "$(MAKE)" -C $(RIOTPKG)/$$i distclean ; done
-@$(foreach dir,$(PKG_PATHS),"$(MAKE)" -C $(dir) distclean $(NEWLINE))
-@rm -rf $(BINDIRBASE)
# Include PROGRAMMER_FLASH/PROGRAMMER_RESET variables

View File

@ -40,7 +40,6 @@ static const mtd_spi_nor_params_t _samd51_nor_params = {
.cs = SAM0_QSPI_PIN_CS,
.wp = SAM0_QSPI_PIN_DATA_2,
.hold = SAM0_QSPI_PIN_DATA_3,
.addr_width = 3,
};
static mtd_spi_nor_t samd51_nor_dev = {

View File

@ -40,7 +40,6 @@ static const mtd_spi_nor_params_t _weact_nor_params = {
.cs = WEACT_4X1CX_NOR_SPI_CS,
.wp = GPIO_UNDEF,
.hold = GPIO_UNDEF,
.addr_width = 3,
};
static mtd_spi_nor_t weact_nor_dev = {

View File

@ -19,5 +19,5 @@ FEATURES_PROVIDED += arduino
# This configuration enables modules that are only available when using Kconfig
# module modelling
ifeq (1, $(TEST_KCONFIG))
KCONFIG_ADD_CONFIG += $(BOARDDIR)/esp32-wrover-kit.config
KCONFIG_BOARD_CONFIG += $(BOARDDIR)/esp32-wrover-kit.config
endif

View File

@ -59,9 +59,11 @@ extern "C" {
* @{
**/
#define SX127X_PARAM_SPI SPI_DEV(0)
#if defined(BOARD_FEATHER_M0_LORA)
#define SX127X_PARAM_SPI_NSS GPIO_PIN(PA, 6)
#define SX127X_PARAM_RESET GPIO_PIN(PA, 8)
#define SX127X_PARAM_DIO0 GPIO_PIN(PA, 9)
#endif
#define SX127X_PARAM_DIO1 GPIO_UNDEF
#define SX127X_PARAM_DIO2 GPIO_UNDEF
#define SX127X_PARAM_DIO3 GPIO_UNDEF

View File

@ -38,7 +38,6 @@ static const mtd_spi_nor_params_t _ikea_tradfri_nor_params = {
.cs = IKEA_TRADFRI_NOR_SPI_CS,
.wp = GPIO_UNDEF,
.hold = GPIO_UNDEF,
.addr_width = 3,
};
static mtd_spi_nor_t ikea_tradfri_nor_dev = {

View File

@ -40,7 +40,6 @@ static const mtd_spi_nor_params_t _mtd_nor_params = {
.cs = GPIO_PIN(PORT_A, 11),
.wp = GPIO_PIN(PORT_C, 6),
.hold = GPIO_PIN(PORT_C, 9),
.addr_width = 3,
};
static mtd_spi_nor_t mtd_nor_dev = {

View File

@ -19,4 +19,6 @@ config BOARD_LIMIFROG_V1
select HAS_PERIPH_TIMER
select HAS_PERIPH_UART
select HAVE_LIS3MDL
source "$(RIOTBOARD)/common/stm32/Kconfig"

View File

@ -16,5 +16,6 @@ config BOARD_MSB_430H
select HAS_PERIPH_TIMER
select HAS_PERIPH_UART
select BOARD_COMMON_MSB_430
select HAVE_SHT11
source "$(RIOTBOARD)/common/msb-430/Kconfig"

View File

@ -27,4 +27,7 @@ config BOARD_MSBIOT
select BOARD_HAS_HSE
select BOARD_HAS_LSE
select HAVE_MPU9150
select HAVE_SAUL_GPIO
source "$(RIOTBOARD)/common/stm32/Kconfig"

View File

@ -56,7 +56,6 @@ static const mtd_spi_nor_params_t mulle_nor_params = {
.wait_32k_erase = 20LU * US_PER_MS,
.wait_chip_wake_up = 1LU * US_PER_MS,
.spi = MULLE_NOR_SPI_DEV,
.addr_width = 3,
.mode = SPI_MODE_3,
.cs = MULLE_NOR_SPI_CS,
.wp = GPIO_UNDEF,

View File

@ -40,7 +40,6 @@ static const mtd_spi_nor_params_t _nrf52840dk_nor_params = {
.cs = NRF52840DK_NOR_SPI_CS,
.wp = GPIO_UNDEF,
.hold = GPIO_UNDEF,
.addr_width = 3,
};
static mtd_spi_nor_t nrf52840dk_nor_dev = {

View File

@ -18,3 +18,7 @@ config BOARD_OMOTE
select HAS_PERIPH_TIMER
select HAS_PERIPH_UART
select HAS_RIOTBOOT
select HAVE_SAUL_GPIO
select HAVE_BMP180
select HAVE_ADXL345

View File

@ -18,3 +18,6 @@ config BOARD_OPENMOTE_B
select HAS_PERIPH_TIMER
select HAS_PERIPH_UART
select HAS_RIOTBOOT
select HAVE_SI7006
select HAVE_SAUL_GPIO

View File

@ -1,6 +1,6 @@
/**
@defgroup boards_p-nucleo-wb55 STM32 p-nucleo-wb55
@ingroup boards_common_nucleo
@ingroup boards
@brief Support for the STM32 p-nucleo-wb55
Hardware
@ -45,11 +45,7 @@ Flashing the device
-------------------
The ST p-nucleo-wb55 board includes an on-board ST-LINK programmer and can be
flashed using OpenOCD.
@note The latest release of OpenOCD doesn't contain support for this board,
so a recent development version must be built from source to be able to flash
this board.
flashed using OpenOCD (use version 0.11.0 at least).
To flash this board, just use the following command:
@ -102,8 +98,8 @@ Implementation Status
| | RTC | yes | |
| | RNG | yes | |
| | Timer | yes | TIM2 |
| | WDT | no | |
| | USB | no | |
| | WDT | yes | |
| | USB | yes | |
| | PWM | no | |
| | AES | no | |

View File

@ -43,7 +43,6 @@ static const mtd_spi_nor_params_t _pinetime_nor_params = {
.cs = PINETIME_NOR_SPI_CS,
.wp = GPIO_UNDEF,
.hold = GPIO_UNDEF,
.addr_width = 3,
};
static mtd_spi_nor_t pinetime_nor_dev = {

View File

@ -43,7 +43,6 @@ static const mtd_spi_nor_params_t _mtd_nor_params = {
.cs = SPI_HWCS(0), /* GPIO(PORT_A, 3) is used for HWCS(0) on FC2 */
.wp = GPIO_UNDEF,
.hold = GPIO_UNDEF,
.addr_width = 3, /* 24-bit addresses */
};
static mtd_spi_nor_t mtd_nor_dev = {

View File

@ -11,5 +11,7 @@ config BOARD_REMOTE_PA
bool
default y
select BOARD_COMMON_REMOTE
select HAVE_SAUL_GPIO
select HAVE_SAUL_ADC
source "$(RIOTBOARD)/common/remote/Kconfig"

View File

@ -20,3 +20,9 @@ config BOARD_SAMD10_XMINI
select HAS_PERIPH_SPI
select HAS_PERIPH_TIMER
select HAS_PERIPH_UART
select HAVE_SAUL_GPIO
choice LIBC_IMPLEMENTATION
# Use Picolibc to reduce ROM usage
default MODULE_PICOLIBC
endchoice

View File

@ -24,7 +24,7 @@
#include "timex.h"
#ifdef MODULE_MTD
/* N25Q256A */
/* N25Q256A or SST26VF064B */
static const mtd_spi_nor_params_t _same54_nor_params = {
.opcode = &mtd_spi_nor_opcode_default,
.wait_chip_erase = 240 * US_PER_SEC,
@ -38,7 +38,6 @@ static const mtd_spi_nor_params_t _same54_nor_params = {
.cs = SAM0_QSPI_PIN_CS,
.wp = SAM0_QSPI_PIN_DATA_2,
.hold = SAM0_QSPI_PIN_DATA_3,
.addr_width = 4,
};
static mtd_spi_nor_t same54_nor_dev = {

View File

@ -0,0 +1,40 @@
/**
@defgroup boards_samr34-xpro Microchip SAM R34 Xplained Pro
@ingroup boards
@brief Support for the Microchip SAM R34 Xplained Pro and WLR089 Xplained Pro
## Overview
The `SAMR34 Xplained Pro` is a compact evaluation board by Microchip featuring a
SAMR34J18 SoC. The SoC includes a SAML21 ARM Cortex-M0+ micro-controller
bundled with Semtech's SX1276, a 868/915 MHz LoRa compatible radio.
For programming the MCU comes with 40Kb of RAM and 256Kb of flash memory.
## Hardware
![samr34-xpro image](https://www.microchip.com/content/dam/mchp/mrt-dam/devtools/3072-180605-wpd-dm320111-2.jpg)
An evaluation board for the radio certified WLR089 module exists as the WLR089 Xplained Pro, it is compatible with the `samr34-xpro`.
![wlr089-xpro](https://www.microchip.com/content/dam/mchp/mrt-dam/devtools/3411-264438-1598368489-c14679-200616-wsg-ev23m25a-wlr089-explained-pro-evaluation-board.jpg)
### MCU
| MCU | SAMR34J18B |
|:---------- |:--------------------- |
| Family | ARM Cortex-M0+ |
| Vendor | Atmel |
| RAM | 32 kiB + 8 kiB battery RAM |
| Flash | 256 KiB |
| Frequency | up to 48MHz |
| FPU | no |
| Timers | 6 (3xTC (8,16,32 bit), 3xTCC (16 bit)) |
| ADCs | 1x 12-bit (8 channels)|
| UARTs | max 5 (shared with SPI and I2C) |
| SPIs | max 5 (see UART) |
| I2Cs | max 5 (see UART) |
| Vcc | 1.8V - 3.6V |
| Datasheet | [Datasheet](https://ww1.microchip.com/downloads/en/DeviceDoc/SAMR34-R35-Low-Power-LoRa-Sub-GHz-SiP-Data-Sheet-DS70005356B.pdf) |
| Board Manual | [SAM R34 XPro](https://www.microchip.com/en-us/development-tool/DM320111)<br>[WLR089 XPro](https://www.microchip.com/en-us/development-tool/EV23M25A)|
*/

View File

@ -7,9 +7,7 @@
*/
/**
* @defgroup boards_samr34-xpro Microchip SAM R34 Xplained Pro
* @ingroup boards
* @brief Support for the Microchip SAM R34 Xplained Pro board.
* @ingroup boards_samr34-xpro
* @{
*
* @file
@ -32,50 +30,50 @@ extern "C" {
* @name Semtech SX1276 configuration
* @{
*/
#define SX127X_PARAM_SPI (SPI_DEV(0))
#define SX127X_PARAM_SPI_NSS GPIO_PIN(1, 31) /* D10 */
#define SX127X_PARAM_RESET GPIO_PIN(1, 15) /* A0 */
#define SX127X_PARAM_DIO0 GPIO_PIN(1, 16) /* D2 */
#define SX127X_PARAM_DIO1 GPIO_PIN(0, 11) /* D3 */
#define SX127X_PARAM_DIO2 GPIO_PIN(0, 12) /* D4 */
#define SX127X_PARAM_DIO3 GPIO_PIN(1, 17) /* D5 */
#define SX127X_PARAM_PASELECT (SX127X_PA_RFO)
#define SX127X_PARAM_SPI SPI_DEV(0) /**< internal SPI */
#define SX127X_PARAM_SPI_NSS GPIO_PIN(1, 31) /**< D10 */
#define SX127X_PARAM_RESET GPIO_PIN(1, 15) /**< A0 */
#define SX127X_PARAM_DIO0 GPIO_PIN(1, 16) /**< D2 */
#define SX127X_PARAM_DIO1 GPIO_PIN(0, 11) /**< D3 */
#define SX127X_PARAM_DIO2 GPIO_PIN(0, 12) /**< D4 */
#define SX127X_PARAM_DIO3 GPIO_PIN(1, 17) /**< D5 */
#define SX127X_PARAM_PASELECT SX127X_PA_RFO /**< no boost */
/** @}*/
/**
* @name Board specific configuration
* @{
*/
#define TCXO_PWR_PIN GPIO_PIN(PA, 9)
#define TX_OUTPUT_SEL_PIN GPIO_PIN(PA, 13)
#define TCXO_PWR_PIN GPIO_PIN(PA, 9) /**< 32 MHz oscillator for radio enable */
#define TX_OUTPUT_SEL_PIN GPIO_PIN(PA, 13) /**< BAND_SEL */
/** @}*/
/**
* @name LED pin definitions and handlers
* @{
*/
#define LED_PORT PORT->Group[0]
#define LED_PORT PORT->Group[0] /**< GPIO port */
#define LED0_PIN GPIO_PIN(PA, 18)
#define LED0_MASK (1 << 18)
#define LED0_ON (LED_PORT.OUTCLR.reg = LED0_MASK)
#define LED0_OFF (LED_PORT.OUTSET.reg = LED0_MASK)
#define LED0_TOGGLE (LED_PORT.OUTTGL.reg = LED0_MASK)
#define LED0_PIN GPIO_PIN(PA, 18) /**< GPIO pin */
#define LED0_MASK (1 << 18) /**< GPIO pin mask */
#define LED0_ON (LED_PORT.OUTCLR.reg = LED0_MASK) /**< enable LED */
#define LED0_OFF (LED_PORT.OUTSET.reg = LED0_MASK) /**< disable LED */
#define LED0_TOGGLE (LED_PORT.OUTTGL.reg = LED0_MASK) /**< toggle LED */
#define LED1_PIN GPIO_PIN(PA, 19)
#define LED1_MASK (1 << 19)
#define LED1_ON (LED_PORT.OUTCLR.reg = LED1_MASK)
#define LED1_OFF (LED_PORT.OUTSET.reg = LED1_MASK)
#define LED1_TOGGLE (LED_PORT.OUTTGL.reg = LED1_MASK)
#define LED1_PIN GPIO_PIN(PA, 19) /**< GPIO pin */
#define LED1_MASK (1 << 19) /**< GPIO pin mask */
#define LED1_ON (LED_PORT.OUTCLR.reg = LED1_MASK) /**< enable LED */
#define LED1_OFF (LED_PORT.OUTSET.reg = LED1_MASK) /**< disable LED */
#define LED1_TOGGLE (LED_PORT.OUTTGL.reg = LED1_MASK) /**< toggle LED */
/** @} */
/**
* @name BTN0 (SW0 Button) pin definitions
* @{
*/
#define BTN0_PORT PORT->Group[0]
#define BTN0_PIN GPIO_PIN(PA, 28)
#define BTN0_MODE GPIO_IN_PU
#define BTN0_PORT PORT->Group[0] /**< GPIO port */
#define BTN0_PIN GPIO_PIN(PA, 28) /**< GPIO pin */
#define BTN0_MODE GPIO_IN_PU /**< Pull Up GPIO */
/** @} */
/**

View File

@ -41,7 +41,6 @@ static const mtd_spi_nor_params_t _serpente_nor_params = {
.cs = SERPENTE_NOR_SPI_CS,
.wp = GPIO_UNDEF,
.hold = GPIO_UNDEF,
.addr_width = 3,
};
static mtd_spi_nor_t serpente_nor_dev = {

View File

@ -3,9 +3,6 @@ ifneq (,$(filter saul_default,$(USEMODULE)))
USEMODULE += saul_gpio
endif
# limit the stack size so most tests and examples compile
CFLAGS += -DTHREAD_STACKSIZE_DEFAULT=512
# add board common drivers
USEMODULE += boards_common_silabs
USEMODULE += silabs_bc

View File

@ -1,5 +1,8 @@
# setup JLink for flashing
JLINK_PRE_FLASH = r
# limit the stack size so most tests and examples compile
CFLAGS += -DTHREAD_STACKSIZE_DEFAULT=512
# include board common
include $(RIOTBOARD)/common/silabs/Makefile.include

View File

@ -24,11 +24,6 @@
#define RMUTEX_H
#include <stdint.h>
#ifdef __cplusplus
#include "c11_atomics_compat.hpp"
#else
#include <stdatomic.h>
#endif
#include "mutex.h"
#include "sched.h"
@ -62,14 +57,14 @@ typedef struct rmutex_t {
* atomic_int_least16_t is used. Note @ref kernel_pid_t is an int16
* @internal
*/
atomic_int_least16_t owner;
kernel_pid_t owner;
} rmutex_t;
/**
* @brief Static initializer for rmutex_t.
* @details This initializer is preferable to rmutex_init().
*/
#define RMUTEX_INIT { MUTEX_INIT, 0, ATOMIC_VAR_INIT(KERNEL_PID_UNDEF) }
#define RMUTEX_INIT { MUTEX_INIT, 0, KERNEL_PID_UNDEF }
/**
* @brief Initializes a recursive mutex object.

View File

@ -1,5 +1,5 @@
/*
* Copyright (C) 2014 Freie Universität Berlin
* Copyright (C) 2014-2017 Freie Universität Berlin
*
* This file is subject to the terms and conditions of the GNU Lesser
* General Public License v2.1. See the file LICENSE in the top level
@ -75,6 +75,7 @@
* @brief Scheduler API definition
*
* @author Kaspar Schleiser <kaspar@schleiser.de>
* @author Hauke Petersen <hauke.petersen@fu-berlin.de>
*/
#ifndef SCHED_H
@ -252,6 +253,19 @@ extern clist_node_t sched_runqueues[SCHED_PRIO_LEVELS];
*/
NORETURN void sched_task_exit(void);
/**
* @brief Change the priority of the given thread
*
* @note This functions expects interrupts to be disabled when called!
*
* @pre (thread != NULL)
* @pre (priority < SCHED_PRIO_LEVELS)
*
* @param[in,out] thread target thread
* @param[in] priority new priority to assign to @p thread
*/
void sched_change_priority(thread_t *thread, uint8_t priority);
/**
* @brief Set CPU to idle mode (CPU dependent)
*

View File

@ -24,9 +24,10 @@
#include <stdio.h>
#include <inttypes.h>
#include "assert.h"
#include "atomic_utils.h"
#include "rmutex.h"
#include "thread.h"
#include "assert.h"
#define ENABLE_DEBUG 0
#include "debug.h"
@ -78,7 +79,7 @@ static int _lock(rmutex_t *rmutex, int trylock)
*/
/* ensure that owner is read atomically, since I need a consistent value */
owner = atomic_load_explicit(&rmutex->owner, memory_order_relaxed);
owner = atomic_load_kernel_pid(&rmutex->owner);
DEBUG("rmutex %" PRIi16 " : mutex held by %" PRIi16 " \n",
thread_getpid(), owner);
@ -104,8 +105,7 @@ static int _lock(rmutex_t *rmutex, int trylock)
DEBUG("rmutex %" PRIi16 " : setting the owner\n", thread_getpid());
/* ensure that owner is written atomically, since others need a consistent value */
atomic_store_explicit(&rmutex->owner, thread_getpid(),
memory_order_relaxed);
atomic_store_kernel_pid(&rmutex->owner, thread_getpid());
DEBUG("rmutex %" PRIi16 " : increasing refs\n", thread_getpid());
@ -127,8 +127,8 @@ int rmutex_trylock(rmutex_t *rmutex)
void rmutex_unlock(rmutex_t *rmutex)
{
assert(atomic_load_explicit(&rmutex->owner,
memory_order_relaxed) == thread_getpid());
/* ensure that owner is read atomically, since I need a consistent value */
assert(atomic_load_kernel_pid(&rmutex->owner) == thread_getpid());
assert(rmutex->refcount > 0);
DEBUG("rmutex %" PRIi16 " : decrementing refs refs\n", thread_getpid());
@ -143,8 +143,7 @@ void rmutex_unlock(rmutex_t *rmutex)
DEBUG("rmutex %" PRIi16 " : resetting owner\n", thread_getpid());
/* ensure that owner is written only once */
atomic_store_explicit(&rmutex->owner, KERNEL_PID_UNDEF,
memory_order_relaxed);
atomic_store_kernel_pid(&rmutex->owner, KERNEL_PID_UNDEF);
DEBUG("rmutex %" PRIi16 " : releasing mutex\n", thread_getpid());

View File

@ -1,5 +1,5 @@
/*
* Copyright (C) 2014 Freie Universität Berlin
* Copyright (C) 2014-2017 Freie Universität Berlin
*
* This file is subject to the terms and conditions of the GNU Lesser
* General Public License v2.1. See the file LICENSE in the top level
@ -15,6 +15,7 @@
*
* @author Kaspar Schleiser <kaspar@schleiser.de>
* @author René Kijewski <rene.kijewski@fu-berlin.de>
* @author Hauke Petersen <hauke.petersen@fu-berlin.de>
*
* @}
*/
@ -86,21 +87,21 @@ static void (*sched_cb)(kernel_pid_t active_thread,
* and readout away, switching between the two orders depending on the CLZ
* instruction availability
*/
static inline void _set_runqueue_bit(thread_t *process)
static inline void _set_runqueue_bit(uint8_t priority)
{
#if defined(BITARITHM_HAS_CLZ)
runqueue_bitcache |= BIT31 >> process->priority;
runqueue_bitcache |= BIT31 >> priority;
#else
runqueue_bitcache |= 1 << process->priority;
runqueue_bitcache |= 1 << priority;
#endif
}
static inline void _clear_runqueue_bit(thread_t *process)
static inline void _clear_runqueue_bit(uint8_t priority)
{
#if defined(BITARITHM_HAS_CLZ)
runqueue_bitcache &= ~(BIT31 >> process->priority);
runqueue_bitcache &= ~(BIT31 >> priority);
#else
runqueue_bitcache &= ~(1 << process->priority);
runqueue_bitcache &= ~(1 << priority);
#endif
}
@ -218,41 +219,54 @@ thread_t *__attribute__((used)) sched_run(void)
return next_thread;
}
/* Note: Forcing the compiler to inline this function will reduce .text for applications
* not linking in sched_change_priority(), which benefits the vast majority of apps.
*/
static inline __attribute__((always_inline)) void _runqueue_push(thread_t *thread, uint8_t priority)
{
DEBUG("sched_set_status: adding thread %" PRIkernel_pid " to runqueue %" PRIu8 ".\n",
thread->pid, priority);
clist_rpush(&sched_runqueues[priority], &(thread->rq_entry));
_set_runqueue_bit(priority);
/* some thread entered a runqueue
* if it is the active runqueue
* inform the runqueue_change callback */
#if (IS_USED(MODULE_SCHED_RUNQ_CALLBACK))
thread_t *active_thread = thread_get_active();
if (active_thread && active_thread->priority == priority) {
sched_runq_callback(priority);
}
#endif
}
/* Note: Forcing the compiler to inline this function will reduce .text for applications
* not linking in sched_change_priority(), which benefits the vast majority of apps.
*/
static inline __attribute__((always_inline)) void _runqueue_pop(thread_t *thread)
{
DEBUG("sched_set_status: removing thread %" PRIkernel_pid " from runqueue %" PRIu8 ".\n",
thread->pid, thread->priority);
clist_lpop(&sched_runqueues[thread->priority]);
if (!sched_runqueues[thread->priority].next) {
_clear_runqueue_bit(thread->priority);
#if (IS_USED(MODULE_SCHED_RUNQ_CALLBACK))
sched_runq_callback(thread->priority);
#endif
}
}
void sched_set_status(thread_t *process, thread_status_t status)
{
if (status >= STATUS_ON_RUNQUEUE) {
if (!(process->status >= STATUS_ON_RUNQUEUE)) {
DEBUG(
"sched_set_status: adding thread %" PRIkernel_pid " to runqueue %" PRIu8 ".\n",
process->pid, process->priority);
clist_rpush(&sched_runqueues[process->priority],
&(process->rq_entry));
_set_runqueue_bit(process);
/* some thread entered a runqueue
* if it is the active runqueue
* inform the runqueue_change callback */
#if (IS_USED(MODULE_SCHED_RUNQ_CALLBACK))
thread_t *active_thread = thread_get_active();
if (active_thread && active_thread->priority == process->priority) {
sched_runq_callback(process->priority);
}
#endif
_runqueue_push(process, process->priority);
}
}
else {
if (process->status >= STATUS_ON_RUNQUEUE) {
DEBUG(
"sched_set_status: removing thread %" PRIkernel_pid " from runqueue %" PRIu8 ".\n",
process->pid, process->priority);
clist_lpop(&sched_runqueues[process->priority]);
if (!sched_runqueues[process->priority].next) {
_clear_runqueue_bit(process);
#if (IS_USED(MODULE_SCHED_RUNQ_CALLBACK))
sched_runq_callback(process->priority);
#endif
}
_runqueue_pop(process);
}
}
@ -306,3 +320,40 @@ void sched_register_cb(void (*callback)(kernel_pid_t, kernel_pid_t))
sched_cb = callback;
}
#endif
void sched_change_priority(thread_t *thread, uint8_t priority)
{
assert(thread && (priority < SCHED_PRIO_LEVELS));
if (thread->priority == priority) {
return;
}
unsigned irq_state = irq_disable();
if (thread_is_active(thread)) {
_runqueue_pop(thread);
_runqueue_push(thread, priority);
}
thread->priority = priority;
irq_restore(irq_state);
thread_t *active = thread_get_active();
if ((active == thread)
|| ((active != NULL) && (active->priority > priority) && thread_is_active(thread))
) {
/* If the change in priority would result in a different decision of
* the scheduler, we need to yield to make sure the change in priority
* takes effect immediately. This can be due to one of the following:
*
* 1) The priority of the thread currently running has been reduced
* (higher numeric value), so that other threads now have priority
* over the currently running.
* 2) The priority of a pending thread has been increased (lower numeric value) so that it
* now has priority over the running thread.
*/
thread_yield_higher();
}
}

View File

@ -161,10 +161,7 @@ void reset_handler_default(void)
#endif /* CPU_HAS_BACKUP_RAM */
#ifdef MODULE_MPU_NOEXEC_RAM
/* Mark the RAM non executable. This is a protection mechanism which
* makes exploitation of buffer overflows significantly harder.
*
* This marks the memory region from 0x20000000 to 0x3FFFFFFF as non
/* This marks the memory region from 0x20000000 to 0x3FFFFFFF as non
* executable. This is the Cortex-M SRAM region used for on-chip RAM.
*/
mpu_configure(

View File

@ -102,11 +102,10 @@ int thread_isr_stack_usage(void)
return -1;
}
static inline void *align_stack(void *stack_start, int *stacksize)
static inline void *align_stack(uintptr_t start, int *stacksize)
{
const size_t alignment = sizeof(uintptr_t);
const uintptr_t align_mask = alignment - 1;
uintptr_t start = (uintptr_t)stack_start;
size_t unalignment = (start & align_mask)
? (alignment - (start & align_mask)) : 0;
start += unalignment;
@ -117,10 +116,9 @@ static inline void *align_stack(void *stack_start, int *stacksize)
char *thread_stack_init(thread_task_func_t task_func, void *arg, void *stack_start, int stacksize)
{
char *stk;
ucontext_t *p;
stack_start = align_stack(stack_start, &stacksize);
stack_start = align_stack((uintptr_t)stack_start, &stacksize);
VALGRIND_STACK_REGISTER(stack_start, (char *)stack_start + stacksize);
VALGRIND_DEBUG("VALGRIND_STACK_REGISTER(%p, %p)\n",
@ -128,18 +126,16 @@ char *thread_stack_init(thread_task_func_t task_func, void *arg, void *stack_sta
DEBUG("thread_stack_init\n");
stk = stack_start;
/* Use intermediate cast to uintptr_t to silence -Wcast-align. The stack
* is aligned to word size above. */
p = (ucontext_t *)(uintptr_t)(stk + (stacksize - sizeof(ucontext_t)));
p = (ucontext_t *)(uintptr_t)((uint8_t *)stack_start + (stacksize - sizeof(ucontext_t)));
stacksize -= sizeof(ucontext_t);
if (getcontext(p) == -1) {
err(EXIT_FAILURE, "thread_stack_init: getcontext");
}
p->uc_stack.ss_sp = stk;
p->uc_stack.ss_sp = stack_start;
p->uc_stack.ss_size = stacksize;
p->uc_stack.ss_flags = 0;
p->uc_link = &end_context;

View File

@ -259,6 +259,7 @@ static int _confirm_op(ieee802154_dev_t *dev, ieee802154_hal_op_t op, void *ctx)
int radio_state = NRF_RADIO->STATE;
switch (op) {
case IEEE802154_HAL_OP_TRANSMIT:
info = ctx;
eagain = (state != STATE_IDLE
&& state != STATE_CCA_BUSY && NRF_RADIO->STATE != RADIO_STATE_STATE_Disabled);

View File

@ -12,7 +12,7 @@ config CPU_ARCH_RISCV
select HAS_NEWLIB
select HAS_PERIPH_CORETIMER
select HAS_PICOLIBC if '$(RIOT_CI_BUILD)' != '1'
#select HAS_RUST_TARGET
select HAS_RUST_TARGET
select HAS_SSP
select MODULE_MALLOC_THREAD_SAFE if TEST_KCONFIG

View File

@ -8,7 +8,7 @@ FEATURES_PROVIDED += cpp
FEATURES_PROVIDED += libstdcpp
FEATURES_PROVIDED += newlib
FEATURES_PROVIDED += periph_coretimer
#FEATURES_PROVIDED += rust_target
FEATURES_PROVIDED += rust_target
FEATURES_PROVIDED += ssp
# RISC-V toolchain on CI does not work properly with picolibc yet

View File

@ -35,8 +35,8 @@ SECTIONS
__stack_size = DEFINED(__stack_size) ? __stack_size : 256;
/* Populate information about rom size */
_srom = ORIGIN(rom);
_erom = ORIGIN(rom) + LENGTH(rom);
_srom = ORIGIN(flash);
_erom = ORIGIN(flash) + LENGTH(flash);
.init :
{
@ -220,5 +220,5 @@ SECTIONS
.end_fw (NOLOAD) : ALIGN(4) {
_end_fw = . ;
} > rom
} > flash
}

View File

@ -174,7 +174,7 @@ endif # CPU_FAM_F2 || CPU_FAM_F4 || CPU_FAM_F7 || CPU_FAM_G0 || CPU_FAM_G4 || C
if CPU_FAM_F0 || CPU_FAM_F1 || CPU_FAM_F3
config CLOCK_PLL_PREDIV
int "PLLIN division factor" if CUSTOM_PLL_PARAMS && !CPU_LINE_STM32F031X6 && !CPU_LINE_STM32F042X6 && !CPU_LINE_STM32F303X8
default 2 if CPU_LINE_STM32F031X6 || CPU_LINE_STM32F042X6 || CPU_LINE_STM32F303X8
default 2 if CPU_LINE_STM32F031X6 || CPU_LINE_STM32F042X6 || CPU_LINE_STM32F303X8 || CPU_LINE_STM32F303XC
default 1
range 1 16

View File

@ -39,7 +39,13 @@ TEST_INTERACTIVE_DELAY = int(os.environ.get('TEST_INTERACTIVE_DELAY') or 1)
# By default never reset after the terminal is open unless explicitly requested
# through an environment variable.
TESTRUNNER_RESET_AFTER_TERM = int(os.environ.get('TESTRUNNER_RESET_AFTER_TERM')
or '0')
or 0)
# When running e.g. tests/shell_ble we don't want to reset the board, because
# then ble-serial would terminate and the created virtual serial port would get
# lost. By default the board is reset before the test starts.
TESTRUNNER_RESET_BOARD_ON_STARTUP = \
int(os.environ.get('TESTRUNNER_RESET_BOARD_ON_STARTUP') or 1)
MAKE = os.environ.get('MAKE', 'make')
@ -70,7 +76,8 @@ def find_exc_origin(exc_info):
def setup_child(timeout=10, spawnclass=pexpect.spawnu, env=None, logfile=None):
# Some boards can't be reset after a terminal is open. Therefore reset
# before `cleanterm`.
_reset_board(env)
if TESTRUNNER_RESET_BOARD_ON_STARTUP:
_reset_board(env)
# on platforms exposing UART over USB, wait a little before connecting to
# the serial terminal. This gives time for stdio to be ready.

View File

@ -13,8 +13,10 @@ IOTLAB_ARCHI_nrf52dk = nrf52dk:ble
IOTLAB_ARCHI_nrf52832-mdk = nrf52832mdk:ble
IOTLAB_ARCHI_nrf52840dk = nrf52840dk:multi
IOTLAB_ARCHI_nrf52840-mdk = nrf52840mdk:multi
IOTLAB_ARCHI_nucleo-wl55jc = nucleo-wl55jc:stm32wl
IOTLAB_ARCHI_pba-d-01-kw2x = phynode:kw2xrf
IOTLAB_ARCHI_samr21-xpro = samr21:at86rf233
IOTLAB_ARCHI_samr30-xpro = samr30:at86rf212b
IOTLAB_ARCHI_samr34-xpro = samr34:sx1276
IOTLAB_ARCHI_zigduino = zigduino:atmega128rfa1
IOTLAB_ARCHI := $(IOTLAB_ARCHI_$(BOARD))

View File

@ -228,6 +228,9 @@ def generate_module_compile_commands(path, state, args):
except ValueError:
pass
if args.clangd:
cdetails.cflags.append('-Wno-unknown-warning-option')
c_extra_includes = []
cxx_extra_includes = []
@ -288,14 +291,16 @@ if __name__ == '__main__':
help='Drop the given flag, if present (repeatable)')
parser.add_argument('--clangd', default=False, action='store_const', const=True,
help='Shorthand for --add-built-in-includes --add-libstdxx-includes ' +
'--filter-out=-Wformat-truncation --filter-out=-Wformat-overflow ' +
'--filter-out=-mno-thumb-interwork')
'and some CFLAG adjustments throughy --filter-out, and ignores ' +
'unknown warning flags')
_args = parser.parse_args()
if _args.clangd:
_args.add_built_in_includes = True
_args.add_libstdcxx_includes = True
_args.filter_out = ['-Wformat-truncation', '-Wformat-overflow', '-mno-thumb-interwork',
_args.filter_out = ['-mno-thumb-interwork',
# Only even included for versions of GCC that support it
'-malign-data=natural',
# Only supported starting with clang 11
'-msmall-data-limit=8',
]
generate_compile_commands(_args)

View File

@ -13357,6 +13357,7 @@ drivers/sx127x/include/sx127x_registers\.h:[0-9]+: warning: Member SX127X_RNG_RE
drivers/sx127x/include/sx127x_registers\.h:[0-9]+: warning: Member SX127X_RNG_REG_MODEM_CONFIG2 \(macro definition\) of file sx127x_registers\.h is not documented\.
drivers/sx127x/include/sx127x_registers\.h:[0-9]+: warning: Member VERSION_SX1272 \(macro definition\) of file sx127x_registers\.h is not documented\.
drivers/sx127x/include/sx127x_registers\.h:[0-9]+: warning: Member VERSION_SX1276 \(macro definition\) of file sx127x_registers\.h is not documented\.
drivers/sx127x/include/sx127x_registers\.h:[0-9]+: warning: Member VERSION_SX1276_WLR089 \(macro definition\) of file sx127x_registers\.h is not documented\.
drivers/tcs37727/include/tcs37727\-internal\.h:[0-9]+: warning: Member B_COEF_IF \(macro definition\) of file tcs37727\-internal\.h is not documented\.
drivers/tcs37727/include/tcs37727\-internal\.h:[0-9]+: warning: Member CT_COEF_IF \(macro definition\) of file tcs37727\-internal\.h is not documented\.
drivers/tcs37727/include/tcs37727\-internal\.h:[0-9]+: warning: Member CT_OFFSET_IF \(macro definition\) of file tcs37727\-internal\.h is not documented\.

View File

@ -144,3 +144,20 @@ instance [0 | Iface: 7 | mop: 2 | ocp: 0 | mhri: 256 | mri 0]
```
This should also be visible in Foren6.
Topology generation
-------------------
To generate a random topology use the `topogen.sh` script.
This will randomly distribute *N* nodes on on a *W* × *H* map.
Each node has a radio range *R* ± *V* where *V* is a random variance that can also be set to 0.
The further away a node is from a sending node, the higher the packet loss probability.
Nodes outside the sending radius have a zero probability of receiving a packet.
If you have `gnuplot` installed this will also generate a plot of the resulting node distribution:
![example topology](https://gist.githubusercontent.com/benpicco/6fd6f7c79a30cbbc41c3a65e53ed3682/raw/33afb859b65d949238129096858d14e2319fb5fb/network.topo.svg)
A light color means that a node only has a one-way connection to the network, gray means a node is
entirely isolated.

View File

@ -16,11 +16,11 @@ else
CRESET=
fi
WIDTH=100
HEIGHT=100
RANGE=30
VARIANCE=15
NUM=10
WIDTH=100 # X dimension of the simulated world
HEIGHT=100 # Y dimension of the simulated world
RANGE=30 # base node radio range
VARIANCE=15 # random offset to radio range
NUM=10 # number of nodes
echo "writing to $FILE"

View File

@ -41,7 +41,8 @@
* The following list of what `DEVELHELP=1` enables is not comprehensive, but
* should give a rough impression of what to expect:
*
* * Many runtime checks are enabled (stack overflow protection, warnings when
* * Many runtime checks are enabled (stack overflow protection by means of
* @ref pseudomodule_mpu_stack_guard or @ref SCHED_TEST_STACK, warnings when
* sending messages to invalid PIDs, …), some of which just log errors to
* stdout, some even halt the system.
* * Some structures contain additional information, e.g. threads store their

View File

@ -275,7 +275,9 @@ OPTIMIZE_OUTPUT_VHDL = NO
# Note that for custom extensions you also need to set FILE_PATTERNS otherwise
# the files are not read by doxygen.
EXTENSION_MAPPING =
# Python is close enough that we can have Makefile comments starting with `##`
# that are both recognized by Doxygen and comments to Make
EXTENSION_MAPPING = mk=Python
# If the MARKDOWN_SUPPORT tag is enabled then doxygen pre-processes all comments
# according to the Markdown format, which allows for more readable
@ -771,7 +773,8 @@ INPUT = ../../doc.txt \
src/emulators.md \
src/release-cycle.md \
src/changelog.md \
../../LOSTANDFOUND.md
../../LOSTANDFOUND.md \
../../makefiles/pseudomodules.inc.mk
# This tag can be used to specify the character encoding of the source files
# that doxygen parses. Internally doxygen uses the UTF-8 encoding. Doxygen uses

View File

@ -10,3 +10,9 @@ config MODULE_ADXL345
depends on HAS_PERIPH_I2C
depends on TEST_KCONFIG
select MODULE_PERIPH_I2C
config HAVE_ADXL345
bool
select MODULE_ADXL345 if MODULE_SAUL_DEFAULT
help
Indicates that a adxl345 sensor is present.

View File

@ -12,3 +12,9 @@ config MODULE_BMP180
select MODULE_PERIPH_I2C
select MODULE_ZTIMER
select MODULE_ZTIMER_MSEC
config HAVE_BMP180
bool
select MODULE_BMP180 if MODULE_SAUL_DEFAULT
help
Indicates that a bmp180 sensor is present.

View File

@ -12,4 +12,4 @@ USEMODULE += eui_provider
USEMODULE += iolist
USEMODULE += netdev_eth
USEMODULE += random
USEMODULE += xtimer
USEMODULE += ztimer_usec

View File

@ -21,6 +21,7 @@
#include <assert.h>
#include <string.h>
#include "board.h"
#include "dose.h"
#include "random.h"
#include "irq.h"
@ -28,10 +29,15 @@
#include "net/eui_provider.h"
#include "net/netdev/eth.h"
#include "timex.h"
#define ENABLE_DEBUG 0
#include "debug.h"
#if !defined(DOSE_TIMER_DEV) && IS_ACTIVE(MODULE_DOSE_WATCHDOG)
#error "DOSE_TIMER_DEV needs to be set by the board"
#endif
static uint16_t crc16_update(uint16_t crc, uint8_t octet);
static dose_signal_t state_transit_blocked(dose_t *ctx, dose_signal_t signal);
static dose_signal_t state_transit_idle(dose_t *ctx, dose_signal_t signal);
@ -40,7 +46,7 @@ static dose_signal_t state_transit_send(dose_t *ctx, dose_signal_t signal);
static void state(dose_t *ctx, dose_signal_t src);
static void _isr_uart(void *arg, uint8_t c);
static void _isr_gpio(void *arg);
static void _isr_xtimer(void *arg);
static void _isr_ztimer(void *arg);
static void clear_recv_buf(dose_t *ctx);
static void _isr(netdev_t *netdev);
static int _recv(netdev_t *dev, void *buf, size_t len, void *info);
@ -53,9 +59,6 @@ static int _init(netdev_t *dev);
static void _poweron(dose_t *dev);
static void _poweroff(dose_t *dev, dose_state_t sleep_state);
/* smallest possible xtimer timeout */
static const xtimer_ticks32_t xtimer_min_timeout = {.ticks32 = XTIMER_BACKOFF};
static uint16_t crc16_update(uint16_t crc, uint8_t octet)
{
crc = (uint8_t)(crc >> 8) | (crc << 8);
@ -163,7 +166,7 @@ static void _dose_watchdog_cb(void *arg, int chan)
}
DEBUG_PUTS("timeout");
state(&_dose_base[i], DOSE_SIGNAL_XTIMER);
state(&_dose_base[i], DOSE_SIGNAL_ZTIMER);
break;
default:
break;
@ -187,9 +190,8 @@ static dose_signal_t state_transit_blocked(dose_t *ctx, dose_signal_t signal)
(void) signal;
uint32_t backoff;
backoff = random_uint32_range(xtimer_usec_from_ticks(xtimer_min_timeout),
2 * ctx->timeout_base);
xtimer_set(&ctx->timeout, backoff);
backoff = random_uint32_range(0, 2 * ctx->timeout_base);
ztimer_set(ZTIMER_USEC, &ctx->timeout, backoff);
return DOSE_SIGNAL_NONE;
}
@ -262,7 +264,7 @@ static dose_signal_t state_transit_recv(dose_t *ctx, dose_signal_t signal)
if (rc == DOSE_SIGNAL_NONE && !IS_ACTIVE(MODULE_DOSE_WATCHDOG)) {
/* No signal is returned. We stay in the RECV state. */
xtimer_set(&ctx->timeout, ctx->timeout_base);
ztimer_set(ZTIMER_USEC, &ctx->timeout, ctx->timeout_base);
}
return rc;
@ -281,7 +283,7 @@ static dose_signal_t state_transit_send(dose_t *ctx, dose_signal_t signal)
* will bring us back to the BLOCKED state after _send has emitted
* its last octet. */
#ifndef MODULE_PERIPH_UART_COLLISION
xtimer_set(&ctx->timeout, ctx->timeout_base);
ztimer_set(ZTIMER_USEC, &ctx->timeout, ctx->timeout_base);
#endif
return DOSE_SIGNAL_NONE;
@ -305,10 +307,10 @@ static void state(dose_t *ctx, dose_signal_t signal)
break;
case DOSE_STATE_SEND + DOSE_SIGNAL_END:
case DOSE_STATE_SEND + DOSE_SIGNAL_XTIMER:
case DOSE_STATE_SEND + DOSE_SIGNAL_ZTIMER:
case DOSE_STATE_INIT + DOSE_SIGNAL_INIT:
case DOSE_STATE_RECV + DOSE_SIGNAL_END:
case DOSE_STATE_RECV + DOSE_SIGNAL_XTIMER:
case DOSE_STATE_RECV + DOSE_SIGNAL_ZTIMER:
signal = state_transit_idle(ctx, signal);
ctx->state = DOSE_STATE_IDLE;
break;
@ -322,7 +324,7 @@ static void state(dose_t *ctx, dose_signal_t signal)
ctx->state = DOSE_STATE_RECV;
break;
case DOSE_STATE_BLOCKED + DOSE_SIGNAL_XTIMER:
case DOSE_STATE_BLOCKED + DOSE_SIGNAL_ZTIMER:
case DOSE_STATE_SEND + DOSE_SIGNAL_UART:
signal = state_transit_send(ctx, signal);
ctx->state = DOSE_STATE_SEND;
@ -354,7 +356,7 @@ static void _isr_gpio(void *arg)
state(dev, DOSE_SIGNAL_GPIO);
}
static void _isr_xtimer(void *arg)
static void _isr_ztimer(void *arg)
{
dose_t *dev = arg;
@ -364,7 +366,7 @@ static void _isr_xtimer(void *arg)
#endif
case DOSE_STATE_BLOCKED:
case DOSE_STATE_SEND:
state(dev, DOSE_SIGNAL_XTIMER);
state(dev, DOSE_SIGNAL_ZTIMER);
break;
default:
;
@ -516,7 +518,7 @@ static inline void _send_done(dose_t *ctx, bool collision)
#ifdef MODULE_PERIPH_UART_COLLISION
uart_collision_detect_disable(ctx->uart);
if (collision) {
state(ctx, DOSE_SIGNAL_XTIMER);
state(ctx, DOSE_SIGNAL_ZTIMER);
}
#else
(void)ctx;
@ -775,18 +777,12 @@ void dose_setup(dose_t *ctx, const dose_params_t *params, uint8_t index)
);
/* The timeout base is the minimal timeout base used for this driver.
* We have to ensure it is above the XTIMER_BACKOFF. Otherwise state
* transitions are triggered from another state transition setting up the
* timeout.
* To calculate how long it takes to transfer one byte we assume
* 8 data bits + 1 start bit + 1 stop bit per byte.
*/
ctx->timeout_base = CONFIG_DOSE_TIMEOUT_BYTES * 10UL * US_PER_SEC / params->baudrate;
if (ctx->timeout_base < xtimer_usec_from_ticks(xtimer_min_timeout)) {
ctx->timeout_base = xtimer_usec_from_ticks(xtimer_min_timeout);
}
DEBUG("dose timeout set to %" PRIu32 " µs\n", ctx->timeout_base);
ctx->timeout.callback = _isr_xtimer;
ctx->timeout.callback = _isr_ztimer;
ctx->timeout.arg = ctx;
#ifdef MODULE_DOSE_WATCHDOG

View File

@ -82,7 +82,7 @@
#include "net/eui48.h"
#include "bitarithm.h"
#include "mutex.h"
#include "xtimer.h"
#include "ztimer.h"
#ifdef __cplusplus
extern "C" {
@ -120,7 +120,7 @@ typedef enum {
DOSE_SIGNAL_INIT = 0x10, /**< Init the state machine */
DOSE_SIGNAL_GPIO = 0x20, /**< Sense GPIO detected a falling edge */
DOSE_SIGNAL_UART = 0x30, /**< Octet has been received */
DOSE_SIGNAL_XTIMER = 0x40, /**< Timer timed out */
DOSE_SIGNAL_ZTIMER = 0x40, /**< Timer timed out */
DOSE_SIGNAL_SEND = 0x50, /**< Enter send state */
DOSE_SIGNAL_END = 0x60 /**< Leave send state */
} dose_signal_t;
@ -165,13 +165,11 @@ typedef enum {
/**
* @brief Hardware timer to use with the `dose_watchdog` module.
*
* This will be used to detect RX timeout instead of xtimer to speed up
* This will be used to detect RX timeout instead of ztimer to speed up
* the RX path when high data rates / less CPU overhead is required.
*/
#if DOXYGEN
#define DOSE_TIMER_DEV TIMER_DEV(…)
#elif !defined(DOSE_TIMER_DEV) && IS_ACTIVE(MODULE_DOSE_WATCHDOG)
#error "DOSE_TIMER_DEV needs to be set by the board"
#endif
/**
@ -197,7 +195,7 @@ typedef struct {
gpio_t sense_pin; /**< GPIO to sense for start bits on the UART's rx line */
#endif
gpio_t standby_pin; /**< GPIO to put the CAN transceiver in standby mode */
xtimer_t timeout; /**< Timeout timer ensuring always to get back to IDLE state */
ztimer_t timeout; /**< Timeout timer ensuring always to get back to IDLE state */
uint32_t timeout_base; /**< Base timeout in us */
uart_t uart; /**< UART device to use */
uint8_t uart_octet; /**< Last received octet */

View File

@ -113,7 +113,6 @@ typedef struct {
gpio_t cs; /**< CS pin GPIO handle */
gpio_t wp; /**< Write Protect pin GPIO handle */
gpio_t hold; /**< HOLD pin GPIO handle */
uint8_t addr_width; /**< Number of bytes in addresses, usually 3 for small devices */
} mtd_spi_nor_params_t;
/**
@ -150,6 +149,12 @@ typedef struct {
* Computed by mtd_spi_nor_init, no need to touch outside the driver.
*/
uint8_t sec_addr_shift;
/**
* @brief number of address bytes
*
* Computed by mtd_spi_nor_init, no need to touch outside the driver.
*/
uint8_t addr_width;
} mtd_spi_nor_t;
/**

View File

@ -5,30 +5,46 @@
# directory for more details.
#
if TEST_KCONFIG
choice
bool "MPU-9X50 accelerometer/magnetometer/gyroscope"
optional
depends on HAS_PERIPH_I2C
help
This driver supports both MPU9150 and MPU9250. Choose one model.
config MODULE_MPU9150
bool "MPU-9150"
select MODULE_MPU9X50
config MODULE_MPU9250
bool "MPU-9250"
select MODULE_MPU9X50
endchoice
config MODULE_MPU9X50
menuconfig MODULE_MPU9X50
bool
prompt "MPU-9X50 accelerometer/magnetometer/gyroscope" if !(MODULE_SAUL_DEFAULT && HAVE_MPU9X50)
default y if (MODULE_SAUL_DEFAULT && HAVE_MPU9X50)
depends on TEST_KCONFIG
depends on HAS_PERIPH_I2C
select MODULE_PERIPH_I2C
select MODULE_ZTIMER
select MODULE_ZTIMER_MSEC
endif # TEST_KCONFIG
choice
bool "Sensor variant"
default MODULE_MPU9150 if HAVE_MPU9150
default MODULE_MPU9250 if HAVE_MPU9250
depends on MODULE_MPU9X50
help
This driver supports both MPU9150 and MPU9250. Choose one model.
config MODULE_MPU9150
bool "MPU-9150"
config MODULE_MPU9250
bool "MPU-9250"
endchoice
config HAVE_MPU9150
bool
select HAVE_MPU9X50
help
Indicates that a mpu9150 sensor is present.
config HAVE_MPU9250
bool
select HAVE_MPU9X50
help
Indicates that a mpu9250 sensor is present.
config HAVE_MPU9X50
bool
help
Indicates that a mpu9X50 sensor is present.

View File

@ -45,6 +45,8 @@
#define SFLASH_CMD_4_BYTE_ADDR (0xB7) /**< enable 32 bit addressing */
#define SFLASH_CMD_3_BYTE_ADDR (0xE9) /**< enable 24 bit addressing */
#define SFLASH_CMD_ULBPR (0x98) /**< Global Block Protection Unlock */
#define MTD_64K (65536ul)
#define MTD_64K_ADDR_MASK (0xFFFF)
#define MTD_32K (32768ul)
@ -66,6 +68,7 @@
typedef enum {
SPI_NOR_JEDEC_ATMEL = 0x1F | JEDEC_BANK(1),
SPI_NOR_JEDEC_MICROCHIP = 0xBF | JEDEC_BANK(1),
} jedec_manuf_t;
/** @} */
@ -88,7 +91,7 @@ static void mtd_spi_release(const mtd_spi_nor_t *dev)
static inline uint8_t* _be_addr(const mtd_spi_nor_t *dev, uint32_t *addr)
{
*addr = htonl(*addr);
return &((uint8_t*)addr)[4 - dev->params->addr_width];
return &((uint8_t*)addr)[4 - dev->addr_width];
}
/**
@ -111,7 +114,7 @@ static void mtd_spi_cmd_addr_read(const mtd_spi_nor_t *dev, uint8_t opcode,
if (IS_ACTIVE(ENABLE_TRACE)) {
TRACE("mtd_spi_cmd_addr_read: addr:");
for (unsigned int i = 0; i < dev->params->addr_width; ++i) {
for (unsigned int i = 0; i < dev->addr_width; ++i) {
TRACE(" %02x", addr_buf[i]);
}
TRACE("\n");
@ -120,7 +123,7 @@ static void mtd_spi_cmd_addr_read(const mtd_spi_nor_t *dev, uint8_t opcode,
/* Send opcode followed by address */
spi_transfer_byte(_get_spi(dev), dev->params->cs, true, opcode);
spi_transfer_bytes(_get_spi(dev), dev->params->cs, true,
(char *)addr_buf, NULL, dev->params->addr_width);
(char *)addr_buf, NULL, dev->addr_width);
/* Read data */
spi_transfer_bytes(_get_spi(dev), dev->params->cs, false,
@ -147,7 +150,7 @@ static void mtd_spi_cmd_addr_write(const mtd_spi_nor_t *dev, uint8_t opcode,
if (IS_ACTIVE(ENABLE_TRACE)) {
TRACE("mtd_spi_cmd_addr_write: addr:");
for (unsigned int i = 0; i < dev->params->addr_width; ++i) {
for (unsigned int i = 0; i < dev->addr_width; ++i) {
TRACE(" %02x", addr_buf[i]);
}
TRACE("\n");
@ -159,7 +162,7 @@ static void mtd_spi_cmd_addr_write(const mtd_spi_nor_t *dev, uint8_t opcode,
/* only keep CS asserted when there is data that follows */
bool cont = (count > 0);
spi_transfer_bytes(_get_spi(dev), dev->params->cs, cont,
(char *)addr_buf, NULL, dev->params->addr_width);
(char *)addr_buf, NULL, dev->addr_width);
/* Write data */
if (cont) {
@ -303,6 +306,28 @@ static uint32_t mtd_spi_nor_get_size(const mtd_jedec_id_t *id)
(id->device[1] & ~0x3) == 0) {
return (0x1F & id->device[0]) * MBIT_AS_BYTES;
}
if (mtd_spi_manuf_match(id, SPI_NOR_JEDEC_MICROCHIP)) {
switch (id->device[1]) {
case 0x12: /* SST26VF020A */
case 0x8c: /* SST25VF020B */
return 2 * MBIT_AS_BYTES;
case 0x54: /* SST26WF040B */
case 0x8d: /* SST25VF040B */
return 4 * MBIT_AS_BYTES;
case 0x58: /* SST26WF080B */
case 0x8e: /* SST25VF080B */
return 8 * MBIT_AS_BYTES;
case 0x1: /* SST26VF016 */
case 0x41: /* SST26VF016B */
return 16 * MBIT_AS_BYTES;
case 0x2: /* SST26VF032 */
case 0x42: /* SST26VF032B */
return 32 * MBIT_AS_BYTES;
case 0x43: /* SST26VF064B */
case 0x53: /* SST26WF064C */
return 64 * MBIT_AS_BYTES;
}
}
/* everyone else seems to use device ID 2 for density */
return 1 << id->device[1];
@ -376,6 +401,12 @@ static void _init_pins(mtd_spi_nor_t *dev)
}
}
static void _enable_32bit_addr(mtd_spi_nor_t *dev)
{
mtd_spi_cmd(dev, dev->params->opcode->wren);
mtd_spi_cmd(dev, SFLASH_CMD_4_BYTE_ADDR);
}
static int mtd_spi_nor_power(mtd_dev_t *mtd, enum mtd_power_state power)
{
mtd_spi_nor_t *dev = (mtd_spi_nor_t *)mtd;
@ -399,9 +430,8 @@ static int mtd_spi_nor_power(mtd_dev_t *mtd, enum mtd_power_state power)
}
#endif
/* enable 32 bit address mode */
if (dev->params->addr_width == 4) {
mtd_spi_cmd(dev, dev->params->opcode->wren);
mtd_spi_cmd(dev, SFLASH_CMD_4_BYTE_ADDR);
if (dev->addr_width == 4) {
_enable_32bit_addr(dev);
}
break;
@ -414,6 +444,20 @@ static int mtd_spi_nor_power(mtd_dev_t *mtd, enum mtd_power_state power)
return 0;
}
static void _set_addr_width(mtd_dev_t *mtd)
{
mtd_spi_nor_t *dev = (mtd_spi_nor_t *)mtd;
uint32_t flash_size = mtd->pages_per_sector * mtd->page_size
* mtd->sector_count;
if (flash_size > 0xFFFFFF) {
dev->addr_width = 4;
} else {
dev->addr_width = 3;
}
}
static int mtd_spi_nor_init(mtd_dev_t *mtd)
{
DEBUG("mtd_spi_nor_init: %p\n", (void *)mtd);
@ -422,10 +466,6 @@ static int mtd_spi_nor_init(mtd_dev_t *mtd)
DEBUG("mtd_spi_nor_init: -> spi: %lx, cs: %lx, opcodes: %p\n",
(unsigned long)_get_spi(dev), (unsigned long)dev->params->cs, (void *)dev->params->opcode);
/* verify configuration */
assert(dev->params->addr_width > 0);
assert(dev->params->addr_width <= 4);
/* CS, WP, Hold */
_init_pins(dev);
@ -450,6 +490,7 @@ static int mtd_spi_nor_init(mtd_dev_t *mtd)
mtd->sector_count = mtd_spi_nor_get_size(&dev->jedec_id)
/ (mtd->pages_per_sector * mtd->page_size);
}
_set_addr_width(mtd);
DEBUG("mtd_spi_nor_init: %" PRIu32 " bytes "
"(%" PRIu32 " sectors, %" PRIu32 " bytes/sector, "
@ -459,14 +500,23 @@ static int mtd_spi_nor_init(mtd_dev_t *mtd)
mtd->sector_count, mtd->pages_per_sector * mtd->page_size,
mtd->pages_per_sector * mtd->sector_count,
mtd->pages_per_sector, mtd->page_size);
DEBUG("mtd_spi_nor_init: Using %u byte addresses\n", dev->params->addr_width);
DEBUG("mtd_spi_nor_init: Using %u byte addresses\n", dev->addr_width);
uint8_t status;
mtd_spi_cmd_read(dev, dev->params->opcode->rdsr, &status, sizeof(status));
mtd_spi_release(dev);
DEBUG("mtd_spi_nor_init: device status = 0x%02x\n", (unsigned int)status);
/* enable 32 bit address mode */
if (dev->addr_width == 4) {
_enable_32bit_addr(dev);
}
/* Global Block-Protection Unlock */
mtd_spi_cmd(dev, dev->params->opcode->wren);
mtd_spi_cmd(dev, SFLASH_CMD_ULBPR);
mtd_spi_release(dev);
/* check whether page size and sector size are powers of two (most chips' are)
* and compute the number of shifts needed to get the page and sector addresses
* from a byte address */

View File

@ -558,6 +558,7 @@ extern "C" {
/* Version */
#define SX127X_REG_VERSION (0x42)
#define VERSION_SX1276 (0x12)
#define VERSION_SX1276_WLR089 (0x13)
#define VERSION_SX1272 (0x22)
/* Additional settings */

View File

@ -53,7 +53,7 @@ int sx127x_check_version(const sx127x_t *dev)
}
DEBUG("[sx127x] SX1272 transceiver detected\n");
#else /* MODULE_SX1276) */
if (version != VERSION_SX1276) {
if (version != VERSION_SX1276 && version != VERSION_SX1276_WLR089) {
DEBUG("[sx127x] sx1276 test failed, invalid version number: %d\n",
version);
return -1;

View File

@ -23,7 +23,7 @@
int main(void)
{
puts("Hello World!");
puts("Hello CI TEST");
printf("You are running RIOT on a(n) %s board.\n", RIOT_BOARD);
printf("This board features a(n) %s MCU.\n", RIOT_MCU);

View File

@ -11,7 +11,9 @@ CARGO_COMPILE_COMMANDS_FLAGS = --clang
$(CARGO_COMPILE_COMMANDS): $(BUILDDEPS)
$(Q)DIRS="$(DIRS)" APPLICATION_BLOBS="$(BLOBS)" \
"$(MAKE)" -C $(APPDIR) -f $(RIOTMAKE)/application.inc.mk compile-commands
@# replacement addresses https://github.com/rust-lang/rust-bindgen/issues/1555
$(Q)$(RIOTTOOLS)/compile_commands/compile_commands.py $(CARGO_COMPILE_COMMANDS_FLAGS) $(BINDIR) \
| sed 's/"riscv-none-embed"/"riscv32"/g' \
| $(LAZYSPONGE) $@

View File

@ -6,6 +6,10 @@
EXTERNAL_MODULE_PATHS := $(sort $(foreach dir,$(EXTERNAL_MODULE_DIRS),\
$(foreach mod,$(USEMODULE),$(dir $(wildcard $(dir)/$(mod)/Makefile)))))
# Locate used packages in $(RIOTPKG).
PKG_PATHS := $(sort $(foreach dir,$(RIOTPKG),\
$(foreach pkg,$(USEPKG),$(dir $(wildcard $(dir)/$(pkg)/Makefile)))))
# Back up current state to detect changes
OLD_STATE := $(USEMODULE) $(USEPKG) $(FEATURES_USED)

View File

@ -47,6 +47,7 @@ export DOCKER_ENV_VARS += \
ELFFILE \
HEXFILE \
FLASHFILE \
IOTLAB_NODE \
LINK \
LINKFLAGPREFIX \
LINKFLAGS \
@ -241,6 +242,11 @@ DOCKER_APPDIR = $(DOCKER_RIOTPROJECT)/$(BUILDRELPATH)
# Directory mapping in docker and directories environment variable configuration
DOCKER_VOLUMES_AND_ENV += $(call docker_volume,$(ETC_LOCALTIME),/etc/localtime,ro)
DOCKER_VOLUMES_AND_ENV += $(call docker_volume,$(RIOTBASE),$(DOCKER_RIOTBASE))
# Selective components of Cargo to ensure crates are not re-downloaded (and
# subsequently rebuilt) on every run. Not using all of ~/.cargo as ~/.cargo/bin
# would be run by Cargo and that'd be very weird.
DOCKER_VOLUMES_AND_ENV += $(call docker_volume,$(HOME)/.cargo/registry,$(DOCKER_BUILD_ROOT)/.cargo/registry)
DOCKER_VOLUMES_AND_ENV += $(call docker_volume,$(HOME)/.cargo/git,$(DOCKER_BUILD_ROOT)/.cargo/git)
DOCKER_VOLUMES_AND_ENV += -e 'RIOTBASE=$(DOCKER_RIOTBASE)'
DOCKER_VOLUMES_AND_ENV += -e 'CCACHE_BASEDIR=$(DOCKER_RIOTBASE)'

View File

@ -179,8 +179,8 @@ $(KCONFIG_GENERATED_ENV_CONFIG): FORCE | $(GENERATED_DIR)
| $(LAZYSPONGE) $(LAZYSPONGE_FLAGS) $@
# All directories in EXTERNAL_MODULES_PATHS which have a Kconfig file
EXTERNAL_MODULE_KCONFIGS ?= $(sort $(foreach dir,$(EXTERNAL_MODULE_PATHS),\
$(wildcard $(dir)/Kconfig)))
EXTERNAL_MODULE_KCONFIGS ?= $(sort $(foreach dir,$(EXTERNAL_MODULE_DIRS),\
$(wildcard $(dir)/*/Kconfig)))
# Build a Kconfig file that source all external modules configuration
# files. Every EXTERNAL_MODULE_DIRS with a Kconfig file is written to
# KCONFIG_EXTERNAL_CONFIGS as 'osource dir/Kconfig'

View File

@ -1,6 +1,38 @@
## @defgroup pseudomodules Generic pseudomodules
## @brief Modules influencing general RIOT behavior
##
## These are implemented in other modules or core components,
## and serve to enable certain functionality.
##
## Here, pseudomodules are used instead of plain defines (that would be set using `CFLAGS += -DMODULE_NAME`)
## because they can participate in dependency resolution:
## they can pull in other modules.
##
## Pseudomodules are often enabled automatically through module dependencies,
## but can also be enabled manually by stating `USEMODULE += module_name` in the Makefile.
##
## The list of documented pseudomodules is not comprehensive by far;
## @ref makefiles/pseudomodules.inc.mk lists all that are not defined inside their main modules.
## Not all modules listed there are "generic" pseudomodules;
## some are merely optional components of a particular subsystem and should be documented there.
##
## See also <a href="creating-modules.html#pseudomodules">the documentation on pseudomodules in general</a>.
##
## @{
PSEUDOMODULES += atomic_utils
PSEUDOMODULES += base64url
## @defgroup pseudomodule_board_software_reset board_software_reset
## @brief Use any software-only reset button on the board to reboot
##
## Some boards have reset buttons that are not wired to the MCU's reset line,
## but merely are configured to cause a reset by convention.
##
## If this module is active, the button will be configured thusly (and then not
## be advertised in any other capacity, e.g. through @ref sys_auto_init_saul).
PSEUDOMODULES += board_software_reset
PSEUDOMODULES += can_mbox
PSEUDOMODULES += can_pm
PSEUDOMODULES += can_raw
@ -87,8 +119,21 @@ PSEUDOMODULES += log
PSEUDOMODULES += log_printfnoformat
PSEUDOMODULES += log_color
PSEUDOMODULES += lora
## @defgroup pseudomodule_mpu_stack_guard mpu_stack_guard
## @brief MPU based stack guard
##
## When this module is active (which it is by default on supported MCUs),
## the Memory Protection Unit will be configured to detect stack overflows.
PSEUDOMODULES += mpu_stack_guard
## @defgroup pseudomodule_mpu_noexec_ram mpu_noexec_ram
## @brief Mark RAM as non-executable using the MPU
##
## Mark the RAM non executable.
## This is a protection mechanism which makes exploitation of buffer overflows significantly harder.
PSEUDOMODULES += mpu_noexec_ram
PSEUDOMODULES += mtd_write_page
PSEUDOMODULES += nanocoap_%
PSEUDOMODULES += netdev_default
@ -109,11 +154,15 @@ PSEUDOMODULES += netstats_rpl
PSEUDOMODULES += nimble
PSEUDOMODULES += nimble_adv_ext
PSEUDOMODULES += nimble_autoconn_%
PSEUDOMODULES += nimble_netif_ext
PSEUDOMODULES += nimble_phy_coded
PSEUDOMODULES += nimble_phy_2mbit
PSEUDOMODULES += nimble_rpble_ext
PSEUDOMODULES += nimble_statconn_ext
PSEUDOMODULES += newlib
PSEUDOMODULES += newlib_gnu_source
PSEUDOMODULES += newlib_nano
PSEUDOMODULES += nice
PSEUDOMODULES += nrf24l01p_ng_diagnostics
PSEUDOMODULES += openthread
PSEUDOMODULES += picolibc
@ -155,6 +204,7 @@ PSEUDOMODULES += stdin
PSEUDOMODULES += stdio_available
PSEUDOMODULES += stdio_cdc_acm
PSEUDOMODULES += stdio_ethos
PSEUDOMODULES += stdio_nimble_debug
PSEUDOMODULES += stdio_uart_rx
PSEUDOMODULES += stm32_eth
PSEUDOMODULES += stm32_eth_auto
@ -214,3 +264,5 @@ NO_PSEUDOMODULES += auto_init_usbus
NO_PSEUDOMODULES += auto_init_screen
# Packages and drivers may also add modules to PSEUDOMODULES in their `Makefile.include`.
## @}

View File

@ -2,6 +2,7 @@ STDIO_MODULES = \
slipdev_stdio \
stdio_cdc_acm \
stdio_ethos \
stdio_nimble \
stdio_null \
stdio_rtt \
stdio_semihosting \
@ -29,6 +30,18 @@ ifneq (,$(filter stdio_ethos,$(USEMODULE)))
USEMODULE += stdin
endif
ifneq (,$(filter stdio_nimble,$(USEMODULE)))
USEMODULE += stdio_available
USEPKG += nimble
USEMODULE += tsrb
USEMODULE += isrpipe
USEMODULE += nimble_svc_gap
USEMODULE += nimble_svc_gatt
ifneq (,$(filter stdio_nimble_debug,$(USEMODULE)))
FEATURES_REQUIRED += periph_uart
endif
endif
ifneq (,$(filter stdin,$(USEMODULE)))
ifneq (,$(filter stdio_uart,$(USEMODULE)))
USEMODULE += stdio_uart_rx

View File

@ -45,6 +45,7 @@ export BINDIR # This is the folder where the application should b
export CARGO_TARGET_DIR # This is the folder where Rust parts of the application should be built in.
export BUILD_DIR # This is the base folder to store common build files and artifacts, e.g. test results.
export APPDIR # The base folder containing the application
export PKG_PATHS # List of absolute paths where packages of $(USEPKG) can be found
export PKGDIRBASE # The base folder for building packages
export PYTHONPATH # Python default search path for module filesi, with RIOT specific packages

View File

@ -21,6 +21,7 @@ rsource "esp32_sdk/Kconfig"
rsource "esp32_sdk_libs/Kconfig"
rsource "esp8266_sdk/Kconfig"
rsource "fff/Kconfig"
rsource "fido2_tests/Kconfig"
rsource "gecko_sdk/Kconfig"
rsource "gemmlowp/Kconfig"
rsource "hacl/Kconfig"

View File

@ -20,11 +20,13 @@ ESP32_SDK_LIBS = $(addprefix $(ESP32_SDK_BUILD_DIR)/, $(ESP32_SDK_COMPONENT_LIBS
all: $(ESP32_SDK_LIBS) $(ESP32_SDK_VER_FILE)
$(ESP32_SDK_BUILD_DIR):
$(PKG_PREPARED): $(ESP32_SDK_BUILD_DIR) $(ESP32_SDK_VER_FILE)
$(ESP32_SDK_BUILD_DIR): $(PKG_PATCHED)
$(Q)mkdir -p $(ESP32_SDK_BUILD_DIR)
# Set the SDK version from the SDK hash/tag. For example "v3.1-51-g913a06a9".
$(ESP32_SDK_VER_FILE):
$(ESP32_SDK_VER_FILE): $(PKG_PATCHED) | $(ESP32_SDK_BUILD_DIR)
$(Q)echo "#define IDF_VER \"$(ESP32_SDK_VER_CMD)\"" > $@
$(ESP32_SDK_BUILD_DIR)/lib%.a: \

View File

@ -31,7 +31,9 @@ ESP32_SDK_LIBS = $(addprefix $(ESP32_SDK_BUILD_DIR)/, $(ESP32_SDK_COMPONENT_LIBS
all: $(ESP32_SDK_LIBS)
$(ESP32_SDK_BUILD_DIR):
$(PKG_PREPARED): $(ESP32_SDK_BUILD_DIR)
$(ESP32_SDK_BUILD_DIR): $(PKG_PATCHED)
$(Q)mkdir -p $(ESP32_SDK_BUILD_DIR)
$(ESP32_SDK_BUILD_DIR)/lib%.a: \

View File

@ -20,7 +20,9 @@ ESP_SDK_LIBS = $(addprefix $(ESP8266_SDK_BUILD_DIR)/, $(ESP_SDK_COMPONENT_LIBS))
all: $(ESP_SDK_LIBS) $(ESP8266_SDK_BUILD_DIR)/esp8266_idf_version.h
$(ESP8266_SDK_BUILD_DIR):
$(PKG_PREPARED): $(ESP8266_SDK_BUILD_DIR)
$(ESP8266_SDK_BUILD_DIR): $(PKG_PATCHED)
$(Q)mkdir -p $(ESP8266_SDK_BUILD_DIR)
# Set the SDK version from the SDK hash/tag. For example "v3.1-51-g913a06a9".

4
pkg/fido2_tests/Kconfig Normal file
View File

@ -0,0 +1,4 @@
config PACKAGE_FIDO2_TESTS
bool "FIDO2 tests"
help
Test suite for FIDO2, U2F, and other security key functions.

View File

@ -23,7 +23,7 @@ else
CFLAGS += -Wno-unused-but-set-variable
endif
IGNORE := nimble_autoconn_% nimble_phy_% nimble_adv_ext
IGNORE := nimble_autoconn_% nimble_phy_% nimble_%_ext
SUBMODS := $(filter-out $(IGNORE),$(filter nimble_%,$(USEMODULE)))
.PHONY: all

View File

@ -12,6 +12,15 @@ USEMODULE += nimble_riot_contrib
# RIOT port
USEMODULE += nimble_porting_nimble
# Pull in dependencies based on used features
ifneq (,$(filter ble_phy_coded,$(FEATURES_USED)))
USEMODULE += nimble_phy_coded
endif
ifneq (,$(filter ble_phy_2mbit,$(FEATURES_USED)))
USEMODULE += nimble_phy_2mbit
endif
# NOTE: this dependency depends on inclusion order, for it to work properly
# mynewt-core should be selected as nimble backend as early as possible,
# i.e. at the application level.
@ -56,6 +65,10 @@ ifneq (,$(filter nimble_autoadv,$(USEMODULE)))
USEMODULE += bluetil_ad
endif
ifneq (,$(filter nimble_autoconn_ext,$(USEMODULE)))
USEMODULE += nimble_netif_ext
endif
ifneq (,$(filter nimble_autoconn_%,$(USEMODULE)))
USEMODULE += nimble_autoconn
endif
@ -67,10 +80,6 @@ ifneq (,$(filter nimble_autoconn,$(USEMODULE)))
USEMODULE += bluetil_ad
endif
ifneq (,$(filter nimble_phy_%,$(USEMODULE)))
USEMODULE += nimble_adv_ext
endif
ifneq (,$(filter nimble_phy_2mbit,$(USEMODULE)))
FEATURES_REQUIRED += ble_phy_2mbit
endif
@ -79,6 +88,11 @@ ifneq (,$(filter nimble_phy_coded,$(USEMODULE)))
FEATURES_REQUIRED += ble_phy_coded
endif
ifneq (,$(filter nimble_rpble_ext,$(USEMODULE)))
USEMODULE += nimble_rpble
USEMODULE += nimble_netif_ext
endif
ifneq (,$(filter nimble_rpble,$(USEMODULE)))
USEMODULE += gnrc_rpl
USEMODULE += nimble_netif
@ -92,12 +106,22 @@ ifneq (,$(filter nimble_scanlist,$(USEMODULE)))
USEMODULE += ztimer_usec
endif
ifneq (,$(filter nimble_statconn_ext,$(USEMODULE)))
USEMODULE += nimble_statconn
USEMODULE += nimble_netif_ext
endif
ifneq (,$(filter nimble_statconn,$(USEMODULE)))
USEMODULE += random
USEMODULE += nimble_netif
USEMODULE += nimble_addr
endif
ifneq (,$(filter nimble_netif_ext,$(USEMODULE)))
USEMODULE += nimble_netif
USEMODULE += nimble_adv_ext
endif
ifneq (,$(filter nimble_netif,$(USEMODULE)))
FEATURES_REQUIRED += ble_nimble_netif
USEMODULE += random

View File

@ -26,6 +26,14 @@ ifneq (,$(filter nimble_controller,$(USEMODULE)))
ifneq (,$(filter nimble_drivers_nrf5x,$(USEMODULE)))
INCLUDES += $(NIMIBASE)/nimble/drivers/$(CPU_FAM)/include
endif
# Enable additional PHY modes if requested by the build
ifneq (,$(filter ble_phy_2mbit,$(FEATURES_USED)))
CFLAGS += -DMYNEWT_VAL_BLE_LL_CFG_FEAT_LE_2M_PHY=1
endif
ifneq (,$(filter ble_phy_coded,$(FEATURES_USED)))
CFLAGS += -DMYNEWT_VAL_BLE_LL_CFG_FEAT_LE_CODED_PHY=1
endif
endif
# include nimble host headers
@ -94,18 +102,6 @@ ifneq (,$(filter nimble_adv_ext,$(USEMODULE)))
endif
endif
ifneq (,$(filter nimble_phy_2mbit,$(USEMODULE)))
ifneq (,$(filter nimble_controller,$(USEMODULE)))
CFLAGS += -DMYNEWT_VAL_BLE_LL_CFG_FEAT_LE_2M_PHY=1
endif
endif
ifneq (,$(filter nimble_phy_coded,$(USEMODULE)))
ifneq (,$(filter nimble_controller,$(USEMODULE)))
CFLAGS += -DMYNEWT_VAL_BLE_LL_CFG_FEAT_LE_CODED_PHY=1
endif
endif
ifneq (,$(filter nimble_netif,$(USEMODULE)))
INCLUDES += -I$(RIOTPKG)/nimble/netif/include
@ -135,6 +131,17 @@ ifneq (,$(filter nimble_netif,$(USEMODULE)))
CFLAGS += -DMYNEWT_VAL_BLE_LL_CONN_INIT_SLOTS=1
CFLAGS += -DMYNEWT_VAL_BLE_LL_CFG_FEAT_DATA_LEN_EXT=1
endif
else
ifneq (,$(filter stdio_nimble,$(USEMODULE)))
# the maximum fragment size that we can receive. For maximum efficiency this
# should be equal to the maximum configured link layer packet size.
# WARNING: this value MUST never be larger than MYNEWT_VAL_BLE_LL_MAX_PKT_SIZE
CFLAGS += -DMYNEWT_VAL_BLE_L2CAP_COC_MPS=251
# in order to fit a 251 byte COC data segment into a single mbuf buffer, the
# used block size must be at least 297 byte (251 data + 48 overhead)
CFLAGS += -DMYNEWT_VAL_MSYS_1_BLOCK_SIZE="(MYNEWT_VAL_BLE_L2CAP_COC_MPS + 48)"
endif
endif
ifneq (,$(filter nimble_rpble,$(USEMODULE)))

View File

@ -131,29 +131,31 @@ enum {
*/
typedef struct {
/** amount of time spend in scanning mode [in ms] */
uint32_t period_scan;
uint32_t period_scan_ms;
/** amount of time spend in advertising mode [in ms] */
uint32_t period_adv;
uint32_t period_adv_ms;
/** a random value from 0 to this value is added to the duration of each
* scanning and advertising period [in ms] */
uint32_t period_jitter;
uint32_t period_jitter_ms;
/** advertising interval used when in advertising mode [in ms] */
uint32_t adv_itvl;
uint32_t adv_itvl_ms;
/** scan interval applied while in scanning state [in ms] */
uint32_t scan_itvl;
uint32_t scan_itvl_ms;
/** scan window applied while in scanning state [in ms] */
uint32_t scan_win;
uint32_t scan_win_ms;
/** opening a new connection is aborted after this time [in ms] */
uint32_t conn_timeout;
uint32_t conn_timeout_ms;
/** connection interval used when opening a new connection, lower bound.
* [in ms] */
uint32_t conn_itvl_min;
uint32_t conn_itvl_min_ms;
/** connection interval, upper bound [in ms] */
uint32_t conn_itvl_max;
/** slave latency used for new connections [in ms] */
uint32_t conn_itvl_max_ms;
/** slave latency used for new connections */
uint16_t conn_latency;
/** supervision timeout used for new connections [in ms] */
uint32_t conn_super_to;
uint32_t conn_super_to_ms;
/** BLE PHY mode to use */
nimble_phy_t phy_mode;
/** node ID included in the advertising data, may be NULL */
const char *node_id;
} nimble_autoconn_params_t;

View File

@ -64,24 +64,32 @@ extern "C" {
#define NIMBLE_AUTOCONN_CONN_SVTO_MS (2500U) /* 2.5s */
#endif
/**
* @brief Default BLE PHY mode used by autoconn
*/
#ifndef NIMBLE_AUTOCONN_PHY_MODE
#define NIMBLE_AUTOCONN_PHY_MODE NIMBLE_PHY_1M
#endif
#ifndef NIMBLE_AUTOCONN_NODE_ID
#define NIMBLE_AUTOCONN_NODE_ID "RIOT-autoconn"
#endif
#ifndef NIMBLE_AUTOCONN_PARAMS
#define NIMBLE_AUTOCONN_PARAMS \
{ .period_scan = NIMBLE_AUTOCONN_PERIOD_SCAN_MS, \
.period_adv = NIMBLE_AUTOCONN_PERIOD_ADV_MS, \
.period_jitter = NIMBLE_AUTOCONN_PERIOD_JITTER_MS, \
.adv_itvl = NIMBLE_AUTOCONN_ADV_ITVL_MS, \
.scan_itvl = NIMBLE_AUTOCONN_SCAN_ITVL_MS, \
.scan_win = NIMBLE_AUTOCONN_SCAN_WIN_MS, \
.conn_timeout = NIMBLE_AUTOCONN_CONN_TIMEOUT_MS, \
.conn_itvl_min = NIMBLE_AUTOCONN_CONN_ITVL_MIN_MS, \
.conn_itvl_max = NIMBLE_AUTOCONN_CONN_ITVL_MAX_MS, \
.conn_latency = NIMBLE_AUTOCONN_CONN_LATENCY, \
.conn_super_to = NIMBLE_AUTOCONN_CONN_SVTO_MS, \
.node_id = NIMBLE_AUTOCONN_NODE_ID, }
{ .period_scan_ms = NIMBLE_AUTOCONN_PERIOD_SCAN_MS, \
.period_adv_ms = NIMBLE_AUTOCONN_PERIOD_ADV_MS, \
.period_jitter_ms = NIMBLE_AUTOCONN_PERIOD_JITTER_MS, \
.adv_itvl_ms = NIMBLE_AUTOCONN_ADV_ITVL_MS, \
.scan_itvl_ms = NIMBLE_AUTOCONN_SCAN_ITVL_MS, \
.scan_win_ms = NIMBLE_AUTOCONN_SCAN_WIN_MS, \
.conn_timeout_ms = NIMBLE_AUTOCONN_CONN_TIMEOUT_MS, \
.conn_itvl_min_ms = NIMBLE_AUTOCONN_CONN_ITVL_MIN_MS, \
.conn_itvl_max_ms = NIMBLE_AUTOCONN_CONN_ITVL_MAX_MS, \
.conn_latency = NIMBLE_AUTOCONN_CONN_LATENCY, \
.conn_super_to_ms = NIMBLE_AUTOCONN_CONN_SVTO_MS, \
.phy_mode = NIMBLE_AUTOCONN_PHY_MODE, \
.node_id = NIMBLE_AUTOCONN_NODE_ID, }
#endif
/**@}*/

View File

@ -55,9 +55,8 @@ static volatile uint8_t _enabled = 0;
static bluetil_ad_t _ad;
static uint8_t _ad_buf[BLE_HS_ADV_MAX_SZ];
static struct ble_gap_adv_params _adv_params;
static struct ble_gap_conn_params _conn_params;
static uint32_t _conn_timeout;
static nimble_netif_accept_cfg_t _accept_params;
static nimble_netif_connect_cfg_t _conn_params;
static struct ble_npl_callout _state_evt;
static ble_npl_time_t _timeout_adv_period;
@ -77,7 +76,7 @@ static void _on_state_change(struct ble_npl_event *ev)
/* stop scanning */
nimble_scanner_stop();
/* start advertising/accepting */
int res = nimble_netif_accept(_ad.buf, _ad.pos, &_adv_params);
int res = nimble_netif_accept(_ad.buf, _ad.pos, &_accept_params);
assert((res == 0) || (res == -ENOMEM));
(void)res;
@ -137,11 +136,18 @@ static void _on_scan_evt(uint8_t type, const ble_addr_t *addr,
{
(void)info;
#if IS_USED(MODULE_NIMBLE_AUTOCONN_EXT)
if ((type != (NIMBLE_SCANNER_EXT_ADV | BLE_HCI_ADV_CONN_MASK)) ||
(info->status != BLE_GAP_EXT_ADV_DATA_STATUS_COMPLETE)) {
return;
}
#else
/* we are only interested in ADV_IND packets, the rest can be dropped right
* away */
if (type != BLE_HCI_ADV_RPT_EVTYPE_ADV_IND) {
return;
}
#endif
bluetil_ad_t ad = {
.buf = (uint8_t *)ad_buf,
@ -157,7 +163,7 @@ static void _on_scan_evt(uint8_t type, const ble_addr_t *addr,
nimble_scanner_stop();
DEBUG("[autoconn] SCAN success, initiating connection\n");
_state = STATE_CONN;
int res = nimble_netif_connect(addr, &_conn_params, _conn_timeout);
int res = nimble_netif_connect(addr, &_conn_params);
assert(res >= 0);
(void)res;
}
@ -271,47 +277,66 @@ int nimble_autoconn_update(const nimble_autoconn_params_t *params,
}
/* scan and advertising period configuration */
ble_npl_time_ms_to_ticks(params->period_adv, &_timeout_adv_period);
ble_npl_time_ms_to_ticks(params->period_scan, &_timeout_scan_period);
ble_npl_time_ms_to_ticks(params->period_jitter, &_period_jitter);
ble_npl_time_ms_to_ticks(params->period_adv_ms, &_timeout_adv_period);
ble_npl_time_ms_to_ticks(params->period_scan_ms, &_timeout_scan_period);
ble_npl_time_ms_to_ticks(params->period_jitter_ms, &_period_jitter);
/* populate the connection parameters */
_conn_params.scan_itvl = BLE_GAP_SCAN_ITVL_MS(params->scan_win);
_conn_params.scan_window = _conn_params.scan_itvl;
_conn_params.itvl_min = BLE_GAP_CONN_ITVL_MS(params->conn_itvl_min);
_conn_params.itvl_max = BLE_GAP_CONN_ITVL_MS(params->conn_itvl_max);
_conn_params.latency = 0;
_conn_params.supervision_timeout = BLE_GAP_SUPERVISION_TIMEOUT_MS(
params->conn_super_to);
_conn_params.min_ce_len = 0;
_conn_params.max_ce_len = 0;
_conn_timeout = params->conn_timeout;
memset(&_conn_params, 0, sizeof(_conn_params));
_conn_params.scan_itvl_ms = params->scan_itvl_ms;
_conn_params.scan_window_ms = params->scan_win_ms;
_conn_params.conn_itvl_min_ms = params->conn_itvl_min_ms;
_conn_params.conn_itvl_max_ms = params->conn_itvl_max_ms;
_conn_params.conn_supervision_timeout_ms = params->conn_super_to_ms;
_conn_params.conn_slave_latency = params->conn_latency;
_conn_params.timeout_ms = params->conn_timeout_ms;
#if IS_USED(MODULE_NIMBLE_AUTOCONN_EXT)
_conn_params.phy_mode = params->phy_mode;
#else
_conn_params.phy_mode = NIMBLE_PHY_1M;
#endif
_conn_params.own_addr_type = nimble_riot_own_addr_type;
/* we use the same values to updated existing connections */
struct ble_gap_upd_params conn_update_params;
conn_update_params.itvl_min = _conn_params.itvl_min;
conn_update_params.itvl_max = _conn_params.itvl_max;
conn_update_params.latency = _conn_params.latency;
conn_update_params.supervision_timeout = _conn_params.supervision_timeout;
conn_update_params.itvl_min = BLE_GAP_CONN_ITVL_MS(params->conn_itvl_min_ms);
conn_update_params.itvl_max = BLE_GAP_CONN_ITVL_MS(params->conn_itvl_max_ms);
conn_update_params.latency = params->conn_latency;
conn_update_params.supervision_timeout =
BLE_GAP_SUPERVISION_TIMEOUT_MS(params->conn_super_to_ms);
conn_update_params.min_ce_len = 0;
conn_update_params.max_ce_len = 0;
/* calculate the used scan parameters */
nimble_scanner_cfg_t scan_params;
scan_params.itvl_ms = params->scan_itvl;
scan_params.win_ms = params->scan_win;
scan_params.flags = NIMBLE_SCANNER_PASSIVE
| NIMBLE_SCANNER_FILTER_DUPS
| NIMBLE_SCANNER_PHY_1M;
scan_params.itvl_ms = params->scan_itvl_ms;
scan_params.win_ms = params->scan_win_ms;
scan_params.flags = (NIMBLE_SCANNER_PASSIVE | NIMBLE_SCANNER_FILTER_DUPS);
#if IS_USED(MODULE_NIMBLE_AUTOCONN_EXT) && IS_USED(MODULE_NIMBLE_PHY_CODED)
if (params->phy_mode == NIMBLE_PHY_CODED) {
scan_params.flags |= NIMBLE_SCANNER_PHY_CODED;
}
else {
scan_params.flags |= NIMBLE_SCANNER_PHY_1M;
}
#else
scan_params.flags |= NIMBLE_SCANNER_PHY_1M;
#endif
/* set the advertising parameters used */
_adv_params.conn_mode = BLE_GAP_CONN_MODE_UND;
_adv_params.disc_mode = BLE_GAP_DISC_MODE_GEN;
_adv_params.itvl_min = BLE_GAP_ADV_ITVL_MS(params->adv_itvl);
_adv_params.itvl_max = _adv_params.itvl_min;
_adv_params.channel_map = 0;
_adv_params.filter_policy = 0;
_adv_params.high_duty_cycle = 0;
memset(&_accept_params, 0, sizeof(_accept_params));
#if IS_USED(MODULE_NIMBLE_AUTOCONN_EXT)
_accept_params.flags = 0;
_accept_params.primary_phy = params->phy_mode;
_accept_params.secondary_phy = params->phy_mode;
#else
_accept_params.flags = NIMBLE_NETIF_FLAG_LEGACY;
_accept_params.primary_phy = NIMBLE_PHY_1M;
_accept_params.secondary_phy = NIMBLE_PHY_1M;
#endif
_accept_params.adv_itvl_ms = params->adv_itvl_ms;
_accept_params.timeout_ms = BLE_HS_FOREVER;
_accept_params.own_addr_type = nimble_riot_own_addr_type;
/* initialize the advertising data that will be used */
if (adlen > 0) {

View File

@ -69,6 +69,20 @@ extern "C" {
#define NIMBLE_HOST_STACKSIZE (THREAD_STACKSIZE_DEFAULT)
#endif
/**
* @brief BLE PHY modes
*/
typedef enum {
NIMBLE_PHY_INVALID, /**< PHY mode invalid */
NIMBLE_PHY_1M, /**< legacy 1Mbit PHY mode (always supported) */
#if IS_USED(MODULE_NIMBLE_PHY_2MBIT)
NIMBLE_PHY_2M, /**< 2Mbit PHY mode */
#endif
#if IS_USED(MODULE_NIMBLE_PHY_CODED)
NIMBLE_PHY_CODED, /**< Coded (long range) PHY mode */
#endif
} nimble_phy_t;
/**
* @brief Export our own address type for later usage
*/

View File

@ -176,6 +176,13 @@ void nimble_riot_init(void)
nimble_autoconn_enable();
#endif
#ifdef MODULE_STDIO_NIMBLE
extern void stdio_nimble_init(void);
/* stdio_nimble_init() needs to be called after nimble stack initialization
* and before nimble_autoadv_init() */
stdio_nimble_init();
#endif
#ifdef MODULE_NIMBLE_AUTOADV
extern void nimble_autoadv_init(void);
nimble_autoadv_init();

View File

@ -1,5 +1,5 @@
/*
* Copyright (C) 2018-2019 Freie Universität Berlin
* Copyright (C) 2018-2021 Freie Universität Berlin
*
* This file is subject to the terms and conditions of the GNU Lesser
* General Public License v2.1. See the file LICENSE in the top level
@ -70,6 +70,7 @@
#include <errno.h>
#include "net/ble.h"
#include "nimble_riot.h"
#include "host/ble_hs.h"
@ -103,6 +104,46 @@ extern "C" {
#define NIMBLE_NETIF_MTU (1280U)
#endif
/**
* @brief Flags for enabling legacy advertisement and high-duty cycle mode
* when accepting incoming connections
*/
enum {
NIMBLE_NETIF_FLAG_LEGACY = 0x01, /**< use legacy advertising mode */
NIMBLE_NETIF_FLAG_HD_MODE = 0x02, /**< use high duty cycle mode, only
* valid for direct advertising */
};
/**
* @brief Parameter set used to configure accepting connections (advertising)
*/
typedef struct {
uint8_t flags; /**< flags */
uint8_t channel_map; /**< specify custom channel map */
uint8_t own_addr_type; /**< specify our own address type to use */
int8_t tx_power; /**< specify TX power to be used */
uint32_t adv_itvl_ms; /**< advertising interval [ms] */
uint32_t timeout_ms; /**< stop accepting after this time [ms] */
nimble_phy_t primary_phy; /**< primary PHY mode */
nimble_phy_t secondary_phy; /**< secondary PHY mode */
} nimble_netif_accept_cfg_t;
/**
* @brief Parameter set used to configure connection initiation
*/
typedef struct {
uint16_t scan_itvl_ms; /**< scan interval [ms] */
uint16_t scan_window_ms; /**< scan window [ms] */
uint16_t conn_itvl_min_ms; /**< connection interval, lower bound [ms] */
uint16_t conn_itvl_max_ms; /**< connection interval, upper bound [ms] */
uint16_t conn_supervision_timeout_ms; /**< supervision timeout [ms] */
uint16_t conn_slave_latency;/**< slave latency */
uint32_t timeout_ms; /**< abort connection initiation after this time
* [ms] */
uint8_t phy_mode; /**< PHY mode used for the connection */
uint8_t own_addr_type; /**< specify our own address type to use */
} nimble_netif_connect_cfg_t;
/**
* @brief Set to > 0 to enforce different connection intervals for each of the
* nodes BLE connections
@ -197,19 +238,18 @@ void nimble_netif_eventcb(nimble_netif_eventcb_t cb);
*
* @param[in] addr address of the advertising BLE slave, in the NimBLE
* addr format (little endian)
* @param[in] conn_params connection (timing) parameters, set to NULL to use
* NimBLEs default parameters
* @param[in] timeout connect timeout [in ms]
* @param[in] cfg connection parameters
*
* @return the used connection handle on success
* @return -EBUSY if already connected to the given address or if
* a connection setup procedure is in progress
* @return -EBUSY if already connected to the given address or if a connection
* setup procedure is in progress
* @return -ENOMEM if no connection context memory is available
* @return -ECANCELED if unable to find valid connection interval
* @return -EINVAL if unable to apply given PHY mode
* @return -EIO on all other NimBLE errors
*/
int nimble_netif_connect(const ble_addr_t *addr,
struct ble_gap_conn_params *conn_params,
uint32_t timeout);
const nimble_netif_connect_cfg_t *cfg);
/**
* @brief Close the connection with the given handle
@ -219,6 +259,7 @@ int nimble_netif_connect(const ble_addr_t *addr,
* @return 0 on success
* @return -EINVAL if the handle is invalid
* @return -ENOTCONN if context for given handle is not connected
* @return -EIO on all other NimBLE errors
*/
int nimble_netif_close(int handle);
@ -227,36 +268,39 @@ int nimble_netif_close(int handle);
*
* @param[in] ad advertising data (in BLE AD format)
* @param[in] ad_len length of @p ad in bytes
* @param[in] adv_params advertising (timing) parameters to use
* @param[in] cfg advertising parameters to use
*
* @return 0 on success
* @return -EALREADY if already advertising
* @return -ENOMEM on insufficient connection memory
* @return -EINVAL on invalid configuration parameters
* @return -ECANCELED on other errors
*/
int nimble_netif_accept(const uint8_t *ad, size_t ad_len,
const struct ble_gap_adv_params *adv_params);
const nimble_netif_accept_cfg_t *cfg);
/**
* @brief Wait for an incoming connection from a specific peer, sending
* directed advertisements (IND_DIR)
* directed advertisements
*
* @param[in] addr BLE address of the target peer
* @param[in] timeout_ms stop advertising after this time (in ms), set to
* BLE_HS_FOREVER to disable timeout
* @param[in] adv_params advertising (timing) parameters to use
* @param[in] cfg advertising parameters to use
*
* @return 0 on success
* @return -EALREADY if already advertising
* @return -ENOMEM on insufficient connection memory
* @return -EINVAL on invalid configuration parameters
* @return -ECANCELED on other errors
*/
int nimble_netif_accept_direct(const ble_addr_t *addr, uint32_t timeout_ms,
const struct ble_gap_adv_params *adv_params);
int nimble_netif_accept_direct(const ble_addr_t *addr,
const nimble_netif_accept_cfg_t *cfg);
/**
* @brief Stop accepting incoming connections (stop advertising)
* *
* @return 0 on success
* @return -EALREADY if not currently advertising
* @return -EIO on other NimBLE errors
*/
int nimble_netif_accept_stop(void);

View File

@ -1,5 +1,5 @@
/*
* Copyright (C) 2018-2019 Freie Universität Berlin
* Copyright (C) 2018-2021 Freie Universität Berlin
*
* This file is subject to the terms and conditions of the GNU Lesser
* General Public License v2.1. See the file LICENSE in the top level
@ -55,6 +55,8 @@
#define NIMBLE_NETIF_PRIO GNRC_NETIF_PRIO
#endif
#define EXT_ADV_INST 0
/* thread flag used for signaling transmit readiness */
#define FLAG_TX_UNSTALLED (1u << 13)
#define FLAG_TX_NOTCONN (1u << 12)
@ -543,10 +545,14 @@ static int _on_gap_slave_evt(struct ble_gap_event *event, void *arg)
/* nothing to do here */
break;
case BLE_GAP_EVENT_ADV_COMPLETE: {
uint8_t addr[BLE_ADDR_LEN];
nimble_netif_conn_free(handle, addr);
_notify(handle, NIMBLE_NETIF_ACCEPT_STOP, addr);
if (conn->state == NIMBLE_NETIF_ADV) {
uint8_t addr[BLE_ADDR_LEN];
nimble_netif_conn_free(handle, addr);
_notify(handle, NIMBLE_NETIF_ACCEPT_STOP, addr);
}
}
case BLE_GAP_EVENT_PHY_UPDATE_COMPLETE:
break;
default:
break;
}
@ -577,14 +583,10 @@ void nimble_netif_eventcb(nimble_netif_eventcb_t cb)
}
int nimble_netif_connect(const ble_addr_t *addr,
struct ble_gap_conn_params *conn_params,
uint32_t timeout)
const nimble_netif_connect_cfg_t *params)
{
assert(addr);
assert(_eventcb);
uint16_t itvl_min = 0;
uint16_t itvl_max = 0;
assert(params);
/* the netif_conn module expects addresses in network byte order */
uint8_t addrn[BLE_ADDR_LEN];
@ -602,33 +604,63 @@ int nimble_netif_connect(const ble_addr_t *addr,
return -ENOMEM;
}
if ((conn_params != NULL)
&& (conn_params->itvl_min != conn_params->itvl_max)) {
/* we need to save the min/max intervals in order to restore them
* later on */
itvl_min = conn_params->itvl_min;
itvl_max = conn_params->itvl_max;
uint16_t itvl = nimble_netif_conn_gen_itvl(itvl_min, itvl_max);
if (itvl == 0) {
return -ECANCELED;
}
conn_params->itvl_min = itvl;
conn_params->itvl_max = itvl;
/* generate connection interval */
uint16_t itvl = params->conn_itvl_min_ms;
if (params->conn_itvl_min_ms < params->conn_itvl_max_ms) {
itvl = nimble_netif_conn_gen_itvl(params->conn_itvl_min_ms,
params->conn_itvl_max_ms);
}
if (itvl == 0) {
nimble_netif_conn_free(handle, NULL);
return -ECANCELED;
}
int res = ble_gap_connect(nimble_riot_own_addr_type, addr, timeout,
conn_params, _on_gap_master_evt, (void *)handle);
assert(res == 0);
(void)res;
struct ble_gap_conn_params p = {
.scan_itvl = BLE_GAP_SCAN_ITVL_MS(params->scan_itvl_ms),
.scan_window = BLE_GAP_SCAN_WIN_MS(params->scan_window_ms),
.itvl_min = BLE_GAP_CONN_ITVL_MS(itvl),
.itvl_max = BLE_GAP_CONN_ITVL_MS(itvl),
.latency = params->conn_slave_latency,
.supervision_timeout = BLE_GAP_SUPERVISION_TIMEOUT_MS(
params->conn_supervision_timeout_ms),
.min_ce_len = 0,
.max_ce_len = 0,
};
if (itvl_min != itvl_max) {
conn_params->itvl_min = itvl_min;
conn_params->itvl_max = itvl_max;
#if MYNEWT_VAL_BLE_EXT_ADV
uint8_t phy_mask;
if (params->phy_mode == NIMBLE_PHY_1M) {
phy_mask = BLE_GAP_LE_PHY_1M_MASK;
}
#if IS_USED(MODULE_NIMBLE_PHY_2MBIT)
else if (params->phy_mode == NIMBLE_PHY_2M) {
phy_mask = (BLE_GAP_LE_PHY_1M_MASK | BLE_GAP_LE_PHY_2M_MASK);
}
#endif
#if IS_USED(MODULE_NIMBLE_PHY_CODED)
else if (params->phy_mode == NIMBLE_PHY_CODED) {
phy_mask = BLE_GAP_LE_PHY_CODED_MASK;
}
#endif
else {
return -EINVAL;
}
int res = ble_gap_ext_connect(params->own_addr_type, addr,
params->timeout_ms, phy_mask, &p, &p, &p,
_on_gap_master_evt, (void *)handle);
#else
uint32_t timeout = (params->timeout_ms == 0) ? BLE_HS_FOREVER
: params->timeout_ms;
int res = ble_gap_connect(params->own_addr_type, addr,
timeout, &p,
_on_gap_master_evt, (void *)handle);
#endif
if (res != 0) {
return -EIO;
}
_notify(handle, NIMBLE_NETIF_INIT_MASTER, addrn);
return handle;
}
@ -642,63 +674,168 @@ int nimble_netif_close(int handle)
return -ENOTCONN;
}
int res = ble_gap_terminate(ble_l2cap_get_conn_handle(conn->coc),
BLE_ERR_REM_USER_CONN_TERM);
assert(res == 0);
(void)res;
int res = ble_gap_terminate(conn->gaphandle, BLE_ERR_REM_USER_CONN_TERM);
if (res != 0) {
return -EIO;
}
return 0;
}
static int _accept(const uint8_t *ad, size_t ad_len, const ble_addr_t *addr,
uint32_t timeout,
const struct ble_gap_adv_params *adv_params)
#if MYNEWT_VAL_BLE_EXT_ADV
static int _get_phy_hci(uint8_t mode)
{
assert(adv_params);
switch (mode) {
case NIMBLE_PHY_1M:
return BLE_HCI_LE_PHY_1M;
#if IS_USED(MODULE_NIMBLE_PHY_2MBIT)
case NIMBLE_PHY_2M:
return BLE_HCI_LE_PHY_2M;
#endif
#if IS_USED(MODULE_NIMBLE_PHY_CODED)
case NIMBLE_PHY_CODED:
return BLE_HCI_LE_PHY_CODED;
#endif
default:
return -1;
}
}
#endif
static int _accept(const uint8_t *ad, size_t ad_len, const ble_addr_t *addr,
const nimble_netif_accept_cfg_t *params)
{
int handle;
int res;
(void)res;
assert(params);
/* allocate a connection context for incoming connections */
handle = nimble_netif_conn_start_adv();
if (handle < 0) {
return handle;
}
/* set advertisement data */
if (ad != NULL) {
res = ble_gap_adv_set_data(ad, (int)ad_len);
assert(res == 0);
}
/* remember address if applicable */
if (addr) {
nimble_netif_conn_t *conn = nimble_netif_conn_get(handle);
bluetil_addr_swapped_cp(addr->val, conn->addr);
}
/* remember context and start advertising */
res = ble_gap_adv_start(nimble_riot_own_addr_type, addr, timeout,
adv_params, _on_gap_slave_evt, (void *)handle);
assert(res == 0);
#if MYNEWT_VAL_BLE_EXT_ADV
struct ble_gap_ext_adv_params p;
memset(&p, 0, sizeof(p));
/* figure out PHY modes */
int phy_pri = _get_phy_hci(params->primary_phy);
int phy_sec = _get_phy_hci(params->secondary_phy);
if ((phy_pri < 0) || (phy_sec < 0)) {
nimble_netif_conn_free(handle, NULL);
return -EINVAL;
}
/* the 2M PHY is not allowed as primary phy, we need to used the 1M PHY
* instead. This is for convenience so uses may define 2M as primary PHY */
if (phy_pri == BLE_HCI_LE_PHY_2M) {
phy_pri = BLE_HCI_LE_PHY_1M;
}
if (addr != NULL) {
p.directed = 1;
memcpy(&p.peer, addr, sizeof(p.peer));
if (params->flags & NIMBLE_NETIF_FLAG_HD_MODE) {
p.high_duty_directed = 1;
}
}
else {
p.connectable = 1;
}
if (params->flags & NIMBLE_NETIF_FLAG_LEGACY) {
p.legacy_pdu = 1;
/* legacy connectable PDUs are always scannable */
p.scannable = 1;
}
p.itvl_min = BLE_GAP_ADV_ITVL_MS(params->adv_itvl_ms);
p.itvl_max = BLE_GAP_ADV_ITVL_MS(params->adv_itvl_ms);
p.channel_map = params->channel_map;
p.own_addr_type = params->own_addr_type;
p.primary_phy = (uint8_t)phy_pri;
p.secondary_phy = (uint8_t)phy_sec;
p.tx_power = params->tx_power;
res = ble_gap_ext_adv_configure(EXT_ADV_INST, &p, NULL,
_on_gap_slave_evt, (void *)handle);
if (res != 0) {
nimble_netif_conn_free(handle, NULL);
return -EINVAL;
}
if (ad != NULL) {
struct os_mbuf *data = os_msys_get_pkthdr(ad_len, 0);
if (data == NULL) {
nimble_netif_conn_free(handle, NULL);
return -ENOMEM;
}
res = os_mbuf_append(data, ad, ad_len);
if (res != 0) {
os_mbuf_free_chain(data);
nimble_netif_conn_free(handle, NULL);
return -ENOMEM;
}
res = ble_gap_ext_adv_set_data(EXT_ADV_INST, data);
assert(res == 0);
}
res = ble_gap_ext_adv_start(EXT_ADV_INST, params->timeout_ms / 10, 0);
#else
uint8_t mode = (addr != NULL) ? BLE_GAP_CONN_MODE_DIR
: BLE_GAP_CONN_MODE_UND;
struct ble_gap_adv_params p = {
.conn_mode = mode,
.disc_mode = BLE_GAP_DISC_MODE_GEN,
.itvl_min = BLE_GAP_ADV_ITVL_MS(params->adv_itvl_ms),
.itvl_max = BLE_GAP_ADV_ITVL_MS(params->adv_itvl_ms),
.channel_map = params->channel_map,
.filter_policy = 0,
.high_duty_cycle = (params->flags & NIMBLE_NETIF_FLAG_HD_MODE) ? 1 : 0,
};
/* set advertisement data, if applicable */
if (ad != NULL) {
res = ble_gap_adv_set_data(ad, (int)ad_len);
if (res != 0) {
nimble_netif_conn_free(handle, NULL);
return -EINVAL;
}
}
/* start advertising */
uint32_t timeout = (params->timeout_ms == 0) ? BLE_HS_FOREVER
: params->timeout_ms;
res = ble_gap_adv_start(params->own_addr_type, addr, timeout,
&p, _on_gap_slave_evt, (void *)handle);
#endif
if (res != 0) {
nimble_netif_conn_free(handle, NULL);
return -ECANCELED;
}
_notify(handle, NIMBLE_NETIF_ACCEPTING, _netif.l2addr);
return 0;
}
int nimble_netif_accept(const uint8_t *ad, size_t ad_len,
const struct ble_gap_adv_params *adv_params)
const nimble_netif_accept_cfg_t *params)
{
assert(ad != NULL);
assert(ad_len > 0);
return _accept(ad, ad_len, NULL, BLE_HS_FOREVER, adv_params);
return _accept(ad, ad_len, NULL, params);
}
int nimble_netif_accept_direct(const ble_addr_t *addr, uint32_t timeout,
const struct ble_gap_adv_params *adv_params)
int nimble_netif_accept_direct(const ble_addr_t *addr,
const nimble_netif_accept_cfg_t *params)
{
return _accept(NULL, 0, addr, timeout, adv_params);
assert(addr);
return _accept(NULL, 0, addr, params);
}
int nimble_netif_accept_stop(void)
@ -708,9 +845,15 @@ int nimble_netif_accept_stop(void)
return -EALREADY;
}
int res = ble_gap_adv_stop();
assert(res == 0);
(void)res;
int res;
#if MYNEWT_VAL_BLE_EXT_ADV
res = ble_gap_ext_adv_stop(EXT_ADV_INST);
#else
res = ble_gap_adv_stop();
#endif
if (res != 0) {
return -EIO;
}
nimble_netif_conn_free(handle, NULL);
_notify(handle, NIMBLE_NETIF_ACCEPT_STOP, _netif.l2addr);

View File

@ -113,6 +113,7 @@ typedef struct {
uint16_t conn_latency; /**< used slave latency for parent connection */
uint32_t conn_super_to_ms; /**< used supervision timeout for parent
* connection, in ms */
nimble_phy_t phy_mode; /**< BLE PHY mode to use */
uint32_t eval_itvl_min_ms; /**< amount of time a node searches for
* potential parents, lower bound in ms */
uint32_t eval_itvl_max_ms; /**< amount of time a node searches for

View File

@ -1,5 +1,5 @@
/*
* Copyright (C) 2019 Freie Universität Berlin
* Copyright (C) 2019-2021 Freie Universität Berlin
*
* This file is subject to the terms and conditions of the GNU Lesser
* General Public License v2.1. See the file LICENSE in the top level
@ -69,6 +69,13 @@ extern "C" {
#define NIMBLE_RPBLE_EVAL_ITVL_MAX_MS 13000U
#endif
/**
* @brief Default BLE PHY mode used by rpble
*/
#ifndef NIMBLE_RPBLE_PHY_MODE
#define NIMBLE_RPBLE_PHY_MODE NIMBLE_PHY_1M
#endif
#ifndef NIMBLE_RPBLE_PARAMS
#define NIMBLE_RPBLE_PARAMS \
{ .scan_itvl_ms = NIMBLE_RPBLE_SCAN_ITVL_MS, \
@ -81,6 +88,7 @@ extern "C" {
.conn_itvl_max_ms = NIMBLE_RPBLE_CONN_ITVL_MAX_MS, \
.conn_latency = NIMBLE_RPBLE_CONN_LATENCY, \
.conn_super_to_ms = NIMBLE_RPBLE_CONN_SUPER_TO_MS, \
.phy_mode = NIMBLE_RPBLE_PHY_MODE, \
.eval_itvl_min_ms = NIMBLE_RPBLE_EVAL_ITVL_MIN_MS, \
.eval_itvl_max_ms = NIMBLE_RPBLE_EVAL_ITVL_MAX_MS }
#endif

View File

@ -50,9 +50,8 @@
#define POS_FREE_SLOTS 22
/* keep the timing parameters for connections and advertisements */
static struct ble_gap_adv_params _adv_params = { 0 };
static struct ble_gap_conn_params _conn_params = { 0 };
static uint32_t _conn_scan_to; /* in ms */
static nimble_netif_accept_cfg_t _accept_params;
static nimble_netif_connect_cfg_t _conn_params;
/* local RPL context */
static nimble_rpble_ctx_t _local_rpl_ctx;
@ -107,7 +106,7 @@ static void _children_accept(void)
assert(res == BLUETIL_AD_OK);
/* start advertising this node */
res = nimble_netif_accept(ad.buf, ad.pos, &_adv_params);
res = nimble_netif_accept(ad.buf, ad.pos, &_accept_params);
assert(res == 0);
}
@ -118,10 +117,17 @@ static void _on_scan_evt(uint8_t type, const ble_addr_t *addr,
int res;
(void)info;
#if IS_USED(MODULE_NIMBLE_RPBLE_EXT)
if ((type != (NIMBLE_SCANNER_EXT_ADV | BLE_HCI_ADV_CONN_MASK)) ||
(info->status != BLE_GAP_EXT_ADV_DATA_STATUS_COMPLETE)) {
return;
}
#else
/* filter out all non-connectible advertisements */
if (type != BLE_HCI_ADV_RPT_EVTYPE_ADV_IND) {
return;
}
#endif
/* check if scanned node does actually speak rpble */
bluetil_ad_data_t sd_field;
@ -199,7 +205,7 @@ static void _parent_connect(struct ble_npl_event *ev)
}
/* try to connect to parent */
int res = nimble_netif_connect(&_psel.addr, &_conn_params, _conn_scan_to);
int res = nimble_netif_connect(&_psel.addr, &_conn_params);
if (res < 0) {
_parent_find();
return;
@ -283,19 +289,36 @@ int nimble_rpble_param_update(const nimble_rpble_cfg_t *cfg)
cfg->eval_itvl_max_ms);
ble_npl_time_ms_to_ticks(itvl, &_eval_itvl);
_adv_params.conn_mode = BLE_GAP_CONN_MODE_UND;
_adv_params.disc_mode = BLE_GAP_DISC_MODE_GEN;
_adv_params.itvl_min = BLE_GAP_ADV_ITVL_MS(cfg->adv_itvl_ms);
_adv_params.itvl_max = _adv_params.itvl_min;
/* accept parameter extraction */
memset(&_accept_params, 0, sizeof(_accept_params));
#if IS_USED(MODULE_NIMBLE_RPBLE_EXT)
_accept_params.flags = 0;
_accept_params.primary_phy = cfg->phy_mode;
_accept_params.secondary_phy = cfg->phy_mode;
#else
_accept_params.flags = NIMBLE_NETIF_FLAG_LEGACY;
_accept_params.primary_phy = NIMBLE_PHY_1M;
_accept_params.secondary_phy = NIMBLE_PHY_1M;
#endif
_accept_params.adv_itvl_ms = cfg->adv_itvl_ms;
_accept_params.timeout_ms = BLE_HS_FOREVER;
_accept_params.own_addr_type = nimble_riot_own_addr_type;
_conn_params.scan_itvl = BLE_GAP_SCAN_ITVL_MS(cfg->conn_scan_itvl_ms);
_conn_params.scan_window = BLE_GAP_SCAN_WIN_MS(cfg->conn_scan_win_ms);
_conn_params.latency = cfg->conn_latency;
_conn_params.supervision_timeout =
BLE_GAP_SUPERVISION_TIMEOUT_MS(cfg->conn_super_to_ms);
_conn_params.itvl_min = BLE_GAP_CONN_ITVL_MS(cfg->conn_itvl_min_ms);
_conn_params.itvl_max = BLE_GAP_CONN_ITVL_MS(cfg->conn_itvl_max_ms);
_conn_scan_to = cfg->conn_scan_to_ms;
/* connection parameter extraction */
memset(&_conn_params, 0, sizeof(_conn_params));
_conn_params.scan_itvl_ms = cfg->conn_scan_itvl_ms;
_conn_params.scan_window_ms = cfg->conn_scan_win_ms;
_conn_params.conn_itvl_min_ms = cfg->conn_itvl_min_ms;
_conn_params.conn_itvl_max_ms = cfg->conn_itvl_max_ms;
_conn_params.conn_supervision_timeout_ms = cfg->conn_super_to_ms;
_conn_params.conn_slave_latency = cfg->conn_latency;
_conn_params.timeout_ms = cfg->conn_scan_to_ms;
#if IS_USED(MODULE_NIMBLE_RPBLE_EXT)
_conn_params.phy_mode = cfg->phy_mode;
#else
_conn_params.phy_mode = NIMBLE_PHY_1M;
#endif
_conn_params.own_addr_type = nimble_riot_own_addr_type;
/* register event callback */
nimble_netif_eventcb(_on_netif_evt);
@ -304,9 +327,18 @@ int nimble_rpble_param_update(const nimble_rpble_cfg_t *cfg)
nimble_scanner_cfg_t scan_params = { 0 };
scan_params.itvl_ms = cfg->scan_itvl_ms;
scan_params.win_ms = cfg->scan_win_ms;
scan_params.flags = NIMBLE_SCANNER_PASSIVE
| NIMBLE_SCANNER_FILTER_DUPS
| NIMBLE_SCANNER_PHY_1M;
scan_params.flags = (NIMBLE_SCANNER_PASSIVE | NIMBLE_SCANNER_FILTER_DUPS);
#if IS_USED(MODULE_NIMBLE_RPBLE_EXT) && IS_USED(MODULE_NIMBLE_PHY_CODED)
if (cfg->phy_mode == NIMBLE_PHY_CODED) {
scan_params.flags |= NIMBLE_SCANNER_PHY_CODED;
}
else {
scan_params.flags |= NIMBLE_SCANNER_PHY_1M;
}
#else
scan_params.flags |= NIMBLE_SCANNER_PHY_1M;
#endif
nimble_scanner_init(&scan_params, _on_scan_evt);
/* start to look for parents */

View File

@ -44,7 +44,9 @@ enum {
NIMBLE_SCANNER_LIMITED = 0x02, /**< do limited discovery */
NIMBLE_SCANNER_FILTER_DUPS = 0x04, /**< filter duplicates */
NIMBLE_SCANNER_PHY_1M = 0x10, /**< scan on 1Mbit PHY */
#if IS_USED(MODULE_NIMBLE_PHY_CODED)
NIMBLE_SCANNER_PHY_CODED = 0x20, /**< scan on CODED PHY */
#endif
};
/**

View File

@ -100,9 +100,12 @@ int nimble_scanner_start(void)
uint8_t limited = (_scan_flags & NIMBLE_SCANNER_LIMITED) ? 1 : 0;
const struct ble_gap_ext_disc_params *uncoded =
(_scan_flags & NIMBLE_SCANNER_PHY_1M) ? &_scan_params : NULL;
#if IS_USED(MODULE_NIMBLE_PHY_CODED)
const struct ble_gap_ext_disc_params *coded =
(_scan_flags & NIMBLE_SCANNER_PHY_CODED) ? &_scan_params : NULL;
#else
const struct ble_gap_ext_disc_params *coded = NULL;
#endif
int32_t dur = (_scan_duration == BLE_HS_FOREVER) ? 0
: _scan_duration / 10;

View File

@ -113,6 +113,21 @@ extern "C" {
#define NIMBLE_STATCONN_CONN_SUPERTO_MS (2500U)
#endif
/**
* @brief BLE PHY mode used by statconn. This value is only used if statconn
* is used in its extended mode (module `nimble_statconn_ext`)
*/
#ifndef NIMBLE_STATCONN_PHY_MODE
#define NIMBLE_STATCONN_PHY_MODE NIMBLE_PHY_1M
#endif
/**
* @brief Statconn connection parameters
*/
typedef struct {
nimble_phy_t phy_mode; /**< BLE PHY mode used for the connection */
} nimble_statconn_cfg_t;
/**
* @brief Initialize the statconn module
*
@ -138,23 +153,31 @@ void nimble_statconn_eventcb(nimble_netif_eventcb_t cb);
* connection by that master.
*
* @param[in] addr BLE address of the peer
* @param[in] cfg additional connection parameters, set to NULL to apply
* default values
*
* @return 0 if peer was successfully added
* @return -EALREADY if the peer address is already in use
* @return -ENOMEM if no empty connection slot is available
* @return -EINVAL if invalid configuration parameters are given
*/
int nimble_statconn_add_master(const uint8_t *addr);
int nimble_statconn_add_master(const uint8_t *addr,
const nimble_statconn_cfg_t *cfg);
/**
* @brief Connect to a peer (slave) with a given address as master
*
* @param[in] addr BLE address of the peer
* @param[in] cfg additional connection parameters, set to NULL to apply
* default values
*
* @return 0 if peer was successfully added
* @return -EALREADY if the peer address is already in use
* @return -ENOMEM if no empty connection slot is available
* @return -EINVAL if invalid configuration parameters are given
*/
int nimble_statconn_add_slave(const uint8_t *addr);
int nimble_statconn_add_slave(const uint8_t *addr,
const nimble_statconn_cfg_t *cfg);
/**
* @brief Remove the connection to the given peer

View File

@ -44,6 +44,9 @@
typedef struct {
uint8_t addr[BLE_ADDR_LEN]; /**< peer addr, network byte order */
uint8_t state; /**< internal state */
#if IS_USED(MODULE_NIMBLE_STATCONN_EXT)
nimble_phy_t phy_mode; /**< PHY mode used by this slot */
#endif
} slot_t;
static const uint8_t _ad[2] = { BLE_GAP_AD_FLAGS, BLUETIL_AD_FLAGS_DEFAULT };
@ -51,9 +54,8 @@ static const uint8_t _ad[2] = { BLE_GAP_AD_FLAGS, BLUETIL_AD_FLAGS_DEFAULT };
static mutex_t _lock = MUTEX_INIT;
static slot_t _slots[NIMBLE_NETIF_MAX_CONN];
static struct ble_gap_adv_params _adv_params;
static struct ble_gap_conn_params _conn_params;
static uint32_t _conn_timeout;
static nimble_netif_accept_cfg_t _accept_params;
static nimble_netif_connect_cfg_t _conn_params;
static nimble_netif_eventcb_t _eventcb = NULL;
@ -87,10 +89,17 @@ static void _activate(uint8_t role)
peer.type = BLE_ADDR_RANDOM;
bluetil_addr_swapped_cp(slot->addr, peer.val);
/* try to (re)open the connection */
nimble_netif_connect(&peer, &_conn_params, _conn_timeout);
#if IS_USED(MODULE_NIMBLE_STATCONN_EXT)
_conn_params.phy_mode = slot->phy_mode;
#endif
nimble_netif_connect(&peer, &_conn_params);
}
else if (slot && (role == ROLE_S)) {
nimble_netif_accept(_ad, sizeof(_ad), &_adv_params);
#if IS_USED(MODULE_NIMBLE_STATCONN_EXT)
_accept_params.primary_phy = slot->phy_mode;
_accept_params.secondary_phy = slot->phy_mode;
#endif
nimble_netif_accept(_ad, sizeof(_ad), &_accept_params);
}
mutex_unlock(&_lock);
}
@ -153,7 +162,8 @@ static void _on_netif_evt(int handle, nimble_netif_event_t event,
}
}
static int _be(uint8_t role, const uint8_t *addr)
static int _be(uint8_t role, const uint8_t *addr,
const nimble_statconn_cfg_t *cfg)
{
mutex_lock(&_lock);
slot_t *s = _get_addr(addr);
@ -170,6 +180,18 @@ static int _be(uint8_t role, const uint8_t *addr)
s->state = (role | PENDING);
memcpy(s->addr, addr, BLE_ADDR_LEN);
mutex_unlock(&_lock);
#if IS_USED(MODULE_NIMBLE_STATCONN_EXT)
if (cfg != NULL) {
s->phy_mode = cfg->phy_mode;
}
else {
s->phy_mode = NIMBLE_STATCONN_PHY_MODE;
}
#else
(void)cfg;
#endif
_activate(role);
return 0;
}
@ -179,27 +201,31 @@ void nimble_statconn_init(void)
memset(_slots, 0, sizeof(_slots));
/* set the advertising parameters used */
_adv_params.conn_mode = BLE_GAP_CONN_MODE_UND;
_adv_params.disc_mode = BLE_GAP_DISC_MODE_GEN;
_adv_params.itvl_min = BLE_GAP_ADV_ITVL_MS(NIMBLE_STATCONN_ADV_ITVL_MS);
_adv_params.itvl_max = _adv_params.itvl_min;
_adv_params.channel_map = 0;
_adv_params.filter_policy = 0;
_adv_params.high_duty_cycle = 0;
memset(&_accept_params, 0, sizeof(_accept_params));
#if IS_USED(MODULE_NIMBLE_STATCONN_EXT)
_accept_params.flags = 0;
#else
_accept_params.flags = NIMBLE_NETIF_FLAG_LEGACY;
_accept_params.primary_phy = NIMBLE_PHY_1M;
_accept_params.secondary_phy = NIMBLE_PHY_1M;
#endif
_accept_params.adv_itvl_ms = NIMBLE_STATCONN_ADV_ITVL_MS;
_accept_params.timeout_ms = BLE_HS_FOREVER;
_accept_params.own_addr_type = nimble_riot_own_addr_type;
/* set connection parameters */
_conn_params.scan_itvl = BLE_GAP_SCAN_ITVL_MS(NIMBLE_STATCONN_CONN_WIN_MS);
_conn_params.scan_window = _conn_params.scan_itvl;
_conn_params.latency = NIMBLE_STATCONN_CONN_LATENCY;
_conn_params.supervision_timeout = BLE_GAP_SUPERVISION_TIMEOUT_MS(
NIMBLE_STATCONN_CONN_SUPERTO_MS);
_conn_params.itvl_min = BLE_GAP_CONN_ITVL_MS(
NIMBLE_STATCONN_CONN_ITVL_MIN_MS);
_conn_params.itvl_max = BLE_GAP_CONN_ITVL_MS(
NIMBLE_STATCONN_CONN_ITVL_MAX_MS);
_conn_params.min_ce_len = 0;
_conn_params.max_ce_len = 0;
_conn_timeout = NIMBLE_STATCONN_CONN_TIMEOUT_MS;
memset(&_conn_params, 0, sizeof(_conn_params));
#if !IS_USED(MODULE_NIMBLE_AUTOCONN_EXT)
_conn_params.phy_mode = NIMBLE_PHY_1M;
#endif
_conn_params.scan_itvl_ms = NIMBLE_STATCONN_CONN_WIN_MS;
_conn_params.scan_window_ms = NIMBLE_STATCONN_CONN_WIN_MS;
_conn_params.conn_itvl_min_ms = NIMBLE_STATCONN_CONN_ITVL_MIN_MS;
_conn_params.conn_itvl_max_ms = NIMBLE_STATCONN_CONN_ITVL_MAX_MS;
_conn_params.conn_supervision_timeout_ms = NIMBLE_STATCONN_CONN_SUPERTO_MS;
_conn_params.conn_slave_latency = NIMBLE_STATCONN_CONN_LATENCY;
_conn_params.timeout_ms = NIMBLE_STATCONN_CONN_TIMEOUT_MS;
_conn_params.own_addr_type = nimble_riot_own_addr_type;
/* register our event callback */
nimble_netif_eventcb(_on_netif_evt);
@ -210,14 +236,16 @@ void nimble_statconn_eventcb(nimble_netif_eventcb_t cb)
_eventcb = cb;
}
int nimble_statconn_add_master(const uint8_t *addr)
int nimble_statconn_add_master(const uint8_t *addr,
const nimble_statconn_cfg_t *cfg)
{
return _be(ROLE_S, addr);
return _be(ROLE_S, addr, cfg);
}
int nimble_statconn_add_slave(const uint8_t *addr)
int nimble_statconn_add_slave(const uint8_t *addr,
const nimble_statconn_cfg_t *cfg)
{
return _be(ROLE_M, addr);
return _be(ROLE_M, addr, cfg);
}
int nimble_statconn_rm(const uint8_t *addr)

View File

@ -1,7 +1,7 @@
PKG_NAME=tinycbor
PKG_URL=https://github.com/intel/tinycbor
# Tinycbor v0.5.3
PKG_VERSION=755f9ef932f9830a63a712fd2ac971d838b131f1
# Tinycbor v0.6.0
PKG_VERSION=d393c16f3eb30d0c47e6f9d92db62272f0ec4dc7
PKG_LICENSE=MIT
include $(RIOTBASE)/pkg/pkg.mk

View File

@ -1,3 +1,801 @@
RIOT-2022.01 - Release Notes
============================
RIOT is a multi-threading operating system which enables soft real-time
capabilities and comes with support for a range of devices that are typically
found in the Internet of Things: 8-bit and 16-bit microcontrollers as well as
light-weight 32-bit processors.
RIOT is based on the following design principles: energy-efficiency, soft
real-time capabilities, small memory footprint, modularity, and uniform API
access, independent of the underlying hardware (with partial POSIX compliance).
RIOT is developed by an international open-source community which is
independent of specific vendors (e.g. similarly to the Linux community) and is
licensed with a non-viral copyleft license (LGPLv2.1), which allows indirect
business models around the free open-source software platform provided by RIOT.
About this release
==================
The 2022.01 release brings support for new packages, new boards and drivers,
as well as several package upgrades and bug fixes. Among others, this release
improves the RIOT codebase with:
Rust support
------------
RIOT now offers convenient integration of Rust application programming, with
wrappers interfacing to RIOT modules such as timers, network stack.
Improved timers
---------------
Many modules have migrated from using xtimer to our more power-efficient
alternative ztimer. Also, ztimer64 was introduced, which enables
a drop-in replacement for all of xtimer features.
Kconfig support
---------------
Kconfig modeling coverage is significantly extended. Nearly all supported
boards are now modeled with Kconfig.
Summary:
--------
436 pull requests, composed of 1159 commits, have been merged since the
last release, and 11 issues have been solved. 43 people contributed with
code in 88 days. 2475 files have been touched with 44925 (+) insertions and
14687 deletions (-).
Notations used below
====================
+ means new feature/item
* means modified feature/item
- means removed feature/item
New features and changes
========================
Full list available at https://github.com/RIOT-OS/RIOT/milestone/37?closed=1
Core
----
+ core/include/kernel_defines.h: add index_of() macro (#17142)
+ core: Add IS_CT_CONSTANT() (#17273)
+ core: add WITHOUT_PEDANTIC() and DECLARE_CONSTANT() (#17176)
* core: Warn about using irq_enable (#17433)
* core: make SCHED_TEST_STACK boolean and default to 1 with DEVELHELP (#17132)
System Libraries
----------------
+ sys/architecture: add HAS_ALIGNMENT_OF() helper (#17177)
+ sys/arduino: add assertion to gpio handling (#17443)
+ sys/atomic_utils: add atomic_{load,store}_ptr() (#17256)
+ sys/include/event/periodic: add count (#17276)
+ sys/isrpipe: add isrpipe_write (#17336)
+ sys/sched_rr: Add a round robin scheduler module (#16126)
+ sys/stdio: add optional function stdio_available (#17446)
+ sys/test_utils/result_output: add sort to multiple output check (#17269)
+ sys/tsrb: add peek functions (#17266)
+ sys/tsrb: add tsrb_clear (#17337)
+ sys/ztimer: add 'ztimer_no_periph_rtt' (#17284)
+ sys/ztimer: add some best practices (#17370)
+ sys/ztimer: ztimer_now() add warning regarding comparing now() values (#17404)
+ usb/hid: Add HID report descriptor defines (#17242)
+ sys/arduino: add Serial over stdio support (#17447)
+ sys: introduce sysclk function to retrieve core clock frequency (#17342)
+ sys/new_delete: add malloc/free based new/delete implementation (#17464)
* event/timeout: remove forced ZTIMER_USEC dependency (#16958)
* riotboot_dfu: use ztimer instead of xtimer (#17051)
* riotboot_serial: enter bootloader mode by pin (#17248)
* schedstatistics: Convert to ztimer (#17216)
* stdio_rtt: Convert to ztimer (#17122)
* stdio_semihosting: Convert to ztimer (#17123)
* sys/can: migrate to ztimer (#17366)
* sys/cpp11-compat: use new/delete operators from sys/cpp_new_delete (#17475)
* sys/evtimer: use now returned by set (#17394)
* sys/fmt: make fmt_s32_dfp() string based (#17106)
* sys/Makefile.dep: fix event periodic dependency (#17318)
* sys/picolibc_syscalls_default: support new picolibc stdio globals (#17001)
* sys/random: default to musl LCG instead of TinyMT (#17188)
* sys/suit: adjust dependencies for CoAP transport (#17182)
* sys/test_utils/result_output/json: optional space after symbol (#17034)
* sys/turo: Allow default selection of json (#17039)
* sys/ztimer/xtimer2ztimer.cocci: extend and fix api replacements (#17234)
* sys/ztimer64: default select ztimer64_init (#17414)
* sys/ztimer64: make _del_entry_from_list() safe for uninit ztimer64_t (#17368)
* sys/ztimer: remove double ztimer indirection (#17272)
* sys/ztimer: ztimer_remove report success (#17408)
* usbus/cdc_acm: Return stall on line coding not supported (#17085)
* usbus/hid: fix ep_out readiness (#17230)
* usbus/hid: fix ep_out readiness (#17245)
* usbus: Bind extra USB config (#17380)
* usbus: check received setup request data amount (#17203)
* sys/ztimer64: initial PR (#16928)
Networking
----------
+ gnrc_pktbuf_cmd: add od dependency with gnrc_pktbuf_static (#17228)
+ sys/net/dhcpv6: Add stateless DHCPv6 (#16731)
+ sys/net: Add ipv4/ipv6 pseudomodules (#16966)
+ sys/shell/sc_nimble_netif: add ping subcommand (#16539)
* dsm: rename DTLS_PEER_MAX and make it dependent on
CONFIG_DTLS_PEER_MAX (#16967)
* gcoap_dtls: destroy session in _tl_send only on connection errors (#16963)
* gnrc_dhcpv6_client / uhcp: delay router advertisements until prefix
was received (#16755)
* gnrc_gomach: adapt duty recording parameters' namings. (#8954)
* gnrc_netif: move netdev initialization to ops->init (#16918)
* lwip: bump to v2.1.3 (#16774)
* net/gcoap: port to ztimer (#17141)
* nimble/statconn: use errno return values (#17344)
* pkg/lwip: Don't control IPv6 via IPv4 flag (#17175)
* pkg/lwip: Fix dualstack build when only using 6lowpan (#17174)
* pkg/openthread: bump version to 20200818 + adapt to use CMake to
configure the build (#16948)
* pkg/openthread: migrate to ztimer (#17120)
* pkg/paho-mqtt: migrate to ztimer (#17143)
* pkg/semtech-loramac: fix get/set dr command (#17117)
* sys/evtimer,ztimer: do not depend on ztimer_now64 (#17357)
* sys/net/gnrc: fix compilation with -Wcast-align (#17157)
* sys/shell/gnrc_netif: Allow 'ifconfig help' (#17006)
* test/ieee802154_hal: general cleanup and cosmetic fixes (#16913)
* tests/lwip_sock: Take lock before calling etharp (#17145)
* socket_zep: port to radio HAL (#16932)
* ieee802154/hal: adapt to latest changes of #13943 (#16946)
Packages
--------
+ pkg/lz4: add support for LZ4 compression/decompression (#17178)
+ pkg/uzlib: add support for zlib compression/decompression (#17179)
+ pkg: add support for Elk Tiny Javascript engine (#16887)
+ pkg: add support for FreeRTOS coreJSON library (#16997)
+ pkg/arduino_sdi_12: add SDI-12 for Arduino as package (#16587)
* hacl: Switch git address to RIOT-OS-pkgmirror (#16941)
* make: support package mirrors (#16927)
* pkg/emlearn: bump to 0.12 (#16937)
* pkg/jerryscript: bump to 2.4.0 (#16938)
* pkg/mynewt-core/patches: silence cast-align (#17397)
* pkg/qr-code-generator: bump to 1.7.0 (#16939)
* pkg/uwb-core: fix wrong header include (#17345)
* pkg/uwb-core: enable frame filtering, allow usage of common event thread (#17264)
* pkg/wakaama: use ztimer (#17103)
* pkg/arduino_sdi_12: support the remote-revb board (#17119)
* pkg/fatfs: bump version to r0.14b (#16412)
* Update tiny-asn1 package (#16936)
* pkg/lvgl: use ztimer instead of xtimer (#17031)
* pkg: migrate some packages to ztimer (#17309)
Boards
------
+ boards/feather-m0: add arduino feature (#17401)
+ boards/iotlab-m3: add MTD definition (#17339)
+ boards/nrf9160dk: add riotboot support (#17226)
+ boards/nucleo-g431rb: added PWM configuration (#17030)
+ boards/p-l496g-cell02: add riotboot feature (#17463)
+ boards/stm32f469i-disco: Add DAC (#17214)
+ boards/stm32g031-disco,examples,tests: Added STM32G031-DISCO board (#16959)
+ boards: add board support for Alientek Pandora (#17259)
+ boards: add support for stm32f746g-disco (#17198)
* boards/common/microbit: fix doxygen grouping (#17440)
* boards/esp* and cpu/esp: feature definition cleanup (#17438)
* boards/lora-e5-dev: enable 3.3V and 5V output by default (#17158)
* boards/lora-e5-dev: fix default DARWIN port (#17373)
* boards/stm32f469i-disco: Create board (#16898)
* boards/{calliope-mini,microbit*}: factorize common microbit module,
use ztimer (#17124)
* boards: cpu: replace GPIO_UNDEF by SPI_CS_UNDEF in SPI configuration (#17468)
* boards: model nrf52 boards (#17299)
* boards: unify user button defines (#17428)
* tools/elf2uf2: addition of new PROGRAMMER for RPi-pico (#17348)
CPU
---
+ Add some Rust building infrastructure and example (#16274)
+ cpu/esp32: add clear bus during init to the I2C software
implementation (#17346)
+ cpu/nrf9160: add periph_flashpage support (#17225)
+ cpu/stm32: Add hardening changes to stm32 (#16979)
+ nimble_scanner: rework to enable scanning BLE5 PHYs and extended
advertisements (#16843)
+ nrf5x_common: Add qdec peripheral implementation (#17201)
+ cpu/esp32: Add openocd programming support (#16911)
+ cpu/stm32: add driver for the LTDC peripheral (#17437)
+ cpu/stm32: add new usbdev FS support (#17281)
+ cpu/stm32: add support for U5 family (#17410)
* boards/common/esp8266: Set RTS and DTR to 0 on pyterm. (#16305)
* cc2538_rf: remove RX Busy detection in request_set_trx_state (#16821)
* cpu/arm7_common: suppress false positives of cppcheck (#17218)
* cpu/atmega_common: make cppcheck happy (#17219)
* cpu/atmega_common: Remember CTC mode with timer_periodic (#17387)
* cpu/atxmega/include/cpu_conf: ztimer64 arithmetic idle stack fix (#17362)
* cpu/cortexm_common: make CI happy (#17220)
* cpu/esp32: make CI happy (#17221)
* cpu/esp32: place freertos and periph in IRAM (#17087)
* cpu/esp32: support CPU clocks 2 MHz and 40 MHz (#17413)
* cpu/esp: change dynamic SSID option handling (#17415)
* cpu/esp: migrate to ztimer (#17386)
* cpu/kinetis/include: fix xtimer backend timer selection (#17393)
* cpu/native/include: other stacksizes based on default (#16956)
* cpu/native: migrate periph_rtc to ztimer (#17125)
* cpu/qn908x: migrate ADC periph to ztimer (#17321)
* cpu/sam0_common: SPI: don't perform DMA transfer for small buffers (#16926)
* cpu/sam0_common: uart: set oversampling based on baud rate (#17186)
* cpu/stm32/include/cpu_conf_stm32_common.h: fix typo in macro (#17187)
* cpu/stm32: bump cmsis repositories to latest releases + extend CPU
models kconfig (#17293)
* cpu/stm32: duplicated ADC devices definitions (#16968)
* cpu/stm32: migrate adc and eth periphs to ztimer (#17320)
* cpu/stm32: split periph_cpu.h in sub headers (#17441)
* cpu: do not auto-select ztimer_periph_rtt for sam0, fe310 (#17395)
* drivers/periph: use uint_fast8_t as default type (#17191)
* esp8266: Download Espressif RTOS SDK as a new RIOT PKG (#16425)
* periph/flashpage: extend API (#16972)
* periph/flashpage: fix wrong doxygen group (#17202)
* stm32/usbdev: Use ztimer instead of xtimer (#17047)
* cpu/esp: compile optional modules in CI (#17314)
* cpu/stm32/wl: initial periph_adc implementation (#17183)
* cpu/stm32: enable USB OTG FS on high end L4 (#17302)
Device Drivers
--------------
+ drivers/dose: enable standby pin (#16752)
+ drivers/hm330x: initial commit (#16333)
+ drivers: add PCF857X I2C I/O expander driver (#10430)
+ drivers: only build saul interface if saul module is used + add
saul_drivers test application (#17470)
+ netdev: add netdev_register_signal (#16922)
+ drivers/ft5x06: add support for touch panel controller (#17448)
+ drivers/stmpe811: add spi mode (#17088)
+ drivers/dose: make use of UART collision detection feature (#16681)
* driver/at30tse75x: port to ztimer_usec (#17137)
* drivers/ads101x: migrate to ztimer (#17102)
* drivers/ata8520e: migrate to ztimer (#17105)
* drivers/atwinc15x0: migrate to ztimer (#17381)
* drivers/bmp180: migrate to ztimer (#17101)
* drivers/dose: calculate timeout based on symbol rate (#16768)
* drivers/dsp0401: migrate to ztimer (#17110)
* drivers/mhz19: migrate to ztimer (#17308)
* drivers/rn2xx3: migrate to ztimer (#17112)
* drivers/sdcard_spi: convert to ztimer_usec (#17361)
* drivers/stmpe811: improve interrupt callback management (#17487)
* drivers/xbee: migrate to ztimer_msec (#17114)
* drivers: migrate mpu9x50 and si70xx to ztimer (#17358)
* drivers: migrate some drivers to ztimer (#17315)
* drivers: remove some useless xtimer includes (#17303)
* drivers: several cleanups related to xtimer + some ztimer migration (#17375)
* makefiles: remove PCF857x pseudomodule definitions (#17343)
* drivers/periph_common: build periph module selectively (#17418)
Documentation
-------------
+ boards/lora-e5-dev: add warning in doc (#17185)
+ doc/getting-started.md: added beginner friendly instructions (#17050)
+ doc/rust: Add maintenance guidance (#17505)
* boards/lora-e5-dev: extended documentation (#17244)
* boards/stm32f746g-disco: extend documentation (#17310)
* doc/.../getting-started.md: update software requirements (#17002)
* doc/boards/rpi-pico: Addition of section concerning shell access (#17454)
* doc: fix libcoap removal commit (#17378)
* pkg/openwsn: update doc (#17131)
* tools/zep_dispatch: document foren6 usage (#17326)
* doc: fix missing or non matching arguments in Doxygen documentation (#17461)
Build System / Tooling
----------------------
+ dist/tools/ci: add can_fast_ci_run.py (#17239)
+ dist/tools/doccheck/exclude_patterns: add new warnings (#17104)
+ dist/tools/doccheck: add create_pattern.sh (#17082)
+ make: add info-emulated-boards helper target (#16975)
+ Makefile.base: add SUBMODULES_NO_SRC to excluded a selected SUBMODULE
*.c (#17222)
+ tools/compile_and_test_for_board: apply black automatic code
formatter + add format checker in tox (#16905)
+ tools/insufficient_memory: add create_makefile.ci.sh and Makefile.ci
make target (#16109)
+ tools/pythonlibs/riotctrl_*: add code format check with black (#16915)
+ tools/zep_dispatch: add support for foren6 sniffer (#16879)
+ tools/zep_dispatch: add topology generator (#16889)
+ makefiles/cflags.inc.mk: Add -Wcast-align (#14955)
* cppcheck: output all annotations as error (#17134)
* dist/tools/coccinelle/force: remove static.cocci (#17139)
* Makefile.include: remove warning about EXTERNAL_MODULE_DIRS API
change (#16984)
* Makefile.include: rename Makefile.ci target to create-Makefile.ci (#17205)
* makefiles/docker.inc.mk: pass TEST_KCONFIG (#17398)
* murdock: make use of can_fast_ci_run.py (#17325)
* static-tests: disable cppcheck (#17282)
* tools/backport_pr: check code format with black (#16907)
* tools: can_fast_ci_run.py: ignore comment changes for `\.[ch]$` (#17405)
Kconfig
-------
+ cpu/avr8: model kconfig (#16929)
+ cpu/efm32: model kconfig (#16912)
+ cpu/esp: integrate CPU clock frequency selection in Kconfig (#17424)
+ cpu/msp430: add Kconfig (#17290)
+ cpu/nrf52: initial kconfig modeling (no netif) (#16837)
+ cpu/nrf9160: add Kconfig dependencies (#17291)
+ cpu/riscv: model Kconfig (#16909)
+ makefiles/kconfig: add board & CPU config variables (#17376)
+ pkg/uwb*: add Kconfig dependency modelling (#16780)
+ sys/trace: migrate to ztimer and add Kconfig support (#17319)
+ .murdock: Add modules/pkgs diff of make/kconfig (#17094)
+ .murdock: Add nucleo boards to kconfig test (#16845)
+ .murdock: Add same54-xpro to kconfig tests (#17255)
* .murdock: Kconfig test apps for all boards (#17402)
* boards/adafruit-itsybitsy-m4: Model kconfig (#17331)
* boards/feather-m0*: base board definition in Kconfig (#17445)
* boards/samd21-based: model Kconfig (#17355)
* boards/saml21-based: model kconfig (#17270)
* boards/stm32-based: model Kconfig (#17374)
* cpu/esp{32,8266}: model kconfig (#17232)
* cpu/kinetis: model kconfig (#17235)
* cpu/lpc23xx: model kconfig (#17279)
* cpu/nrf51: model kconfig (#17274)
* cpu/qn908x: model kconfig (#17277)
* cpu/{cc26xx, cc13xx}: model kconfig (#17236)
* drivers/sx126x/Kconfig: rework model selection (#17289)
* sys/benchmark/kconfig: cleanup ztimer dependency (#17317)
* sys/log: model Kconfig (#17286)
* sys/vfs: model Kconfig (#17287)
Examples
--------
+ example/gcoap: add LWIP make option (#17130)
* examples/gcoap: split client and server implementation (#17471)
* examples/gnrc_networking_subnets: remove broken symlink (#17389)
* examples/lorawan: use ztimer_msec if not rtc (#17181)
* examples/gnrc_networking: cleanup and static function declarations in
udp.c (#17384)
Testing
-------
+ pkg/fff: Add fake functions framework package (#17076)
+ murdock: add some doc on how to efficiently limit builds (#17312)
+ tests/bench_ztimer: add port of bench_xtimer (#17391)
+ tests/pkg_ucglib: add missing function declaration (#17347)
* gh/workflows/release-tests: update LoRaWAN parameters to ttnv3 (#17009)
* gha/workflows/release-test: set python version to 3.8 (#17038)
* tests/*: Fix nightly failures due to f-string (#17283)
* tests/malloc: fix counting bugs (#17323)
* tests/periph_adc: migrate to ztimer (#17322)
* tests/periph_timer_periodic: spice up test (#17388)
* tests/unittests/tests-base64: enlarge test buffer for worst case (#17292)
* test/pkg_u8g2: increase main stacksize for SDL (#16954)
* tests/pkg_fatfs{_vfs}: drop whitelist (#17478)
* Fix some cppcheck errors (#17271)
API Changes
-----------
* core/kernel_defines.h: drop ALIGN_OF() (#17267)
* core/kernel_defines: drop BUILD_BUG_ON() (#17268)
* core/msg: make msg_avail() return 0 on no queue (#17262)
* cpu: call cpu_init() from startup code, not from board (#16055)
* drivers/periph_i2c: let i2c_acquire return void (#17275)
* sys/ztimer: ztimer_set() return the now value (#17385)
* USB: refactor to xmit-based API (#17064)
Deprecations
============
Deprecations (2)
----------------
* cpu/mips: deprecate mips cpu (#17304)
* sys/include/xtimer.h: deprecate nanosleep (#17296)
* sys/include/evtimer.h: deprecate evtimer_now_min (#17357)
* usbdev/USBUS: deprecate transfer failure reporting report (#17046)
Removals (9)
------------
- boards/fox: remove BOARD (#17021)
- dist/iotlab: remove deprecated auto-ssh backward compatibility (#17476)
- drivers/ethos: remove deprecated USE_ETHOS_FOR_STDIO define (#17499)
- make: remove deprecation warnings raised with flasher tools old vars (#17490)
- pkg/libcoap: remove (#17163)
- sys/asymcute: remove deprecated CONFIG_ASYMCUTE_BUFSIZE_EXP (#17481)
- sys/crypto: remove deprecated CIPHER_AES_128 (#17480)
- sys/saul_reg: remove deprecated saul_reg_rm function (#17489)
- sys/shell: remove deprecated SHELL_NO_{ECHO,PROMPT} defines (#17484)
Bug fixes (66)
==============
* cpu/native: add `-no-pie` to LINKFLAGS (#16186)
* boards/adafruit-clue: use internal RC oscillator (#17069)
* boards/feather-m0-*: fix Arduino feature in Kconfig (#17444)
* boards/nrf9160dk: fix LED macros (#17328)
* boards/nucleo-g07xrb: fix or exclude some doxygen warnings (#17079)
* boards/nucleo-g07xrb: fix or exclude some doxygen warnings [backport
2021.10] (#17084)
* boards/stm32f723e-disco: use connect_assert_srst with openocd (#17462)
* boards/stm32f746g-disco: use connect_assert_srst with openocd (#17449)
* boards/stm32f769i-disco: fix and cleanup default configuration (#17199)
* cdc_ecm: Truncate frames at max ethernet size (#17200)
* cpu/atmega1281: fix pcint (#17227)
* cpu/esp*: small documentation fixes (#17456)
* cpu/esp32: fix esp_wifi_enterprise compilation problem (#17306)
* cpu/esp8266: fix problems with ESP WiFi and migration to ztimer (#17427)
* cpu/esp8266: place freertos functions in IRAM (#17080)
* cpu/esp: revert the change for default definition of ESP_WIFI_PASS (#17420)
* cpu/esp_common: fix unaligned access in periph_flashpage (#17150)
* cpu/native: align stack in thread_stack_init() (#17155)
* cpu/sam0: prevent disabled irq from being called (#17007)
* cpu/stm32/periph/usbdev: fix alignment issues (#17154)
* cpu/stm32: clone cmsis header in build/stm32 (#17212)
* dhcpv6_client: keep integers in retransmission calculations signed (#16992)
* doc: fix the reference to libcoap removal commit in LOSTANDFOUND.md (#17371)
* driver/css811: fix read status (#17340)
* drivers/ccs811: fix of documentation (#17169)
* drivers/dht: correct interpreting raw values (#16934)
* drivers/dose: fix standby mode (#17184)
* drivers/encx24j600: fix unaligned memory access (#17156)
* drivers/lis3dh: fix unaligned memory access (#17149)
* drivers/sx126x: fix sync word and TX PA configuration (#17138)
* ethos: move bulk of state machine out of ISR context (#17265)
* Fix NDEBUG compilation problems (#14364)
* gnrc_ipv6_nib: queue packets that trigger probing on border router (#16947)
* ieee802154 / tests/unittests: fix all-asan reported errors (#17329)
* Makefile.base: cleanup non selected source object files (#16945)
* Makefile.base: do not clean objects of bindist modules (#16981)
* makefile.dep: require `arch_%` `cpu_core_%` features first (#17224)
* murdock: don't run can_fast_ci_run if `FULL_BUILD==1` (#17495)
* nimble: fix nimble_scanner regression bugs (#17334)
* pkg/arduino_sdi_12: fix for the feather-m0 board (#17501)
* pkg/ccn-ndn: migrate to ztimer (#17377)
* pkg/littlefs{,2}: fix compilation with -Wcast-align (#17151)
* pkg/nimble: version bump to fix broken scanning (#16960)
* pkg/paho-mqtt: fix memory corruption (#17503)
* pkg/relic: bump to current master (#17161)
* pycrypto: use pycryptodome instead (#17107)
* SECURITY.md: fix broken email reference (#17118)
* shell/gnrc_icmpv6_echo: Fix hang with no msg queue (#17261)
* sys/fido2: fix CBOR parsing (#17192)
* sys/fido2: fix CBOR parsing [backport 2021.10] (#17193)
* sys/net/dns: mark dns_hdr_t as packed (#17153)
* sys/net/fib: fix compilation with -Wcast-align (#17194)
* sys/net/gcoap: Use socket _buf API to recognize truncated requests (#16378)
* sys/posix/socket: align struct sockaddr{,_storage} (#17152)
* sys/posix/socket: use explicit bind (#16852)
* sys/test_utils/result_output: fix turo_float() precision value (#17036)
* sys/ztimer/kconfig: enable xtimer compat only with timer backend (#17307)
* sys/ztimer: don't access non-existent timer (#17409)
* sys/ztimer: don't default to rtc for ztimer_sec (#17113)
* sys/ztimer: fix backend selection (#17372)
* tests/socket_zep: fix automatic test (#17432)
* tests/unittests: fix unaligned access (#17195)
* tools/openocd: check OPENOCD_VERIFY after IMAGE_OFFSET is computed (#17251)
* tools/zep_dispatch: forward based on source addr, not MAC addr (#16957)
* turo: some json fixes (#17027)
* usbus/dfu: fix underflow condition while updating firmware (#17128)
Known issues
============
Network related issues (53)
---------------------------
* 6lo gnrc fragmentation expects driver to block on TX (#7474)
* 6lo: RIOT does not receive packets from Linux when short_addr is set (#11033)
* Address registration handling inappropriate (#15867)
* app/netdev: application stops working after receiving frames with
assertion or completely without error (#8271)
* at86rf2xx: Dead lock when sending while receiving (#8242)
* at86rf2xx: lost interrupts (#5486)
* CC2538 RF overlapping PIN usage (#8779)
* core: "Invalid read of size 4" (#7199)
* cpu/esp8266: Tracking open problems of esp_wifi netdev driver (#10861)
* dist/tools/sliptty/start_network.sh: IPv6 connectivity is broken on
PC (#14689)
* driver/mrf24j40: blocks shell input with auto_init_gnrc_netif (#12943)
* drivers/at86rf215: Incorrect channel number set for subGHz (#15906)
* DTLS examples cannot send message to localhost (#14315)
* Emcute cannot create a double-byte name (#12642)
* ethernet: Missing multicast addr assignment (#13493)
* ethos: fails to respond to first message. (#11988)
* ethos: Unable to choose global source address. (#13745)
* ethos: Unable to handle fragmented IPv6 packets from Linux kernel (#12264)
* examples/cord_ep: Dead lock when (re-)registering in callback
function (#12884)
* examples/gnrc_border_router: esp_wifi crashes on disconnect (#14679)
* Forwarding a packet back to its link layer source should not be
allowed (#5051)
* gcoap example request on tap I/F fails with NIB issue (#8199)
* gcoap: Suspected crosstalk between requests (possible NULL call) (#14390)
* General 802.15.4/CC2538 RF driver dislikes fast ACKs (#7304)
* gnrc ipv6: multicast packets are not dispatched to the upper layers (#5230)
* gnrc_border_router stops routing after a while (#16398)
* gnrc_icmpv6_echo: flood-pinging another node leads to leaks in own
packet buffer (#12565)
* gnrc_ipv6: Multicast is not forwarded if routing node listens to the
address (#4527)
* gnrc_rpl: missing bounds checks in _parse_options (#16085)
* gnrc_rpl: nib route not updated when topology / DODAG changes (#17327)
* gnrc_sock_udp: Possible Race condition on copy in application buffer (#10389)
* gomach: Resetting netif with cli doesn't return (#10370)
* ieee802154_submac: IPv6 fragmentation broken (#16998)
* LoRaWan node ISR stack overflowed (#14962)
* lwip_sock_tcp / sock_async: received events before calling
sock_accept() are lost due to race condition. (#16303)
* Missing drop implementations in netdev_driver_t::recv (#10410)
* net: netdev_driver_t::send() doc unclear (#10969)
* netdev_ieee802154: Mismatch between radio ll address and in memory
address (#10380)
* nrf52: Not able to add global or ULA address to interface (#13280)
* nrfmin: communication not possible after multicast ping with no
interval (#11405)
* openthread: does not build on current Arch (#10809)
* ping6 is failing when testing with cc2538dk (#13997)
* pkg/tinydtls: auxiliary data API does not work for async sockets (#16054)
* Possible memory leak in RIOT/build/pkg/ndn-riot/app.c (#15638)
* Riot-os freezes with lwip + enc28j60 + stm32L4 (#13088)
* samr30 xpro doesn't seem to use its radio ok (#12761)
* scan-build errors found during 2019.07 testing (#11852)
* send data with UDP at 10HZ, the program die (#11860)
* stale border router does not get replaced (#12210)
* tests/lwip: does not compile for IPv4 on 6LoWPAN-based boards. (#17162)
* two nodes livelock sending neighbor solicitations back and forth
between each other (#16670)
* Unclear how Router Solicitations are (or should be) handled (#15926)
* xbee: setting PAN ID sometimes fails (#10338)
Timer related issues (15)
-------------------------
* cpu/native: timer interrupt issue (#6442)
* misc issues with tests/trickle (#9052)
* MSP430: periph_timer clock config wrong (#8251)
* periph/timer: `timer_set()` underflow safety check (tracking issue) (#13072)
* periph_timer: systematic proportional error in timer_set (#10545)
* saml21 system time vs rtc (#10523)
* Sleep mode for Arduino (#13321)
* stm32_common/periph/rtc: current implementation broken/poor accuracy (#8746)
* sys/newlib: gettimeofday() returns time since boot, not current wall
time. (#9187)
* tests: xtimer_drift gets stuck on native (#6052)
* xtimer mis-scaling with long sleep times (#9049)
* xtimer: add's items to the wrong list if the timer overflows between
_xtimer_now() and irq_disable() (#7114)
* xtimer_set_msg: crash when using same message for 2 timers (#10510)
* xtimer_usleep stuck for small values (#7347)
* xtimer_usleep wrong delay time (#10073)
Drivers related issues (17)
---------------------------
* (almost solved) SPI SD-Card driver: SPI initialisation freeze until
timeout (#14439)
* adc is not a ADC-Driver but a analog pin abstraction (#14424)
* at86rf2xx: Simultaneous use of different transceiver types is not
supported (#4876)
* cpu/msp430: GPIO driver doesn't work properly (#9419)
* driver/hts221: Temperature and Humidity readings incorrect (#12445)
* ESP32 + DHT + SAUL reading two endpoints causes freeze. (#12057)
* examples/dtls-wolfssl not working on pba-d-01-kw2x (#13527)
* fail to send data to can bus (#12371)
* floats and doubles being used all over the place. (#12045)
* mdt_erase success, but vfs_format resets board (esp32-heltec-
lora32-v2) (#14506)
* periph/spi: Switching between CPOL=0,1 problems on Kinetis with
software CS (#6567)
* periph: GPIO drivers are not thread safe (#4866)
* Potential security and safety race conditions on attached devices (#13444)
* PWM: Single-phase initialization creates flicker (#15121)
* STM32: SPI clock not returning to idle state and generating
additional clock cycles (#11104)
* TCP client cannot send read only data (#16541)
* Two bugs may lead to NULL dereference. (#15006)
Native related issues (6)
-------------------------
* examples/ccn-lite: floating point exception while testing on native (#15878)
* examples/micropython: floating point exception while testing on
native (#15870)
* native getchar is blocking RIOT (#16834)
* native not float safe (#495)
* native: tlsf: early malloc will lead to a crash (#5796)
* SIGFPE on native architecture when printing double floats on Ubuntu
21.04 (#16282)
Other platforms related issues (21)
-----------------------------------
* Failing tests on FE310 (Hifive1b) (#13086)
* [TRACKING] Fixes for automatic tests of ESP32 boards. (#12763)
* arm7: printf() with float/double not working (#11885)
* boards/hifive1: flashing issue (#13104)
* Cannot use LLVM with Cortex-M boards (#13390)
* cpu/cortexm_common: irq_enable returns the current state of
interrupts (not previous) (#10076)
* cpu/sam0: flashpage write / read cycle produces different results
depending on code layout in flash (#14929)
* cpu/stm32f1: CPU hangs after wake-up from STOP power mode (#13918)
* esp32-wroom-32: tests/netstats_l2 failing sometimes (#14237)
* esp8266 precompiled bootloaders don't support partitions past 1MB (#16402)
* gcoap/esp8266: Stack overflow with gcoap example (#13606)
* I found stm32 DMA periph driver bugs! when I tested stm32l431rc
board. (#16242)
* Incorrect default $PORT building for esp32-wroom-32 on macOS (#10258)
* MIPS: toolchain objcopy doesn't work and no .bin can be generated (#14410)
* MPU doesn't work on cortex-m0+ (#14822)
* newlib-nano: Printf formatting does not work properly for some
numeric types (#1891)
* periph_timer: Test coverage & broken on STM32F767ZI (#15072)
* riscv: ISR stack is too small for ENABLE_DEBUG in core files (#16395)
* stm32152re: hardfault when DBGMCU_CR_DBG* bits are set and branch
after __WFI() (#14015)
* stm32f7: Large performance difference between stm32f746 and stm32f767 (#14728)
* sys/riotboot/flashwrite: unaligned write when skipping
`RIOTBOOT_MAGIC` on stm32wb (#15917)
Build system related issues (14)
--------------------------------
* `buildtest` uses wrong build directory (#9742)
* `make -j flash` fails due to missing make dependencies or `make
flash-only` rebuilds the .elf (#16385)
* Build dependencies - processing order issues (#9913)
* build: info-build doesn't work with boards without port set (#15185)
* BUILD_IN_DOCKER ignores USEMODULE (#14504)
* dist/tools/cppcheck/cppchck.sh: errors when running with Cppcheck
1.89 (#12771)
* doxygen: riot.css modified by 'make doc' (#8122)
* LTO broken (binaries too large) (#16202)
* macros: RIOT_FILE_RELATIVE printing wrong file name for headers (#4053)
* make: ccache leads to differing binaries (#14264)
* make: Setting constants on compile time doesn't really set them
everywhere (#3256)
* make: use of immediate value of variables before they have their
final value (#8913)
* Tracking: remove harmful use of `export` in make and immediate
evaluation (#10850)
* Windows AVR Mega development makefile Error (#6120)
Other issues (53)
-----------------
* [TRACKING] sys/shell refactoring. (#12105)
* _NVIC_SystemReset stuck in infinite loop when calling pm_reboot
through shell after flashing with J-Link (#13044)
* `make term` no longer works with JLinkExe v6.94 (#16022)
* `make term` output is inconsistent between boards, `ethos` and
`native` (#12108)
* assert: c99 static_assert macro doesn't function for multiple
static_asserts in the same scope (#9371)
* Basic test for periph/rtt introduced in #15431 is incorrect (#15940)
* boards/esp32-wroom-32: tests/mtd_raw flakey (#16130)
* boards/saml11-xpro: second UART is broken (#17206)
* Bug: openocd 0.10.0-6 Ubuntu dies while debugging with -rtos auto (#13285)
* C++11 extensions in header files (#5561)
* Can't build relic with benchmarks or tests (#12897)
* CC2538DK board docs: broken links (#12889)
* cpu/stm32/periph/rtc overflow error (#16574)
* cpu/stm32: some tests are failing on CM33 (l5, u5) (#17439)
* doc/LOSTANDFOUND: not rendered as expected (#17063)
* edbg: long lines flooded over serial become garbled (#14548)
* examples / tests: LoRa tests fail on platforms that don't support
LoRa (#14520)
* File systems report names with leading slashes (#14635)
* flashing issue on frdm-k64f (#15903)
* frdm-k22f failing tests/periph_flashpage (#17057)
* gcoap_dtls: Selecting transport at run time is not possible (#16674)
* I2C not working under RIOT with U8G2 pkg (#16381)
* ieee802154_security: Nonce is reused after reboot (#16844)
* lwip: drivers/at86rf2xx/at86rf2xx_netdev.c invalid state during TCP
disconnect (#17209)
* lwip: invalid state transition on ieee802154_submac users (#17208)
* Making the newlib thread-safe (#4488)
* mcuboot: flashes but no output (#17524)
* nanocoap: incomplete response to /.well-known/core request (#10731)
* newlib-nano: Printf formatting does not work properly with `"PRIu8"` (#17083)
* Order of auto_init functions (#13541)
* pkg/tinydtls: Multiple issues (#16108)
* Possible memset optimized out in crypto code (#10751)
* Potential race condition in compile_and_test_for_board.py (#12621)
* pyterm on stdio_cdc_acm stops working after a few seconds (#16077)
* RIOT cannot compile with the latest version of macOS (10.14) and
Xcode 10 (#10121)
* RIOT is saw-toothing in energy consumption (even when idling) (#5009)
* riotboot/nrf52840dk: flashing slot1 with JLINK fails (#14576)
* scheduler: priority inversion problem (#7365)
* sys/fmt: Missing tests for fmt_float, fmt_lpad (#7220)
* sys/riotboot: documentation issues (#11243)
* sys/stdio_uart: dropped data when received at once (#10639)
* tests/cpp11_*: failing on i-nucleo-lrwan1 (#14578)
* tests/lwip target board for python test is hardcoded to native (#6533)
* tests/periph_flashpage: failing on stm32l475ve (#17280)
* tests/pkg_libhydrogen: test fails on master for the samr21-xpro with
LLVM (#15066)
* tests/pkg_tensorflow-lite: tests randomly failing on nrf52dk and
esp32-wroom-32 (#13133)
* tests/test_tools: test fails while testing on samr21-xpro/iotlab-m3 (#15888)
* tests/thread_float: crashes on avr-rss2 (#16908)
* tests: broken with stdio_rtt if auto_init is disabled (#13120)
* tests: some tests don't work with `newlib` lock functions. (#12732)
* Tracker: Reduce scope on unintended COMMON variables (#2346)
* usb-serial/list-ttys.sh: Broken when a debugger offers multiple
serial ports (#15814)
* Use of multiple CAN bus on compatible boards (#14801)
There are 179 known issues in this release
Fixed Issues since the last release (2021.10)
=============================================
- sx127x: wrong RSSI values (#17451)
- drivers/aip31068: initialization fails in most cases when using
esp_i2c_sw (#17311)
- cpu/esp32: esp_wifi_enterprise compilation error (#17305)
- ethos: race condition seems to cause packet loss (#17254)
- tests/lwip_sock_ip: failing on `native` when using IPV4 (#17144)
- Sam boards: isr_eic call all IRQ raised without taking into account
their status (enabled/disabled) (#16978)
- esp8266: Hangs when erasing spi sector on mtd0 if using esp_wifi (#16281)
- esp32: can't use newer C++ standard than c++11 (#15685)
- tests/mpu_noexec_ram: fails on i-nucleo-lrwan1 (#14572)
- Different build behavior between `murdock` and
`riot/riotbuild:latest` image (#9645)
- pkg: libcoap is partially broken and outdated (#7737)
11 fixed issues since last release (2021.10)
Acknowledgements
================
We would like to thank all companies that provided us with hardware for porting
and testing RIOT-OS. Further thanks go to companies and institutions that
directly sponsored development time. And finally, big thanks to all of you
contributing in so many different ways to make RIOT worthwhile!
More information
================
http://www.riot-os.org
Matrix and Forum
================
* Join the RIOT Matrix room at: #riot-os:matrix.org
* Join the RIOT Forum at: forum.riot-os.org
License
=======
* The code developed by the RIOT community is licensed under the GNU Lesser
General Public License (LGPL) version 2.1 as published by the Free Software
Foundation.
* Some external sources and packages are published under a separate license.
All code files contain licensing information.
RIOT-2021.10 - Release Notes
============================
RIOT is a multi-threading operating system which enables soft real-time

View File

@ -843,7 +843,6 @@ ifneq (,$(filter fido2_ctap,$(USEMODULE)))
USEMODULE += ztimer_msec
USEMODULE += event
USEMODULE += event_timeout
USEMODULE += prng_sha256prng
USEMODULE += cipher_modes
USEMODULE += crypto_aes_256
USEMODULE += hashes

View File

@ -4,4 +4,17 @@
# General Public License v2.1. See the file LICENSE in the top level
# directory for more details.
menuconfig MODULE_FIDO2
bool "FIDO2"
help
FIDO2 is an authentication standard that seeks to solve the password
problem by enabling passwordless authentication. FIDO2 consists of the
W3C Web Authentication specification (WebAuthn) and the Client to
Authenticator Protocol (CTAP). For more information visit
https://fidoalliance.org/fido2.
if MODULE_FIDO2
rsource "ctap/Kconfig"
endif # MODULE_FIDO2

View File

@ -4,13 +4,37 @@
# General Public License v2.1. See the file LICENSE in the top level
# directory for more details.
menuconfig KCONFIG_USEMODULE_FIDO2_CTAP
menuconfig MODULE_FIDO2_CTAP
bool "FIDO2 CTAP"
depends on USEMODULE_FIDO2_CTAP
depends on HAS_PERIPH_FLASHPAGE
depends on HAS_PERIPH_GPIO
depends on HAS_PERIPH_GPIO_IRQ
depends on MODULE_FIDO2
depends on TEST_KCONFIG
select PACKAGE_TINYCBOR
select PACKAGE_MICRO-ECC
select PACKAGE_TINY-ASN1
select MODULE_PERIPH_GPIO
select MODULE_PERIPH_GPIO_IRQ
select MODULE_EVENT
select MODULE_EVENT_TIMEOUT
select MODULE_ZTIMER
select MODULE_ZTIMER_MSEC
select MODULE_MTD
select MODULE_MTD_FLASHPAGE
select MODULE_MTD_WRITE_PAGE
select MODULE_RANDOM
select MODULE_CRYPTO_AES_256
select MODULE_CIPHER_MODES
select MODULE_HASHES
help
Configure a FIDO2 CTAP authenticator via KConfig.
Y to enable CTAP protocol support. The Client-to-Authenticator
Protocol (CTAP) is an application layer protocol for the communication
between an authenticator and a host. CTAP is part of the FIDO2 Project.
For more information visit https://fidoalliance.org/fido2.
if KCONFIG_USEMODULE_FIDO2_CTAP
if MODULE_FIDO2_CTAP
config FIDO2_CTAP_STACK_SIZE
int "CTAP thread stack size"
@ -93,4 +117,4 @@ config FIDO2_CTAP_FLASH_START_PAGE
rsource "transport/Kconfig"
endif # KCONFIG_USEMODULE_FIDO2_CTAP
endif # MODULE_FIDO2_CTAP

View File

@ -4,4 +4,9 @@
# General Public License v2.1. See the file LICENSE in the top level
# directory for more details.
menuconfig MODULE_FIDO2_CTAP_TRANSPORT
bool "FIDO2 CTAP transport"
depends on MODULE_FIDO2_CTAP
depends on TEST_KCONFIG
rsource "hid/Kconfig"

View File

@ -4,13 +4,16 @@
# General Public License v2.1. See the file LICENSE in the top level
# directory for more details.
menuconfig KCONFIG_USEMODULE_FIDO2_CTAP_TRANSPORT_HID
bool "FIDO2 CTAP TRANSPORT HID"
depends on USEMODULE_FIDO2_CTAP_TRANSPORT_HID
menuconfig MODULE_FIDO2_CTAP_TRANSPORT_HID
bool "FIDO2 CTAP transport HID"
depends on MODULE_FIDO2_CTAP_TRANSPORT
depends on TEST_KCONFIG
select MODULE_ISRPIPE
select MODULE_USBUS_HID
help
Configure a FIDO2 CTAP authenticator via KConfig.
if KCONFIG_USEMODULE_FIDO2_CTAP_TRANSPORT_HID
if MODULE_FIDO2_CTAP_TRANSPORT_HID
config FIDO2_CTAP_TRANSPORT_HID_TRANSACTION_TIMEOUT
int "CTAPHID Transaction timeout in milliseconds"
@ -20,4 +23,4 @@ config FIDO2_CTAP_TRANSPORT_HID_TRANSACTION_TIMEOUT
of time to prevent the authenticator from being locked by a
stalling application.
endif # KCONFIG_USEMODULE_FIDO2_CTAP_TRANSPORT_HID
endif # MODULE_FIDO2_CTAP_TRANSPORT_HID

View File

@ -139,6 +139,8 @@
#include <stdint.h>
#include "irq.h"
#include "sched.h"
#include "atomic_utils_arch.h"
#ifdef __cplusplus
@ -263,6 +265,16 @@ static inline uintptr_t atomic_load_uintptr(const volatile uintptr_t *var) {
static inline void * atomic_load_ptr(void **ptr_addr) {
return (void *)atomic_load_uintptr((const volatile uintptr_t *)ptr_addr);
}
/**
* @brief Load an `kernel_pid_t` atomically
*
* @param[in] var Variable to load atomically
* @return The value stored in @p var
*/
static inline kernel_pid_t atomic_load_kernel_pid(const volatile kernel_pid_t *var)
{
return atomic_load_u16((const volatile uint16_t *)var);
}
/** @} */
/**
@ -321,6 +333,17 @@ static inline void atomic_store_uintptr(volatile uintptr_t *dest, uintptr_t val)
static inline void atomic_store_ptr(void **dest, const void *val) {
atomic_store_uintptr((volatile uintptr_t *)dest, (uintptr_t)val);
}
/**
* @brief Store an `kernel_pid_t` atomically
*
* @param[out] dest Location to atomically write the new value to
* @param[in] val Value to write
*/
static inline void atomic_store_kernel_pid(volatile kernel_pid_t *dest,
kernel_pid_t val)
{
atomic_store_u16((volatile uint16_t *)dest, (uint16_t)val);
}
/** @} */
/**

View File

@ -97,6 +97,7 @@ enum {
UNIT_V, /**< Volts */
UNIT_W, /**< Watt */
UNIT_GS, /**< gauss */
UNIT_T, /**< Tesla */
UNIT_DBM, /**< decibel-milliwatts */
UNIT_COULOMB, /**< coulomb */
UNIT_F, /**< Farad */

View File

@ -0,0 +1,69 @@
/*
* Copyright (C) 2019 Freie Universität Berlin
*
* This file is subject to the terms and conditions of the GNU Lesser
* General Public License v2.1. See the file LICENSE in the top level
* directory for more details.
*/
/**
* @defgroup sys_stdio_nimble STDIO over NimBLE
* @ingroup sys
*
* @experimental This feature is experimental as some use-cases, such as examples/twr_aloha, show
* unexpected behaviour.
*
* @brief Standard input/output backend using NimBLE.
*
* @note 'stdio_read' blocks until at least one character was read.
*
* @note 'stdio_write' is considered non-blocking even though it uses a mutex to protect the
* write buffer since only 'stdio_write' uses this mutex. Characters will be written
* in FIFO mode. Characters that do not fit in the buffer will be dropped.
*
* @{
* @file
*
* @author Hendrik van Essen <hendrik.ve@fu-berlin.de>
*/
#ifndef STDIO_NIMBLE_H
#define STDIO_NIMBLE_H
#include "stdio_base.h"
#ifdef __cplusplus
extern "C" {
#endif
/**
* @brief Whether to clear the buffers when establishing a new connection or
* not. Defaults to true.
*/
#ifndef CONFIG_STDIO_NIMBLE_CLEAR_BUFFER_ON_CONNECT
#define CONFIG_STDIO_NIMBLE_CLEAR_BUFFER_ON_CONNECT 1
#endif
/**
* @brief Size of buffer for stdin in bytes
*
* @note Must be a power of two!
*/
#ifndef CONFIG_STDIO_NIMBLE_STDIN_BUFSIZE
#define CONFIG_STDIO_NIMBLE_STDIN_BUFSIZE 1024
#endif
/**
* @brief Size of buffer for stdout in bytes
*
* @note Must be a power of two!
*/
#ifndef CONFIG_STDIO_NIMBLE_STDOUT_BUFSIZE
#define CONFIG_STDIO_NIMBLE_STDOUT_BUFSIZE 2048
#endif
#ifdef __cplusplus
}
#endif
/** @} */
#endif /* STDIO_NIMBLE_H */

View File

@ -137,6 +137,7 @@ ifneq (,$(filter gnrc_netif,$(USEMODULE)))
USEMODULE += netif
USEMODULE += l2util
USEMODULE += fmt
USEMODULE += ztimer_msec
ifneq (,$(filter netdev_ieee802154_submac,$(USEMODULE)))
USEMODULE += gnrc_netif_pktq
endif

View File

@ -41,8 +41,8 @@
#include "fmt.h"
#include "log.h"
#include "sched.h"
#if IS_USED(MODULE_XTIMER) || IS_USED(MODULE_ZTIMER_XTIMER_COMPAT)
#include "xtimer.h"
#if IS_USED(MODULE_ZTIMER)
#include "ztimer.h"
#endif
#include "net/gnrc/netif.h"
@ -1370,7 +1370,7 @@ bool gnrc_netif_ipv6_wait_for_global_address(gnrc_netif_t *netif,
/* wait for global address */
msg_t m;
while (!has_global) {
if (xtimer_msg_receive_timeout(&m, timeout_ms * US_PER_MS) < 0) {
if (ztimer_msg_receive_timeout(ZTIMER_MSEC, &m, timeout_ms) < 0) {
DEBUG_PUTS("gnrc_netif: timeout waiting for prefix");
break;
}
@ -1867,7 +1867,7 @@ static void *_gnrc_netif_thread(void *args)
/* now let rest of GNRC use the interface */
gnrc_netif_release(netif);
#if (CONFIG_GNRC_NETIF_MIN_WAIT_AFTER_SEND_US > 0U)
xtimer_ticks32_t last_wakeup = xtimer_now();
uint32_t last_wakeup = ztimer_now(ZTIMER_USEC);
#endif
while (1) {
@ -1893,13 +1893,14 @@ static void *_gnrc_netif_thread(void *args)
DEBUG("gnrc_netif: GNRC_NETDEV_MSG_TYPE_SND received\n");
_send(netif, msg.content.ptr, false);
#if (CONFIG_GNRC_NETIF_MIN_WAIT_AFTER_SEND_US > 0U)
xtimer_periodic_wakeup(
ztimer_periodic_wakeup(
ZTIMER_USEC,
&last_wakeup,
CONFIG_GNRC_NETIF_MIN_WAIT_AFTER_SEND_US
);
/* override last_wakeup in case last_wakeup +
* CONFIG_GNRC_NETIF_MIN_WAIT_AFTER_SEND_US was in the past */
last_wakeup = xtimer_now();
last_wakeup = ztimer_now(ZTIMER_USEC);
#endif
break;
case GNRC_NETAPI_MSG_TYPE_SET:

Some files were not shown because too many files have changed in this diff Show More