1
0
mirror of https://github.com/RIOT-OS/RIOT.git synced 2025-12-25 22:43:50 +01:00

Merge pull request #11463 from aabadie/nimble_nrf51

pkg/nimble: adapt to nrf51 family
This commit is contained in:
Hauke Petersen 2019-08-07 13:54:32 +02:00 committed by GitHub
commit 4a75d0bdd5
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
9 changed files with 44 additions and 10 deletions

View File

@ -2,4 +2,7 @@
FEATURES_PROVIDED += periph_rtt
FEATURES_PROVIDED += periph_timer
# Various other features (if any)
FEATURES_PROVIDED += ble_nimble
-include $(RIOTCPU)/nrf51/Makefile.features

View File

@ -7,6 +7,11 @@ include $(RIOTMAKE)/tools/serial.inc.mk
# include common nrf51 headers
INCLUDES += -I$(RIOTBOARD)/common/nrf51/include
# use alternative xtimer mapping if applicable
ifneq (,$(filter nimble,$(USEPKG)))
CFLAGS += -DBOARD_NRF51_XTIMER_ALT
endif
ifeq ($(PROGRAMMER),openocd)
# use common openocd configuration for nrf51
export OPENOCD_CONFIG = $(RIOTBOARD)/common/nrf51/dist/openocd.cfg

View File

@ -31,9 +31,22 @@ extern "C" {
/**
* @name Xtimer configuration
*
* Some external packages (e.g. NimBLE) require dedicated access to timer 0.
* Setting the BOARD_NRF51_XTIMER_ALT variable allows to change the default
* xtimer configuration to use
*
* @{
*/
#ifndef BOARD_NRF51_XTIMER_ALT
/* default xtimer mapping */
#define XTIMER_WIDTH (24)
#else
/* alternative mapping to TIMER_DEV(1) */
#define XTIMER_DEV TIMER_DEV(1)
#define XTIMER_WIDTH (16)
#define XTIMER_CHAN (0)
#endif
#define XTIMER_BACKOFF (40)
/** @} */

View File

@ -64,8 +64,8 @@ nimble_transport_ram:
nimble_controller:
"$(MAKE)" -C $(PDIR)/nimble/controller/src/ -f $(TDIR)/controller.mk
nimble_drivers_nrf52:
"$(MAKE)" -C $(PDIR)/nimble/drivers/nrf52/src/ -f $(TDIR)/drivers.nrf52.mk
nimble_drivers_nrf5x:
"$(MAKE)" -C $(PDIR)/nimble/drivers/$(CPU_FAM)/src/ -f $(TDIR)/drivers.nrf5x.mk
# additional, RIOT specific nimble modules
nimble_addr:

View File

@ -29,8 +29,8 @@ endif
# nimble controller dependencies
ifneq (,$(filter nimble_controller,$(USEMODULE)))
USEMODULE += nimble_transport_ram
ifeq (nrf52,$(CPU_FAM))
USEMODULE += nimble_drivers_nrf52
ifneq (,$(filter nrf5%,$(CPU_FAM)))
USEMODULE += nimble_drivers_nrf5x
endif
endif

View File

@ -17,8 +17,8 @@ ifneq (,$(filter nimble_controller,$(USEMODULE)))
CFLAGS += -DNIMBLE_CFG_CONTROLLER=1
CFLAGS += -DMYNEWT_VAL_OS_CPUTIME_FREQ=32768
ifneq (,$(filter nimble_drivers_nrf52,$(USEMODULE)))
INCLUDES += $(NIMIBASE)/nimble/drivers/nrf52/include
ifneq (,$(filter nimble_drivers_nrf5x,$(USEMODULE)))
INCLUDES += $(NIMIBASE)/nimble/drivers/$(CPU_FAM)/include
endif
endif

View File

@ -36,7 +36,7 @@
#endif
#ifdef MODULE_NIMBLE_CONTROLLER
#ifdef CPU_FAM_NRF52
#if defined(CPU_FAM_NRF52) || defined(CPU_FAM_NRF51)
#include "nrf_clock.h"
#endif
@ -56,9 +56,10 @@ static void *_host_thread(void *arg)
#ifdef MODULE_NIMBLE_CONTROLLER
/* XXX: NimBLE needs the nRF5x's LF clock to run */
#ifdef CPU_FAM_NRF52
#if defined(CPU_FAM_NRF52) || defined(CPU_FAM_NRF51)
clock_start_lf();
#endif
/* Run the controller
*
* Create task where NimBLE LL will run. This one is required as LL has its

View File

@ -1,3 +1,3 @@
MODULE = nimble_drivers_nrf52
MODULE = nimble_drivers_nrf5x
include $(RIOTBASE)/Makefile.base

View File

@ -1,3 +1,14 @@
# For nRF51-based targets, we need to reduce buffer sizes to make this test fit
# into RAM
# Note: as the CPU variable is not set at this point, we manually 'whitelist'
# all supported nrf51-boards here
BOARDS_NRF51 := airfy-beacon calliope-mini microbit nrf51dk nrf51dongle \
nrf6310 yunjia-nrf51822
ifneq (,$(filter $(BOARDS_NRF51),$(BOARD)))
APP_MTU ?= 250
MSYS_CNT ?= 6
endif
# Set the tests default configuration
APP_MTU ?= 5000
APP_BUF_CHUNKSIZE ?= 250 # must be full divider of APP_MTU
@ -14,10 +25,11 @@ CFLAGS += -DAPP_CID=$(APP_CID)
# configure NimBLE
USEPKG += nimble
MSYS_CNT ?= 23
CFLAGS += -DMYNEWT_VAL_BLE_L2CAP_COC_MAX_NUM=1
CFLAGS += -DMYNEWT_VAL_BLE_L2CAP_COC_MPS=250
CFLAGS += -DMYNEWT_VAL_BLE_MAX_CONNECTIONS=1
CFLAGS += -DMYNEWT_VAL_MSYS_1_BLOCK_COUNT=23
CFLAGS += -DMYNEWT_VAL_MSYS_1_BLOCK_COUNT=$(MSYS_CNT)
CFLAGS += -DMYNEWT_VAL_MSYS_1_BLOCK_SIZE=298
CFLAGS += -DMYNEWT_VAL_BLE_LL_CFG_FEAT_DATA_LEN_EXT=1