circuitpython/ports/nrf/drivers/bluetooth/bluetooth_common.mk
glennrub f8f14bf0c7 nrf: Add support for s132 v5.0.0 bluetooth stack (#139)
* ports/nrf/boards: Adding linker script for nrf52832 using BLE stack s132 v.5.0.0.

* ports/nrf/drivers/bluetooth: Updating makefile to add BLE_API_VERSION=4 if s132 v5.0.0 is used.

* ports/nrf/drivers/bluetooth: Updating BLE stack download script to also download S132 v5.0.0.

* ports/nrf/drivers/bluetooth: Updating ble_drv.c to handle BLE_API_VERSION=4 (s132 v5.0.0).

* ports/nrf/boards: Updating linker script for nrf52832 with s132 v.5.0.0 bluetooth stack.

* ports/nrf/drivers/bluetooth: Removing commented out code in ble_drv.c

* ports/nrf/drivers/bluetooth: Updating define of GATT_MTU_SIZE_DEFAULT for SD132v5 to be defined using the new name defined in the SD headers in a more generic way.

* ports/nrf/drivers/bluetooth: Cleaning up use of BLE_API_VERSION in the ble_drv.c. Also considering s140v6 API, so not all has been changed to >= if API version 3 and 4 in combo is used. New s140v6 will differ on these, and add a new API not compatible with the API for 3 and 4.
2018-07-18 17:12:25 +10:00

58 lines
2.0 KiB
Makefile

SOFTDEV_HEX_NAME ?=
SOFTDEV_HEX_PATH ?=
ifeq ($(SD), s110)
INC += -Idrivers/bluetooth/$(SD)_$(MCU_VARIANT)_$(SOFTDEV_VERSION)/$(SD)_$(MCU_VARIANT)_$(SOFTDEV_VERSION)_API/include
CFLAGS += -DBLUETOOTH_SD_DEBUG=1
CFLAGS += -DBLUETOOTH_SD=110
SOFTDEV_HEX_NAME = $(SD)_$(MCU_VARIANT)_$(SOFTDEV_VERSION)_softdevice.hex
SOFTDEV_HEX_PATH = drivers/bluetooth/$(SD)_$(MCU_VARIANT)_$(SOFTDEV_VERSION)
else ifeq ($(SD), s120)
$(error No BLE wrapper available yet)
else ifeq ($(SD), s130)
$(error No BLE wrapper available yet)
else ifeq ($(SD), s132)
INC += -Idrivers/bluetooth/$(SD)_$(MCU_VARIANT)_$(SOFTDEV_VERSION)/$(SD)_$(MCU_VARIANT)_$(SOFTDEV_VERSION)_API/include
INC += -Idrivers/bluetooth/$(SD)_$(MCU_VARIANT)_$(SOFTDEV_VERSION)/$(SD)_$(MCU_VARIANT)_$(SOFTDEV_VERSION)_API/include/$(MCU_VARIANT)
CFLAGS += -DBLUETOOTH_SD_DEBUG=1
CFLAGS += -DBLUETOOTH_SD=132
ifeq ($(SOFTDEV_VERSION), 2.0.1)
CFLAGS += -DBLE_API_VERSION=2
else ifeq ($(SOFTDEV_VERSION), 3.0.0)
CFLAGS += -DBLE_API_VERSION=3
else ifeq ($(SOFTDEV_VERSION), 5.0.0)
CFLAGS += -DBLE_API_VERSION=4
endif
SOFTDEV_HEX_NAME = $(SD)_$(MCU_VARIANT)_$(SOFTDEV_VERSION)_softdevice.hex
SOFTDEV_HEX_PATH = drivers/bluetooth/$(SD)_$(MCU_VARIANT)_$(SOFTDEV_VERSION)
else
$(error Incorrect softdevice set flag)
endif
define STACK_MISSING_ERROR
###### ERROR: Bluetooth LE Stack not found ############
# #
# The build target requires a Bluetooth LE stack. #
# $(SD)_$(MCU_VARIANT)_$(SOFTDEV_VERSION) Bluetooth LE stack not found. #
# #
# Please run the download script: #
# #
# drivers/bluetooth/download_ble_stack.sh #
# #
#######################################################
endef
SOFTDEV_HEX = $(SOFTDEV_HEX_PATH)/$(SOFTDEV_HEX_NAME)
ifeq ($(shell test ! -e $(SOFTDEV_HEX) && echo -n no),no)
$(error $(STACK_MISSING_ERROR))
endif