mirror of
https://github.com/espressif/openthread.git
synced 2026-08-05 18:37:45 +00:00
[continuous-integration] add SPI build check (#5165)
Enables NCP SPI in build checks. Also fixes some build errors in SPI code.
This commit is contained in:
@@ -153,12 +153,32 @@ jobs:
|
||||
script/check-simulation-build
|
||||
script/check-posix-build
|
||||
|
||||
clang:
|
||||
name: clang-${{ matrix.clang_ver }}
|
||||
runs-on: ubuntu-18.04
|
||||
strategy:
|
||||
matrix:
|
||||
clang_ver: ["6.0", "7", "8", "9"]
|
||||
env:
|
||||
CC: clang-${{ matrix.clang_ver }}
|
||||
CXX: clang++-${{ matrix.clang_ver }}
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
- name: Bootstrap
|
||||
run: |
|
||||
sudo apt-get update
|
||||
sudo apt-get --no-install-recommends install -y clang-${{ matrix.clang_ver }} clang++-${{ matrix.clang_ver }} ninja-build libreadline-dev libncurses-dev
|
||||
- name: Build
|
||||
run: |
|
||||
script/check-simulation-build
|
||||
script/check-posix-build
|
||||
|
||||
clang-m32:
|
||||
name: clang-m32-${{ matrix.clang_ver }}
|
||||
runs-on: ubuntu-18.04
|
||||
strategy:
|
||||
matrix:
|
||||
clang_ver: [9]
|
||||
clang_ver: ["6.0", "7", "8", "9"]
|
||||
env:
|
||||
CC: clang-${{ matrix.clang_ver }}
|
||||
CXX: clang++-${{ matrix.clang_ver }}
|
||||
@@ -175,6 +195,7 @@ jobs:
|
||||
sudo apt-get --no-install-recommends install -y libreadline-dev:i386 libncurses-dev:i386
|
||||
- name: Build
|
||||
run: |
|
||||
script/check-simulation-build
|
||||
script/check-posix-build
|
||||
|
||||
gn:
|
||||
|
||||
@@ -72,6 +72,7 @@ build_all_features()
|
||||
"-DOPENTHREAD_CONFIG_MLE_ATTACH_BACKOFF_ENABLE=1"
|
||||
"-DOPENTHREAD_CONFIG_MLE_STEERING_DATA_SET_OOB_ENABLE=1"
|
||||
"-DOPENTHREAD_CONFIG_MPL_DYNAMIC_INTERVAL_ENABLE"
|
||||
"-DOPENTHREAD_CONFIG_NCP_SPI_ENABLE=1"
|
||||
"-DOPENTHREAD_CONFIG_NCP_UART_ENABLE=1"
|
||||
"-DOPENTHREAD_CONFIG_PLATFORM_FLASH_API_ENABLE=1"
|
||||
"-DOPENTHREAD_CONFIG_PLATFORM_RADIO_COEX_ENABLE=1"
|
||||
|
||||
@@ -71,7 +71,7 @@
|
||||
} \
|
||||
} while (0)
|
||||
|
||||
#else
|
||||
#else // OPENTHREAD_CONFIG_PLATFORM_ASSERT_MANAGEMENT
|
||||
|
||||
#define OT_ASSERT(cond) \
|
||||
do \
|
||||
@@ -86,7 +86,7 @@
|
||||
|
||||
#endif // OPENTHREAD_CONFIG_PLATFORM_ASSERT_MANAGEMENT
|
||||
|
||||
#else
|
||||
#else // OPENTHREAD_CONFIG_ASSERT_ENABLE
|
||||
|
||||
#define OT_ASSERT(cond)
|
||||
|
||||
|
||||
+15
-8
@@ -35,6 +35,7 @@
|
||||
#include <openthread/ncp.h>
|
||||
#include <openthread/platform/misc.h>
|
||||
#include <openthread/platform/spi-slave.h>
|
||||
#include <openthread/platform/toolchain.h>
|
||||
|
||||
#include "openthread-core-config.h"
|
||||
#include "common/code_utils.hpp"
|
||||
@@ -81,7 +82,7 @@ NcpSpi::NcpSpi(Instance *aInstance)
|
||||
, mTxState(kTxStateIdle)
|
||||
, mHandlingRxFrame(false)
|
||||
, mResetFlag(true)
|
||||
, mPrepareTxFrameTask(*aInstance, &NcpSpi::PrepareTxFrame, this)
|
||||
, mPrepareTxFrameTask(*aInstance, NcpSpi::PrepareTxFrame, this)
|
||||
, mSendFrameLength(0)
|
||||
{
|
||||
SpiFrame sendFrame(mSendFrame);
|
||||
@@ -102,14 +103,15 @@ NcpSpi::NcpSpi(Instance *aInstance)
|
||||
|
||||
mTxFrameBuffer.SetFrameAddedCallback(HandleFrameAddedToTxBuffer, this);
|
||||
|
||||
otPlatSpiSlaveEnable(&NcpSpi::SpiTransactionComplete, &NcpSpi::SpiTransactionProcess, this);
|
||||
IgnoreError(otPlatSpiSlaveEnable(&NcpSpi::SpiTransactionComplete, &NcpSpi::SpiTransactionProcess, this));
|
||||
|
||||
// We signal an interrupt on this first transaction to
|
||||
// make sure that the host processor knows that our
|
||||
// reset flag was set.
|
||||
|
||||
otPlatSpiSlavePrepareTransaction(mEmptySendFrameZeroAccept, kSpiHeaderSize, mEmptyReceiveFrame, kSpiHeaderSize,
|
||||
/* aRequestTransactionFlag */ true);
|
||||
IgnoreError(otPlatSpiSlavePrepareTransaction(mEmptySendFrameZeroAccept, kSpiHeaderSize, mEmptyReceiveFrame,
|
||||
kSpiHeaderSize,
|
||||
/* aRequestTransactionFlag */ true));
|
||||
}
|
||||
|
||||
bool NcpSpi::SpiTransactionComplete(void * aContext,
|
||||
@@ -217,7 +219,8 @@ exit:
|
||||
|
||||
sendFrame.SetHeaderAcceptLen(aInputLen - kSpiHeaderSize);
|
||||
|
||||
otPlatSpiSlavePrepareTransaction(aOutputBuf, aOutputLen, aInputBuf, aInputLen, (mTxState == kTxStateSending));
|
||||
IgnoreError(
|
||||
otPlatSpiSlavePrepareTransaction(aOutputBuf, aOutputLen, aInputBuf, aInputLen, (mTxState == kTxStateSending)));
|
||||
|
||||
return shouldProcess;
|
||||
}
|
||||
@@ -278,6 +281,9 @@ void NcpSpi::PrepareNextSpiSendFrame(void)
|
||||
readLength = mTxFrameBuffer.OutFrameRead(frameLength, sendFrame.GetData());
|
||||
OT_ASSERT(readLength == frameLength);
|
||||
|
||||
// Suppress the warning when assertions are disabled
|
||||
OT_UNUSED_VARIABLE(readLength);
|
||||
|
||||
sendFrame.SetHeaderDataLen(frameLength);
|
||||
mSendFrameLength = frameLength + kSpiHeaderSize;
|
||||
|
||||
@@ -302,7 +308,7 @@ void NcpSpi::PrepareNextSpiSendFrame(void)
|
||||
ExitNow();
|
||||
}
|
||||
|
||||
mTxFrameBuffer.OutFrameRemove();
|
||||
IgnoreError(mTxFrameBuffer.OutFrameRemove());
|
||||
|
||||
exit:
|
||||
return;
|
||||
@@ -367,8 +373,9 @@ void NcpSpi::HandleRxFrame(void)
|
||||
{
|
||||
sendFrame.SetHeaderAcceptLen(kSpiBufferSize - kSpiHeaderSize);
|
||||
|
||||
otPlatSpiSlavePrepareTransaction(mEmptySendFrameFullAccept, kSpiHeaderSize, mReceiveFrame, kSpiBufferSize,
|
||||
/* aRequestTrans */ false);
|
||||
IgnoreError(otPlatSpiSlavePrepareTransaction(mEmptySendFrameFullAccept, kSpiHeaderSize, mReceiveFrame,
|
||||
kSpiBufferSize,
|
||||
/* aRequestTrans */ false));
|
||||
|
||||
// No need to check the error status. Getting `OT_ERROR_BUSY`
|
||||
// is OK as everything will be set up properly from callback when
|
||||
|
||||
Reference in New Issue
Block a user