-
Notifications
You must be signed in to change notification settings - Fork 2.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[CYW30739] Support OTA requestor app. (#14389)
* [CYW30739] Support OTA requestor app. * Add examples/ota-requestor-app/cyw30739 files. * Add OTAImageProcessorImpl for CYW30739. * Refine README files for CYW30739 apps. * Add a null check for HandleProcessBlock
- Loading branch information
Showing
29 changed files
with
1,670 additions
and
46 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 = "cyw30739" | ||
|
||
import("//args.gni") | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
# 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/cyw30739_sdk.gni") | ||
|
||
import("${cyw30739_sdk_build_root}/cyw30739_executable.gni") | ||
import("${cyw30739_sdk_build_root}/cyw30739_sdk.gni") | ||
|
||
cyw30739_project_dir = "${chip_root}/examples/ota-requestor-app/cyw30739" | ||
|
||
declare_args() { | ||
setupPinCode = 0 | ||
setupDiscriminator = 0 | ||
} | ||
|
||
cyw30739_sdk("sdk") { | ||
sources = [ "${cyw30739_project_dir}/include/CHIPProjectConfig.h" ] | ||
|
||
include_dirs = [ "${cyw30739_project_dir}/include" ] | ||
|
||
defines = [ | ||
"CHIP_DEVICE_CONFIG_USE_TEST_SETUP_PIN_CODE=${setupPinCode}", | ||
"CHIP_DEVICE_CONFIG_USE_TEST_SETUP_DISCRIMINATOR=${setupDiscriminator}", | ||
] | ||
} | ||
|
||
cyw30739_executable("ota_requestor_app") { | ||
output_name = "chip-cyw30739-ota-requestor-example.elf" | ||
|
||
sources = [ "src/main.cpp" ] | ||
|
||
deps = [ | ||
":sdk", | ||
"${chip_root}/examples/ota-requestor-app/ota-requestor-common", | ||
"${chip_root}/examples/shell/shell_common:shell_common", | ||
"${chip_root}/src/lib", | ||
] | ||
|
||
include_dirs = [ "include" ] | ||
} | ||
|
||
group("cyw30739") { | ||
deps = [ ":ota_requestor_app" ] | ||
} | ||
|
||
group("default") { | ||
deps = [ ":cyw30739" ] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,121 @@ | ||
# Matter CYW30739 OTA Requestor Example | ||
|
||
An example showing the use of the Matter OTA Requestor functionality on the | ||
Infineon CYW30739 platform. | ||
|
||
--- | ||
|
||
## Table of Contents | ||
|
||
- [CHIP CYW30739 OTA Requestor Example](#matter-cyw30739-ota-requestor-example) | ||
- [Introduction](#introduction) | ||
- [Building](#building) | ||
- [Flashing the Application](#flashing-the-application) | ||
- [Running the Complete Example](#running-the-complete-example) | ||
|
||
--- | ||
|
||
## Introduction | ||
|
||
The CYW30739 OTA Requestor example provides a baseline demonstration the Matter | ||
OTA Requestor functionality built with the Infineon Modustoolbox SDK. It can be | ||
controlled by a Matter controller over Thread network. | ||
|
||
The CYW30739 device can be commissioned over Bluetooth Low Energy where the | ||
device and the Matter controller will exchange security information with the | ||
Rendez-vous procedure. Target Thread Network information including the active | ||
dataset and CASE credentials are then provided. | ||
|
||
## Building | ||
|
||
- Build the example application: | ||
|
||
```bash | ||
$ cd ~/connectedhomeip | ||
$ git submodule update --init | ||
$ ./scripts/examples/gn_build_example.sh examples/ota-requestor-app/cyw30739 out/ota-requestor-app | ||
``` | ||
|
||
- To delete generated executable, libraries and object files use: | ||
|
||
```bash | ||
$ cd ~/connectedhomeip | ||
$ rm -rf ./out/ | ||
``` | ||
|
||
- OR use GN/Ninja directly | ||
|
||
```bash | ||
$ cd ~/connectedhomeip/examples/ota-requestor-app/cyw30739 | ||
$ git submodule update --init | ||
$ source third_party/connectedhomeip/scripts/activate.sh | ||
$ gn gen out/debug | ||
$ ninja -C out/debug | ||
``` | ||
|
||
- To delete generated executable, libraries and object files use: | ||
|
||
```bash | ||
$ cd ~/connectedhomeip/examples/ota-requestor-app/cyw30739 | ||
$ rm -rf out/ | ||
``` | ||
|
||
## Flashing the Application | ||
|
||
### Enter Recovery Mode | ||
|
||
Put the CYW30739 in to the recovery mode before running the flash script. | ||
|
||
1. Press and hold the `RECOVERY` button on the board. | ||
2. Press and hold the `RESET` button on the board. | ||
3. Release the `RESET` button. | ||
4. After one second, release the `RECOVERY` button. | ||
|
||
### Run Flash Script | ||
|
||
- On the command line: | ||
|
||
```bash | ||
$ cd ~/connectedhomeip/examples/ota-requestor-app/cyw30739 | ||
$ python3 out/debug/chip-cyw30739-ota-requestor-example.flash.py | ||
``` | ||
|
||
## Running the Complete Example | ||
|
||
- It is assumed here that you already have an OpenThread border router | ||
configured and running. If not see the following guide | ||
[Openthread_border_router](https://github.com/project-chip/connectedhomeip/blob/master/docs/guides/openthread_border_router_pi.md) | ||
for more information on how to setup a border router on a raspberryPi. | ||
|
||
- Get the active dataset hex for the chip-tool. | ||
```bash | ||
ot-ctl dataset active -x | ||
``` | ||
|
||
- You can provision and control the Chip device using the python controller, | ||
Chip tool standalone, Android or iOS app | ||
|
||
[Chip tool](https://github.com/project-chip/connectedhomeip/blob/master/examples/chip-tool/README.md) | ||
|
||
Here is an example with the chip tool: | ||
|
||
- Start a Linux OTA Provider. | ||
|
||
```bash | ||
# Start the OTA provider server with an OTA binary file | ||
chip-ota-provider-app -f <path/to/ota/binary> | ||
``` | ||
|
||
- Setup the CYW30739 OTA Requestor the the Linux OTA Provider by the | ||
controller. | ||
|
||
```bash | ||
# Pair the OTA Requestor | ||
chip-tool pairing ble-thread 1234 hex:0e080000000000000000000300000b35060004001fffe00208dead00beef00cafe0708fddead00beef000005108e11d8ea8ffaa875713699f59e8807e0030a4f70656e5468726561640102c2980410edc641eb63b100b87e90a9980959befc0c0402a0fff8 20202021 3840 | ||
# Pair the OTA Provider | ||
chip-tool pairing onnetwork-vendor 4321 20202021 9050 | ||
# Announce the OTA provider to the requestor | ||
chip-tool otasoftwareupdaterequestor announce-ota-provider 4321 9 0 0 1234 0 | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
# 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}/src/platform/CYW30739/args.gni") | ||
|
||
cyw30739_sdk_target = get_label_info(":sdk", "label_no_toolchain") | ||
|
||
chip_openthread_ftd = true | ||
|
||
declare_args() { | ||
chip_enable_ota_requestor = true | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
../../build_overrides |
61 changes: 61 additions & 0 deletions
61
examples/ota-requestor-app/cyw30739/include/CHIPProjectConfig.h
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
/* | ||
* | ||
* 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. | ||
* | ||
*/ | ||
|
||
#pragma once | ||
|
||
// -------------------- Device Identification Configuration -------------------- | ||
|
||
/* The VendorName attribute of the Basic cluster. */ | ||
#define CHIP_DEVICE_CONFIG_DEVICE_VENDOR_NAME "Infineon" | ||
|
||
/* The VendorID attribute of the Basic cluster. */ | ||
#define CHIP_DEVICE_CONFIG_DEVICE_VENDOR_ID 0x0009 | ||
|
||
/* The ProductName attribute of the Basic cluster. */ | ||
#define CHIP_DEVICE_CONFIG_DEVICE_PRODUCT_NAME "CYW30739 OTA Requestor App" | ||
|
||
/* The ProductID attribute of the Basic cluster. */ | ||
#define CHIP_DEVICE_CONFIG_DEVICE_PRODUCT_ID 0x154c | ||
|
||
/* The HardwareVersionString attribute of the Basic cluster. */ | ||
#define CHIP_DEVICE_CONFIG_DEFAULT_DEVICE_HARDWARE_VERSION_STRING "30739" | ||
|
||
/* The HardwareVersion attribute of the Basic cluster. */ | ||
#define CHIP_DEVICE_CONFIG_DEFAULT_DEVICE_HARDWARE_VERSION 30739 | ||
|
||
/* The SoftwareVersionString attribute of the Basic cluster. */ | ||
#define CHIP_DEVICE_CONFIG_DEVICE_SOFTWARE_VERSION_STRING "TE7.5" | ||
|
||
/* The SoftwareVersion attribute of the Basic cluster. */ | ||
#define CHIP_DEVICE_CONFIG_DEVICE_SOFTWARE_VERSION 0x0705 | ||
|
||
/* The SerialNumber attribute of the Basic cluster. */ | ||
#define CHIP_DEVICE_CONFIG_TEST_SERIAL_NUMBER "TEST_SN" | ||
|
||
// -------------------- Test Configuration -------------------- | ||
#define CHIP_DEVICE_CONFIG_ENABLE_TEST_DEVICE_IDENTITY 1 |
Oops, something went wrong.