-
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.
[Infineon] Add an example of thermostat for CYW30739. (#33357)
- Loading branch information
Showing
20 changed files
with
983 additions
and
1 deletion.
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
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,63 @@ | ||
# 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("//build_overrides/cyw30739_sdk.gni") | ||
|
||
import("${chip_root}/examples/platform/infineon/cyw30739/args.gni") | ||
import("${matter_wpan_sdk_build_root}/matter_wpan_executable.gni") | ||
|
||
app_name = "thermostat" | ||
cyw30739_project_dir = "${chip_root}/examples/thermostat/infineon/cyw30739" | ||
|
||
matter_wpan_example("wpan_example") { | ||
sources = [ "${cyw30739_project_dir}/include/CHIPProjectConfig.h" ] | ||
|
||
include_dirs = [ "${cyw30739_project_dir}/include" ] | ||
} | ||
|
||
template("matter_wpan_app") { | ||
forward_variables_from(invoker, [ "board" ]) | ||
|
||
import("${matter_wpan_sdk_build_root}/boards/${board}/args.gni") | ||
|
||
matter_wpan_executable(target_name) { | ||
sources = [ | ||
"src/AppTask.cpp", | ||
"src/SensorManager.cpp", | ||
"src/TemperatureManager.cpp", | ||
"src/ZclCallbacks.cpp", | ||
] | ||
|
||
if (board_enable_display) { | ||
sources += [ "src/ThermostatUI.cpp" ] | ||
} | ||
|
||
deps = [ app_data_model ] | ||
|
||
include_dirs = [ "include" ] | ||
} | ||
} | ||
|
||
foreach(board, matter_wpan_sdk_board_list) { | ||
matter_wpan_app("${app_name}-${board}") { | ||
} | ||
} | ||
|
||
group("default") { | ||
deps = [] | ||
foreach(board, matter_wpan_sdk_board_list) { | ||
deps += [ ":${app_name}-${board}" ] | ||
} | ||
} |
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,194 @@ | ||
# Matter CYW30739 Thermostat Example | ||
|
||
An example showing the use of Matter on the Infineon CYW30739 platform. | ||
|
||
--- | ||
|
||
## Table of Contents | ||
|
||
- [Matter CYW30739 Thermostat Example](#matter-cyw30739-thermostat-example) | ||
- [Table of Contents](#table-of-contents) | ||
- [Introduction](#introduction) | ||
- [Installing ModusToolbox™ Software](#installing-modustoolbox-software) | ||
- [ModusToolbox™ tools package](#modustoolbox-tools-package) | ||
- [Note for WSL (Windows Subsystem for Linux)](#note-for-wsl-windows-subsystem-for-linux) | ||
- [Checkout Submodules](#checkout-submodules) | ||
- [Building](#building) | ||
- [Factory Data](#factory-data) | ||
- [Commissionable Data](#commissionable-data) | ||
- [Device Information](#device-information) | ||
- [DAC / DAC Key / PAI Certificate / Certificate Declaration](#dac--dac-key--pai-certificate--certificate-declaration) | ||
- [Flashing the Application](#flashing-the-application) | ||
- [Enter Recovery Mode](#enter-recovery-mode) | ||
- [Run Flash Script](#run-flash-script) | ||
- [Running the Complete Example](#running-the-complete-example) | ||
|
||
--- | ||
|
||
## Introduction | ||
|
||
The CYW30739 thermostat example provides a baseline demonstration of a | ||
thermostat device, built using Matter and the Infineon Modustoolbox SDK. It can | ||
be controlled by a Matter controller over Openthread 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. | ||
|
||
## Installing [ModusToolbox™ Software](https://www.infineon.com/cms/en/design-support/tools/sdk/modustoolbox-software) | ||
|
||
Follow the | ||
[Installation Guide](https://www.infineon.com/ModusToolboxInstallguide) to | ||
download and install the ModusToolbox™ Software. | ||
|
||
### ModusToolbox™ tools package | ||
|
||
ModusToolbox™ tools package should be automatically installed in the default | ||
location if you followed the | ||
[Installation Guide](https://www.infineon.com/ModusToolboxInstallguide). Please | ||
refer to the Installation Guide for the default location for different operating | ||
systems. | ||
|
||
If you need to install the ModusToolbox™ tools package in a custom location, you | ||
must set the environment variable `CY_TOOLS_PATHS` to the | ||
`/path/to/ModusToolbox/tools_x.x` to specify the location of tools. | ||
|
||
```bash | ||
export CY_TOOLS_PATHS="/path/to/ModusToolbox/tools_x.x" | ||
``` | ||
|
||
#### Note for WSL (Windows Subsystem for Linux) | ||
|
||
If you are using WSL, please ensure you have installed the ModusToolbox™ | ||
Software for Linux. Running Windows tools directly from the WSL command line | ||
would cause path resolution failure in the build process. | ||
|
||
### Checkout Submodules | ||
|
||
Before building the example, check out the Matter repository and sync submodules | ||
using the following command: | ||
|
||
```bash | ||
$ cd ~/connectedhomeip | ||
$ scripts/checkout_submodules.py --platform infineon | ||
``` | ||
|
||
## Building | ||
|
||
- Build the example application: | ||
|
||
```bash | ||
$ cd ~/connectedhomeip | ||
$ scripts/examples/gn_build_example.sh examples/thermostat/infineon/cyw30739 out/cyw30739-thermostat | ||
``` | ||
|
||
- OR use GN/Ninja directly | ||
|
||
```bash | ||
$ cd ~/connectedhomeip | ||
$ source scripts/activate.sh | ||
$ gn gen --root=examples/thermostat/infineon/cyw30739 out/cyw30739-thermostat | ||
$ ninja -C out/cyw30739-thermostat [thermostat-BOARD_NAME] | ||
``` | ||
|
||
- To delete generated executable, libraries and object files use: | ||
|
||
```bash | ||
$ cd ~/connectedhomeip | ||
$ rm -rf out/cyw30739-thermostat | ||
``` | ||
|
||
## Factory Data | ||
|
||
### Commissionable Data | ||
|
||
Infineon CYW30739 examples use test passcode, discriminator and PAKE parameters | ||
by default. For a production build, manufacturers should override commissionable | ||
data by the following arguments: | ||
|
||
- `matter_passcode`, `matter_discriminator`, `matter_pake_iteration_count`, | ||
`matter_pake_salt` | ||
|
||
```bash | ||
$ cd ~/connectedhomeip | ||
$ scripts/examples/gn_build_example.sh examples/thermostat/infineon/cyw30739 out/cyw30739-thermostat \ | ||
'matter_passcode=20202021' \ | ||
'matter_discriminator=3840' \ | ||
'matter_pake_iteration_count=1000' \ | ||
'matter_pake_salt="U1BBS0UyUCBLZXkgU2FsdA=="' | ||
``` | ||
|
||
### Device Information | ||
|
||
Infineon CYW30739 examples support overriding the default device information by | ||
the following arguments: | ||
|
||
- matter_vendor_name | ||
- matter_vendor_id | ||
- matter_product_name | ||
- matter_product_id | ||
- matter_serial_number | ||
- matter_hardware_version | ||
- matter_hardware_version_string | ||
|
||
To override the default device information, pass the desired values to the | ||
`gn_build_example.sh` script as arguments. | ||
|
||
```bash | ||
$ cd ~/connectedhomeip | ||
$ scripts/examples/gn_build_example.sh examples/thermostat/infineon/cyw30739 out/cyw30739-thermostat \ | ||
'matter_vendor_name="Infineon"' \ | ||
'matter_vendor_id="0x1388"' \ | ||
'matter_product_name="TEST_PRODUCT"' \ | ||
'matter_product_id="0x0001"' \ | ||
'matter_serial_number="TEST_SN"' \ | ||
'matter_hardware_version=30739' \ | ||
'matter_hardware_version_string="30739"' | ||
``` | ||
|
||
### DAC / DAC Key / PAI Certificate / Certificate Declaration | ||
|
||
Infineon CYW30739 examples use development certifications, keys, and CD by | ||
default. For a production build, manufacturers can provision certifications, | ||
keys, and CD by the following arguments: | ||
|
||
- `matter_att_cert`, `matter_att_cert_password`, `matter_cd` | ||
|
||
```bash | ||
$ cd ~/connectedhomeip | ||
$ scripts/examples/gn_build_example.sh examples/thermostat/infineon/cyw30739 out/cyw30739-thermostat \ | ||
'matter_att_cert="/path/to/att_cert.p12"' \ | ||
'matter_att_cert_password="password"' \ | ||
'matter_cd="/path/to/cd.der"' | ||
``` | ||
|
||
## 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 | ||
$ out/cyw30739-thermostat/thermostat-BOARD_NAME.flash.py --port <port> | ||
``` | ||
|
||
## 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. | ||
|
||
- For this example to work, it is necessary to have a second CYW30739 device | ||
running the thermostat example commissioned on the same OpenThread network |
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,33 @@ | ||
# 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}/config/standalone/args.gni") | ||
import("${chip_root}/src/platform/Infineon/CYW30739/args.gni") | ||
|
||
app_data_model = "${chip_root}/examples/thermostat/thermostat-common" | ||
|
||
chip_openthread_ftd = false | ||
chip_enable_icd_server = true | ||
chip_enable_ota_requestor = true | ||
|
||
matter_product_id = "0x0006" | ||
matter_product_name = "CYW30739 Thermostat App" | ||
matter_att_cert = "${chip_root}/examples/platform/infineon/credentials/development/attestation/Matter-Development-DAC-1388-0006.p12" | ||
|
||
matter_wpan_sdk_board_list = [ | ||
"CYW30739B2-P5-EVK-01", | ||
"CYW30739B2-P5-EVK-02", | ||
"CYW30739B2-P5-EVK-03", | ||
] |
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 |
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) 2022 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. | ||
*/ | ||
|
||
#pragma once | ||
|
||
#include <cstdint> | ||
|
||
void AppTaskMain(intptr_t args); | ||
void UpdateThermoStatUI(intptr_t aArg); |
Oops, something went wrong.