2020-02-20 03:40:55 +00:00
|
|
|
# Makefile directives for BlueKitchen BTstack
|
|
|
|
|
|
|
|
ifeq ($(MICROPY_BLUETOOTH_BTSTACK),1)
|
|
|
|
|
2020-04-07 06:02:52 +01:00
|
|
|
MICROPY_BLUETOOTH_BTSTACK_USB ?= 0
|
|
|
|
|
2020-02-20 03:40:55 +00:00
|
|
|
BTSTACK_EXTMOD_DIR = extmod/btstack
|
|
|
|
|
|
|
|
EXTMOD_SRC_C += extmod/btstack/modbluetooth_btstack.c
|
|
|
|
|
|
|
|
INC += -I$(TOP)/$(BTSTACK_EXTMOD_DIR)
|
|
|
|
|
|
|
|
CFLAGS_MOD += -DMICROPY_BLUETOOTH_BTSTACK=1
|
2021-02-10 10:40:11 +00:00
|
|
|
CFLAGS_MOD += -DMICROPY_PY_BLUETOOTH_USE_SYNC_EVENTS=1
|
|
|
|
CFLAGS_MOD += -DMICROPY_PY_BLUETOOTH_ENABLE_PAIRING_BONDING=1
|
2020-02-20 03:40:55 +00:00
|
|
|
|
|
|
|
BTSTACK_DIR = $(TOP)/lib/btstack
|
|
|
|
|
2020-04-20 02:50:02 +01:00
|
|
|
ifneq ($(wildcard $(BTSTACK_DIR)/src),)
|
|
|
|
|
2020-02-20 03:40:55 +00:00
|
|
|
include $(BTSTACK_DIR)/src/Makefile.inc
|
|
|
|
include $(BTSTACK_DIR)/src/ble/Makefile.inc
|
|
|
|
|
|
|
|
INC += -I$(BTSTACK_DIR)/src
|
|
|
|
INC += -I$(BTSTACK_DIR)/3rd-party/bluedroid/decoder/include
|
|
|
|
INC += -I$(BTSTACK_DIR)/3rd-party/bluedroid/encoder/include
|
|
|
|
INC += -I$(BTSTACK_DIR)/3rd-party/md5
|
|
|
|
INC += -I$(BTSTACK_DIR)/3rd-party/yxml
|
|
|
|
|
|
|
|
SRC_BTSTACK = \
|
|
|
|
$(addprefix lib/btstack/src/, $(SRC_FILES)) \
|
|
|
|
$(addprefix lib/btstack/src/ble/, $(filter-out %_tlv.c, $(SRC_BLE_FILES))) \
|
2020-04-07 06:02:52 +01:00
|
|
|
|
2020-08-14 06:46:53 +01:00
|
|
|
ifeq ($(MICROPY_BLUETOOTH_BTSTACK_USB),1)
|
|
|
|
ifeq ($(MICROPY_BLUETOOTH_BTSTACK_H4),1)
|
|
|
|
$(error Cannot specifiy both MICROPY_BLUETOOTH_BTSTACK_USB and MICROPY_BLUETOOTH_BTSTACK_H4)
|
|
|
|
endif
|
|
|
|
endif
|
|
|
|
|
2020-04-07 06:02:52 +01:00
|
|
|
ifeq ($(MICROPY_BLUETOOTH_BTSTACK_USB),1)
|
|
|
|
SRC_BTSTACK += \
|
|
|
|
lib/btstack/platform/libusb/hci_transport_h2_libusb.c
|
|
|
|
|
2020-08-14 06:46:53 +01:00
|
|
|
CFLAGS_MOD += -DMICROPY_BLUETOOTH_BTSTACK_USB=1
|
|
|
|
|
2020-04-07 06:02:52 +01:00
|
|
|
CFLAGS += $(shell pkg-config libusb-1.0 --cflags)
|
|
|
|
LDFLAGS += $(shell pkg-config libusb-1.0 --libs)
|
|
|
|
endif
|
2020-02-20 03:40:55 +00:00
|
|
|
|
2020-08-14 06:43:09 +01:00
|
|
|
ifeq ($(MICROPY_BLUETOOTH_BTSTACK_H4),1)
|
|
|
|
SRC_BTSTACK += \
|
|
|
|
lib/btstack/src/hci_transport_h4.c \
|
|
|
|
lib/btstack/chipset/zephyr/btstack_chipset_zephyr.c
|
|
|
|
|
|
|
|
EXTMOD_SRC_C += \
|
|
|
|
extmod/btstack/btstack_hci_uart.c \
|
|
|
|
|
|
|
|
CFLAGS_MOD += -DMICROPY_BLUETOOTH_BTSTACK_H4=1
|
|
|
|
endif
|
|
|
|
|
2020-04-07 06:02:52 +01:00
|
|
|
ifeq ($(MICROPY_BLUETOOTH_BTSTACK_ENABLE_CLASSIC),1)
|
2020-02-20 03:40:55 +00:00
|
|
|
include $(BTSTACK_DIR)/src/classic/Makefile.inc
|
|
|
|
SRC_BTSTACK += \
|
|
|
|
$(addprefix lib/btstack/src/classic/, $(SRC_CLASSIC_FILES))
|
|
|
|
endif
|
|
|
|
|
2020-04-07 05:50:56 +01:00
|
|
|
LIB_SRC_C += $(SRC_BTSTACK)
|
2020-02-20 03:40:55 +00:00
|
|
|
|
2020-04-17 01:00:36 +01:00
|
|
|
# Suppress some warnings.
|
2021-07-17 14:25:07 +01:00
|
|
|
BTSTACK_WARNING_CFLAGS = -Wno-old-style-definition -Wno-unused-variable -Wno-unused-parameter -Wno-implicit-fallthrough
|
2020-04-17 01:00:36 +01:00
|
|
|
ifneq ($(CC),clang)
|
|
|
|
BTSTACK_WARNING_CFLAGS += -Wno-format
|
|
|
|
endif
|
|
|
|
$(BUILD)/lib/btstack/src/%.o: CFLAGS += $(BTSTACK_WARNING_CFLAGS)
|
2020-10-29 04:47:20 +00:00
|
|
|
$(BUILD)/lib/btstack/platform/%.o: CFLAGS += $(BTSTACK_WARNING_CFLAGS)
|
2020-02-20 03:40:55 +00:00
|
|
|
|
|
|
|
endif
|
2020-04-20 02:50:02 +01:00
|
|
|
endif
|