Skip to content

Commit 4f0521f

Browse files
Initial support of the Texas Instruments CC13X2 CC26X2 MCU family (project-chip#4027)
* Initial support of the Texas Instruments CC13X2 CC26X2 MCU family * Update headers to match repository * Switched License header to Apache 2.0 for SysConfig file. * Replaced C ternary statements with boolean returns. * Replaced Pre-processor include guards with `#pragma once`. * Removed unnecessary forward declarations. * Restyled by whitespace * Restyled by clang-format * Restyled by gn * Restyled by prettier-markdown * fix whitespace (tab) issue from restyled * fix clang-format build issues from restyled Includes for board specific header files need path delimiters. * Restyled by whitespace * revert incorrect changes to m5stack-tft repo * remove common nv driver Revert to using the SDK version of the common nv driver and enable the POSIX-like porting layer. * remove ti sdk files Revert to using the platform support files in the board specific example from the TI SDK. This adds a step to installing the TI SDK to fix-up changes to work with the development version of OpenThread. * Restyled by clang-format * Restyled by gn * Restyled by prettier-markdown * add freertos as a submodule * move openthread platform to simplelink build file * clean up build graph * fix OpenThread configuration to match TI SDK * update lwip config header * Restyled by clang-format * Restyled by gn * remove usage of $HOME This now requires the user to set the absolute locations of the TI SDK and SysConfig tools. * Restyled by prettier-markdown * fix build issues * size sha workspace for the CC13X2 CC26X2 * Restyled by gn * fix gn style and remove commented out code * fix cpp elif in efr32 * re-enable openthread on efr32 and disable on esp32 * align with other platform doxygen disable defines Co-authored-by: Restyled.io <commits@restyled.io>
1 parent 2c5ef7b commit 4f0521f

File tree

91 files changed

+5261
-13
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

91 files changed

+5261
-13
lines changed

.gitmodules

+4
Original file line numberDiff line numberDiff line change
@@ -66,3 +66,7 @@
6666
path = third_party/zap/repo
6767
url = https://github.com/project-chip/zap.git
6868
branch = master
69+
[submodule "freertos"]
70+
path = third_party/freertos/repo
71+
url = https://github.com/FreeRTOS/FreeRTOS-Kernel.git
72+
branch = V10.3.1-kernel-only

BUILD.gn

+12
Original file line numberDiff line numberDiff line change
@@ -123,6 +123,9 @@ if (current_toolchain != "${dir_pw_toolchain}/dummy:dummy") {
123123
# Enable building for Android.
124124
enable_android_builds = false
125125

126+
# Set this to true to enable TI builds by default.
127+
enable_cc13x2_26x2_builds = false
128+
126129
# Set this to true to enable efr32 builds by default.
127130
enable_efr32_builds = false
128131

@@ -157,6 +160,9 @@ if (current_toolchain != "${dir_pw_toolchain}/dummy:dummy") {
157160
enable_linux_lighting_app_build =
158161
enable_default_builds && (host_os == "linux" || host_os == "mac")
159162

163+
# Build the cc13x2_26x2 lock app example.
164+
enable_cc13x2_26x2_lock_app_build = enable_cc13x2_26x2_builds
165+
160166
# Build the efr32 lock app example.
161167
enable_efr32_lock_app_build = enable_efr32_builds
162168

@@ -215,6 +221,12 @@ if (current_toolchain != "${dir_pw_toolchain}/dummy:dummy") {
215221
}
216222
}
217223

224+
if (enable_cc13x2_26x2_lock_app_build) {
225+
group("cc13x2_26x2_lock_app") {
226+
deps = [ "${chip_root}/examples/lock-app/cc13x2_26x2(${chip_root}/config/cc13x2_26x2/toolchain:cc13x2_26x2_lock_app)" ]
227+
}
228+
}
229+
218230
if (enable_standalone_shell_build) {
219231
group("standalone_shell") {
220232
deps =

examples/build_overrides/freertos.gni

+18
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
# Copyright (c) 2020 Project CHIP Authors
2+
#
3+
# Licensed under the Apache License, Version 2.0 (the "License");
4+
# you may not use this file except in compliance with the License.
5+
# You may obtain a copy of the License at
6+
#
7+
# http://www.apache.org/licenses/LICENSE-2.0
8+
#
9+
# Unless required by applicable law or agreed to in writing, software
10+
# distributed under the License is distributed on an "AS IS" BASIS,
11+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
# See the License for the specific language governing permissions and
13+
# limitations under the License.
14+
15+
declare_args() {
16+
# Root directory for FreeRTOS
17+
freertos_root = "//third_party/connectedhomeip/third_party/freertos"
18+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
# Copyright (c) 2020 Project CHIP Authors
2+
#
3+
# Licensed under the Apache License, Version 2.0 (the "License");
4+
# you may not use this file except in compliance with the License.
5+
# You may obtain a copy of the License at
6+
#
7+
# http://www.apache.org/licenses/LICENSE-2.0
8+
#
9+
# Unless required by applicable law or agreed to in writing, software
10+
# distributed under the License is distributed on an "AS IS" BASIS,
11+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
# See the License for the specific language governing permissions and
13+
# limitations under the License.
14+
15+
declare_args() {
16+
# Root directory for TI SimpleLink SDK build helpers.
17+
ti_simplelink_sdk_build_root =
18+
"//third_party/connectedhomeip/third_party/ti_simplelink_sdk"
19+
}

examples/lighting-app/efr32/src/AppTask.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -387,7 +387,7 @@ void AppTask::FunctionHandler(AppEvent * aEvent)
387387
{
388388
EFR32_LOG("Device is commissioned to a Thread network.");
389389
}
390-
#elif
390+
#else
391391
EFR32_LOG("Thread is not defined.");
392392
#endif
393393
}

examples/lock-app/cc13x2_26x2/.gn

+26
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
# Copyright (c) 2020 Project CHIP Authors
2+
#
3+
# Licensed under the Apache License, Version 2.0 (the "License");
4+
# you may not use this file except in compliance with the License.
5+
# You may obtain a copy of the License at
6+
#
7+
# http://www.apache.org/licenses/LICENSE-2.0
8+
#
9+
# Unless required by applicable law or agreed to in writing, software
10+
# distributed under the License is distributed on an "AS IS" BASIS,
11+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
# See the License for the specific language governing permissions and
13+
# limitations under the License.
14+
15+
# The location of the build configuration file.
16+
buildconfig = "//build/config/BUILDCONFIG.gn"
17+
18+
# CHIP uses angle bracket includes.
19+
check_system_includes = true
20+
21+
default_args = {
22+
target_cpu = "arm"
23+
target_os = "freertos"
24+
25+
import("//args.gni")
26+
}
+97
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,97 @@
1+
# Copyright (c) 2020 Project CHIP Authors
2+
#
3+
# Licensed under the Apache License, Version 2.0 (the "License");
4+
# you may not use this file except in compliance with the License.
5+
# You may obtain a copy of the License at
6+
#
7+
# http://www.apache.org/licenses/LICENSE-2.0
8+
#
9+
# Unless required by applicable law or agreed to in writing, software
10+
# distributed under the License is distributed on an "AS IS" BASIS,
11+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
# See the License for the specific language governing permissions and
13+
# limitations under the License.
14+
15+
import("//build/config/defaults.gni")
16+
import("//build_overrides/chip.gni")
17+
import("//build_overrides/openthread.gni")
18+
import("//build_overrides/ti_simplelink_sdk.gni")
19+
import("${ti_simplelink_sdk_build_root}/ti_simplelink_executable.gni")
20+
import("${ti_simplelink_sdk_build_root}/ti_simplelink_sdk.gni")
21+
22+
assert(current_os == "freertos")
23+
24+
project_dir = "${chip_root}/examples/lock-app/cc13x2_26x2"
25+
26+
ti_simplelink_sdk("sdk") {
27+
include_dirs = [ "${project_dir}/main/include" ]
28+
29+
defines = []
30+
if (is_debug) {
31+
defines += [ "BUILD_RELEASE=0" ]
32+
} else {
33+
defines += [ "BUILD_RELEASE=1" ]
34+
}
35+
}
36+
37+
ti_sysconfig("sysconfig") {
38+
sources = [ "${project_dir}/chip.syscfg" ]
39+
outputs = [
40+
"ti_devices_config.c",
41+
"ti_radio_config.c",
42+
"ti_radio_config.h",
43+
"ti_drivers_config.c",
44+
"ti_drivers_config.h",
45+
46+
# disabled until upstream generation is aligned
47+
#"tiop_config.h",
48+
#"tiop_config.c",
49+
50+
# not traditional source files
51+
#"ti_utils_build_linker.cmd.genlibs",
52+
#"syscfg_c.rov.xs",
53+
#"ti_utils_runtime_model.gv",
54+
#"ti_utils_runtime_Makefile",
55+
]
56+
}
57+
58+
ti_simplelink_executable("lock_app") {
59+
include_dirs = [
60+
"${chip_root}/src/app/util",
61+
"${chip_root}/src/app/server",
62+
"${project_dir}",
63+
"${project_dir}/main",
64+
"${project_dir}/main/include",
65+
]
66+
defines = []
67+
output_name = "chip-cc13x2_26x2-lock-example.out"
68+
69+
public_deps = [
70+
":sdk",
71+
":sysconfig",
72+
"${chip_root}/examples/lock-app/lock-common",
73+
"${chip_root}/src/lib",
74+
"${openthread_root}:libopenthread-cli-mtd",
75+
]
76+
77+
sources = [
78+
"${project_dir}/main/AppTask.cpp",
79+
"${project_dir}/main/BoltLockManager.cpp",
80+
"${project_dir}/main/ZclCallbacks.cpp",
81+
"${project_dir}/main/main.cpp",
82+
]
83+
84+
output_dir = root_out_dir
85+
86+
ldscript = "${ti_simplelink_sdk_root}/source/ti/boards/cc13x2_cc26x2/cc13x2_cc26x2_freertos.lds"
87+
88+
ldflags = [ "-T" + rebase_path(ldscript, root_build_dir) ]
89+
}
90+
91+
group("cc13x2_26x2") {
92+
deps = [ ":lock_app" ]
93+
}
94+
95+
group("default") {
96+
deps = [ ":cc13x2_26x2" ]
97+
}
+175
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,175 @@
1+
# CHIP CC1352 CC2652 Lock Example Application
2+
3+
An example application showing the use [CHIP][chip] on the Texas Instruments
4+
CC13X2_26X2 family of Wireless MCUs.
5+
6+
---
7+
8+
- [CHIP CC1352 CC2652 Lock Example Application](#chip-cc1352-cc2652-lock-example-application)
9+
- [Introduction](#introduction)
10+
- [Device UI](#device-ui)
11+
- [Building](#building)
12+
- [Preparation](#preparation)
13+
- [Compilation](#compilation)
14+
- [Programming](#programming)
15+
- [UniFlash](#uniflash)
16+
- [Code Composer Studio](#code-composer-studio)
17+
- [Viewing Logging Output](#viewing-logging-output)
18+
19+
---
20+
21+
## Introduction
22+
23+
![CC1352R1_LAUNCHXL](doc/images/cc1352r1_launchxl.jpg)
24+
25+
The CC13X2_26X2 lock example application provides a working demonstration of a
26+
connected door lock device. This uses the open-source CHIP implementation and
27+
the Texas Instruments SimpleLink™ CC13x2 and CC26x2 software development kit.
28+
29+
This example is enabled to build on all members of the `CC13X2_26X2` family of
30+
MCUs [recommended for Thread][ti_thread_dnd]. By default this example targets
31+
the [CC1352R1_LAUNCHXL][cc1352r1_launchxl] LaunchPad.
32+
33+
The lock example is intended to serve both as a means to explore the workings of
34+
CHIP, as well as a template for creating real products based on the Texas
35+
Instruments devices.
36+
37+
## Device UI
38+
39+
This example application has a simple User Interface to depict the state of the
40+
door lock and to control the state. The user LEDs on the LaunchPad are set on
41+
when the lock is locked, and are set off when unlocked. The LEDs will flash when
42+
in the transition state between locked and unlocked. The user buttons are used
43+
for requesting lock and unlock of the door lock. The left button (`BTN-1`) is
44+
used to request locking. The right button (`BTN-2`) us used to request
45+
unlocking.
46+
47+
## Building
48+
49+
### Preparation
50+
51+
Some initial setup is necessary for preparing the build environment. This
52+
section will need to be done when migrating to new versions of the SDK.
53+
54+
- Download and install the [SimpleLink™ CC13x2 and CC26x2 software development
55+
kit (SDK)][simplelink_sdk] ([4.30.00.54][simplelink_sdk_4.30.00.54])
56+
57+
- Follow the default installation instructions when executing the
58+
installer.
59+
60+
- The version of OpenThread used in this repository is newer than the one
61+
packaged with the TI SDK. Check the following section for a list of
62+
changes needed.
63+
64+
- Download and install [SysConfig][sysconfig]
65+
([sysconfig-1.5.0_1397][sysconfig-1.5.0_1397])
66+
67+
- This may have already been installed with your SimpleLink SDK install
68+
69+
- If you have installed different versions, the build defaults will need to be
70+
changed to reflect this in
71+
`${chip_root}/examples/build_overrides/ti_simplelink_sdk.gni`.
72+
73+
- Install Python 3.8 for the GN build system:
74+
75+
```
76+
# Linux
77+
$ sudo apt-get install python3.8 python3.8-distutils python3.8-dev python3.8-venv
78+
# Distutils listed due to a package manager error on Ubuntu 18.04
79+
80+
```
81+
82+
- You will have to ensure that the default version of Python 3 is Python
83+
3.8.
84+
85+
- run the bootstrap script to setup the build environment.
86+
87+
```
88+
$ cd ~/connectedhomeip
89+
$ source ./script/bootstrap.sh
90+
91+
```
92+
93+
#### Changes to the TI SDK
94+
95+
The OpenThread library will set the short address assigned to the device as soon
96+
as it receives the Child ID response. This may happen while the radio driver is
97+
still in transmit mode. This is easilly fixed by removing state check in the
98+
else condition in
99+
`${ti_simplelink_sdk_root}/examples/rtos/${ti_simplelink_board}/thread/cli_mtd/platform/radio.c`
100+
on linke 1791.
101+
102+
```
103+
- else if (sState != platformRadio_phyState_Transmit)
104+
+ else
105+
{
106+
sReceiveCmd.localShortAddr = aAddress;
107+
}
108+
```
109+
110+
### Compilation
111+
112+
It is necessary to activate the environment in every new shell. Then run GN and
113+
Ninja to build the executable.
114+
115+
- Activate the build environment with the repository activate script.
116+
117+
```
118+
$ cd ~/connectedhomeip
119+
$ source ./script/activate.sh
120+
121+
```
122+
123+
- Run the build to produce a default executable. By default on Linux both the
124+
TI SimpleLink SDK and Sysconfig are located in a `ti` folder in the user's
125+
home directory, and you must provide the absolute path to them. For example
126+
`/home/username/ti/simplelink_cc13x2_26x2_sdk_4_30_00_54` and
127+
`/home/username/ti/sysconfig_1.6.0`. On Windows the default directory is
128+
`C:\ti`
129+
130+
```
131+
$ cd ~/connectedhomeip/examples/lock-app/cc13x2_26x2
132+
$ export TI_SIMPLELINK_SDK_ROOT=<path-to-simplelink-sdk>
133+
$ export TI_SYSCONFIG_ROOT=<path-to-sysconfig-sdk>
134+
$ gn gen out/debug --args="ti_simplelink_sdk_root=\"${TI_SIMPLELINK_SDK_ROOT}\" ti_sysconfig_root=\"${TI_SYSCONFIG_ROOT}\""
135+
$ ninja -C out/debug
136+
137+
```
138+
139+
## Programming
140+
141+
Loading the built image onto a LaunchPad is supported through two methods;
142+
Uniflash and Code Composer Studio (CCS). UniFlash can be used to load the image.
143+
Code Composer Studio can be used to load the image and debug the source code.
144+
145+
### UniFlash
146+
147+
[Programming UniFlash](doc/programming-uniflash.md)
148+
149+
### Code Composer Studio
150+
151+
[Programming and Debugging with CCS](doc/programming-ccs.md)
152+
153+
## Viewing Logging Output
154+
155+
By default the log output will be sent to the Application/User UART. Open a
156+
terminal emulator to that port to see the output with the following options:
157+
158+
| Parameter | Value |
159+
| ------------ | -------- |
160+
| Speed (baud) | `115200` |
161+
| Data bits | `8` |
162+
| Stop bits | `1` |
163+
| Parity | `None` |
164+
| Flow control | `None` |
165+
166+
[chip]: https://github.com/project-chip/connectedhomeip
167+
[cc1352r1_launchxl]: https://www.ti.com/tool/LAUNCHXL-CC1352R1
168+
[simplelink_sdk]: https://www.ti.com/tool/SIMPLELINK-CC13X2-26X2-SDK
169+
[simplelink_sdk_4.30.00.54]:
170+
https://www.ti.com/tool/download/SIMPLELINK-CC13X2-26X2-SDK/4.30.00.54
171+
[sysconfig]: https://www.ti.com/tool/SYSCONFIG
172+
[sysconfig-1.5.0_1397]:
173+
http://software-dl.ti.com/ccs/esd/sysconfig/sysconfig-1.5.0_1397-setup.run
174+
[ti_thread_dnd]:
175+
https://www.ti.com/wireless-connectivity/thread/design-development.html

0 commit comments

Comments
 (0)