Skip to content

Commit

Permalink
Add ECC hardware acceleration for TI platform (#11682)
Browse files Browse the repository at this point in the history
* Add ECC hardware acceleration for TI platform

Add MbedTLS ALT source files for the Texas Instruments CC13X2_26X2 platform to
enable hardware acceleration of ECDSA and ECDHE. This was done to address
timeout issues with PASE and CASE test cases in TE#6. The test cases would fail
due to a gross timeout even though the sessions were established. This change
requires a new version of the SimpleLink SDK to avoid a BLE ROM symbol
collision.

A new version of the SimpleLink SDK based on the 5.30 SDK is used here.
Documentation has been updated in associated project READMEs. The button
middleware driver API has been updated and associated calls in examples have
been updated to match.

Address an issue where the SHA-256 hardware acceleration did not copy the
digest buffer. It was incorrectly assumed that the digest buffer would be empty
when a SHA context was cloned. This addresses an issue in decoding ZCL
messages.

* Restyled by gn

* Restyled by prettier-markdown

* fix copy/paste error

* update pump README

* Add DMM Compatible BLE User config for Matter

Replace TI SDK BLE user config to enable DMM hooks.

Co-authored-by: Alexander D'abreu <alexander.dabreu@ti.com>

* update copyright and make pretty

* update HEAP and cstack size from TE#7

* Restyled by gn

Co-authored-by: Restyled.io <commits@restyled.io>
Co-authored-by: Alexander D'abreu <alexander.dabreu@ti.com>
  • Loading branch information
3 people authored and pull[bot] committed Mar 29, 2023
1 parent 927aa98 commit 4222193
Show file tree
Hide file tree
Showing 28 changed files with 1,476 additions and 229 deletions.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
121 changes: 121 additions & 0 deletions docs/guides/ti_platform_overview.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,121 @@
# Texas Instruments platform overview

The TI platform is a [Matter][matter_gh] platform based on the Texas Instruments
Incorporated SimpleLink SDK.

The following diagram is a simplified representation of a Matter application
which built on the TI Platform.

<p align="center">
<img src="images/matter_ti_overview_simplified.png" alt="matter_ti_overview_simplified">
</p>

## Texas Instruments SimpleLink SDK

The SimpleLink™ CC13xx and CC26xx Software Development Kit (SDK) delivers
components that enable engineers to develop applications on the Texas
Instruments SimpleLink CC13xx and CC26xx family of wireless microcontrollers
(MCUs). This software toolkit provides a cohesive and consistent software
experience for all SimpleLink CC13xx and CC26xx wireless MCU users by packaging
essential software components, such as a Bluetooth® Low Energy (BLE) protocol
stack supporting Bluetooth 5.2, Bluetooth Mesh, Thread 1.1.1 networking stack
based on OpenThread, Zigbee 3.0 compliant protocol suite, RF-Proprietary
examples, TI’s 15.4 Stack as well as the TI-RTOS kernel and TI Drivers in one
easy-to-use software package along with example applications and documentation.
In addition, the Dynamic Multi-Protocol Manager (DMM) software component enables
multiprotocol development on a single SimpleLink wireless MCU through
time-division multiplexing.

The SimpleLink MCU portfolio offers a single development environment that
delivers flexible hardware, software, and tool options for customers developing
wired and wireless applications. With 100 percent code reuse across host MCUs,
Wi-Fi™, Bluetooth Low Energy, Sub-1GHz devices and more, choose the MCU or
connectivity standard that fits your design. A one-time investment with the
SimpleLink software development kit allows you to reuse often, opening the door
to create unlimited applications. For more information, visit
www.ti.com/simplelink.

<hr>

## BLE and Thread stacks

In the TI example applications the Bluetooth Low Energy protocol is used to
provision the Thread protocol to enable Matter communication. Then Thread is
used for IP communication with other Matter devices.

The TI applications leverage the Bluetooth Low Energy stack on the CC13X2 and
CC26X2 families. This BLE software is distributed in binary form within the TI
SimpleLink SDK. The BLE stack leverages code that is present in the device ROM
for certain common BLE operations.

These applications leverage the OpenThread stack available within the Matter
repository for Thread communication. Platform support source is built from the
SimpleLink SDK.

These connection protocols can be run concurrently by using the Texas
Instruments Dynamic Multi-protocol Manager.

<hr>

## LwIP stack

The Lightweight IP stack interfaces with the OpenThread stack to offer standard
IP connectivity protocols that OpenThread does not natively support. This offers
a standard socket based interface to the Matter platform.

<hr>

## MbedTLS

The MbedTLS library is used by OpenThread and Matter for a wide variety of
protocols. This ranges from basic AES and SHA to cryptographic protocols like
ECDSA and ECDH.

The MbedTLS library is hardware accelerated using the TI SimpleLink SDK drivers.
This is achieved through the usage of `_ALT` defines in the MbedTLS
configuration file.

<hr>

## Matter integration

Matter interacts with LwIP, OpenThread, and the TI BLE stack to achieve the
protocol and application functionality. A BLE profile is registered with the
TI-BLE stack to enable provisioning and configuration. Once the device is
provisioned Matter will configure the OpenThread interface to connect to an
existing Thread network or to start its own network. From there the Matter IP
messages are sent to the LwIP stack to be routed to the OpenThread stack for
transmission.

Overall, applications generally only need to interface with the Cluster Library
from Matter. The transport of messages and configuration of the device is all
handled by the platform implementation files.

<hr>

# Matter example applications

Sample Matter applications are provided for the TI platform. These can be used
as reference for your own application.

- [lock-app](../../examples/lock-app/cc13x2x7_26x2x7/README.md)
- [pump-app](../../examples/pump-app/cc13x2x7_26x2x7/README.md)
- [pump-controller-app](../../examples/pump-controller-app/cc13x2x7_26x2x7/README.md)

<hr>

## Build system

The TI platform uses GN to generate ninja build scripts. Build files have
already been written to build and link the TI specific code within the
SimpleLink SDK.

<hr>

## TI Support

For technical support, please consider creating a post on TI's [E2E forum][e2e].
Additionally, we welcome any feedback.

[e2e]: https://e2e.ti.com/support/wireless-connectivity/zigbee-and-thread
[matter_gh]: https://github.com/project-chip/connectedhomeip
47 changes: 22 additions & 25 deletions examples/lock-app/cc13x2x7_26x2x7/README.md
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
# CHIP CC1352 CC2652 Lock Example Application
# Matter CC1352 CC2652 Lock Example Application

An example application showing the use [CHIP][chip] on the Texas Instruments
CC13X2_26X2 family of Wireless MCUs.
An example application showing the use of [Matter][matter] on the Texas
Instruments CC13X2_26X2 family of Wireless MCUs.

---

- [CHIP CC1352 CC2652 Lock Example Application](#chip-cc1352-cc2652-lock-example-application)
- [Matter CC1352 CC2652 Lock Example Application](#matter-cc1352-cc2652-lock-example-application)
- [Introduction](#introduction)
- [Device UI](#device-ui)
- [Building](#building)
Expand All @@ -19,7 +19,7 @@ CC13X2_26X2 family of Wireless MCUs.
- [Provisioning](#provisioning)
- [Bluetooth LE Advertising](#bluetooth-le-advertising)
- [Bluetooth LE Rendezvous](#bluetooth-le-rendezvous)
- [CHIP Remote Commands](#chip-remote-commands)
- [Matter Remote Commands](#matter-remote-commands)
- [TI Support](#ti-support)

---
Expand All @@ -29,16 +29,16 @@ CC13X2_26X2 family of Wireless MCUs.
![CC1352R1_LAUNCHXL](doc/images/cc1352r1_launchxl.jpg)

The CC13X2_26X2 lock example application provides a working demonstration of a
connected door lock device. This uses the open-source CHIP implementation and
connected door lock device. This uses the open-source Matter implementation and
the Texas Instruments SimpleLink™ CC13x2 and CC26x2 software development kit.

This example is enabled to build for CC2652R7 devices. This upcoming devices are
currently not yet in full production. For more information on device
availability or early access to an engineering build of our CHIP-enabled SDK,
please reach out [here][ti_cc13x2_26x2_r7_chip_request].
availability or early access to an engineering build of our Matter-enabled SDK,
please reach out [here][ti_cc13x2_26x2_r7_matter_request].

The lock example is intended to serve both as a means to explore the workings of
CHIP, as well as a template for creating real products based on the Texas
Matter, as well as a template for creating real products based on the Texas
Instruments devices.

## Device UI
Expand Down Expand Up @@ -66,7 +66,7 @@ section will need to be done when migrating to new versions of the SDK. This
guide assumes that the environment is linux based, and recommends Ubuntu 20.04.

- An engineering SDK from TI is required. Please request access for it
[here][ti_cc13x2_26x2_r7_chip_request].
[here][ti_cc13x2_26x2_r7_matter_request].

- Follow the default installation instructions when executing the
installer.
Expand Down Expand Up @@ -152,15 +152,15 @@ Ninja to build the executable.
- Run the build to produce a default executable. By default on Linux both the
TI SimpleLink SDK and Sysconfig are located in a `ti` folder in the user's
home directory, and you must provide the absolute path to them. For example
`/home/username/ti/simplelink_cc13x2_26x2_sdk_4_40_05_02_eng` and
`/home/username/ti/sysconfig_1.7.0`. On Windows the default directory is
`/home/username/ti/simplelink_cc13xx_cc26xx_sdk_5_30_03_01_eng` and
`/home/username/ti/sysconfig_1.10.0`. On Windows the default directory is
`C:\ti`. Take note of this install path, as it will be used in the next
step.

```
$ cd ~/connectedhomeip/examples/lock-app/cc13x2x7_26x2x7
$ export TI_SIMPLELINK_SDK_ROOT=$HOME/ti/simplelink_cc13x2_26x2_sdk_4_40_05_02_eng
$ export TI_SYSCONFIG_ROOT=$HOME/ti/sysconfig_1.7.0
$ export TI_SIMPLELINK_SDK_ROOT=$HOME/ti/simplelink_cc13xx_cc26xx_sdk_5_30_03_01_eng
$ export TI_SYSCONFIG_ROOT=$HOME/ti/sysconfig_1.10.0
$ gn gen out/debug --args="ti_simplelink_sdk_root=\"${TI_SIMPLELINK_SDK_ROOT}\" ti_sysconfig_root=\"${TI_SYSCONFIG_ROOT}\""
$ ninja -C out/debug
Expand Down Expand Up @@ -252,8 +252,8 @@ Router][ot_border_router_setup].

### Provisioning

The first step to bring the CHIP device onto the network is to provision it. Our
example accomplishes this with Bluetooth Low Energy (BLE) and the
The first step to bring the Matter device onto the network is to provision it.
Our example accomplishes this with Bluetooth Low Energy (BLE) and the
[CHIPTool](../../../src/android/CHIPTool/README.md) mobile app.

#### Bluetooth LE Advertising
Expand All @@ -265,17 +265,17 @@ fully provisioned, BLE advertising will stop.

#### Bluetooth LE Rendezvous

To commission and control this application within a CHIP-enabled Thread network,
consult the [CHIPTool README](../../../src/android/CHIPTool/README.md) for
information on the Android smartphone application. Reference the Device
To commission and control this application within a Matter-enabled Thread
network, consult the [CHIPTool README](../../../src/android/CHIPTool/README.md)
for information on the Android smartphone application. Reference the Device
Configuration information printed in the Logging Output of this application.

## TI Support

For technical support, please consider creating a post on TI's [E2E forum][e2e].
Additionally, we welcome any feedback.

[chip]: https://github.com/project-chip/connectedhomeip
[matter]: https://github.com/project-chip/connectedhomeip
[ccs]: https://www.ti.com/tool/CCSTUDIO
[ccs_after_launch]:
https://software-dl.ti.com/ccs/esd/documents/users_guide/ccs_debug-main.html?configuration#after-launch
Expand All @@ -287,14 +287,11 @@ Additionally, we welcome any feedback.
https://software-dl.ti.com/ccs/esd/documents/users_guide/ccs_debug-main.html?configuration#manual-method
[cc1352r1_launchxl]: https://www.ti.com/tool/LAUNCHXL-CC1352R1
[e2e]: https://e2e.ti.com/support/wireless-connectivity/zigbee-and-thread
[simplelink_sdk]: https://www.ti.com/tool/SIMPLELINK-CC13X2-26X2-SDK
[simplelink_sdk_4.30.00.54]:
https://www.ti.com/tool/download/SIMPLELINK-CC13X2-26X2-SDK/4.30.00.54
[sysconfig]: https://www.ti.com/tool/SYSCONFIG
[sysconfig_recommended]:
https://software-dl.ti.com/ccs/esd/sysconfig/sysconfig-1.7.0_1746-setup.run
https://software-dl.ti.com/ccs/esd/sysconfig/sysconfig-1.10.0_2163-setup.run
[ti_thread_dnd]:
https://www.ti.com/wireless-connectivity/thread/design-development.html
[ti_cc13x2_26x2_r7_chip_request]: https://ti.com/chip_sdk
[ti_cc13x2_26x2_r7_matter_request]: https://ti.com/chip_sdk
[ot_border_router_setup]: https://openthread.io/guides/border-router/build
[uniflash]: https://www.ti.com/tool/download/UNIFLASH
18 changes: 2 additions & 16 deletions examples/lock-app/cc13x2x7_26x2x7/chip.syscfg
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
* limitations under the License.
*/


/* Modules */
var AESCCM = scripting.addModule("/ti/drivers/AESCCM");
var AESECB = scripting.addModule("/ti/drivers/AESECB");
Expand All @@ -38,7 +39,6 @@ var ECDH = scripting.addModule("/ti/drivers/ECDH");

/* Instances */
var AESCCM1 = AESCCM.addInstance();
var AESCCM2 = AESCCM.addInstance();
var AESECB1 = AESECB.addInstance();
var AESECB2 = AESECB.addInstance();
var Button1 = Button.addInstance();
Expand All @@ -52,22 +52,18 @@ var TRNG1 = TRNG.addInstance();
var TRNG2 = TRNG.addInstance();
var TRNG3 = TRNG.addInstance();
var UART1 = UART.addInstance();
var UART2 = UART.addInstance();
var AESCTRDRBG1 = AESCTRDRBG.addInstance();
var ECDH1 = ECDH.addInstance();
var ECDH2 = ECDH.addInstance();

AESCTRDRBG1.$name = "CONFIG_AESCTRDRBG_0";
AESCTRDRBG1.aesctrObject.$name = "CONFIG_AESCTR_0";

AESCCM1.$name = "CONFIG_AESCCM0";
AESCCM2.$name = "CONFIG_AESCCM_1";

AESECB1.$name = "CONFIG_AESECB0";
AESECB2.$name = "CONFIG_AESECB_1";

ECDH1.$name = "CONFIG_ECDH0";
ECDH2.$name = "CONFIG_ECDH_1";

/* RTOS */
RTOS.name = "FreeRTOS";
Expand All @@ -78,15 +74,13 @@ Button1.$hardware = system.deviceData.board.components["BTN-1"
Button1.gpioPin.$name = "CONFIG_GPIO_BTN1";
Button1.gpioPin.pull = "Pull Up";
Button1.gpioPin.interruptTrigger = "Falling Edge";
Button1.gpioPin.pinInstance.$name = "CONFIG_PIN_BTN1";

/* Left Button */
Button2.$name = "CONFIG_BTN_RIGHT";
Button2.$hardware = system.deviceData.board.components["BTN-2"];
Button2.gpioPin.$name = "CONFIG_GPIO_BTN2";
Button2.gpioPin.pull = "Pull Up";
Button2.gpioPin.interruptTrigger = "Falling Edge";
Button2.gpioPin.pinInstance.$name = "CONFIG_PIN_BTN2";

/* ======== CCFG ======== */
var CCFG = scripting.addModule("/ti/devices/CCFG");
Expand All @@ -104,11 +98,10 @@ if(deviceName.includes("RB"))
}
/* NVS */
NVS1.$name = "CONFIG_NVSINTERNAL";
NVS1.internalFlash.regionBase = 0x78000;
NVS1.internalFlash.regionBase = 0xAA000;
NVS1.internalFlash.regionSize = 0x4000;

/* RF */
RF.$name = "CONFIG_RF0";
/* if an antenna component exists, assign it to the rf instance */
if (system.deviceData.board && system.deviceData.board.components.RF) {
RF.$hardware = system.deviceData.board.components.RF;
Expand All @@ -126,25 +119,18 @@ LED1.$hardware = system.deviceData.board.components.LED_RED;
LED1.gpioPin.$name = "CONFIG_GPIO_RLED";
LED1.gpioPin.mode = "Output";
LED1.gpioPin.callbackFunction = "";
LED1.gpioPin.pinInstance.$name = "CONFIG_PIN_RLED";

/* Green LED */
LED2.$name = "CONFIG_LED_GREEN";
LED2.$hardware = system.deviceData.board.components.LED_GREEN;
LED2.gpioPin.$name = "CONFIG_GPIO_GLED";
LED2.gpioPin.mode = "Output";
LED2.gpioPin.callbackFunction = "";
LED2.gpioPin.pinInstance.$name = "CONFIG_PIN_GLED";

/* Debug UART */
UART1.$hardware = system.deviceData.board.components.XDS110UART;
UART1.$name = "CONFIG_UART_DEBUG";

/* Display UART */
UART2.$name = "CONFIG_DISPLAY_UART";
UART2.uart.txPin.$suggestSolution = "boosterpack.32";
UART2.uart.rxPin.$suggestSolution = "boosterpack.18";

/* TRNG */
TRNG1.$name = "CONFIG_TRNG_0";
TRNG2.$name = "CONFIG_TRNG_1";
Expand Down
22 changes: 12 additions & 10 deletions examples/lock-app/cc13x2x7_26x2x7/main/AppTask.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ int AppTask::StartAppTask()
int AppTask::Init()
{
LED_Params ledParams;
Button_Params buttionParams;
Button_Params buttonParams;

cc13x2_26x2LogInit();

Expand Down Expand Up @@ -152,15 +152,17 @@ int AppTask::Init()
PLAT_LOG("Initialize buttons");
Button_init();

Button_Params_init(&buttionParams);
buttionParams.buttonEventMask = Button_EV_CLICKED | Button_EV_LONGCLICKED;
buttionParams.longPressDuration = 1000U; // ms
sAppLeftHandle = Button_open(CONFIG_BTN_LEFT, ButtonLeftEventHandler, &buttionParams);

Button_Params_init(&buttionParams);
buttionParams.buttonEventMask = Button_EV_CLICKED | Button_EV_LONGCLICKED;
buttionParams.longPressDuration = 1000U; // ms
sAppRightHandle = Button_open(CONFIG_BTN_RIGHT, ButtonRightEventHandler, &buttionParams);
Button_Params_init(&buttonParams);
buttonParams.buttonEventMask = Button_EV_CLICKED | Button_EV_LONGCLICKED;
buttonParams.longPressDuration = 1000U; // ms
sAppLeftHandle = Button_open(CONFIG_BTN_LEFT, &buttonParams);
Button_setCallback(sAppLeftHandle, ButtonLeftEventHandler);

Button_Params_init(&buttonParams);
buttonParams.buttonEventMask = Button_EV_CLICKED | Button_EV_LONGCLICKED;
buttonParams.longPressDuration = 1000U; // ms
sAppRightHandle = Button_open(CONFIG_BTN_RIGHT, &buttonParams);
Button_setCallback(sAppRightHandle, ButtonRightEventHandler);

// Initialize BoltLock module
PLAT_LOG("Initialize BoltLock");
Expand Down
Loading

0 comments on commit 4222193

Please sign in to comment.