Skip to content

Commit

Permalink
Add initial framework to build TI Matter applications against prebuil…
Browse files Browse the repository at this point in the history
…t OT Libs (project-chip#32857)

* Add initial framework to build matter applications against prebuild Openthread library

* Fix Comment

* Restyled by whitespace

* Restyled by clang-format

* Restyled by gn

* Restyled by autopep8

* Restyled by isort

* Reference checked in libraries in lieu of wget/unzip

* Update library reference

---------

Co-authored-by: Restyled.io <[email protected]>
  • Loading branch information
adabreuti and restyled-commits authored Apr 15, 2024
1 parent bdf3e6e commit cb07513
Show file tree
Hide file tree
Showing 27 changed files with 228 additions and 524 deletions.
100 changes: 100 additions & 0 deletions docs/guides/ti/ti_openthread_library_usage.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,100 @@
# Configuring Openthread libraries on TI CC13x4 Platforms

## Overview

TI Matter example applications provide configuration option for how Thread code
is included in the build. Thread code can be included in as (1) full source or
(2) as optimized for matter thread certified library. The library builds have
been optimized for matter to disable features such as Thread Joiner capability
in order to save on Flash/RAM usage.

Build arguments have been added to enable Matter applications to link against
certified Openthread FTD/MTD libraries or custom user libraries.

## Platform Code Changes

To configure a TI example to utilize either an Openthread source or library
build, open up the `args.gni` file of the example:

To configure the device as an FTD or MTD, set following parameter to either true
or false respectively.

```
chip_openthread_ftd = true
```

- **Openthread Library From Source**:

1. `ot_ti_lib_dir` Is set to an empty string

```
ot_ti_lib_dir=""
```
2. `chip_openthread_target` Is set to an empty string
```
chip_openthread_target = ""
```
3. `openthread_external_platform` Points to the Openthread build dependency
```
openthread_external_platform="${chip_root}/third_party/openthread/platforms/ti:libopenthread-ti"
```
- **TI Certified Openthread Library**:
1. `ot_ti_lib_dir` Is set to an empty string
```
ot_ti_lib_dir=""
```
2. `chip_openthread_target` Points to the TI certified library dependency
```
chip_openthread_target = "${chip_root}/third_party/openthread/platforms/ti:ot-ti-cert"
```
3. `openthread_external_platform` Points to the Openthread build dependency
```
`openthread_external_platform="${chip_root}/third_party/openthread/platforms/ti:libopenthread-ti"`
```
- **Custom Openthread Library**:
1. `ot_ti_lib_dir` Points to a library directory containing a custom
`libopenthread-ftd/mtd` variant
```
ot_ti_lib_dir="${chip_root}/CUSTOM_LIB_DIR_PATH/"
```
2. `chip_openthread_target` Is set to an empty string
```
chip_openthread_target = ""
```
3. `openthread_external_platform` Points to the Openthread build dependency
```
openthread_external_platform="${chip_root}/third_party/openthread/platforms/ti:libopenthread-ti"
```
The TI Openthread certified library for the MTD/FTD configurations is based on
the following header file:
- `third_party/openthread/ot-ti/src/openthread-core-cc13xx_cc26xx-config-matter.h`
In order to update the Openthread configuration when building from source or a
custom library, users may adjust features via the following configuration header
file:
- `${chip_root}/examples/platform/cc13x4_26x4/project_include/OpenThreadConfig.h`
Please refer to TI's standalone Openthread Application build process for
instructions on acquiring FTD/MTD libraries as they are automatically built when
generating the standalone applications.
- `third_party/openthread/ot-ti/README.md`
27 changes: 27 additions & 0 deletions docs/guides/ti/ti_platform_overview.md
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,33 @@ CC2674P10 or the CC2674R10, please refer to the guide linked below.

<hr>

## Factory Data Programming Tool

For instructions on how to program custom factory data on TI devices, please
refer to the guide linked below.

- [TI Factory Data User Guide](./ti_factory_data_user_guide.md)

<hr>

## Intermittently Connected Devices

For instructions on how to use Matters' ICD feature on TI devices, please refer
to the guide linked below.

- [Enabling ICD On TI Devices](./enabling_icd_on_ti_devices.md)

<hr>

## Matter Openthread Library Configuration

For instructions on how to configure the Openthread build configuration for a
Matter application, please refer to the guide linked below.

- [Openthread Library Configuration](./ti_openthread_library_usage.md)

<hr>

### TI Support

For technical support, please consider creating a post on TI's [E2E forum][e2e].
Expand Down
25 changes: 1 addition & 24 deletions examples/all-clusters-app/cc13x4_26x4/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -45,22 +45,6 @@ ti_sysconfig("sysconfig") {
"ti_ble_config.h",
"ti_dmm_application_policy.c",
"ti_dmm_application_policy.h",

# CCFG generation disabled for OTA-able application
#"ti_devices_config.c",
#"ti_devices_config.h",

# disabled until upstream generation is aligned
#"tiop_config.h",
#"tiop_config.c",

# not traditional source files
#"ti_utils_build_linker.cmd.genlibs",
#"syscfg_c.rov.xs",
#"ti_utils_runtime_model.gv",
#"ti_utils_runtime_Makefile",
#"ti_ble_app_config.opt",
#"ti_build_config.opt",
]

public_configs = [ ":sdk_cc13x4_26x4_dmm_config" ]
Expand Down Expand Up @@ -107,16 +91,9 @@ ti_simplelink_executable("all-clusters-app") {
"${chip_root}/examples/all-clusters-app/all-clusters-common",
"${chip_root}/examples/platform/cc13x4_26x4:cc13x4_26x4-attestation-credentials",
"${chip_root}/src/lib",
"${chip_root}/third_party/openthread:openthread",
]

if (chip_openthread_ftd) {
deps += [ "${chip_root}/third_party/openthread/repo:libopenthread-ftd" ]
} else {
deps += [ "${chip_root}/third_party/openthread/repo:libopenthread-mtd" ]
}

defines = []

if (custom_factory_data) {
defines += [ "CC13XX_26XX_FACTORY_DATA" ]
}
Expand Down
7 changes: 4 additions & 3 deletions examples/all-clusters-app/cc13x4_26x4/args.gni
Original file line number Diff line number Diff line change
Expand Up @@ -30,13 +30,14 @@ lwip_debug = false

chip_enable_ota_requestor = true

openthread_external_platform = "${chip_root}/third_party/openthread/platforms/cc13x4_26x4:libopenthread-cc13x4_cc26x4"
openthread_external_platform =
"${chip_root}/third_party/openthread/platforms/ti:libopenthread-ti"
chip_openthread_target = ""

chip_openthread_ftd = true

# Disable CHIP Logging
#chip_progress_logging = false

# Disable verbose logs for all-clusters app to save Flash
#chip_detail_logging = false
#chip_automation_logging = false

Expand Down

This file was deleted.

21 changes: 1 addition & 20 deletions examples/lighting-app/cc13x4_26x4/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -49,18 +49,6 @@ ti_sysconfig("sysconfig") {
# CCFG generation disabled for OTA-able application
#"ti_devices_config.c",
#"ti_devices_config.h",

# disabled until upstream generation is aligned
#"tiop_config.h",
#"tiop_config.c",

# not traditional source files
#"ti_utils_build_linker.cmd.genlibs",
#"syscfg_c.rov.xs",
#"ti_utils_runtime_model.gv",
#"ti_utils_runtime_Makefile",
#"ti_ble_app_config.opt",
#"ti_build_config.opt",
]

public_configs = [ ":sdk_cc13x4_26x4_dmm_config" ]
Expand Down Expand Up @@ -89,16 +77,9 @@ ti_simplelink_executable("lighting_app") {
"${chip_root}/examples/lighting-app/lighting-common",
"${chip_root}/examples/platform/cc13x4_26x4:cc13x4_26x4-attestation-credentials",
"${chip_root}/src/lib",
"${chip_root}/third_party/openthread:openthread",
]

if (chip_openthread_ftd) {
deps += [ "${chip_root}/third_party/openthread/repo:libopenthread-ftd" ]
} else {
deps += [ "${chip_root}/third_party/openthread/repo:libopenthread-mtd" ]
}

defines = []

if (custom_factory_data) {
defines += [ "CC13XX_26XX_FACTORY_DATA" ]
}
Expand Down
9 changes: 7 additions & 2 deletions examples/lighting-app/cc13x4_26x4/args.gni
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,13 @@ lwip_debug = false

chip_enable_ota_requestor = true

chip_openthread_ftd = false
openthread_external_platform = "${chip_root}/third_party/openthread/platforms/cc13x4_26x4:libopenthread-cc13x4_cc26x4"
chip_openthread_ftd = true

ot_ti_lib_dir = ""
openthread_external_platform =
"${chip_root}/third_party/openthread/platforms/ti:libopenthread-ti"

chip_openthread_target = ""

# Disable CHIP Logging
chip_progress_logging = true
Expand Down
17 changes: 1 addition & 16 deletions examples/lock-app/cc13x4_26x4/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -49,14 +49,6 @@ ti_sysconfig("sysconfig") {
# CCFG generation disabled for OTA-able application
#"ti_devices_config.c",
#"ti_devices_config.h",

# not traditional source files
#"ti_utils_build_linker.cmd.genlibs",
#"syscfg_c.rov.xs",
#"ti_utils_runtime_model.gv",
#"ti_utils_runtime_Makefile",
#"ti_ble_app_config.opt",
#"ti_build_config.opt",
]

public_configs = [ ":sdk_cc13x4_26x4_dmm_config" ]
Expand Down Expand Up @@ -93,16 +85,9 @@ ti_simplelink_executable("lock_app") {
"${chip_root}/examples/lock-app/lock-common",
"${chip_root}/examples/platform/cc13x4_26x4:cc13x4_26x4-attestation-credentials",
"${chip_root}/src/lib",
"${chip_root}/third_party/openthread:openthread",
]

if (chip_openthread_ftd) {
deps += [ "${chip_root}/third_party/openthread/repo:libopenthread-ftd" ]
} else {
deps += [ "${chip_root}/third_party/openthread/repo:libopenthread-mtd" ]
}

defines = []

if (custom_factory_data) {
defines += [ "CC13XX_26XX_FACTORY_DATA" ]
}
Expand Down
5 changes: 4 additions & 1 deletion examples/lock-app/cc13x4_26x4/args.gni
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,10 @@ lwip_debug = false
chip_enable_ota_requestor = true

chip_openthread_ftd = true
openthread_external_platform = "${chip_root}/third_party/openthread/platforms/cc13x4_26x4:libopenthread-cc13x4_cc26x4"
ot_ti_lib_dir = ""
openthread_external_platform =
"${chip_root}/third_party/openthread/platforms/ti:libopenthread-ti"
chip_openthread_target = ""

# Disable CHIP Logging
chip_progress_logging = true
Expand Down
Loading

0 comments on commit cb07513

Please sign in to comment.