mirror of
https://github.com/RIOT-OS/RIOT.git
synced 2024-12-29 04:50:03 +01:00
e3b2b75aff
If the package is used for a controller that supports the HCI UART H4 transport layer protocol, the functions implemented in `nimble/transport/common/hci_h4` are very useful to deal with H4 formatted packages. If required, they can be enabled by module `nimble_transport_hci_h4`.
183 lines
6.5 KiB
Makefile
183 lines
6.5 KiB
Makefile
NIMIBASE = -I$(PKGDIRBASE)/nimble
|
|
|
|
# include RIOT glue code headers
|
|
INCLUDES += -I$(RIOTPKG)/nimble/contrib/include
|
|
|
|
# include generic nimble headers
|
|
INCLUDES += $(NIMIBASE)/nimble/include
|
|
|
|
# include the RIOT NPL headers
|
|
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
|
|
INCLUDES += $(NIMIBASE)/porting/nimble/include
|
|
|
|
# include nimble controller headers
|
|
ifneq (,$(filter nimble_controller,$(USEMODULE)))
|
|
INCLUDES += $(NIMIBASE)/nimble/controller/include
|
|
# set environment
|
|
CFLAGS += -DNIMBLE_CFG_CONTROLLER=1
|
|
ifneq (,$(filter nimble_npl_riot,$(USEMODULE)))
|
|
CFLAGS += -DMYNEWT_VAL_OS_CPUTIME_FREQ=32768
|
|
endif
|
|
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
|
|
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
|
|
INCLUDES += $(NIMIBASE)/nimble/transport/include
|
|
|
|
ifneq (,$(filter nimble_transport_hci_h4,$(USEMODULE)))
|
|
INCLUDES += $(NIMIBASE)/nimble/transport/common/hci_h4/include
|
|
endif
|
|
|
|
# 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
|
|
ifneq (,$(filter nimble_svc_ipss,$(USEMODULE)))
|
|
INCLUDES += $(NIMIBASE)/nimble/host/services/ipss/include
|
|
endif
|
|
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
|
|
|
|
# include additional headers for RIOT specific NimBLE submodules
|
|
ifneq (,$(filter nimble_addr,$(USEMODULE)))
|
|
INCLUDES += -I$(RIOTPKG)/nimble/addr/include
|
|
endif
|
|
|
|
ifneq (,$(filter nimble_autoadv,$(USEMODULE)))
|
|
INCLUDES += -I$(RIOTPKG)/nimble/autoadv/include
|
|
DIRS += $(RIOTPKG)/nimble/autoadv
|
|
endif
|
|
|
|
ifneq (,$(filter nimble_autoconn,$(USEMODULE)))
|
|
INCLUDES += -I$(RIOTPKG)/nimble/autoconn/include
|
|
endif
|
|
|
|
ifneq (,$(filter nimble_adv_ext,$(USEMODULE)))
|
|
# extended advertising HCI events can be up to 257 bytes
|
|
CFLAGS += -DMYNEWT_VAL_BLE_TRANSPORT_EVT_SIZE=257
|
|
CFLAGS += -DMYNEWT_VAL_BLE_TRANSPORT_EVT_COUNT=4
|
|
CFLAGS += -DMYNEWT_VAL_BLE_EXT_ADV=1
|
|
CFLAGS += -DMYNEWT_VAL_BLE_LL_EXT_ADV_AUX_PTR_CNT=2
|
|
CFLAGS += -DMYNEWT_VAL_BLE_LL_SCAN_AUX_SEGMENT_CNT=1
|
|
ifneq (,$(filter nimble_controller,$(USEMODULE)))
|
|
CFLAGS += -DMYNEWT_VAL_BLE_LL_CFG_FEAT_LL_EXT_ADV=1
|
|
endif
|
|
ifneq (,$(filter nimble_netif,$(USEMODULE)))
|
|
$(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)
|
|
endif
|
|
else
|
|
# when only using non-extended advertisements the maximum HCI event size is
|
|
# 45 bytes
|
|
CFLAGS += -DMYNEWT_VAL_BLE_TRANSPORT_EVT_SIZE=45
|
|
endif
|
|
|
|
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)
|
|
|
|
# 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)'
|
|
|
|
# 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.
|
|
CFLAGS += -DMYNEWT_VAL_MSYS_1_BLOCK_COUNT=35
|
|
|
|
# optimize the NimBLE controller for IP traffic
|
|
ifneq (,$(filter nimble_controller,$(USEMODULE)))
|
|
CFLAGS += -DMYNEWT_VAL_BLE_LL_MAX_PKT_SIZE=251
|
|
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)))
|
|
INCLUDES += -I$(RIOTPKG)/nimble/rpble/include
|
|
endif
|
|
|
|
ifneq (,$(filter nimble_scanlist,$(USEMODULE)))
|
|
INCLUDES += -I$(RIOTPKG)/nimble/scanlist/include
|
|
endif
|
|
|
|
ifneq (,$(filter nimble_scanner,$(USEMODULE)))
|
|
INCLUDES += -I$(RIOTPKG)/nimble/scanner/include
|
|
endif
|
|
|
|
ifneq (,$(filter nimble_statconn,$(USEMODULE)))
|
|
INCLUDES += -I$(RIOTPKG)/nimble/statconn/include
|
|
endif
|