[TI] initial cc32xx support (#18822)
* inital cc32xx commit
Co-authored-by: Suyash Jain <s-jain@ti.com>
Co-authored-by: Kobi Leibovitch <kobile@ti.com>
* Restyled by whitespace
* Restyled by clang-format
* Restyled by gn
* Restyled by prettier-markdown
* check-spellcheck and misspell fixes
* Restyled by gn
* Restyled by prettier-markdown
* added terms to .wordlist
* backticks for code terms
* dummy commit
* dummy commit
Co-authored-by: Suyash Jain <s-jain@ti.com>
Co-authored-by: Kobi Leibovitch <kobile@ti.com>
Co-authored-by: Restyled.io <commits@restyled.io>
Co-authored-by: Andrei Litvin <andy314@gmail.com>
diff --git a/examples/lock-app/cc32xx/.gn b/examples/lock-app/cc32xx/.gn
new file mode 100644
index 0000000..3d48789
--- /dev/null
+++ b/examples/lock-app/cc32xx/.gn
@@ -0,0 +1,28 @@
+# Copyright (c) 2020 Project CHIP Authors
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+import("//build_overrides/build.gni")
+
+# The location of the build configuration file.
+buildconfig = "${build_root}/config/BUILDCONFIG.gn"
+
+# CHIP uses angle bracket includes.
+check_system_includes = true
+
+default_args = {
+ target_cpu = "arm"
+ target_os = "freertos"
+
+ import("//args.gni")
+}
diff --git a/examples/lock-app/cc32xx/BUILD.gn b/examples/lock-app/cc32xx/BUILD.gn
new file mode 100755
index 0000000..d8fd3d4
--- /dev/null
+++ b/examples/lock-app/cc32xx/BUILD.gn
@@ -0,0 +1,119 @@
+# Copyright (c) 2020 Project CHIP Authors
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+import("//build_overrides/build.gni")
+import("//build_overrides/chip.gni")
+import("//build_overrides/ti_simplelink_sdk.gni")
+import("${build_root}/config/defaults.gni")
+import("${chip_root}/src/platform/device.gni")
+import("${ti_simplelink_sdk_build_root}/ti_simplelink_executable.gni")
+import("${ti_simplelink_sdk_build_root}/ti_simplelink_sdk.gni")
+
+assert(current_os == "freertos")
+
+project_dir = "${chip_root}/examples/lock-app/cc32xx"
+
+ti_simplelink_sdk("sdk") {
+ include_dirs = [ "${project_dir}/main/include" ]
+
+ defines = []
+ if (is_debug) {
+ defines += [ "BUILD_RELEASE=0" ]
+ } else {
+ defines += [ "BUILD_RELEASE=1" ]
+ }
+}
+
+ti_sysconfig("sysconfig") {
+ sources = [ "${project_dir}/chip.syscfg" ]
+ outputs = [
+ "ti_drivers_net_wifi_config.c",
+ "ti_net_config.c",
+ "ti_drivers_config.c",
+ "ti_drivers_config.h",
+ ]
+}
+
+source_set("lock_app_sdk") {
+ defines = []
+
+ configs -= [ "${build_root}/config/compiler:std_default" ]
+ configs += [ ":sdk_posix_config" ]
+
+ sources = [
+ "${chip_root}/src/platform/cc32xx/Logging.cpp",
+ "${project_dir}/main/cc32xxWifiInit.c",
+ "${project_dir}/main/main.cpp",
+ "${ti_simplelink_sdk_root}/examples/rtos/common/ifmod/lwip_if.c",
+ "${ti_simplelink_sdk_root}/examples/rtos/common/ifmod/utils_if.c",
+ "${ti_simplelink_sdk_root}/examples/rtos/common/ifmod/wifi_if.c",
+ ]
+
+ include_dirs = [
+ "${project_dir}/include",
+ "${project_dir}/main",
+ "${project_dir}/main/ifmod/",
+ "${chip_root}/src/platform/cc32xx",
+ ]
+
+ deps = [
+ ":sdk",
+ ":sysconfig",
+ "${chip_root}/examples/lock-app/lock-common",
+ "${chip_root}/src/lib",
+ "${chip_root}/src/setup_payload",
+ ]
+}
+
+ti_simplelink_executable("lock_app") {
+ defines = []
+ output_name = "chip-${ti_simplelink_board}-lock-example.out"
+
+ sources = [
+ "${project_dir}/main/AppTask.cpp",
+ "${project_dir}/main/BoltLockManager.cpp",
+ "${project_dir}/main/CXXExceptionStubs.cpp",
+ "${project_dir}/main/ZclCallbacks.cpp",
+ ]
+
+ deps = [
+ ":lock_app_sdk",
+ ":sdk",
+ ":sysconfig",
+ "${chip_root}/examples/lock-app/lock-common",
+ "${chip_root}/src/lib",
+ "${chip_root}/src/setup_payload",
+ ]
+
+ include_dirs = [
+ "${project_dir}",
+ "${project_dir}/main",
+ ]
+
+ cflags = [
+ "-Wno-implicit-fallthrough",
+ "-Wno-sign-compare",
+ "-Wconversion",
+ ]
+
+ output_dir = root_out_dir
+}
+
+group("cc32xx") {
+ deps = [ ":lock_app" ]
+}
+
+group("default") {
+ deps = [ ":cc32xx" ]
+}
diff --git a/examples/lock-app/cc32xx/README.md b/examples/lock-app/cc32xx/README.md
new file mode 100644
index 0000000..c1474a0
--- /dev/null
+++ b/examples/lock-app/cc32xx/README.md
@@ -0,0 +1,196 @@
+# Matter `CC32XXSF` Lock Example Application
+
+An example application showing the use of [Matter][matter] on the Texas
+Instruments CC32XX family of Wireless MCUs.
+
+---
+
+- [Matter CC32XX Lock Example Application](#matter-cc32xx-lock-example-application)
+ - [Introduction](#introduction)
+ - [Device UI](#device-ui)
+ - [Building](#building)
+ - [Preparation](#preparation)
+ - [Compilation](#compilation)
+ - [Programming](#programming)
+ - [Code Composer Studio](#code-composer-studio)
+ - [UniFlash](#uniflash)
+ - [Viewing Logging Output](#viewing-logging-output)
+ - [Running the Example](#running-the-example)
+ - [Provisioning](#provisioning)
+ - [Matter Remote Commands](#matter-remote-commands)
+ - [TI Support](#ti-support)
+
+---
+
+## Introduction
+
+
+
+The CC32XX lock example application provides a working demonstration of a
+connected door lock device. This uses the open-source CHIP implementation and
+the Texas Instruments SimpleLink™ Wi-Fi® CC32xx software development kit.
+
+By default this example targets the [CC3235SF_LAUNCHXL][cc3235sf_launchxl]
+LaunchPad, but the example application is enabled to build on the whole `CC32XX`
+family of MCUs.
+
+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
+Instruments devices.
+
+## Device UI
+
+This example application has a simple User Interface to depict the state of the
+door lock and to control the state. The user LEDs on the LaunchPad are set on
+when the lock is locked, and are set off when unlocked. The LEDs will flash when
+in the transition state between locked and unlocked. The user buttons are used
+for requesting lock and unlock of the door lock. The left button (`BTN-1`) is
+used to enable provisioning (provisioning is enabled as "oneshot" by default.
+The right button (`BTN-2`) us used to toggle the "Lock" state.
+
+## Building
+
+### Preparation
+
+Some initial setup is necessary for preparing the build environment. This
+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.
+
+- Download and install [SysConfig][sysconfig] ([recommended
+ version][sysconfig_recommended]). This can be done simply with the following
+ commands.
+
+ ```
+ $ cd ~
+ $ wget https://software-dl.ti.com/ccs/esd/sysconfig/sysconfig-1.12.1_2446-setup.run
+ $ chmod +x sysconfig-1.12.1_2446-setup.run
+ $ ./sysconfig-1.12.1_2446-setup.run
+ ```
+
+- Run the bootstrap script to setup the build environment.
+
+ ```
+ $ cd ~/connectedhomeip
+ $ source ./scripts/bootstrap.sh
+ ```
+
+### Compilation
+
+It is necessary to activate the environment in every new shell. Then run GN and
+Ninja to build the executable.
+
+- Activate the build environment with the repository activate script.
+
+ ```
+ $ cd ~/connectedhomeip
+ $ source ./scripts/activate.sh
+ ```
+
+- Run the build to produce a default executable. By default on Linux the
+ Sysconfig is located in a `ti` folder in the user's home directory, and you
+ must provide the absolute path for it. For example
+ `/home/username/ti/sysconfig_1.12.1`. 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/cc32xx
+ $ gn gen out/debug --args="ti_sysconfig_root=\"$HOME/ti/sysconfig_1.12.1\""
+ $ ninja -C out/debug
+ ```
+
+## Programming
+
+Loading the built image onto a LaunchPad is supported through Code Composer
+Studio (CCS). Code Composer Studio can be used to load the image and debug the
+source code. UniFlash programming (bin) image is not generated currently.
+
+### Code Composer Studio
+
+Programming with CCS will allow for a full debug environment within the IDE.
+This is accomplished by creating a target connection to the XDS110 debugger and
+starting a project-less debug session. The CCS IDE will attempt to find the
+source files on the local machine based on the debug information embedded within
+the ELF. CCS may prompt you to find the source code if the image was built on
+another machine or the source code is located in a different location than is
+recorded within the ELF.
+
+Download and install [Code Composer Studio][ccs].
+
+First open CCS and create a new workspace.
+
+Create a target connection (sometimes called the CCXML) for your target SoC and
+debugger as described in the [Manual Method][ccs_manual_method] section of the
+CCS User's Guide.
+
+Next initiate a project-less debug session as described in the [Manual
+Launch][ccs_manual_launch] section of the CCS User's Guide.
+
+CCS should switch to the debug view described in the [After
+Launch][ccs_after_launch] section of the User's Guide. The SoC core will likely
+be disconnected and symbols will not be loaded. Connect to the core as described
+in the [Debug View][ccs_debug_view] section of the User's Guide. Once the core
+is connected, use the `Load` button on the toolbar to load the ELF image.
+
+Note that the default configuration of the CCXML uses 2-wire cJTAG instead of
+the full 4-wire JTAG connection to match the default jumper configuration of the
+LaunchPad.
+
+## Viewing Logging Output
+
+By default the log output will be sent to the Application/User UART. Open a
+terminal emulator to that port to see the output with the following options:
+
+| Parameter | Value |
+| ------------ | -------- |
+| Speed (baud) | `115200` |
+| Data bits | `8` |
+| Stop bits | `1` |
+| Parity | `None` |
+| Flow control | `None` |
+
+## Running the Example
+
+### Provisioning
+
+The first step to bring the Matter device onto the network is to provision it.
+The example accomplishes this through the proprietary SimpleLink provisioning
+method (AP or Smart Config) using the SimpleLink Starter Pro mobile app. Once
+the device is connected to the local AP, commissioning can be triggered using
+"OnNetwork" configuration.
+
+#### Bluetooth LE Provisioning
+
+BLE provisioning is not supported currently.
+
+### CHIP tool changes needed for Wi-Fi example
+
+The timeout for the CHIP tool needs to be increased from 10 to 15 seconds. This
+can be done in `chip::System::Clock::Timeout GetWaitDuration` in
+`connectedhomeip/examples/chip-tool/commands/clusters/ModelCommand.h`
+
+## TI Support
+
+For technical support, please consider creating a post on TI's [E2E forum][e2e].
+Additionally, we welcome any feedback.
+
+[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
+[ccs_debug_view]:
+ https://software-dl.ti.com/ccs/esd/documents/users_guide/ccs_debug-main.html?configuration#debug-view
+[ccs_manual_launch]:
+ https://software-dl.ti.com/ccs/esd/documents/users_guide/ccs_debug-main.html?configuration#manual-launch
+[ccs_manual_method]:
+ https://software-dl.ti.com/ccs/esd/documents/users_guide/ccs_debug-main.html?configuration#manual-method
+[cc3235sf_launchxl]: https://www.ti.com/tool/LAUNCHXL-CC3235SF
+[e2e]:
+ https://e2e.ti.com/support/wireless-connectivity/wi-fi-group/wifi/f/wi-fi-forum
+[sysconfig]: https://www.ti.com/tool/SYSCONFIG
+[sysconfig_recommended]:
+ https://software-dl.ti.com/ccs/esd/sysconfig/sysconfig-1.12.1_2446-setup.run
+[ti_cc32xx_matter_request]:
+ https://www.ti.com/tool/download/SIMPLELINK-CC32XX-SDK/5.30.00.08
+[uniflash]: https://www.ti.com/tool/download/UNIFLASH
diff --git a/examples/lock-app/cc32xx/args.gni b/examples/lock-app/cc32xx/args.gni
new file mode 100755
index 0000000..8d5afa6
--- /dev/null
+++ b/examples/lock-app/cc32xx/args.gni
@@ -0,0 +1,43 @@
+# Copyright (c) 2020 Project CHIP Authors
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+import("//build_overrides/chip.gni")
+import("${chip_root}/examples/platform/cc32xx/args.gni")
+
+ti_simplelink_sdk_target = get_label_info(":sdk", "label_no_toolchain")
+ti_simplelink_sysconfig_target =
+ get_label_info(":sysconfig", "label_no_toolchain")
+
+ti_simplelink_board = "CC3235SF_LAUNCHXL"
+
+# use -Os instead of -Og
+#is_debug = false
+
+# disable BLE for now
+chip_config_network_layer_ble = false
+chip_bypass_rendezvous = false
+
+#enable logging
+chip_progress_logging = true
+chip_detail_logging = true
+chip_automation_logging = true
+
+## Disable lock tracking, since our FreeRTOS configuration does not set
+# INCLUDE_xSemaphoreGetMutexHolder
+chip_stack_lock_tracking = "none"
+
+matter_device_vid = "0xFFF1"
+matter_device_pid = "0x8006"
+matter_software_ver = "0x0001"
+matter_software_ver_str = "1.0d1"
diff --git a/examples/lock-app/cc32xx/build_overrides b/examples/lock-app/cc32xx/build_overrides
new file mode 120000
index 0000000..194ee0b
--- /dev/null
+++ b/examples/lock-app/cc32xx/build_overrides
@@ -0,0 +1 @@
+../../build_overrides/
\ No newline at end of file
diff --git a/examples/lock-app/cc32xx/chip.syscfg b/examples/lock-app/cc32xx/chip.syscfg
new file mode 100755
index 0000000..14fd313
--- /dev/null
+++ b/examples/lock-app/cc32xx/chip.syscfg
@@ -0,0 +1,74 @@
+/**
+ * Import the modules used in this configuration.
+ */
+const Display = scripting.addModule("/ti/display/Display");
+const Display1 = Display.addInstance();
+const SPI = scripting.addModule("/ti/drivers/SPI");
+const Button = scripting.addModule("/ti/drivers/apps/Button");
+const Button1 = Button.addInstance();
+const Button2 = Button.addInstance();
+const LED = scripting.addModule("/ti/drivers/apps/LED");
+const LED1 = LED.addInstance();
+const LED2 = LED.addInstance();
+const LED3 = LED.addInstance();
+const SimpleLinkWifi = scripting.addModule("/ti/drivers/net/wifi/SimpleLinkWifi");
+const net_utils = scripting.addModule("/ti/drivers/net/wifi/net_utils", {}, false);
+const net_utils1 = net_utils.addInstance();
+const HTTPClient = scripting.addModule("/ti/net/HTTPClient", {}, false);
+const HTTPClient1 = HTTPClient.addInstance();
+const MQTT = scripting.addModule("/ti/net/MQTT", {}, false);
+const MQTT1 = MQTT.addInstance();
+const SNTP = scripting.addModule("/ti/net/SNTP");
+const SlNet = scripting.addModule("/ti/net/SlNet", {}, false);
+const SlNet1 = SlNet.addInstance();
+
+/**
+ * Write custom configuration values to the imported modules.
+ */
+Display1.$name = "CONFIG_Display_0";
+Display1.$hardware = system.deviceData.board.components.XDS110UART;
+Display1.uart.$name = "CONFIG_UART2_0";
+
+const Power = scripting.addModule("/ti/drivers/Power", {}, false);
+Power.parkPins.$name = "ti_drivers_power_PowerCC32XXPins0";
+
+Button1.$hardware = system.deviceData.board.components.SW2;
+Button1.$name = "CONFIG_BTN_LEFT";
+
+Button2.$hardware = system.deviceData.board.components.SW3;
+Button2.$name = "CONFIG_BTN_RIGHT";
+
+LED1.$hardware = system.deviceData.board.components.LED_BLUE;
+LED1.$name = "CONFIG_LED_BLUE";
+
+LED2.$hardware = system.deviceData.board.components.LED_GREEN;
+LED2.$name = "CONFIG_LED_GREEN";
+
+LED3.$hardware = system.deviceData.board.components.LED_RED;
+LED3.dimmable = true;
+LED3.$name = "CONFIG_LED_RED";
+
+net_utils1.$name = "CONFIG_NET_UTILS_0";
+
+HTTPClient1.$name = "CONFIG_HTTPCLIENT_0";
+
+MQTT1.$name = "CONFIG_MQTT_0";
+
+SlNet1.$name = "CONFIG_SLNET_0";
+
+/**
+ * Pinmux solution for unlocked pins/peripherals. This ensures that minor changes to the automatic solver in a future
+ * version of the tool will not impact the pinmux you originally saw. These lines can be completely deleted in order to
+ * re-solve from scratch.
+ */
+Display1.uart.uart.$suggestSolution = "UART1";
+Display1.uart.uart.txPin.$suggestSolution = "ball.55";
+Display1.uart.uart.txDmaChannel.$suggestSolution = "UDMA_CH11";
+Display1.uart.uart.rxPin.$suggestSolution = "ball.57";
+Display1.uart.uart.rxDmaChannel.$suggestSolution = "UDMA_CH10";
+Button1.button.$suggestSolution = "boosterpack.3";
+Button2.button.$suggestSolution = "boosterpack.11";
+LED1.ledPin.$suggestSolution = "boosterpack.29";
+LED2.ledPin.$suggestSolution = "boosterpack.10";
+LED3.pwmPin.timer.$suggestSolution = "Timer3";
+LED3.pwmPin.timer.pwmPin.$suggestSolution = "boosterpack.9";
diff --git a/examples/lock-app/cc32xx/main/AppConfig.h b/examples/lock-app/cc32xx/main/AppConfig.h
new file mode 100755
index 0000000..8eeee7f
--- /dev/null
+++ b/examples/lock-app/cc32xx/main/AppConfig.h
@@ -0,0 +1,34 @@
+/*
+ * Copyright (c) 2020 Project CHIP Authors
+ * Copyright (c) 2019 Google LLC.
+ * All rights reserved.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef APP_CONFIG_H
+#define APP_CONFIG_H
+
+// Logging
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+int cc32xxLogInit(void);
+void cc32xxLog(const char * aFormat, ...);
+#define PLAT_LOG(...) cc32xxLog(__VA_ARGS__);
+
+#ifdef __cplusplus
+}
+#endif
+#endif // APP_CONFIG_H
diff --git a/examples/lock-app/cc32xx/main/AppEvent.h b/examples/lock-app/cc32xx/main/AppEvent.h
new file mode 100755
index 0000000..ad9e93e
--- /dev/null
+++ b/examples/lock-app/cc32xx/main/AppEvent.h
@@ -0,0 +1,60 @@
+/*
+ *
+ * Copyright (c) 2018 Nest Labs, Inc.
+ * All rights reserved.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef APP_EVENT_H
+#define APP_EVENT_H
+
+struct AppEvent;
+typedef void (*EventHandler)(AppEvent *);
+
+struct AppEvent
+{
+ enum AppEventType
+ {
+ kEventType_None = 0,
+ kEventType_ButtonLeft,
+ kEventType_ButtonRight,
+ kEventType_AppEvent,
+ };
+
+ enum AppEventButtonType
+ {
+ kAppEventButtonType_None = 0,
+ kAppEventButtonType_Clicked,
+ kAppEventButtonType_LongClicked,
+ };
+
+ enum AppEventType Type;
+
+ union
+ {
+ struct
+ {
+ enum AppEventButtonType Type;
+ } ButtonEvent;
+
+ struct
+ {
+ void * Context;
+ } BoltLockEvent;
+ };
+
+ EventHandler Handler;
+};
+
+#endif // APP_EVENT_H
diff --git a/examples/lock-app/cc32xx/main/AppTask.cpp b/examples/lock-app/cc32xx/main/AppTask.cpp
new file mode 100644
index 0000000..18196a2
--- /dev/null
+++ b/examples/lock-app/cc32xx/main/AppTask.cpp
@@ -0,0 +1,304 @@
+/*
+ *
+ * Copyright (c) 2020 Project CHIP Authors
+ * Copyright (c) 2020 Texas Instruments Incorporated
+ * All rights reserved.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include "AppTask.h"
+#include "AppConfig.h"
+#include "AppEvent.h"
+#include <app-common/zap-generated/attribute-id.h>
+#include <app-common/zap-generated/cluster-id.h>
+#include <app/server/Server.h>
+#include <app/util/attribute-storage.h>
+
+#include "FreeRTOS.h"
+
+#include <credentials/DeviceAttestationCredsProvider.h>
+#include <credentials/examples/DeviceAttestationCredsExample.h>
+
+#include <lib/support/CHIPMem.h>
+#include <lib/support/CHIPPlatformMemory.h>
+#include <platform/CHIPDeviceLayer.h>
+
+#include <app/server/Dnssd.h>
+#include <app/server/OnboardingCodesUtil.h>
+
+#include <ti/drivers/apps/Button.h>
+#include <ti/drivers/apps/LED.h>
+
+/* syscfg */
+#include <ti_drivers_config.h>
+
+extern "C" {
+extern int WiFi_init();
+extern void DisplayBanner();
+}
+
+/* Application Version and Naming*/
+
+#define APP_TASK_STACK_SIZE (4096)
+#define APP_TASK_PRIORITY 4
+#define APP_EVENT_QUEUE_SIZE 10
+
+// Added the below three for DNS Server Initialization
+using namespace ::chip;
+using namespace ::chip::Inet;
+using namespace ::chip::System;
+
+using namespace ::chip::Credentials;
+using namespace ::chip::DeviceLayer;
+
+static TaskHandle_t sAppTaskHandle;
+static QueueHandle_t sAppEventQueue;
+
+extern LED_Handle gLedGreenHandle, gLedRedHandle;
+static Button_Handle gButtonRightHandle;
+
+AppTask AppTask::sAppTask;
+
+int AppTask::StartAppTask()
+{
+ int ret = 0;
+
+ sAppEventQueue = xQueueCreate(APP_EVENT_QUEUE_SIZE, sizeof(AppEvent));
+ if (sAppEventQueue == NULL)
+ {
+ PLAT_LOG("Failed to allocate app event queue");
+ while (1)
+ ;
+ }
+
+ // Start App task.
+ if (xTaskCreate(AppTaskMain, "APP", APP_TASK_STACK_SIZE / sizeof(StackType_t), NULL, APP_TASK_PRIORITY, &sAppTaskHandle) !=
+ pdPASS)
+ {
+ PLAT_LOG("Failed to create app task");
+ while (1)
+ ;
+ }
+ return ret;
+}
+
+int AppTask::Init()
+{
+ CHIP_ERROR ret;
+ LED_Params ledParams;
+ Button_Params buttonParams;
+
+ cc32xxLogInit();
+
+ /* Initial Terminal, and print Application name */
+ DisplayBanner();
+
+ // Init Chip memory management before the stack
+ PLAT_LOG("Initialize Memory");
+ chip::Platform::MemoryInit();
+
+ // Initialize LEDs
+ PLAT_LOG("Initialize LEDs");
+ LED_init();
+
+ LED_Params_init(&ledParams); // default PWM LED
+ gLedRedHandle = LED_open(CONFIG_LED_RED, &ledParams);
+ LED_setOff(gLedRedHandle);
+
+ LED_Params_init(&ledParams); // default PWM LED
+ gLedGreenHandle = LED_open(CONFIG_LED_GREEN, &ledParams);
+ LED_setOff(gLedGreenHandle);
+
+ // Initialize buttons
+ PLAT_LOG("Initialize buttons");
+ Button_init();
+
+ Button_Params_init(&buttonParams);
+ buttonParams.buttonEventMask = Button_EV_CLICKED | Button_EV_LONGCLICKED;
+ buttonParams.longPressDuration = 1000U; // ms
+ gButtonRightHandle = Button_open(CONFIG_BTN_RIGHT, &buttonParams);
+ Button_setCallback(gButtonRightHandle, ButtonRightEventHandler);
+
+ PLAT_LOG("Initialize Wi-Fi");
+ WiFi_init();
+
+ PLAT_LOG("Initialize CHIP stack");
+ ret = PlatformMgr().InitChipStack();
+ if (ret != CHIP_NO_ERROR)
+ {
+ PLAT_LOG("PlatformMgr().InitChipStack() failed");
+ while (1)
+ ;
+ }
+ PLAT_LOG("Start Event Loop Task");
+ ret = PlatformMgr().StartEventLoopTask();
+ if (ret != CHIP_NO_ERROR)
+ {
+ PLAT_LOG("PlatformMgr().StartEventLoopTask() failed");
+ while (1)
+ ;
+ }
+
+ // Init ZCL Data Model and start server
+ PLAT_LOG("Initialize Server");
+ static chip::CommonCaseDeviceServerInitParams initParams;
+ (void) initParams.InitializeStaticResourcesBeforeServerInit();
+ chip::Server::GetInstance().Init(initParams);
+
+ // Initialize device attestation config
+ PLAT_LOG("Initialize device attestation config");
+ SetDeviceAttestationCredentialsProvider(Examples::GetExampleDACProvider());
+
+ // Initialize BoltLock module
+ PLAT_LOG("Initialize BoltLock");
+ BoltLockMgr().Init();
+
+ BoltLockMgr().SetCallbacks(ActionInitiated, ActionCompleted);
+
+ ConfigurationMgr().LogDeviceConfig();
+
+ // QR code will be used with CHIP Tool
+ PLAT_LOG("Print Onboarding Codes");
+ PrintOnboardingCodes(chip::RendezvousInformationFlags(chip::RendezvousInformationFlag::kOnNetwork));
+
+ PLAT_LOG("Start DNS Server");
+ chip::app::DnssdServer::Instance().StartServer();
+
+ return 0;
+}
+
+void AppTask::AppTaskMain(void * pvParameter)
+{
+ AppEvent event;
+
+ sAppTask.Init();
+
+ while (1)
+ {
+ /* Task pend until we have stuff to do */
+ if (xQueueReceive(sAppEventQueue, &event, portMAX_DELAY) == pdTRUE)
+ {
+ sAppTask.DispatchEvent(&event);
+ }
+ }
+}
+
+void AppTask::ButtonRightEventHandler(Button_Handle handle, Button_EventMask events)
+{
+ AppEvent event;
+ event.Type = AppEvent::kEventType_ButtonRight;
+
+ if (events & Button_EV_CLICKED)
+ {
+ event.ButtonEvent.Type = AppEvent::kAppEventButtonType_Clicked;
+ }
+ else if (events & Button_EV_LONGCLICKED)
+ {
+ event.ButtonEvent.Type = AppEvent::kAppEventButtonType_LongClicked;
+ }
+ // button callbacks are in ISR context
+ if (xQueueSendFromISR(sAppEventQueue, &event, NULL) != pdPASS)
+ {
+ /* Failed to post the message */
+ }
+}
+
+void AppTask::PostEvent(const AppEvent * aEvent)
+{
+ if (xQueueSend(sAppEventQueue, aEvent, 0) != pdPASS)
+ {
+ /* Failed to post the message */
+ }
+}
+
+void AppTask::ActionInitiated(BoltLockManager::Action_t aAction, int32_t aActor)
+{
+ // If the action has been initiated by the lock, update the bolt lock trait
+ // and start flashing the LEDs rapidly to indicate action initiation.
+ if (aAction == BoltLockManager::LOCK_ACTION)
+ {
+ PLAT_LOG("Lock initiated");
+ ; // TODO
+ }
+ else if (aAction == BoltLockManager::UNLOCK_ACTION)
+ {
+ PLAT_LOG("Unlock initiated");
+ ; // TODO
+ }
+
+ LED_setOn(gLedGreenHandle, LED_BRIGHTNESS_MAX);
+ LED_startBlinking(gLedGreenHandle, 50 /* ms */, LED_BLINK_FOREVER);
+ LED_setOn(gLedRedHandle, LED_BRIGHTNESS_MAX);
+ LED_startBlinking(gLedRedHandle, 110 /* ms */, LED_BLINK_FOREVER);
+}
+
+void AppTask::ActionCompleted(BoltLockManager::Action_t aAction)
+{
+ uint8_t state;
+
+ // if the action has been completed by the lock, update the bolt lock trait.
+ // Turn on the lock LED if in a LOCKED state OR
+ // Turn off the lock LED if in an UNLOCKED state.
+ if (aAction == BoltLockManager::LOCK_ACTION)
+ {
+ PLAT_LOG("Lock completed");
+ LED_stopBlinking(gLedGreenHandle);
+ LED_setOn(gLedGreenHandle, LED_BRIGHTNESS_MAX);
+ LED_stopBlinking(gLedRedHandle);
+ LED_setOn(gLedRedHandle, LED_BRIGHTNESS_MAX);
+ state = 1;
+ }
+ else if (aAction == BoltLockManager::UNLOCK_ACTION)
+ {
+ PLAT_LOG("Unlock completed");
+ LED_stopBlinking(gLedGreenHandle);
+ LED_setOff(gLedGreenHandle);
+ LED_stopBlinking(gLedRedHandle);
+ LED_setOff(gLedRedHandle);
+ state = 0;
+ }
+ emberAfWriteAttribute(1, ZCL_ON_OFF_CLUSTER_ID, ZCL_ON_OFF_ATTRIBUTE_ID, &state, ZCL_BOOLEAN_ATTRIBUTE_TYPE);
+}
+
+void AppTask::DispatchEvent(AppEvent * aEvent)
+{
+ switch (aEvent->Type)
+ {
+ case AppEvent::kEventType_ButtonRight:
+ if (AppEvent::kAppEventButtonType_Clicked == aEvent->ButtonEvent.Type)
+ {
+ if (BoltLockMgr().IsUnlocked())
+ {
+ BoltLockMgr().InitiateAction(0, BoltLockManager::LOCK_ACTION);
+ }
+ else
+ {
+ BoltLockMgr().InitiateAction(0, BoltLockManager::UNLOCK_ACTION);
+ }
+ }
+ break;
+
+ case AppEvent::kEventType_AppEvent:
+ if (NULL != aEvent->Handler)
+ {
+ // XXX: assume our caller isn't trying to crash our stack
+ aEvent->Handler(aEvent);
+ }
+ break;
+
+ case AppEvent::kEventType_None:
+ default:
+ break;
+ }
+}
diff --git a/examples/lock-app/cc32xx/main/AppTask.h b/examples/lock-app/cc32xx/main/AppTask.h
new file mode 100755
index 0000000..803db3d3
--- /dev/null
+++ b/examples/lock-app/cc32xx/main/AppTask.h
@@ -0,0 +1,78 @@
+/*
+ * Copyright (c) 2020 Project CHIP Authors
+ * Copyright (c) 2019 Google LLC.
+ * All rights reserved.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef APP_TASK_H
+#define APP_TASK_H
+
+#include <stdbool.h>
+#include <stdint.h>
+
+#include "FreeRTOS.h"
+#include "semphr.h"
+#include "task.h"
+
+#include "AppEvent.h"
+#include "BoltLockManager.h"
+
+#include <ti/drivers/apps/Button.h>
+
+class AppTask
+{
+public:
+ int StartAppTask();
+ static void AppTaskMain(void * pvParameter);
+
+ void PostLockActionRequest(int32_t aActor, BoltLockManager::Action_t aAction);
+ void PostEvent(const AppEvent * event);
+
+private:
+ friend AppTask & GetAppTask(void);
+
+ int Init();
+
+ // should this be done by BoltLock Manager? I don't want to unravel this spaghetti quite yet
+ static void ActionInitiated(BoltLockManager::Action_t aAction, int32_t aActor);
+ static void ActionCompleted(BoltLockManager::Action_t aAction);
+
+ void DispatchEvent(AppEvent * event);
+
+ static void ButtonRightEventHandler(Button_Handle handle, Button_EventMask events);
+
+ static void TimerEventHandler(void * p_context);
+
+ enum Function_t
+ {
+ kFunction_NoneSelected = 0,
+ kFunction_SoftwareUpdate = 0,
+ kFunction_FactoryReset,
+
+ kFunction_Invalid
+ } Function;
+
+ Function_t mFunction;
+ bool mFunctionTimerActive;
+
+ static AppTask sAppTask;
+};
+
+inline AppTask & GetAppTask(void)
+{
+ return AppTask::sAppTask;
+}
+
+#endif // APP_TASK_H
diff --git a/examples/lock-app/cc32xx/main/BoltLockManager.cpp b/examples/lock-app/cc32xx/main/BoltLockManager.cpp
new file mode 100644
index 0000000..31c995f
--- /dev/null
+++ b/examples/lock-app/cc32xx/main/BoltLockManager.cpp
@@ -0,0 +1,206 @@
+/*
+ *
+ * Copyright (c) 2020 Project CHIP Authors
+ * Copyright (c) 2019 Google LLC.
+ * All rights reserved.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include "BoltLockManager.h"
+
+#include "AppConfig.h"
+#include "AppTask.h"
+#include "FreeRTOS.h"
+
+#define ACTUATOR_MOVEMENT_PERIOS_MS 1000
+
+BoltLockManager BoltLockManager::sLock;
+
+int BoltLockManager::Init()
+{
+ int ret = 0;
+
+ mTimerHandle = xTimerCreate("BLT_TIMER", pdMS_TO_TICKS(ACTUATOR_MOVEMENT_PERIOS_MS), pdFALSE, this, TimerEventHandler);
+ if (NULL == mTimerHandle)
+ {
+ PLAT_LOG("failed to create bolt lock timer");
+ while (1)
+ ;
+ }
+
+ mState = kState_UnlockingCompleted;
+ mAutoLockTimerArmed = false;
+ mAutoRelock = false;
+ mAutoLockDuration = 0;
+
+ return ret;
+}
+
+void BoltLockManager::SetCallbacks(Callback_fn_initiated aActionInitiated_CB, Callback_fn_completed aActionCompleted_CB)
+{
+ mActionInitiated_CB = aActionInitiated_CB;
+ mActionCompleted_CB = aActionCompleted_CB;
+}
+
+bool BoltLockManager::IsActionInProgress()
+{
+ return (mState == kState_LockingInitiated || mState == kState_UnlockingInitiated) ? true : false;
+}
+
+bool BoltLockManager::IsUnlocked()
+{
+ return (mState == kState_UnlockingCompleted) ? true : false;
+}
+
+void BoltLockManager::EnableAutoRelock(bool aOn)
+{
+ mAutoRelock = aOn;
+}
+
+void BoltLockManager::SetAutoLockDuration(uint32_t aDurationInSecs)
+{
+ mAutoLockDuration = aDurationInSecs;
+}
+
+bool BoltLockManager::InitiateAction(int32_t aActor, Action_t aAction)
+{
+ bool action_initiated = false;
+ State_t new_state;
+
+ // Initiate Lock/Unlock Action only when the previous one is complete.
+ if (mState == kState_LockingCompleted && aAction == UNLOCK_ACTION)
+ {
+ action_initiated = true;
+
+ new_state = kState_UnlockingInitiated;
+ }
+ else if (mState == kState_UnlockingCompleted && aAction == LOCK_ACTION)
+ {
+ action_initiated = true;
+
+ new_state = kState_LockingInitiated;
+ }
+
+ if (action_initiated)
+ {
+ if (mAutoLockTimerArmed && new_state == kState_LockingInitiated)
+ {
+ // If auto lock timer has been armed and someone initiates locking,
+ // cancel the timer and continue as normal.
+ mAutoLockTimerArmed = false;
+
+ CancelTimer();
+ }
+
+ StartTimer(ACTUATOR_MOVEMENT_PERIOS_MS);
+
+ // Since the timer started successfully, update the state and trigger callback
+ mState = new_state;
+
+ if (mActionInitiated_CB)
+ {
+ mActionInitiated_CB(aAction, aActor);
+ }
+ }
+
+ return action_initiated;
+}
+
+void BoltLockManager::StartTimer(uint32_t aTimeoutMs)
+{
+ // XXX: Seth check returns
+ xTimerChangePeriod(mTimerHandle, pdMS_TO_TICKS(aTimeoutMs), 100);
+ xTimerStart(mTimerHandle, 100);
+}
+
+void BoltLockManager::CancelTimer(void)
+{
+ xTimerStop(mTimerHandle, 100);
+}
+
+void BoltLockManager::TimerEventHandler(TimerHandle_t aTimer)
+{
+ BoltLockManager * lock = static_cast<BoltLockManager *>(pvTimerGetTimerID(aTimer));
+
+ // The timer event handler will be called in the context of the timer task
+ // once sLockTimer expires. Post an event to apptask queue with the actual handler
+ // so that the event can be handled in the context of the apptask.
+ // XXX: Seth major spaghetti that I don't want to unravel
+ AppEvent event;
+ event.Type = AppEvent::kEventType_AppEvent;
+ event.BoltLockEvent.Context = static_cast<BoltLockManager *>(lock);
+ if (lock->mAutoLockTimerArmed)
+ {
+ event.Handler = AutoReLockTimerEventHandler;
+ }
+ else
+ {
+ event.Handler = ActuatorMovementTimerEventHandler;
+ }
+ GetAppTask().PostEvent(&event);
+}
+
+void BoltLockManager::AutoReLockTimerEventHandler(AppEvent * aEvent)
+{
+ BoltLockManager * lock = static_cast<BoltLockManager *>(aEvent->BoltLockEvent.Context);
+ int32_t actor = 0;
+
+ // Make sure auto lock timer is still armed.
+ if (!lock->mAutoLockTimerArmed)
+ {
+ return;
+ }
+
+ lock->mAutoLockTimerArmed = false;
+
+ PLAT_LOG("Auto Re-Lock has been triggered!");
+
+ lock->InitiateAction(actor, LOCK_ACTION);
+}
+
+void BoltLockManager::ActuatorMovementTimerEventHandler(AppEvent * aEvent)
+{
+ Action_t actionCompleted = INVALID_ACTION;
+
+ BoltLockManager * lock = static_cast<BoltLockManager *>(aEvent->BoltLockEvent.Context);
+
+ if (lock->mState == kState_LockingInitiated)
+ {
+ lock->mState = kState_LockingCompleted;
+ actionCompleted = LOCK_ACTION;
+ }
+ else if (lock->mState == kState_UnlockingInitiated)
+ {
+ lock->mState = kState_UnlockingCompleted;
+ actionCompleted = UNLOCK_ACTION;
+ }
+
+ if (actionCompleted != INVALID_ACTION)
+ {
+ if (lock->mActionCompleted_CB)
+ {
+ lock->mActionCompleted_CB(actionCompleted);
+ }
+
+ if (lock->mAutoRelock && actionCompleted == UNLOCK_ACTION)
+ {
+ // Start the timer for auto relock
+ lock->StartTimer(lock->mAutoLockDuration * 1000);
+
+ lock->mAutoLockTimerArmed = true;
+
+ PLAT_LOG("Auto Re-lock enabled. Will be triggered in %u seconds", lock->mAutoLockDuration);
+ }
+ }
+}
diff --git a/examples/lock-app/cc32xx/main/BoltLockManager.h b/examples/lock-app/cc32xx/main/BoltLockManager.h
new file mode 100755
index 0000000..40fc4ff
--- /dev/null
+++ b/examples/lock-app/cc32xx/main/BoltLockManager.h
@@ -0,0 +1,87 @@
+/*
+ *
+ * Copyright (c) 2019 Google LLC.
+ * All rights reserved.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef LOCK_MANAGER_H
+#define LOCK_MANAGER_H
+
+#include <stdbool.h>
+#include <stdint.h>
+
+#include "AppEvent.h"
+
+#include <FreeRTOS.h>
+#include <timers.h>
+
+class BoltLockManager
+{
+public:
+ enum Action_t
+ {
+ LOCK_ACTION = 0,
+ UNLOCK_ACTION,
+
+ INVALID_ACTION
+ } Action;
+
+ enum State_t
+ {
+ kState_LockingInitiated = 0,
+ kState_LockingCompleted,
+ kState_UnlockingInitiated,
+ kState_UnlockingCompleted,
+ } State;
+
+ int Init();
+ bool IsUnlocked();
+ void EnableAutoRelock(bool aOn);
+ void SetAutoLockDuration(uint32_t aDurationInSecs);
+ bool IsActionInProgress();
+ bool InitiateAction(int32_t aActor, Action_t aAction);
+
+ typedef void (*Callback_fn_initiated)(Action_t, int32_t aActor);
+ typedef void (*Callback_fn_completed)(Action_t);
+ void SetCallbacks(Callback_fn_initiated aActionInitiated_CB, Callback_fn_completed aActionCompleted_CB);
+
+private:
+ friend BoltLockManager & BoltLockMgr(void);
+ State_t mState;
+
+ Callback_fn_initiated mActionInitiated_CB;
+ Callback_fn_completed mActionCompleted_CB;
+
+ bool mAutoRelock;
+ uint32_t mAutoLockDuration;
+ bool mAutoLockTimerArmed;
+ TimerHandle_t mTimerHandle;
+
+ void CancelTimer(void);
+ void StartTimer(uint32_t aTimeoutMs);
+
+ static void TimerEventHandler(TimerHandle_t aTimer);
+ static void AutoReLockTimerEventHandler(AppEvent * aEvent);
+ static void ActuatorMovementTimerEventHandler(AppEvent * aEvent);
+
+ static BoltLockManager sLock;
+};
+
+inline BoltLockManager & BoltLockMgr(void)
+{
+ return BoltLockManager::sLock;
+}
+
+#endif // LOCK_MANAGER_H
diff --git a/examples/lock-app/cc32xx/main/CXXExceptionStubs.cpp b/examples/lock-app/cc32xx/main/CXXExceptionStubs.cpp
new file mode 100755
index 0000000..a4ef513
--- /dev/null
+++ b/examples/lock-app/cc32xx/main/CXXExceptionStubs.cpp
@@ -0,0 +1,80 @@
+/*
+ *
+ * Copyright (c) 2019 Google LLC.
+ * All rights reserved.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/**
+ * @file
+ * Stub implementations of the C++ ABI exception handling functions.
+ *
+ * These functions replace the standard C++ exception code from the system's
+ * C++ runtime library with stub implementations that simply abort. This
+ * reduces overall code size as well as eliminating some calls to malloc()
+ * that occur during global initialization (see the code in eh_alloc.cc).
+ * This provides significant memory savings on resource constrained devices
+ * that don't use exceptions.
+ *
+ */
+
+#include <stdlib.h>
+
+extern "C" {
+
+void * __cxa_allocate_exception(size_t)
+{
+ abort();
+}
+
+void __cxa_free_exception(void *)
+{
+ abort();
+}
+
+void * __cxa_allocate_dependent_exception()
+{
+ abort();
+}
+
+void __cxa_free_dependent_exception(void *)
+{
+ abort();
+}
+
+void __cxa_throw(void *, void *, void (*)(void *))
+{
+ abort();
+}
+
+void __cxa_rethrow()
+{
+ abort();
+}
+
+void * __cxa_begin_catch(void *)
+{
+ abort();
+}
+
+void __cxa_end_catch()
+{
+ abort();
+}
+
+void * __cxa_get_exception_ptr(void *)
+{
+ abort();
+}
+}
diff --git a/examples/lock-app/cc32xx/main/ZclCallbacks.cpp b/examples/lock-app/cc32xx/main/ZclCallbacks.cpp
new file mode 100644
index 0000000..f3b3526
--- /dev/null
+++ b/examples/lock-app/cc32xx/main/ZclCallbacks.cpp
@@ -0,0 +1,56 @@
+/*
+ *
+ * Copyright (c) 2020 Project CHIP Authors
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include "AppConfig.h"
+#include "BoltLockManager.h"
+
+#include <app-common/zap-generated/ids/Attributes.h>
+#include <app-common/zap-generated/ids/Clusters.h>
+#include <app/ConcreteAttributePath.h>
+#include <lib/support/logging/CHIPLogging.h>
+
+using namespace ::chip;
+using namespace ::chip::app::Clusters;
+
+void MatterPostAttributeChangeCallback(const chip::app::ConcreteAttributePath & attributePath, uint8_t type, uint16_t size,
+ uint8_t * value)
+{
+ if (attributePath.mClusterId == OnOff::Id && attributePath.mAttributeId == OnOff::Attributes::OnOff::Id)
+ {
+ BoltLockMgr().InitiateAction(0, *value ? BoltLockManager::LOCK_ACTION : BoltLockManager::UNLOCK_ACTION);
+ }
+}
+
+/** @brief OnOff Cluster Init
+ *
+ * This function is called when a specific cluster is initialized. It gives the
+ * application an opportunity to take care of cluster initialization procedures.
+ * It is called exactly once for each endpoint where cluster is present.
+ *
+ * @param endpoint Ver.: always
+ *
+ * TODO Issue #3841
+ * emberAfOnOffClusterInitCallback happens before the stack initialize the cluster
+ * attributes to the default value.
+ * The logic here expects something similar to the deprecated Plugins callback
+ * emberAfPluginOnOffClusterServerPostInitCallback.
+ *
+ */
+void emberAfOnOffClusterInitCallback(EndpointId endpoint)
+{
+ // TODO: implement any additional Cluster Server init actions
+}
diff --git a/examples/lock-app/cc32xx/main/cc32xxWifiInit.c b/examples/lock-app/cc32xx/main/cc32xxWifiInit.c
new file mode 100644
index 0000000..03bb5c1
--- /dev/null
+++ b/examples/lock-app/cc32xx/main/cc32xxWifiInit.c
@@ -0,0 +1,243 @@
+/*
+ *
+ * Copyright (c) 2020 Project CHIP Authors
+ * Copyright (c) 2020 Texas Instruments Incorporated
+ * All rights reserved.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+//****************************************************************************
+//
+//! \addtogroup
+//! @{
+//
+//****************************************************************************
+
+/* Standard Include */
+#include <assert.h>
+#include <mqueue.h>
+#include <pthread.h>
+#include <stdint.h>
+#include <stdlib.h>
+#include <string.h>
+#include <time.h>
+#include <unistd.h>
+
+/* TI-DRIVERS Header files */
+#include <ti/drivers/net/wifi/simplelink.h>
+#include <ti/drivers/net/wifi/slwificonn.h>
+
+#include <ti/devices/cc32xx/inc/hw_types.h>
+
+#include <ti/devices/cc32xx/driverlib/rom_map.h>
+
+#include <ti/devices/cc32xx/driverlib/pin.h>
+#include <ti/devices/cc32xx/driverlib/prcm.h>
+
+#include "ti_drivers_config.h"
+#include <ti/drivers/GPIO.h>
+#include <ti/drivers/SPI.h>
+#include <ti/drivers/apps/Button.h>
+#include <ti/drivers/apps/LED.h>
+#include <ti/net/slnet.h>
+#include <ti/net/slnetconn.h>
+#include <ti/net/slnetif.h>
+
+#include "utils_if.h"
+#include "wifi_if.h"
+
+#include <AppConfig.h>
+int CHIP_IF_init();
+
+/* Application Version and Naming*/
+#define APPLICATION_NAME "CC32XX-MATTER:: E-LOCK"
+#define APPLICATION_VERSION "01.00.00.00"
+
+/* USER's defines */
+#define SLNETCONN_TASK_STACK_SIZE (2048)
+#define DISPLAY_TASK_STACK_SIZE (512)
+
+/****************************************************************************
+ LOCAL FUNCTION PROTOTYPES
+ ****************************************************************************/
+static void ButtonLeftEventHandler(Button_Handle handle, Button_EventMask events);
+
+/****************************************************************************
+ EXT. FUNCTION PROTOTYPES
+ ****************************************************************************/
+extern void LWIP_IF_start();
+
+/****************************************************************************
+ GLOBAL VARIABLES
+ ****************************************************************************/
+pthread_t gSlNetConnThread = (pthread_t) NULL;
+Button_Handle gButtonLeftHandle, gButtonRightHandle;
+LED_Handle gLedBlueHandle, gLedGreenHandle, gLedRedHandle;
+
+/****************************************************************************
+ STATIC VARIABLES
+ ****************************************************************************/
+static bool gIsConnected = 0;
+
+//*****************************************************************************
+// Local Functions
+//*****************************************************************************
+
+void SimpleLinkSockEventHandler(SlSockEvent_t * pSock)
+{
+ /* Unused in this application */
+}
+
+void SimpleLinkHttpServerEventHandler(SlNetAppHttpServerEvent_t * pHttpEvent, SlNetAppHttpServerResponse_t * pHttpResponse)
+{
+ /* Unused in this application */
+}
+
+void SimpleLinkNetAppRequestEventHandler(SlNetAppRequest_t * pNetAppRequest, SlNetAppResponse_t * pNetAppResponse)
+{
+ /* Unused in this application */
+}
+
+void SimpleLinkNetAppRequestMemFreeEventHandler(uint8_t * buffer)
+{
+ /* Unused in this application */
+}
+
+//*****************************************************************************
+//
+//! \brief Application startup display on UART
+//!
+//! \param none
+//!
+//! \return none
+//!
+//*****************************************************************************
+void DisplayBanner()
+{
+ cc32xxLog("\n\n\n\r");
+ cc32xxLog("\t\t *************************************************\n\r");
+ cc32xxLog("\t\t %s Application \n\r", APPLICATION_NAME);
+ cc32xxLog("\t\t %s \n\r", APPLICATION_VERSION);
+ cc32xxLog("\t\t *************************************************\n\r");
+ cc32xxLog("\n\n\n\r");
+}
+
+//*****************************************************************************
+//
+//! \brief SlWifiConn Event Handler
+//!
+//*****************************************************************************
+void SlNetConnEventHandler(uint32_t ifID, SlNetConnStatus_e netStatus, void * data)
+{
+ switch (netStatus)
+ {
+ case SLNETCONN_STATUS_CONNECTED_MAC:
+ gIsConnected = 1;
+ LED_setOn(gLedBlueHandle, LED_BRIGHTNESS_MAX);
+ cc32xxLog("[SlNetConnEventHandler] I/F %d - CONNECTED (MAC LEVEL)!\n\r", ifID);
+ break;
+ case SLNETCONN_STATUS_CONNECTED_IP:
+ gIsConnected = 1;
+ cc32xxLog("[SlNetConnEventHandler] I/F %d - CONNECTED (IP LEVEL)!\n\r", ifID);
+ break;
+ case SLNETCONN_STATUS_CONNECTED_INTERNET:
+ gIsConnected = 1;
+ cc32xxLog("[SlNetConnEventHandler] I/F %d - CONNECTED (INTERNET LEVEL)!\n\r", ifID);
+ break;
+ case SLNETCONN_STATUS_WAITING_FOR_CONNECTION:
+ case SLNETCONN_STATUS_DISCONNECTED:
+ gIsConnected = 0;
+ LED_setOff(gLedBlueHandle);
+ cc32xxLog("[SlNetConnEventHandler] I/F %d - DISCONNECTED!\n\r", ifID);
+ break;
+ default:
+ cc32xxLog("[SlNetConnEventHandler] I/F %d - UNKNOWN STATUS\n\r", ifID);
+ break;
+ }
+}
+
+//*****************************************************************************
+//
+//! \brief Launchpad switch used to enable one shot provisioning
+//!
+//*****************************************************************************
+static void ButtonLeftEventHandler(Button_Handle handle, Button_EventMask events)
+{
+ // Enable Provisioning
+ int retVal = SlWifiConn_enableProvisioning(WifiProvMode_ONE_SHOT, PROVISIONING_CMD, 0);
+ assert(retVal == 0);
+}
+
+//*****************************************************************************
+//
+//! \brief Main application thread
+//!
+//! \param none
+//!
+//! \return none
+//!
+//*****************************************************************************
+int WiFi_init()
+{
+ int retVal;
+ Button_Params buttonParams;
+ LED_Params ledParams;
+
+ SPI_init();
+
+#ifdef NWP_LOG
+ // NWP log config
+ // If your application already has UART0 configured, no need for this line
+ MAP_PRCMPeripheralClkEnable(PRCM_UARTA0, PRCM_RUN_MODE_CLK);
+ // Mux Pin 62 to mode 1 for outputting NWP logs
+ MAP_PinTypeUART(PIN_62, PIN_MODE_1);
+#endif
+
+ LED_Params_init(&ledParams); // default PWM LED
+ gLedBlueHandle = LED_open(CONFIG_LED_BLUE, &ledParams);
+ LED_setOff(gLedBlueHandle);
+
+ Button_Params_init(&buttonParams);
+ buttonParams.buttonEventMask = Button_EV_CLICKED | Button_EV_LONGCLICKED;
+ buttonParams.longPressDuration = 1000U; // ms
+ gButtonLeftHandle = Button_open(CONFIG_BTN_LEFT, &buttonParams);
+ Button_setCallback(gButtonLeftHandle, ButtonLeftEventHandler);
+
+ /* Enable SlWifiConn */
+ retVal = WIFI_IF_init();
+ assert(retVal >= 0);
+
+ /* Enable SlNet framework */
+ retVal = ti_net_SlNet_initConfig();
+ assert(retVal == 0);
+
+ /* Enable SlNetConn */
+ retVal = SlNetConn_init(0);
+ assert(retVal == 0);
+ gSlNetConnThread = OS_createTask(1, SLNETCONN_TASK_STACK_SIZE, SlNetConn_process, NULL, OS_TASK_FLAG_DETACHED);
+ assert(gSlNetConnThread);
+
+ return (retVal);
+}
+
+int WiFi_deinit()
+{
+ int retVal;
+ cc32xxLog("[APP] Networking App Completed (entering low power mode)\r\n ");
+ retVal = SlNetConn_stop(SlNetConnEventHandler);
+ retVal = WIFI_IF_deinit();
+ cc32xxLog("[APP] Exit (%d) \r\n", retVal);
+ assert(retVal == 0);
+ return (retVal);
+}
diff --git a/examples/lock-app/cc32xx/main/debug_settings.h b/examples/lock-app/cc32xx/main/debug_settings.h
new file mode 100644
index 0000000..61cefd3
--- /dev/null
+++ b/examples/lock-app/cc32xx/main/debug_settings.h
@@ -0,0 +1,42 @@
+/*
+ *
+ * Copyright (c) 2021 Project CHIP Authors
+ * All rights reserved.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+//*****************************************************************************
+// Includes
+//*****************************************************************************
+// Standard includes
+#ifndef DEBUG_SETTINGS_H
+#define DEBUG_SETTINGS_H
+
+// Select the print method used in the main app
+#define D_DEBUG_METHOD D_USER_DEFINED
+
+// Select Sevrity Color
+#define _FATAL_CLR_ _CLR_B_RED_
+#define _ERROR_CLR_ _CLR_RED_
+#define _WARNING_CLR_ _CLR_MAGENTA_
+#define _INFO_CLR_ _CLR_GREEN_
+#define _DEBUG_CLR_ _CLR_YELLOW_
+#define _TRACE_CLR_ _CLR_RESET_
+
+#if (D_DEBUG_METHOD == D_USER_DEFINED)
+extern void cc32xxLog(const char * msg, ...);
+#define PRINTF(...) cc32xxLog(__VA_ARGS__);
+#endif
+
+#endif // DEBUG_SETTINGS_H
diff --git a/examples/lock-app/cc32xx/main/include/CHIPProjectConfig.h b/examples/lock-app/cc32xx/main/include/CHIPProjectConfig.h
new file mode 100644
index 0000000..d5187cc
--- /dev/null
+++ b/examples/lock-app/cc32xx/main/include/CHIPProjectConfig.h
@@ -0,0 +1,150 @@
+/*
+ * Copyright (c) 2020 Project CHIP Authors
+ * Copyright (c) 2019 Google LLC.
+ * All rights reserved.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/**
+ * @file
+ * Example project configuration file for CHIP.
+ *
+ * This is a place to put application or project-specific overrides
+ * to the default configuration values for general CHIP features.
+ *
+ */
+
+#ifndef CHIP_PROJECT_CONFIG_H
+#define CHIP_PROJECT_CONFIG_H
+
+#if BUILD_RELEASE // release build
+
+// Security and Authentication enabled for release build.
+#define CHIP_CONFIG_SECURITY_TEST_MODE 0
+#define CHIP_CONFIG_REQUIRE_AUTH 1
+
+#else // development build
+
+// Security and Authentication disabled for development build.
+// For convenience, enable CHIP Security Test Mode and disable the requirement for
+// authentication in various protocols.
+// WARNING: These options make it possible to circumvent basic CHIP security functionality,
+// including message encryption. Because of this they MUST NEVER BE ENABLED IN PRODUCTION BUILDS.
+#define CHIP_CONFIG_SECURITY_TEST_MODE 0
+#define CHIP_CONFIG_REQUIRE_AUTH 0
+
+/**
+ * CHIP_DEVICE_CONFIG_ENABLE_TEST_DEVICE_IDENTITY
+ *
+ * Enables the use of a hard-coded default CHIP device id and credentials if no device id
+ * is found in CHIP NV storage.
+ *
+ * This option is for testing only and should be disabled in production releases.
+ */
+#define CHIP_DEVICE_CONFIG_ENABLE_TEST_DEVICE_IDENTITY 34
+
+// Use a default pairing code if one hasn't been provisioned in flash.
+#define CHIP_DEVICE_CONFIG_USE_TEST_SETUP_PIN_CODE 20202021
+#define CHIP_DEVICE_CONFIG_USE_TEST_SETUP_DISCRIMINATOR 0xF00
+
+// Use a default pairing code if one hasn't been provisioned in flash.
+#define CHIP_DEVICE_CONFIG_USE_TEST_PAIRING_CODE "CHIPUS"
+
+/**
+ * CHIP_DEVICE_CONFIG_USE_TEST_SERIAL_NUMBER
+ *
+ * Enables the use of a hard-coded default serial number if none
+ * is found in CHIP NV storage.
+ */
+#define CHIP_DEVICE_CONFIG_USE_TEST_SERIAL_NUMBER "DUMMY_SN"
+
+#endif // BUILD_RELEASE
+
+/**
+ * CHIP_DEVICE_CONFIG_DEVICE_VENDOR_ID
+ *
+ * 0xE100: Google's Vendor Id.
+ */
+#define CHIP_DEVICE_CONFIG_DEVICE_VENDOR_ID 0xFFF1
+
+/**
+ * CHIP_DEVICE_CONFIG_DEVICE_PRODUCT_ID
+ *
+ * 0xFE00: SDK Sample Lock Resource
+ */
+#define CHIP_DEVICE_CONFIG_DEVICE_PRODUCT_ID 0x8006
+
+/**
+ * CHIP_DEVICE_CONFIG_DEVICE_PRODUCT_REVISION
+ *
+ * The product revision number assigned to device or product by the device vendor. This
+ * number is scoped to the device product id, and typically corresponds to a revision of the
+ * physical device, a change to its packaging, and/or a change to its marketing presentation.
+ * This value is generally *not* incremented for device software revisions.
+ */
+#define CHIP_DEVICE_CONFIG_DEVICE_PRODUCT_REVISION 1
+
+/**
+ * CHIP_DEVICE_CONFIG_DEVICE_FIRMWARE_REVISION
+ *
+ * A string identifying the firmware revision running on the device.
+ * CHIP currently expects the firmware version to be in the format
+ * {MAJOR_VERSION}.0d{MINOR_VERSION}
+ */
+#ifndef CHIP_DEVICE_CONFIG_DEVICE_FIRMWARE_REVISION
+#define CHIP_DEVICE_CONFIG_DEVICE_FIRMWARE_REVISION "1.0d1"
+#endif
+/**
+ * CHIP_DEVICE_CONFIG_ENABLE_CHIPOBLE
+ *
+ * Enable support for CHIP-over-BLE (CHIPOBLE).
+ */
+#define CHIP_DEVICE_CONFIG_ENABLE_CHIPOBLE 0
+
+/**
+ * CHIP_DEVICE_CONFIG_ENABLE_CHIP_TIME_SERVICE_TIME_SYNC
+ *
+ * Enables synchronizing the device's real time clock with a remote CHIP Time service
+ * using the CHIP Time Sync protocol.
+ */
+//#define CHIP_DEVICE_CONFIG_ENABLE_CHIP_TIME_SERVICE_TIME_SYNC 1
+
+/**
+ * CHIP_CONFIG_EVENT_LOGGING_UTC_TIMESTAMPS
+ *
+ * Enable recording UTC timestamps.
+ */
+#define CHIP_CONFIG_EVENT_LOGGING_UTC_TIMESTAMPS 1
+
+/**
+ * CHIP_DEVICE_CONFIG_EVENT_LOGGING_DEBUG_BUFFER_SIZE
+ *
+ * A size, in bytes, of the individual debug event logging buffer.
+ */
+#define CHIP_DEVICE_CONFIG_EVENT_LOGGING_DEBUG_BUFFER_SIZE (512)
+
+/**
+ * CHIP_CONFIG_EVENT_LOGGING_DEFAULT_IMPORTANCE
+ *
+ * For a development build, set the default importance of events to be logged as Debug.
+ * Since debug is the lowest importance level, this means all standard, critical, info and
+ * debug importance level vi events get logged.
+ */
+#if BUILD_RELEASE
+#define CHIP_CONFIG_EVENT_LOGGING_DEFAULT_IMPORTANCE chip::Profiles::DataManagement::Production
+#else
+#define CHIP_CONFIG_EVENT_LOGGING_DEFAULT_IMPORTANCE chip::Profiles::DataManagement::Debug
+#endif // BUILD_RELEASE
+
+#endif // CHIP_PROJECT_CONFIG_H
diff --git a/examples/lock-app/cc32xx/main/main.cpp b/examples/lock-app/cc32xx/main/main.cpp
new file mode 100644
index 0000000..4546931
--- /dev/null
+++ b/examples/lock-app/cc32xx/main/main.cpp
@@ -0,0 +1,76 @@
+/*
+ *
+ * Copyright (c) 2020 Project CHIP Authors
+ * Copyright (c) 2020 Texas Instruments Incorporated
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include <stdbool.h>
+#include <stdint.h>
+
+#include <lib/support/CHIPMem.h>
+#include <lib/support/CHIPPlatformMemory.h>
+#include <mbedtls/platform.h>
+#include <platform/CHIPDeviceLayer.h>
+
+#include <AppConfig.h>
+#include <AppTask.h>
+
+#include <FreeRTOS.h>
+
+/* Driver Header files */
+#include <ti/drivers/Board.h>
+#include <ti/drivers/GPIO.h>
+#include <ti/drivers/NVS.h>
+
+using namespace ::chip;
+using namespace ::chip::Inet;
+using namespace ::chip::DeviceLayer;
+
+// ================================================================================
+// FreeRTOS Callbacks
+// ================================================================================
+extern "C" void vApplicationStackOverflowHook(void)
+{
+ while (1)
+ {
+ ;
+ }
+}
+
+// ================================================================================
+// Main Code
+// ================================================================================
+int main(void)
+{
+ Board_init();
+ GPIO_init();
+
+ mbedtls_platform_set_calloc_free(CHIPPlatformMemoryCalloc, CHIPPlatformMemoryFree);
+
+ int ret = GetAppTask().StartAppTask();
+ if (ret != 0)
+ {
+ // can't log until the kernel is started
+ // PLAT_LOG("GetAppTask().StartAppTask() failed");
+ while (1)
+ ;
+ }
+
+ vTaskStartScheduler();
+
+ // Should never get here.
+ while (1)
+ ;
+}
diff --git a/examples/lock-app/cc32xx/main/wifi_settings.h b/examples/lock-app/cc32xx/main/wifi_settings.h
new file mode 100644
index 0000000..6fdf1f6
--- /dev/null
+++ b/examples/lock-app/cc32xx/main/wifi_settings.h
@@ -0,0 +1,103 @@
+/*
+ *
+ * Copyright (c) 2021 Project CHIP Authors
+ * All rights reserved.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+//*****************************************************************************
+// Includes
+//*****************************************************************************
+// Standard includes
+#ifndef WIFI_SETTINGS_H
+#define WIFI_SETTINGS_H
+
+//*****************************************************************************
+// WIFI IF INTRODUCTION
+//*****************************************************************************
+/* This module enables an easy integration of Wi-Fi to a SimpleLink Networking
+ * framework.
+ * It was designed for applications that use the Wi-Fi Station role only.
+ * The simple API and settings enables the user to initiate the Wi-Fi and
+ * configure the provisioning method that will be used upon first connection
+ * attempt.
+ * Upon successful init (WIFI_IF_init()), the system enables the NWP for any
+ * SL commands.
+ * The NWP will be in a low power state (AUTO-CONNECT will be disabled) waiting
+ * for connection request (SlNetConn_Start()).
+ * User should not call sl_Start/sl_Stop when using this module. Please use
+ * WIFI_IF_restart() (for reseting the NWP) or WIFI_IF_deinit() instead.
+ */
+
+//*****************************************************************************
+// WIFI IF USER SETTINGS
+//*****************************************************************************
+
+/*
+ * Defines the minimum severity level allowed.
+ * Use E_DEBUG to enable Wifi internal messages
+ * Options: E_TRACE, E_DEBUG, E_INFO, E_WARNING, E_ERROR, E_FATAL
+ */
+#define WIFI_IF_DEBUG_LEVEL E_INFO
+
+/*
+ * Defines Provisioning (initial) Parameters:
+ * Mode can be: WifiProvMode_OFF, WifiProvMode_ON, WifiProvMode_ONE_SHOT
+ * Command can be one of the following:
+ * SL_WLAN_PROVISIONING_CMD_START_MODE_AP,
+ * SL_WLAN_PROVISIONING_CMD_START_MODE_SC,
+ * SL_WLAN_PROVISIONING_CMD_START_MODE_APSC,
+ * SL_WLAN_PROVISIONING_CMD_START_MODE_APSC_EXTERNAL_CONFIGURATION,
+ * SL_WLAN_PROVISIONING_CMD_START_MODE_EXTERNAL_CONFIGURATION
+ */
+#define PROVISIONING_MODE WifiProvMode_ONE_SHOT
+#define PROVISIONING_CMD SL_WLAN_PROVISIONING_CMD_START_MODE_APSC
+
+/*
+ * Defines Provisioning AP /SC Parameters:
+ */
+#define PROVISIONING_TIMEOUT 0 // 0 - use default
+#define PROVISIONING_AP_PASSWORD "1234567890" // NULL - use default (OPEN)
+#define PROVISIONING_SC_KEY "1234567890123456" // NULL - use defaults
+
+/* Force provisioning by deleting existing profiles.
+ * To be used for testing during development only.
+ * Note: When FORCE_PROVSIONING is enabled - the following static profile
+ * configurations are ignored
+ */
+#define FORCE_PROVISIONING (0)
+
+/* Static Profile setting - Method 1: Hard coded
+ * Define AP_SSID and optionally AP_PASSWORD - to connect to local network
+ * Hard-Coded Definition: update AP_SSID and AP_PASSWORD (NULL means OPEN, else is WPA2)
+ */
+#define AP_SSID NULL // "network-name"
+#define AP_PASSWORD NULL // "network-password"
+
+/* Static Profile setting - Method 2: Configuration file
+ * File format should be:
+ * "<network-name>' '<network-password>"
+ * i.e. ssid and password with one space character between them
+ * Do not use newline, extra space symbols or quotation mark
+ */
+#define AP_CFG_FILENAME "network.cfg" // config file name
+#define AP_CFG_TOKEN 12345678 // config file read access token
+#define AP_CFG_MAX_SIZE 100 // config file Maximum file length
+
+/* Define (if needed) the external handle for TI Driver's LED for wi-fi status:
+ * off: disconnected, blinking: provisionig, on: connected
+ * Comment the definition in case the auto control is not required */
+#define WIFI_LED_HANDLE gLedBlueHandle
+
+#endif // WIFI_SETTINGS_H
diff --git a/examples/lock-app/cc32xx/third_party/connectedhomeip b/examples/lock-app/cc32xx/third_party/connectedhomeip
new file mode 120000
index 0000000..11a54ed
--- /dev/null
+++ b/examples/lock-app/cc32xx/third_party/connectedhomeip
@@ -0,0 +1 @@
+../../../../
\ No newline at end of file