Commit ffce77e1 authored by schneider's avatar schneider Committed by Rahix

fix(sdk): Plug in pre-release with BTLE support

Plug in a new SDK with improved BLE support (more source files
available)

Does not yet actually us BLE.
parent ca3aaa55

Too many changes to show.

To preserve performance only 1000 of 1000+ files are displayed.
...@@ -29,10 +29,15 @@ ...@@ -29,10 +29,15 @@
# property whatsoever. Maxim Integrated Products, Inc. retains all # property whatsoever. Maxim Integrated Products, Inc. retains all
# ownership rights. # ownership rights.
# #
# $Id: Makefile 41870 2019-03-26 14:20:03Z nathan.goldstick $ # $Id: Makefile 44505 2019-07-09 20:32:03Z nathan.goldstick $
# #
################################################################################ ################################################################################
# Include project configuration.
ifneq "$(wildcard config.mk)" ""
include config.mk
endif
# This is the name of the build output file # This is the name of the build output file
ifeq "$(PROJECT)" "" ifeq "$(PROJECT)" ""
PROJECT=max32665 PROJECT=max32665
...@@ -55,29 +60,6 @@ endif ...@@ -55,29 +60,6 @@ endif
TARGET_UC:=$(shell echo $(TARGET) | tr a-z A-Z) TARGET_UC:=$(shell echo $(TARGET) | tr a-z A-Z)
TARGET_LC:=$(shell echo $(TARGET) | tr A-Z a-z) TARGET_LC:=$(shell echo $(TARGET) | tr A-Z a-z)
# Beacon App Defines
ifneq "$(BEACON_APP_BEACON_APP_ADV_TYPE)" ""
PROJ_CFLAGS+=-DBEACON_APP_BEACON_APP_ADV_TYPE
endif
ifneq "$(BEACON_APP_MODE)" ""
PROJ_CFLAGS+=-DBEACON_APP_MODE
endif
ifneq "$(BEACON_APP_PEER_ADDR)" ""
PROJ_CFLAGS+=-DBEACON_APP_PEER_ADDR
endif
ifneq "$(BEACON_APP_USE_LEGACY_PDU)" ""
PROJ_CFLAGS+=-DBEACON_APP_USE_LEGACY_PDU
endif
ifneq "$(BEACON_APP_USE_ANON_ADV)" ""
PROJ_CFLAGS+=-DBEACON_APP_USE_ANON_ADV
endif
ifneq "$(BEACON_APP_USE_FRAG_PREF)" ""
PROJ_CFLAGS+=-DBEACON_APP_USE_FRAG_PREF
endif
ifneq "$(BEACON_APP_USE_PER_ADV)" ""
PROJ_CFLAGS+=-DBEACON_APP_USE_PER_ADV
endif
# Last octet address modifier # Last octet address modifier
ifneq "$(BLE_ADDR_LSB)" "" ifneq "$(BLE_ADDR_LSB)" ""
PROJ_CFLAGS+=-DBLE_ADDR_LSB=$(BLE_ADDR_LSB) PROJ_CFLAGS+=-DBLE_ADDR_LSB=$(BLE_ADDR_LSB)
...@@ -90,10 +72,8 @@ endif ...@@ -90,10 +72,8 @@ endif
# This is the path to the CMSIS root directory # This is the path to the CMSIS root directory
ifeq "$(MAXIM_PATH)" "" ifeq "$(MAXIM_PATH)" ""
LIBS_DIR=../../../Libraries LIBS_DIR=../../../Libraries
NDALIBS_DIR=../../../NDALibraries
else else
LIBS_DIR=/$(subst \,/,$(subst :,,$(MAXIM_PATH))/Firmware/$(TARGET_UC)/Libraries) LIBS_DIR=/$(subst \,/,$(subst :,,$(MAXIM_PATH))/Firmware/$(TARGET_UC)/Libraries)
NDALIBS_DIR=/$(subst \,/,$(subst :,,$(MAXIM_PATH))/Firmware/$(TARGET_UC)/NDALibraries)
endif endif
CMSIS_ROOT=$(LIBS_DIR)/CMSIS CMSIS_ROOT=$(LIBS_DIR)/CMSIS
...@@ -101,23 +81,105 @@ CMSIS_ROOT=$(LIBS_DIR)/CMSIS ...@@ -101,23 +81,105 @@ CMSIS_ROOT=$(LIBS_DIR)/CMSIS
SRCS = main.c SRCS = main.c
SRCS += stack_beacon.c SRCS += stack_beacon.c
SRCS += beacon_main.c SRCS += beacon_main.c
# Where to find source files for this test # Where to find source files for this test
VPATH = . VPATH = .
VPATH += fcl/src
# Where to find header files for this test # Where to find header files for this test
IPATH = . IPATH = .
################################################################################
# Project build configuration.
#-------------------------------------------------------------------------------
# Configuration passed via environment vars.
ifdef BTLE_APP_USE_LEGACY_API
ifeq "$(BTLE_APP_USE_LEGACY_API)" ""
PROJ_CFLAGS+=-DBTLE_APP_USE_LEGACY_API=TRUE
else
ifeq "$(BTLE_APP_USE_LEGACY_API)" "0"
else
ifeq "$(BTLE_APP_USE_LEGACY_API)" "FALSE"
else
PROJ_CFLAGS+=-DBTLE_APP_USE_LEGACY_API=TRUE
endif
endif
endif
endif
ifdef CONSOLE_UART
ifneq "$(CONSOLE_UART)" ""
PROJ_CFLAGS+=-DCONSOLE_UART=$(CONSOLE_UART)
endif
endif
ifdef ENABLE_SDMA
ifneq "$(ENABLE_SDMA)" ""
ifeq "$(ENABLE_SDMA)" "0"
undefine ENABLE_SDMA
else
ifeq "$(ENABLE_SDMA)" "FALSE"
undefine ENABLE_SDMA
else
ENABLE_SDMA=1
endif
endif
endif
endif
ifneq "$(ENABLE_SDMA)" ""
ifdef BTLE_APP_USE_LEGACY_API
ifneq "$(BTLE_APP_USE_LEGACY_API)" ""
ifeq "$(BTLE_APP_USE_LEGACY_API)" "0"
$(error SDMA currently requires BTLE_APP_USE_LEGACY_API)
endif
ifeq "$(BTLE_APP_USE_LEGACY_API)" "FALSE"
$(error SDMA currently requires BTLE_APP_USE_LEGACY_API)
endif
endif
endif
endif
#-------------------------------------------------------------------------------
# Configuration specified here.
#--------------------
# Stack configuration
# Enable assertion checking for development # Enable assertion checking for development
PROJ_CFLAGS+=-DMXC_ASSERT_ENABLE PROJ_CFLAGS+=-DMXC_ASSERT_ENABLE=TRUE
PROJ_CFLAGS+=-DASYMMETRIC -DWORD32 PROJ_CFLAGS+=-DWSF_TRACE_ENABLED=TRUE
PROJ_CFLAGS+=-DWSF_ASSERT_ENABLED=TRUE
# PROJ_CFLAGS+=-DLL_TRACE_ENABLED=TRUE
# PROJ_CFLAGS+=-DLL_DBG_PIN_ENABLED=TRUE
PROJ_CFLAGS+=-DWSF_MS_PER_TICK=1
#--------------------
# Application CFLAGS configuration
#--------------------
# Stack CFLAGS configuration
PROJ_CFLAGS+=-DINIT_BROADCASTER
# PROJ_CFLAGS+=-DINIT_OBSERVER
# PROJ_CFLAGS+=-DINIT_CENTRAL
PROJ_CFLAGS+=-DINIT_PERIPHERAL
PROJ_CFLAGS+=-DINIT_ENCRYPTED
ENABLE_LL_TESTER?=#1
# Use this variable to override default compilier optimization.
#MXC_OPTIMIZE_CFLAGS=-Os #MXC_OPTIMIZE_CFLAGS=-Os
#MXC_OPTIMIZE_CFLAGS=-O0 -fomit-frame-pointer
# Point this variable to a linker file to override the default file # Point this variable to a linker file to override the default file
#LINKERFILE=$(CMSIS_ROOT)/Device/Maxim/$(TARGET_UC)/Source/GCC/$(TARGET_LC).ld #LINKERFILE=$(CMSIS_ROOT)/Device/Maxim/$(TARGET_UC)/Source/GCC/$(TARGET_LC).ld
################################################################################ ################################################################################
# Include external library makefiles here # Include external library makefiles here
DEBUG=1
# Include the BSP # Include the BSP
BOARD_DIR=$(LIBS_DIR)/Boards/$(BOARD) BOARD_DIR=$(LIBS_DIR)/Boards/$(BOARD)
...@@ -128,7 +190,7 @@ PERIPH_DRIVER_DIR=$(LIBS_DIR)/$(TARGET)PeriphDriver ...@@ -128,7 +190,7 @@ PERIPH_DRIVER_DIR=$(LIBS_DIR)/$(TARGET)PeriphDriver
include ${PERIPH_DRIVER_DIR}/periphdriver.mk include ${PERIPH_DRIVER_DIR}/periphdriver.mk
# Include Cordio BTLE Library # Include Cordio BTLE Library
CORDIO_DIR=$(NDALIBS_DIR)/BTLE CORDIO_DIR=$(LIBS_DIR)/BTLE
include ${CORDIO_DIR}/btle.mk include ${CORDIO_DIR}/btle.mk
# Include MAXUSB library # Include MAXUSB library
......
...@@ -26,7 +26,7 @@ ...@@ -26,7 +26,7 @@
#include "wsf_buf.h" #include "wsf_buf.h"
#include "wsf_assert.h" #include "wsf_assert.h"
#include "hci_api.h" #include "hci_api.h"
#include "sec_api.h" #include "hci_vs.h"
#include "dm_api.h" #include "dm_api.h"
#include "smp_api.h" #include "smp_api.h"
#include "att_api.h" #include "att_api.h"
...@@ -34,9 +34,6 @@ ...@@ -34,9 +34,6 @@
#include "app_main.h" #include "app_main.h"
#include "app_db.h" #include "app_db.h"
#include "app_ui.h" #include "app_ui.h"
#include "svc_ch.h"
#include "svc_core.h"
#include "svc_wp.h"
#include "util/calc128.h" #include "util/calc128.h"
#include "beacon_api.h" #include "beacon_api.h"
...@@ -44,100 +41,41 @@ ...@@ -44,100 +41,41 @@
Macros Macros
**************************************************************************************************/ **************************************************************************************************/
/*! Enumeration of client characteristic configuration descriptors */
enum
{
BEACON_GATT_SC_CCC_IDX, /*! GATT service, service changed characteristic */
BEACON_WP_DAT_CCC_IDX, /*! ARM Ltd. proprietary service, data transfer characteristic */
BEACON_NUM_CCC_IDX
};
#ifndef BEACON_APP_ADV_TYPE
/* Non-scannable and connectable undirected advertising */
//#define BEACON_APP_ADV_TYPE DM_EXT_ADV_CONN_UNDIRECT
/* Scannable and non-connectable directed advertising */
//#define BEACON_APP_ADV_TYPE DM_EXT_ADV_SCAN_DIRECT
/* Non-scannable and non-connectable directed advertising */
#define BEACON_APP_ADV_TYPE DM_EXT_ADV_NONCONN_DIRECT
#endif /* BEACON_APP_ADV_TYPE */
#ifndef BEACON_APP_MODE
#define BEACON_APP_MODE APP_MODE_DISCOVERABLE
//#define BEACON_APP_MODE APP_MODE_CONNECTABLE
#endif /* BEACON_PP_MODEE */
#ifndef BEACON_APP_PEER_ADDR
#define BEACON_APP_PEER_ADDR "\x01\x03\x44\x8B\x05"
#endif /* BEACON_APP_PEER_ADDR */
#ifndef BEACON_APP_USE_LEGACY_PDU
#define BEACON_APP_USE_LEGACY_PDU 0
#endif /* BEACON_APP_USE_LEGACY_PDU */
#ifndef BLE_BEACON_USE_ANON_ADV
#define BLE_BEACON_USE_ANON_ADV 0
#endif /* BLE_BEACON_USE_ANON_ADV */
#ifndef BLE_BEACON_USE_FRAG_PREF
#define BLE_BEACON_USE_FRAG_PREF 1
#endif /* BLE_BEACON_USE_FRAG_PREF */
#ifndef BLE_BEACON_USE_PER_ADV
#define BLE_BEACON_USE_PER_ADV 0
#endif /* BLE_BEACON_USE_PER_ADV */
/************************************************************************************************** /**************************************************************************************************
Configurable Parameters Configurable Parameters
**************************************************************************************************/ **************************************************************************************************/
/*! configurable parameters for advertising */ /*! configurable parameters for advertising */
/* These intervals directly impact energy usage during the non-connected/advertising mode */
#ifdef BTLE_APP_USE_LEGACY_API
static const appAdvCfg_t beaconAdvCfg =
{
{ 1000, 0, 0}, /*! Advertising durations in ms */
{ 96, 200, 0} /*! Advertising intervals in 0.625 ms units */
};
#else /* BTLE_APP_USE_LEGACY_API */
static const appExtAdvCfg_t beaconExtAdvCfg = static const appExtAdvCfg_t beaconExtAdvCfg =
{ {
{ 0}, /*!< \brief Advertising durations for extended advertising in ms */ { 0, 0, 0}, /*! Advertising durations for extended advertising in ms */
{ 200}, /*!< \brief Advertising intervals for extended advertising in 0.625 { 96, 200, 0}, /*! Advertising intervals for extended advertising in 0.625 ms units (20 ms to 10.24 s). */
ms units (20 ms to 10.24 s). */ { 0, 0, 0}, /*! Maximum number of extended advertising events controller will send prior to terminating extended advertising */
{ 0}, /*!< \brief Maximum number of extended advertising events Controller { 0, 0, 0}, /*! Whether to use legacy advertising PDUs with extended advertising. If set to TRUE then length of advertising data cannot exceed 31 octets. */
will send prior to terminating extended advertising */ { 6, 0, 0} /*! Advertising intervals for periodic advertising in 1.25 ms units (7.5 ms to 81.91875 s). */
/*! \brief Whether to use legacy advertising PDUs with extended
advertising. If set to TRUE then length of advertising
data cannot exceed 31 octets. */
#if BEACON_APP_USE_LEGACY_PDU
{FALSE},
#else /* BEACON_APP_USE_LEGACY_PDU */
{TRUE},
#endif /* BEACON_APP_USE_LEGACY_PDU */
{ 0} /*!< \brief Advertising intervals for periodic advertising in 1.25
ms units (7.5 ms to 81.91875 s). */
}; };
#endif /* BTLE_APP_USE_LEGACY_API */
/*! configurable parameters for slave */ /*! configurable parameters for slave */
static const appSlaveCfg_t beaconSlaveCfg = static const appSlaveCfg_t beaconSlaveCfg =
{ {
1, /*! Maximum connections */ 1, /*! Maximum connections */
}; };
/*! TRUE if Out-of-band pairing data is to be sent */
static const bool_t beaconSendOobData = FALSE;
/*! SMP security parameter configuration */
static const attCfg_t beaconAttCfg =
{
15, /* ATT server service discovery connection idle timeout in seconds */
241, /* desired ATT MTU */
ATT_MAX_TRANS_TIMEOUT, /* transcation timeout in seconds */
4 /* number of queued prepare writes supported by server */
};
/************************************************************************************************** /**************************************************************************************************
Advertising Data Advertising Data
**************************************************************************************************/ **************************************************************************************************/
#ifdef BTLE_APP_USE_LEGACY_API
/*! advertising data, discoverable mode */ /*! advertising data, discoverable mode */
static const uint8_t beaconAdvDataDisc[] = static const uint8_t beaconAdvDataDisc[] =
{ {
...@@ -150,279 +88,66 @@ static const uint8_t beaconAdvDataDisc[] = ...@@ -150,279 +88,66 @@ static const uint8_t beaconAdvDataDisc[] =
/*! manufacturer specific data */ /*! manufacturer specific data */
3, /*! length */ 3, /*! length */
DM_ADV_TYPE_MANUFACTURER, /*! AD type */ DM_ADV_TYPE_MANUFACTURER, /*! AD type */
UINT16_TO_BYTES(HCI_ID_ARM), /*! company ID */ UINT16_TO_BYTES(HCI_ID_ARM) /*! company ID */
};
/*! scan data, discoverable mode */
static const uint8_t beaconScanDataDisc[] =
{
/*! device name */ /*! device name */
#if BEACON_APP_USE_LEGACY_PDU 8, /*! length */
17, /*! length */
#else /* BEACON_APP_USE_LEGACY_PDU */
102, /*! length */
#endif /* BEACON_APP_USE_LEGACY_PDU */
DM_ADV_TYPE_LOCAL_NAME, /*! AD type */ DM_ADV_TYPE_LOCAL_NAME, /*! AD type */
'e', 'D',
'x',
't',
' ',
'a',
'd',
'v',
' ',
'b',
'a',
's',
'i',
'c',
' ',
'c',
'o'
#if ! BEACON_APP_USE_LEGACY_PDU
,
'n',
'n',
'e',
'c',
't',
'i',
'o',
'n',
' ',
'd',
'a', 'a',
't', 't',
's', 's',
' ', ' ',
'a', 'T',
'p', 'X'
'p',
' ',
'e',
'x',
't',
' ',
'a',
'd',
'v',
' ',
'b',
'a',
's',
'i',
'c',
' ',
'c',
'o',
'n',
'n',
'e',
'c',
't',
'i',
'o',
'n',
' ',
'd',
'a',
't',
's',
' ',
'a',
'p',
'p',
' ',
'e',
'x',
't',
' ',
'a',
'd',
'v',
' ',
'b',
'a',
's',
'i',
'c',
' ',
'c',
'o',
'n',
'n',
'e',
'c',
't',
'i',
'o',
'n',
' ',
'd',
'a',
't',
's',
' ',
'a',
'p',
'p'
#endif /* BEACON_APP_USE_LEGACY_PDU */
}; };
/*! scan data, discoverable mode */ #else /* BTLE_APP_USE_LEGACY_API */
static const uint8_t beaconScanDataDisc[] = /*! extended advertising and scan data, discoverable mode */
static const uint8_t beaconExtAdvDataDisc[] =
{ {
/*! flags */
2, /*! length */
DM_ADV_TYPE_FLAGS, /*! AD type */
DM_FLAG_LE_GENERAL_DISC | /*! flags */
DM_FLAG_LE_BREDR_NOT_SUP,
/*! manufacturer specific data */
3, /*! length */
DM_ADV_TYPE_MANUFACTURER, /*! AD type */
UINT16_TO_BYTES(HCI_ID_ARM), /*! company ID */
/*! device name */ /*! device name */
11, /*! length */ 8, /*! length */
DM_ADV_TYPE_LOCAL_NAME, /*! AD type */
'B',
'L',
'E',
' ',
'b',
'e',
'a',
'c',
'o',
'n',
/*! device name */
#if BEACON_APP_USE_LEGACY_PDU
18, /*! length */
#else /* BEACON_APP_USE_LEGACY_PDU */
102, /*! length */
#endif /* BEACON_APP_USE_LEGACY_PDU */
DM_ADV_TYPE_LOCAL_NAME, /*! AD type */ DM_ADV_TYPE_LOCAL_NAME, /*! AD type */
's', 'D',
'c',
'a', 'a',
'n',
' ',
'r',
'e',
's',
'p',
'o',
'n',
's',
'e',
' ',
't', 't',
'o',
' '
#if BEACON_APP_USE_LEGACY_PDU
,
'a',
'u',
'x',
' ',
's', 's',
'c',
'a',
'n',
' ', ' ',
'r', 'T',