Skip to content

Commit

Permalink
[TI] Optimize Thread Matter Builds for CC13x2x7/x4 (#28955)
Browse files Browse the repository at this point in the history
* Split Thread Message queues, increment OT-TI version

* Increment CC13xx SDK version

* Re-enable CC13x4 Crypto Accel

* Fix Licence header

* Move SDK Dependency for 32xx

* Restyled by clang-format

* Restyled by gn

---------

Co-authored-by: Restyled.io <[email protected]>
  • Loading branch information
2 people authored and pull[bot] committed Oct 26, 2023
1 parent 9751b1a commit 06247dd
Show file tree
Hide file tree
Showing 8 changed files with 53 additions and 13 deletions.
39 changes: 32 additions & 7 deletions src/platform/cc13xx_26xx/ThreadStackManagerImpl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,8 @@ CHIP_ERROR ThreadStackManagerImpl::InitThreadStack(otInstance * otInst)
CHIP_ERROR err = CHIP_NO_ERROR;

// Create FreeRTOS queue for platform driver messages
procQueue = xQueueCreate(16U, sizeof(ThreadStackManagerImpl::procQueueMsg));
procQueue = xQueueCreate(20U, sizeof(ThreadStackManagerImpl::procQueueMsg));
procQueue_radio = xQueueCreate(20U, sizeof(ThreadStackManagerImpl::procQueueMsg));

#if OPENTHREAD_CONFIG_HEAP_EXTERNAL_ENABLE != 0
mbedtls_platform_set_calloc_free(ot_calloc, ot_free);
Expand Down Expand Up @@ -116,7 +117,19 @@ bool ThreadStackManagerImpl::IsInitialized()

void ThreadStackManagerImpl::_SendProcMessage(ThreadStackManagerImpl::procQueueMsg & procMsg)
{
xQueueSendFromISR(procQueue, &procMsg, NULL);

BaseType_t err;

if (procMsg.cmd == procQueueCmd_radio)
{
err = xQueueSendFromISR(procQueue_radio, &procMsg, NULL);
}
else
{
err = xQueueSendFromISR(procQueue, &procMsg, NULL);
}

(void) err;

// signal processing loop
SignalThreadActivityPendingFromISR();
Expand All @@ -138,6 +151,23 @@ extern "C" void otPlatFree(void * aPtr)
void ThreadStackManagerImpl::_ProcMessage(otInstance * aInstance)
{
procQueueMsg procMsg;
procQueueMsg procMsg_radio;

/* Process Radio events */
while (pdTRUE == xQueueReceive(procQueue_radio, &procMsg_radio, 0U))
{
switch (procMsg_radio.cmd)
{
case procQueueCmd_radio: {
platformRadioProcess(aInstance, procMsg_radio.arg);
break;
}
default: {
break;
}
}
}

while (pdTRUE == xQueueReceive(procQueue, &procMsg, 0U))
{
switch (procMsg.cmd)
Expand All @@ -147,11 +177,6 @@ void ThreadStackManagerImpl::_ProcMessage(otInstance * aInstance)
break;
}

case procQueueCmd_radio: {
platformRadioProcess(aInstance, procMsg.arg);
break;
}

case procQueueCmd_tasklets: {
otTaskletsProcess(aInstance);
break;
Expand Down
2 changes: 2 additions & 0 deletions src/platform/cc13xx_26xx/cc13x2_26x2/ThreadStackManagerImpl.h
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,7 @@ class ThreadStackManagerImpl final : public ThreadStackManager,
void _SendProcMessage(procQueueMsg & procMsg);
void _ProcMessage(otInstance * aInstance);
void GetExtAddress(otExtAddress & aExtAddr);
CHIP_ERROR GetBufferInfo(void);

private:
// ===== Methods that implement the ThreadStackManager abstract interface.
Expand All @@ -114,6 +115,7 @@ class ThreadStackManagerImpl final : public ThreadStackManager,

ThreadStackManagerImpl() = default;
QueueHandle_t procQueue;
QueueHandle_t procQueue_radio;
};

/**
Expand Down
2 changes: 2 additions & 0 deletions src/platform/cc13xx_26xx/cc13x4_26x4/ThreadStackManagerImpl.h
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,7 @@ class ThreadStackManagerImpl final : public ThreadStackManager,
void _SendProcMessage(procQueueMsg & procMsg);
void _ProcMessage(otInstance * aInstance);
void GetExtAddress(otExtAddress & aExtAddr);
CHIP_ERROR GetBufferInfo(void);

private:
// ===== Methods that implement the ThreadStackManager abstract interface.
Expand All @@ -113,6 +114,7 @@ class ThreadStackManagerImpl final : public ThreadStackManager,

ThreadStackManagerImpl() = default;
QueueHandle_t procQueue;
QueueHandle_t procQueue_radio;
};

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,10 +41,10 @@
//#define MBEDTLS_AES_ALT
//#define MBEDTLS_ECDH_COMPUTE_SHARED_ALT
//#define MBEDTLS_ECDH_GEN_PUBLIC_ALT
//#define MBEDTLS_ECDSA_SIGN_ALT
//#define MBEDTLS_ECDSA_VERIFY_ALT
//#define MBEDTLS_ENTROPY_HARDWARE_ALT
//#define MBEDTLS_SHA256_ALT
#define MBEDTLS_ECDSA_SIGN_ALT
#define MBEDTLS_ECDSA_VERIFY_ALT
#define MBEDTLS_ENTROPY_HARDWARE_ALT
#define MBEDTLS_SHA256_ALT

// Thread Joining disabled
//#define MBEDTLS_ECJPAKE_ALT
Expand Down
2 changes: 1 addition & 1 deletion third_party/openthread/ot-ti
Submodule ot-ti updated 1 files
+11 −4 src/radio.c
9 changes: 9 additions & 0 deletions third_party/ti_simplelink_sdk/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,15 @@ mbedtls_target("mbedtls") {
"${chip_root}/src/platform/cc13xx_26xx/cc13x2_26x2/crypto/sha256_alt.c",
]
}
if (ti_simplelink_device_family == "cc13x4_26x4") {
sources = [
"${chip_root}/src/platform/cc13xx_26xx/cc13x4_26x4/crypto/aes_alt.c",
"${chip_root}/src/platform/cc13xx_26xx/cc13x4_26x4/crypto/ecdh_alt.c",
"${chip_root}/src/platform/cc13xx_26xx/cc13x4_26x4/crypto/ecdsa_alt.c",
"${chip_root}/src/platform/cc13xx_26xx/cc13x4_26x4/crypto/ecjpake_alt.c",
"${chip_root}/src/platform/cc13xx_26xx/cc13x4_26x4/crypto/sha256_alt.c",
]
}

public_configs = [ ":ti_simplelink_mbedtls_config" ]

Expand Down
2 changes: 1 addition & 1 deletion third_party/ti_simplelink_sdk/repo_cc13xx_cc26xx
2 changes: 2 additions & 0 deletions third_party/ti_simplelink_sdk/ti_simplelink_sdk.gni
Original file line number Diff line number Diff line change
Expand Up @@ -247,6 +247,7 @@ template("ti_simplelink_sdk") {
"${ti_simplelink_sdk_root}/kernel/freertos/dpl/PowerCC26X2_freertos.c",
"${ti_simplelink_sdk_root}/kernel/freertos/dpl/TimerPCC26XX_freertos.c",
"${ti_simplelink_sdk_root}/kernel/freertos/startup/startup_cc13x2_cc26x2_gcc.c",
"${ti_simplelink_sdk_root}/source/ti/drivers/sha2/SHA2CC26X2.c",
]
} else if (ti_simplelink_device_family == "cc13x4_26x4") {
sources += [
Expand All @@ -255,6 +256,7 @@ template("ti_simplelink_sdk") {
"${ti_simplelink_sdk_root}/kernel/freertos/dpl/PowerCC26X2_freertos.c",
"${ti_simplelink_sdk_root}/kernel/freertos/dpl/TimerPCC26XX_freertos.c",
"${ti_simplelink_sdk_root}/kernel/freertos/startup/startup_cc13x4_cc26x4_gcc.c",
"${ti_simplelink_sdk_root}/source/ti/drivers/sha2/SHA2CC26X2.c",
]
} else if (ti_simplelink_device_family == "cc32xx") {
sources += [
Expand Down

0 comments on commit 06247dd

Please sign in to comment.