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 @@
# property whatsoever. Maxim Integrated Products, Inc. retains all
# 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
ifeq "$(PROJECT)" ""
PROJECT=max32665
......@@ -55,29 +60,6 @@ endif
TARGET_UC:=$(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
ifneq "$(BLE_ADDR_LSB)" ""
PROJ_CFLAGS+=-DBLE_ADDR_LSB=$(BLE_ADDR_LSB)
......@@ -90,10 +72,8 @@ endif
# This is the path to the CMSIS root directory
ifeq "$(MAXIM_PATH)" ""
LIBS_DIR=../../../Libraries
NDALIBS_DIR=../../../NDALibraries
else
LIBS_DIR=/$(subst \,/,$(subst :,,$(MAXIM_PATH))/Firmware/$(TARGET_UC)/Libraries)
NDALIBS_DIR=/$(subst \,/,$(subst :,,$(MAXIM_PATH))/Firmware/$(TARGET_UC)/NDALibraries)
endif
CMSIS_ROOT=$(LIBS_DIR)/CMSIS
......@@ -101,23 +81,105 @@ CMSIS_ROOT=$(LIBS_DIR)/CMSIS
SRCS = main.c
SRCS += stack_beacon.c
SRCS += beacon_main.c
# Where to find source files for this test
VPATH = .
VPATH += fcl/src
# Where to find header files for this test
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
PROJ_CFLAGS+=-DMXC_ASSERT_ENABLE
PROJ_CFLAGS+=-DASYMMETRIC -DWORD32
PROJ_CFLAGS+=-DMXC_ASSERT_ENABLE=TRUE
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=-O0 -fomit-frame-pointer
# Point this variable to a linker file to override the default file
#LINKERFILE=$(CMSIS_ROOT)/Device/Maxim/$(TARGET_UC)/Source/GCC/$(TARGET_LC).ld
################################################################################
# Include external library makefiles here
DEBUG=1
# Include the BSP
BOARD_DIR=$(LIBS_DIR)/Boards/$(BOARD)
......@@ -128,7 +190,7 @@ PERIPH_DRIVER_DIR=$(LIBS_DIR)/$(TARGET)PeriphDriver
include ${PERIPH_DRIVER_DIR}/periphdriver.mk
# Include Cordio BTLE Library
CORDIO_DIR=$(NDALIBS_DIR)/BTLE
CORDIO_DIR=$(LIBS_DIR)/BTLE
include ${CORDIO_DIR}/btle.mk
# Include MAXUSB library
......
......@@ -26,7 +26,7 @@
#include "wsf_buf.h"
#include "wsf_assert.h"
#include "hci_api.h"
#include "sec_api.h"
#include "hci_vs.h"
#include "dm_api.h"
#include "smp_api.h"
#include "att_api.h"
......@@ -34,9 +34,6 @@
#include "app_main.h"
#include "app_db.h"
#include "app_ui.h"
#include "svc_ch.h"
#include "svc_core.h"
#include "svc_wp.h"
#include "util/calc128.h"
#include "beacon_api.h"
......@@ -44,100 +41,41 @@
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 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 =
{
{ 0}, /*!< \brief Advertising durations for extended advertising in ms */
{ 200}, /*!< \brief Advertising intervals for extended advertising in 0.625
ms units (20 ms to 10.24 s). */
{ 0}, /*!< \brief Maximum number of extended advertising events Controller
will send prior to terminating extended advertising */
/*! \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). */
{ 0, 0, 0}, /*! Advertising durations for extended advertising in ms */
{ 96, 200, 0}, /*! Advertising intervals for extended advertising in 0.625 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, 0, 0}, /*! Whether to use legacy advertising PDUs with extended advertising. If set to TRUE then length of advertising data cannot exceed 31 octets. */
{ 6, 0, 0} /*! 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 */
static const appSlaveCfg_t beaconSlaveCfg =
{
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
**************************************************************************************************/
#ifdef BTLE_APP_USE_LEGACY_API
/*! advertising data, discoverable mode */
static const uint8_t beaconAdvDataDisc[] =
{
......@@ -150,279 +88,66 @@ static const uint8_t beaconAdvDataDisc[] =
/*! manufacturer specific data */
3, /*! length */
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 */
#if BEACON_APP_USE_LEGACY_PDU
17, /*! length */
#else /* BEACON_APP_USE_LEGACY_PDU */
102, /*! length */
#endif /* BEACON_APP_USE_LEGACY_PDU */
8, /*! length */
DM_ADV_TYPE_LOCAL_NAME, /*! AD type */
'e',
'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',
'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',
' ',
'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 */
'T',
'X'
};
/*! scan data, discoverable mode */
static const uint8_t beaconScanDataDisc[] =
#else /* BTLE_APP_USE_LEGACY_API */
/*! 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 */
11, /*! 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 */
8, /*! length */
DM_ADV_TYPE_LOCAL_NAME, /*! AD type */
's',
'c',
'D',
'a',
'n',
' ',
'r',
'e',
's',
'p',
'o',
'n',
's',
'e',
' ',
't',
'o',
' '
#if BEACON_APP_USE_LEGACY_PDU
,
'a',
'u',
'x',
' ',
's',
'c',
'a',
'n',
' ',
'r',
'e',
'q',
'u',
'e',
's',
't',
' ',
's',
'c',
'a',
'n',
' ',
'r',
'e',
's',
'p',
'o',
'n',
's',
'e',
' ',
't',
'o',
' ',
'a',
'u',
'x',
' ',
's',
'c',
'a',
'n',
' ',
'r',
'e',
'q',
'u',
'e',
's',
't',
' ',
's',
'c',
'a',
'n',
' ',
'r',
'e',
's',
'p',
'o',
'n',
's',
'e',
' ',
't',
'o',
' ',
'a',
'u',
'x',
' ',
's',
'c',
'a',
'n',
' ',
'r',
'e',
'q',
'u',
'e',
's',
't'
#endif /* BEACON_APP_USE_LEGACY_PDU */
'T',
'X'
};