Skip to content

Commit

Permalink
fix(BLE): Platform build error (analogdevicesinc#1020)
Browse files Browse the repository at this point in the history
Co-authored-by: EricB-ADI <[email protected]>
  • Loading branch information
EricB-ADI and EricB-ADI authored May 20, 2024
1 parent e56d5a7 commit 700e2d3
Show file tree
Hide file tree
Showing 18 changed files with 64 additions and 62 deletions.
21 changes: 16 additions & 5 deletions .github/workflows/scripts/build.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
from pathlib import Path

from pathlib import Path, PurePath
import os
from subprocess import run
import argparse
Expand All @@ -13,6 +14,9 @@
blacklist = [
"MAX32570",
"MAX32572",
"MAX32657",
"MAX32665/BLE_LR_Central",
"MAX32665/BLE_LR_Peripheral",
"MAXREFDES178",
"BCB",
"ROM",
Expand All @@ -26,7 +30,12 @@
"WLP_DB",
"TQFN_DB",
"WLP_V1"

]
project_blacklist = {
"BLE_LR_Central",
"BLE_LR_Peripheral",
}

known_errors = [
"ERR_NOTSUPPORTED",
Expand Down Expand Up @@ -161,19 +170,21 @@ def test(maxim_path : Path = None, targets=None, boards=None, projects=None):
boards = sorted(boards) # Enforce alphabetical ordering

# Get list of examples for this target.
_projects = []
_projects = set()
if projects is None:
console.print(f"[yellow]Auto-searching for {target} examples...[/yellow]")
for dirpath, subdirs, items in os.walk(maxim_path / "Examples" / target):
if 'Makefile' in items and ("main.c" in items or "project.mk" in items):
_projects.append(Path(dirpath))
if 'Makefile' in items and ("main.c" in items or "project.mk" in items) and PurePath(dirpath).name not in project_blacklist:
_projects.add(Path(dirpath))

else:
assert(type(projects) is list)
for dirpath, subdirs, items in os.walk(maxim_path / "Examples" / target):
dirpath = Path(dirpath)
if dirpath.name in projects:
_projects.append(dirpath)
_projects.add(dirpath)



console.print(f"Found {len(_projects)} projects for [bold cyan]{target}[/bold cyan]")
console.print(f"Detected boards: {boards}")
Expand Down
4 changes: 4 additions & 0 deletions Examples/MAX32655/Bluetooth/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
all:
@for DIR in ./* ; do $(MAKE) -C $$DIR; done
clean:
@for DIR in ./* ; do $(MAKE) -C $$DIR distclean; rm -rf $$DIR/build; done
5 changes: 2 additions & 3 deletions Examples/MAX32665/Bluetooth/BLE_LR_Central/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,8 @@
Macros
**************************************************************************************************/

#warning "(ERROR): Exmaple is deprecated and non functional!"

/*! \brief UART TX buffer size */
#define PLATFORM_UART_TERMINAL_BUFFER_SIZE 2048U
#define DEFAULT_TX_POWER 4 /* dBm */
Expand All @@ -84,8 +86,6 @@ static LlRtCfg_t mainLlRtCfg;

volatile int wutTrimComplete;

extern uint8_t appCodedPhyDemo;

/**************************************************************************************************
Functions
**************************************************************************************************/
Expand Down Expand Up @@ -245,7 +245,6 @@ int main(void)
APP_TRACE_INFO0("Long distance scanner demo (CODED PHY S=8)");
APP_TRACE_INFO1("BT_VER=%d", BT_VER);
APP_TRACE_INFO0("==========================================");
appCodedPhyDemo = 1;

#if defined(HCI_TR_EXACTLE) && (HCI_TR_EXACTLE == 1)
WsfCsEnter();
Expand Down
4 changes: 1 addition & 3 deletions Examples/MAX32665/Bluetooth/BLE_LR_Peripheral/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -75,8 +75,7 @@
/**************************************************************************************************
Global Variables
**************************************************************************************************/
extern uint8_t appCodedPhyDemo;

#warning "(ERROR): Exmaple is deprecated and non functional!"
/*! \brief Pool runtime configuration. */
static wsfBufPoolDesc_t mainPoolDesc[] = { { 16, 8 }, { 32, 4 }, { 192, 8 }, { 256, 8 } };

Expand Down Expand Up @@ -240,7 +239,6 @@ int main(void)
APP_TRACE_INFO0("Long range demo (coded-PHY s=8)");
APP_TRACE_INFO0("===============================");
APP_TRACE_INFO1("BT_VER: %d", BT_VER);
appCodedPhyDemo = 1;

#if defined(HCI_TR_EXACTLE) && (HCI_TR_EXACTLE == 1)
WsfCsEnter();
Expand Down
4 changes: 4 additions & 0 deletions Examples/MAX32665/Bluetooth/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
all:
@for DIR in ./* ; do $(MAKE) -C $$DIR; done
clean:
@for DIR in ./* ; do $(MAKE) -C $$DIR distclean; rm -rf $$DIR/build; done
4 changes: 4 additions & 0 deletions Examples/MAX32690/Bluetooth/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
all:
@for DIR in ./* ; do $(MAKE) -C $$DIR; done
clean:
@for DIR in ./* ; do $(MAKE) -C $$DIR distclean; rm -rf $$DIR/build; done
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,8 @@ extern "C" {
/*! \brief Minimum amount of time required for scanning, to cover ADV + SCAN REQ + SCAN RSP. */
#define LCTR_MIN_SCAN_USEC BB_MIN_SCAN_US



/**************************************************************************************************
Constants
**************************************************************************************************/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,6 @@
/**************************************************************************************************
Global Variables
**************************************************************************************************/
extern uint8_t appCodedPhyDemo;

/*! \brief Transitive context (valid only for a single Advertising Event). */
struct
Expand Down Expand Up @@ -366,7 +365,7 @@ static bool_t lctrExtAdvRptPend(lctrExtScanCtx_t *pExtScanCtx, LlExtAdvReportInd
uint64_t hash;
lctrAdvRptGenerateExtHash(&hash, pRpt->addrType, BstreamToBda64(pRpt->addr),
pRpt->eventType, pRpt->advSID, pExtScanCtx->extAdvHdr.did);
if (lctrAdvRptCheckDuplicate(&lctrMstExtScan.advFilt, hash) && (appCodedPhyDemo == 0))
if (lctrAdvRptCheckDuplicate(&lctrMstExtScan.advFilt, hash))
{
/* Duplicate found, just exit. */
return FALSE;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@
/*! \brief Scan operational context. */
lctrMstScanCtx_t lctrMstScan;

extern uint8_t appCodedPhyDemo;


/*************************************************************************************************/
/*!
Expand Down Expand Up @@ -613,11 +613,7 @@ void lctrAdvRptGenerateExtHash(uint64_t *pHash, uint8_t addrType, uint64_t addr,
/*************************************************************************************************/
bool_t lctrAdvRptCheckDuplicate(lctrAdvRptFilt_t *pAdvFilt, uint64_t hash)
{
if (appCodedPhyDemo)
{
pAdvFilt->addToFiltTbl = TRUE;
return TRUE;
}


if (!pAdvFilt->enable)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,6 @@ lctrSyncInfo_t trsfSyncInfo;
/*! \brief Active extended scan contexts. */
lctrActiveExtScan_t lctrActiveExtScan;

extern uint8_t appCodedPhyDemo;

/*************************************************************************************************/
/*!
Expand Down Expand Up @@ -851,14 +850,9 @@ void LctrMstExtScanDefaults(void)
lmgrCb.numExtScanPhys = 1;
lctrMstExtScanTbl[LCTR_SCAN_PHY_1M]->scanParam = defScanParam;

if (appCodedPhyDemo)
{
lctrMstExtScan.enaPhys = 1 << LCTR_SCAN_PHY_CODED;
}
else
{
lctrMstExtScan.enaPhys = 1 << LCTR_SCAN_PHY_1M;
}

lctrMstExtScan.enaPhys = 1 << LCTR_SCAN_PHY_1M;


/* Setup timers. */
lctrMsgHdr_t *pMsg;
Expand Down Expand Up @@ -1573,14 +1567,10 @@ lctrPerScanCtx_t *lctrAllocPerScanCtx(void)
pMsg->event = LCTR_PER_SCAN_SUP_TIMEOUT;

/* Update once PHY is known. */
if (appCodedPhyDemo)
{
pCtx->bleData.chan.txPhy = pCtx->bleData.chan.rxPhy = BB_PHY_BLE_CODED;
}
else
{
pCtx->bleData.chan.txPhy = pCtx->bleData.chan.rxPhy = BB_PHY_BLE_1M;
}


pCtx->bleData.chan.txPhy = pCtx->bleData.chan.rxPhy = BB_PHY_BLE_1M;


/* Default PHY. */
pCtx->rxPhys = lmgrConnCb.rxPhys;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ lctrExtScanCtx_t lctrMstExtInitTbl[LCTR_SCAN_PHY_TOTAL];
/*! \brief Extended initiator control block. */
lctrExtInitCtrlBlk_t lctrMstExtInit;

extern uint8_t appCodedPhyDemo;


/*************************************************************************************************/
/*!
Expand Down Expand Up @@ -564,14 +564,8 @@ void LctrMstExtInitDefaults(void)

lmgrCb.numExtScanPhys = 1;

if (appCodedPhyDemo == 0)
{
lctrMstExtInit.enaPhys = 1 << LCTR_SCAN_PHY_1M;
}
else
{
lctrMstExtInit.enaPhys = 1 << LCTR_SCAN_PHY_CODED;
}
lctrMstExtInit.enaPhys = 1 << LCTR_SCAN_PHY_1M;

}

/*************************************************************************************************/
Expand Down
3 changes: 1 addition & 2 deletions Libraries/Cordio/controller/sources/ble/lhci/lhci_cmd_vs.c
Original file line number Diff line number Diff line change
Expand Up @@ -82,8 +82,7 @@ bool_t lhciCommonVsStdDecodeCmdPkt(LhciHdr_t *pHdr, uint8_t *pBuf)
uint8_t status = HCI_SUCCESS;
uint8_t evtParamLen = 1; /* default is status field only */
uint32_t regReadAddr = 0;
uint32_t channel = 0;

uint8_t channel = 0;

/* Decode and consume command packet. */

Expand Down
14 changes: 4 additions & 10 deletions Libraries/Cordio/controller/sources/ble/ll/ll_main_adv_master_ae.c
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,6 @@
#include "wsf_msg.h"
#include "wsf_trace.h"

extern uint8_t appCodedPhyDemo;

/*************************************************************************************************/
/*!
Expand Down Expand Up @@ -171,14 +170,10 @@ void LlExtScanEnable(uint8_t enable, uint8_t filterDup, uint16_t duration, uint1
const unsigned int perMsPerUnit = 1280;
unsigned int filterDupMax;

if (appCodedPhyDemo)
{
filterDupMax = LL_SCAN_FILTER_DUP_DISABLE;
}
else
{
filterDupMax = LL_SCAN_FILTER_DUP_ENABLE_PERIODIC;
}


filterDupMax = LL_SCAN_FILTER_DUP_ENABLE_PERIODIC;


lctrExtScanEnableMsg_t *pMsg;
uint32_t durMs = duration * durMsPerUnit;
Expand Down Expand Up @@ -555,4 +550,3 @@ uint8_t LlReadPeriodicAdvListSize(uint8_t *pListSize)

return LL_SUCCESS;
}

6 changes: 3 additions & 3 deletions Libraries/Cordio/controller/sources/ble/ll/ll_main_dtm.c
Original file line number Diff line number Diff line change
Expand Up @@ -476,7 +476,7 @@ uint8_t LlEnhancedTxTest(uint8_t rfChan, uint8_t len, uint8_t pktType, uint8_t p

if (llTestCb.state == LL_TEST_STATE_IDLE) {
/* Init test state. */
memset(&llTestCb.rpt, 0, sizeof(llTestCb.rpt));
memset((void*)&llTestCb.rpt, 0, sizeof(llTestCb.rpt));
}

/* Handle non-packet test mode. */
Expand Down Expand Up @@ -1031,7 +1031,7 @@ uint8_t LlEndTest(LlTestReport_t *pRpt)
LL_TRACE_INFO1(" numRxCrcError=%u", llTestCb.rpt.numRxCrcError);
LL_TRACE_INFO1(" numRxTimeout=%u", llTestCb.rpt.numRxTimeout);

memset(&llTestCb.rpt, 0, sizeof(llTestCb.rpt)); /* clear report */
memset((void*)&llTestCb.rpt, 0, sizeof(llTestCb.rpt)); /* clear report */

return LL_SUCCESS;
}
Expand Down Expand Up @@ -1074,7 +1074,7 @@ uint8_t LlSetTxTestErrorPattern(uint32_t pattern)
/*************************************************************************************************/
static void llTestResetHandler(void)
{
memset(&llTestCb, 0, sizeof(llTestCb));
memset((void*)&llTestCb, 0, sizeof(llTestCb));
llTestCb.tx.errPattern = 0xFFFFFFFF;

llTestCb.packetsFreed = TRUE;
Expand Down
2 changes: 1 addition & 1 deletion Libraries/Cordio/platform/targets/nordic/build/config.mk
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,6 @@ endif

# Compiler flags
C_FLAGS += -mcpu=$(CPU) -mthumb -mlittle-endian

C_FLAGS += -DAPP_CODED_PHY_DEMO=0
# Linker flags
LD_FLAGS += -mthumb -mcpu=$(CPU)
2 changes: 1 addition & 1 deletion Libraries/Cordio/wsf/sources/targets/baremetal/wsf_nvm.c
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
#include "util/crc32.h"
#include "wsf_buf.h"
#include "wsf_queue.h"
#include "mxc_device.h"


/**************************************************************************************************
Macros
Expand Down
1 change: 1 addition & 0 deletions Libraries/PeriphDrivers/Source/TMR/tmr_me16.c
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ int MXC_TMR_Init(mxc_tmr_regs_t *tmr, mxc_tmr_cfg_t *cfg, bool init_pins)
return E_NULL_PTR;
}

tmr_id = MXC_TMR_GET_IDX(tmr);
MXC_ASSERT(tmr_id >= 0);

switch (cfg->clock) {
Expand Down
7 changes: 7 additions & 0 deletions Libraries/libs.mk
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@ endif
# Cordio (Disabled by default)
# ************************
LIB_CORDIO ?= 0
CODED_PHY_DEMO ?= 0
ifeq ($(LIB_CORDIO), 1)
# Include the Cordio Library
CORDIO_DIR ?= $(LIBS_DIR)/Cordio
Expand All @@ -73,6 +74,12 @@ else
LIBS += $(LIBS_DIR)/BlePhy/$(CHIP_UC)/libphy_riscv.a
endif

ifeq ($(CODED_PHY_DEMO),1)
PROJ_CFLAGS += -DAPP_CODED_PHY_DEMO=1
else
PROJ_CFLAGS += -DAPP_CODED_PHY_DEMO=0
endif

endif
# ************************

Expand Down

0 comments on commit 700e2d3

Please sign in to comment.