2018-05-24 11:36:20 +02:00
|
|
|
NIMIBASE = -I$(PKGDIRBASE)/nimble
|
|
|
|
|
|
|
|
# include RIOT glue code headers
|
|
|
|
INCLUDES += -I$(RIOTPKG)/nimble/contrib/include
|
|
|
|
|
2019-02-22 13:55:16 +01:00
|
|
|
# include generic nimble headers
|
|
|
|
INCLUDES += $(NIMIBASE)/nimble/include
|
2018-05-24 11:36:20 +02:00
|
|
|
|
|
|
|
# include the RIOT NPL headers
|
2021-07-05 14:31:14 +02:00
|
|
|
ifneq (,$(filter nimble_npl_riot,$(USEMODULE)))
|
|
|
|
INCLUDES += $(NIMIBASE)/porting/npl/riot/include
|
|
|
|
else
|
|
|
|
INCLUDES += $(NIMIBASE)/porting/npl/riot/include/npl_syscfg
|
|
|
|
INCLUDES += -I$(RIOTPKG)/nimble/npl/include
|
|
|
|
endif
|
2019-02-22 13:55:16 +01:00
|
|
|
INCLUDES += $(NIMIBASE)/porting/nimble/include
|
2018-05-24 11:36:20 +02:00
|
|
|
|
|
|
|
# include nimble controller headers
|
2019-02-22 13:55:16 +01:00
|
|
|
ifneq (,$(filter nimble_controller,$(USEMODULE)))
|
|
|
|
INCLUDES += $(NIMIBASE)/nimble/controller/include
|
|
|
|
# set environment
|
|
|
|
CFLAGS += -DNIMBLE_CFG_CONTROLLER=1
|
2021-07-05 14:31:14 +02:00
|
|
|
ifneq (,$(filter nimble_npl_riot,$(USEMODULE)))
|
|
|
|
CFLAGS += -DMYNEWT_VAL_OS_CPUTIME_FREQ=32768
|
|
|
|
endif
|
2019-04-27 21:24:54 +02:00
|
|
|
ifneq (,$(filter nimble_drivers_nrf5x,$(USEMODULE)))
|
|
|
|
INCLUDES += $(NIMIBASE)/nimble/drivers/$(CPU_FAM)/include
|
2019-02-22 13:55:16 +01:00
|
|
|
endif
|
2021-12-06 13:08:23 +01:00
|
|
|
|
|
|
|
# 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
|
2019-02-22 13:55:16 +01:00
|
|
|
endif
|
2018-05-24 11:36:20 +02:00
|
|
|
|
|
|
|
# include nimble host headers
|
2019-02-22 13:55:16 +01:00
|
|
|
ifneq (,$(filter nimble_host,$(USEMODULE)))
|
|
|
|
INCLUDES += $(NIMIBASE)/nimble/host/include
|
|
|
|
endif
|
|
|
|
ifneq (,$(filter nimble_host_store_ram,$(USEMODULE)))
|
|
|
|
INCLUDES += $(NIMIBASE)/nimble/host/store/ram/include
|
|
|
|
endif
|
|
|
|
ifneq (,$(filter nimble_host_util,$(USEMODULE)))
|
|
|
|
INCLUDES += $(NIMIBASE)/nimble/host/util/include
|
|
|
|
endif
|
|
|
|
|
|
|
|
# include transport headers
|
2022-03-22 08:53:47 +01:00
|
|
|
INCLUDES += $(NIMIBASE)/nimble/transport/include
|
2018-05-24 11:36:20 +02:00
|
|
|
|
2022-08-11 09:44:19 +02:00
|
|
|
ifneq (,$(filter nimble_transport_hci_h4,$(USEMODULE)))
|
|
|
|
INCLUDES += $(NIMIBASE)/nimble/transport/common/hci_h4/include
|
|
|
|
endif
|
|
|
|
|
2019-02-22 13:55:16 +01:00
|
|
|
# include services
|
|
|
|
ifneq (,$(filter nimble_svc_ans,$(USEMODULE)))
|
|
|
|
INCLUDES += $(NIMIBASE)/nimble/host/services/ans/include
|
|
|
|
endif
|
|
|
|
ifneq (,$(filter nimble_svc_bas,$(USEMODULE)))
|
|
|
|
INCLUDES += $(NIMIBASE)/nimble/host/services/bas/include
|
|
|
|
endif
|
|
|
|
ifneq (,$(filter nimble_svc_bleuart,$(USEMODULE)))
|
|
|
|
INCLUDES += $(NIMIBASE)/nimble/host/services/bleuart/include
|
|
|
|
endif
|
|
|
|
ifneq (,$(filter nimble_svc_gap,$(USEMODULE)))
|
|
|
|
INCLUDES += $(NIMIBASE)/nimble/host/services/gap/include
|
|
|
|
endif
|
|
|
|
ifneq (,$(filter nimble_svc_gatt,$(USEMODULE)))
|
|
|
|
INCLUDES += $(NIMIBASE)/nimble/host/services/gatt/include
|
|
|
|
endif
|
|
|
|
ifneq (,$(filter nimble_svc_ias,$(USEMODULE)))
|
|
|
|
INCLUDES += $(NIMIBASE)/nimble/host/services/ias/include
|
|
|
|
endif
|
2019-03-27 11:29:10 +01:00
|
|
|
ifneq (,$(filter nimble_svc_ipss,$(USEMODULE)))
|
|
|
|
INCLUDES += $(NIMIBASE)/nimble/host/services/ipss/include
|
|
|
|
endif
|
2019-02-22 13:55:16 +01:00
|
|
|
ifneq (,$(filter nimble_svc_lls,$(USEMODULE)))
|
|
|
|
INCLUDES += $(NIMIBASE)/nimble/host/services/lls/include
|
|
|
|
endif
|
|
|
|
ifneq (,$(filter nimble_svc_tps,$(USEMODULE)))
|
|
|
|
INCLUDES += $(NIMIBASE)/nimble/host/services/tps/include
|
|
|
|
endif
|
2019-03-26 09:50:08 +01:00
|
|
|
|
|
|
|
# include additional headers for RIOT specific NimBLE submodules
|
|
|
|
ifneq (,$(filter nimble_addr,$(USEMODULE)))
|
|
|
|
INCLUDES += -I$(RIOTPKG)/nimble/addr/include
|
|
|
|
endif
|
2021-09-13 14:41:00 +02:00
|
|
|
|
2020-02-24 11:38:17 +01:00
|
|
|
ifneq (,$(filter nimble_autoadv,$(USEMODULE)))
|
|
|
|
INCLUDES += -I$(RIOTPKG)/nimble/autoadv/include
|
2022-02-14 10:24:55 +01:00
|
|
|
DIRS += $(RIOTPKG)/nimble/autoadv
|
2020-02-24 11:38:17 +01:00
|
|
|
endif
|
2021-09-13 14:41:00 +02:00
|
|
|
|
2019-08-29 15:56:24 +02:00
|
|
|
ifneq (,$(filter nimble_autoconn,$(USEMODULE)))
|
|
|
|
INCLUDES += -I$(RIOTPKG)/nimble/autoconn/include
|
|
|
|
endif
|
2021-09-13 14:41:00 +02:00
|
|
|
|
2021-09-13 14:41:59 +02:00
|
|
|
ifneq (,$(filter nimble_adv_ext,$(USEMODULE)))
|
2022-06-07 09:24:00 +02:00
|
|
|
# extended advertising HCI events can be up to 257 bytes
|
|
|
|
CFLAGS += -DMYNEWT_VAL_BLE_TRANSPORT_EVT_SIZE=257
|
2022-08-18 07:51:39 +02:00
|
|
|
CFLAGS += -DMYNEWT_VAL_BLE_TRANSPORT_EVT_COUNT=4
|
2021-09-13 14:41:59 +02:00
|
|
|
CFLAGS += -DMYNEWT_VAL_BLE_EXT_ADV=1
|
|
|
|
CFLAGS += -DMYNEWT_VAL_BLE_LL_EXT_ADV_AUX_PTR_CNT=2
|
2021-11-22 10:35:37 +01:00
|
|
|
CFLAGS += -DMYNEWT_VAL_BLE_LL_SCAN_AUX_SEGMENT_CNT=1
|
2021-09-13 14:41:59 +02:00
|
|
|
ifneq (,$(filter nimble_controller,$(USEMODULE)))
|
|
|
|
CFLAGS += -DMYNEWT_VAL_BLE_LL_CFG_FEAT_LL_EXT_ADV=1
|
|
|
|
endif
|
2021-11-22 10:35:37 +01:00
|
|
|
ifneq (,$(filter nimble_netif,$(USEMODULE)))
|
2021-11-24 14:51:30 +01:00
|
|
|
$(eval $(call _add_ext_adv_instance,NIMBLE_NETIF_ADV_INSTANCE))
|
|
|
|
endif
|
|
|
|
ifneq (,$(filter nimble_autoadv,$(USEMODULE)))
|
|
|
|
$(eval $(call _add_ext_adv_instance,NIMBLE_AUTOADV_INSTANCE))
|
|
|
|
endif
|
|
|
|
# check that an advertisement instances was configured
|
|
|
|
ifneq (-1,$(BLE_MULTI_ADV_INSTANCES))
|
|
|
|
CFLAGS += -DMYNEWT_VAL_BLE_MULTI_ADV_INSTANCES=$(BLE_MULTI_ADV_INSTANCES)
|
2021-11-22 10:35:37 +01:00
|
|
|
endif
|
2022-06-07 09:24:00 +02:00
|
|
|
else
|
|
|
|
# when only using non-extended advertisements the maximum HCI event size is
|
|
|
|
# 45 bytes
|
|
|
|
CFLAGS += -DMYNEWT_VAL_BLE_TRANSPORT_EVT_SIZE=45
|
2021-09-13 14:41:59 +02:00
|
|
|
endif
|
|
|
|
|
2019-05-17 11:15:49 +02:00
|
|
|
ifneq (,$(filter nimble_netif,$(USEMODULE)))
|
|
|
|
INCLUDES += -I$(RIOTPKG)/nimble/netif/include
|
|
|
|
|
|
|
|
# configure NimBLE's internals
|
|
|
|
NIMBLE_MAX_CONN ?= 3
|
|
|
|
CFLAGS += -DMYNEWT_VAL_BLE_L2CAP_COC_MAX_NUM=$(NIMBLE_MAX_CONN)
|
|
|
|
CFLAGS += -DMYNEWT_VAL_BLE_MAX_CONNECTIONS=$(NIMBLE_MAX_CONN)
|
2021-05-27 12:33:21 +02:00
|
|
|
|
|
|
|
# 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)
|
2022-07-27 09:43:17 +02:00
|
|
|
CFLAGS += -DMYNEWT_VAL_MSYS_1_BLOCK_SIZE='(MYNEWT_VAL_BLE_L2CAP_COC_MPS + 48)'
|
2021-05-27 12:33:21 +02:00
|
|
|
|
|
|
|
# in the worst case, NimBLEs internal buffer needs to hold two full IPv6 MTUs
|
|
|
|
# per connection (1 TX and 1 RX). But in practice this would be highly over-
|
|
|
|
# provisioned. Allocating 10 memory blocks per connection plus another 5
|
|
|
|
# for internal buffering has proven to be a generous default value.
|
2019-05-17 11:15:49 +02:00
|
|
|
CFLAGS += -DMYNEWT_VAL_MSYS_1_BLOCK_COUNT=35
|
2019-11-21 14:37:14 +01:00
|
|
|
|
|
|
|
# optimize the NimBLE controller for IP traffic
|
|
|
|
ifneq (,$(filter nimble_controller,$(USEMODULE)))
|
2021-05-27 12:33:21 +02:00
|
|
|
CFLAGS += -DMYNEWT_VAL_BLE_LL_MAX_PKT_SIZE=251
|
2021-05-26 18:24:46 +02:00
|
|
|
CFLAGS += -DMYNEWT_VAL_BLE_LL_CONN_INIT_SLOTS=1
|
2019-11-21 14:37:14 +01:00
|
|
|
CFLAGS += -DMYNEWT_VAL_BLE_LL_CFG_FEAT_DATA_LEN_EXT=1
|
|
|
|
endif
|
2021-12-17 02:31:01 +01:00
|
|
|
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)
|
2022-07-27 09:43:17 +02:00
|
|
|
CFLAGS += -DMYNEWT_VAL_MSYS_1_BLOCK_SIZE='(MYNEWT_VAL_BLE_L2CAP_COC_MPS + 48)'
|
2021-12-17 02:31:01 +01:00
|
|
|
endif
|
2019-05-17 11:15:49 +02:00
|
|
|
endif
|
2021-09-13 14:41:00 +02:00
|
|
|
|
2021-04-20 14:45:30 +02:00
|
|
|
ifneq (,$(filter nimble_rpble,$(USEMODULE)))
|
|
|
|
INCLUDES += -I$(RIOTPKG)/nimble/rpble/include
|
|
|
|
endif
|
2021-09-13 14:41:00 +02:00
|
|
|
|
2019-03-26 11:39:29 +01:00
|
|
|
ifneq (,$(filter nimble_scanlist,$(USEMODULE)))
|
|
|
|
INCLUDES += -I$(RIOTPKG)/nimble/scanlist/include
|
|
|
|
endif
|
2021-09-13 14:41:00 +02:00
|
|
|
|
2019-03-26 13:46:25 +01:00
|
|
|
ifneq (,$(filter nimble_scanner,$(USEMODULE)))
|
|
|
|
INCLUDES += -I$(RIOTPKG)/nimble/scanner/include
|
|
|
|
endif
|
2021-09-13 14:41:00 +02:00
|
|
|
|
2020-03-02 17:40:26 +01:00
|
|
|
ifneq (,$(filter nimble_statconn,$(USEMODULE)))
|
|
|
|
INCLUDES += -I$(RIOTPKG)/nimble/statconn/include
|
|
|
|
endif
|