Skip to content

Commit 8edcecd

Browse files
authoredMay 8, 2024
[Infineon] Add an example of thermostat for CYW30739. (#33357)
1 parent b976e7a commit 8edcecd

20 files changed

+983
-1
lines changed
 

‎.github/workflows/examples-infineon.yaml

+26
Original file line numberDiff line numberDiff line change
@@ -190,6 +190,32 @@ jobs:
190190
/tmp/bloat_reports/
191191
- name: Clean out build output
192192
run: rm -rf ./out
193+
- name: Build CYW30739 Thermostat App
194+
run: |
195+
./scripts/run_in_build_env.sh \
196+
"./scripts/build/build_examples.py \
197+
--target cyw30739-cyw30739b2_p5_evk_01-thermostat \
198+
--target cyw30739-cyw30739b2_p5_evk_02-thermostat \
199+
--target cyw30739-cyw30739b2_p5_evk_03-thermostat \
200+
build \
201+
--copy-artifacts-to out/artifacts \
202+
"
203+
- name: Get thermostat size stats
204+
run: |
205+
.environment/pigweed-venv/bin/python3 scripts/tools/memory/gh_sizes.py \
206+
cyw30739 CYW30739B2-P5-EVK-01 thermostat \
207+
out/artifacts/cyw30739-cyw30739b2_p5_evk_01-thermostat/thermostat-CYW30739B2-P5-EVK-01.elf \
208+
/tmp/bloat_reports/
209+
.environment/pigweed-venv/bin/python3 scripts/tools/memory/gh_sizes.py \
210+
cyw30739 CYW30739B2-P5-EVK-02 thermostat \
211+
out/artifacts/cyw30739-cyw30739b2_p5_evk_02-thermostat/thermostat-CYW30739B2-P5-EVK-02.elf \
212+
/tmp/bloat_reports/
213+
.environment/pigweed-venv/bin/python3 scripts/tools/memory/gh_sizes.py \
214+
cyw30739 CYW30739B2-P5-EVK-03 thermostat \
215+
out/artifacts/cyw30739-cyw30739b2_p5_evk_03-thermostat/thermostat-CYW30739B2-P5-EVK-03.elf \
216+
/tmp/bloat_reports/
217+
- name: Clean out build output
218+
run: rm -rf ./out
193219
- name: Uploading Size Reports
194220
uses: ./.github/actions/upload-size-reports
195221
if: ${{ !env.ACT }}
+28
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
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_overrides/build.gni")
16+
17+
# The location of the build configuration file.
18+
buildconfig = "${build_root}/config/BUILDCONFIG.gn"
19+
20+
# CHIP uses angle bracket includes.
21+
check_system_includes = true
22+
23+
default_args = {
24+
target_cpu = "arm"
25+
target_os = "cyw30739"
26+
27+
import("//args.gni")
28+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,63 @@
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_overrides/chip.gni")
16+
import("//build_overrides/cyw30739_sdk.gni")
17+
18+
import("${chip_root}/examples/platform/infineon/cyw30739/args.gni")
19+
import("${matter_wpan_sdk_build_root}/matter_wpan_executable.gni")
20+
21+
app_name = "thermostat"
22+
cyw30739_project_dir = "${chip_root}/examples/thermostat/infineon/cyw30739"
23+
24+
matter_wpan_example("wpan_example") {
25+
sources = [ "${cyw30739_project_dir}/include/CHIPProjectConfig.h" ]
26+
27+
include_dirs = [ "${cyw30739_project_dir}/include" ]
28+
}
29+
30+
template("matter_wpan_app") {
31+
forward_variables_from(invoker, [ "board" ])
32+
33+
import("${matter_wpan_sdk_build_root}/boards/${board}/args.gni")
34+
35+
matter_wpan_executable(target_name) {
36+
sources = [
37+
"src/AppTask.cpp",
38+
"src/SensorManager.cpp",
39+
"src/TemperatureManager.cpp",
40+
"src/ZclCallbacks.cpp",
41+
]
42+
43+
if (board_enable_display) {
44+
sources += [ "src/ThermostatUI.cpp" ]
45+
}
46+
47+
deps = [ app_data_model ]
48+
49+
include_dirs = [ "include" ]
50+
}
51+
}
52+
53+
foreach(board, matter_wpan_sdk_board_list) {
54+
matter_wpan_app("${app_name}-${board}") {
55+
}
56+
}
57+
58+
group("default") {
59+
deps = []
60+
foreach(board, matter_wpan_sdk_board_list) {
61+
deps += [ ":${app_name}-${board}" ]
62+
}
63+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,194 @@
1+
# Matter CYW30739 Thermostat Example
2+
3+
An example showing the use of Matter on the Infineon CYW30739 platform.
4+
5+
---
6+
7+
## Table of Contents
8+
9+
- [Matter CYW30739 Thermostat Example](#matter-cyw30739-thermostat-example)
10+
- [Table of Contents](#table-of-contents)
11+
- [Introduction](#introduction)
12+
- [Installing ModusToolbox™ Software](#installing-modustoolbox-software)
13+
- [ModusToolbox™ tools package](#modustoolbox-tools-package)
14+
- [Note for WSL (Windows Subsystem for Linux)](#note-for-wsl-windows-subsystem-for-linux)
15+
- [Checkout Submodules](#checkout-submodules)
16+
- [Building](#building)
17+
- [Factory Data](#factory-data)
18+
- [Commissionable Data](#commissionable-data)
19+
- [Device Information](#device-information)
20+
- [DAC / DAC Key / PAI Certificate / Certificate Declaration](#dac--dac-key--pai-certificate--certificate-declaration)
21+
- [Flashing the Application](#flashing-the-application)
22+
- [Enter Recovery Mode](#enter-recovery-mode)
23+
- [Run Flash Script](#run-flash-script)
24+
- [Running the Complete Example](#running-the-complete-example)
25+
26+
---
27+
28+
## Introduction
29+
30+
The CYW30739 thermostat example provides a baseline demonstration of a
31+
thermostat device, built using Matter and the Infineon Modustoolbox SDK. It can
32+
be controlled by a Matter controller over Openthread network.
33+
34+
The CYW30739 device can be commissioned over Bluetooth Low Energy where the
35+
device and the Matter controller will exchange security information with the
36+
Rendez-vous procedure. Target Thread Network information including the active
37+
dataset and CASE credentials are then provided.
38+
39+
## Installing [ModusToolbox™ Software](https://www.infineon.com/cms/en/design-support/tools/sdk/modustoolbox-software)
40+
41+
Follow the
42+
[Installation Guide](https://www.infineon.com/ModusToolboxInstallguide) to
43+
download and install the ModusToolbox™ Software.
44+
45+
### ModusToolbox™ tools package
46+
47+
ModusToolbox™ tools package should be automatically installed in the default
48+
location if you followed the
49+
[Installation Guide](https://www.infineon.com/ModusToolboxInstallguide). Please
50+
refer to the Installation Guide for the default location for different operating
51+
systems.
52+
53+
If you need to install the ModusToolbox™ tools package in a custom location, you
54+
must set the environment variable `CY_TOOLS_PATHS` to the
55+
`/path/to/ModusToolbox/tools_x.x` to specify the location of tools.
56+
57+
```bash
58+
export CY_TOOLS_PATHS="/path/to/ModusToolbox/tools_x.x"
59+
```
60+
61+
#### Note for WSL (Windows Subsystem for Linux)
62+
63+
If you are using WSL, please ensure you have installed the ModusToolbox™
64+
Software for Linux. Running Windows tools directly from the WSL command line
65+
would cause path resolution failure in the build process.
66+
67+
### Checkout Submodules
68+
69+
Before building the example, check out the Matter repository and sync submodules
70+
using the following command:
71+
72+
```bash
73+
$ cd ~/connectedhomeip
74+
$ scripts/checkout_submodules.py --platform infineon
75+
```
76+
77+
## Building
78+
79+
- Build the example application:
80+
81+
```bash
82+
$ cd ~/connectedhomeip
83+
$ scripts/examples/gn_build_example.sh examples/thermostat/infineon/cyw30739 out/cyw30739-thermostat
84+
```
85+
86+
- OR use GN/Ninja directly
87+
88+
```bash
89+
$ cd ~/connectedhomeip
90+
$ source scripts/activate.sh
91+
$ gn gen --root=examples/thermostat/infineon/cyw30739 out/cyw30739-thermostat
92+
$ ninja -C out/cyw30739-thermostat [thermostat-BOARD_NAME]
93+
```
94+
95+
- To delete generated executable, libraries and object files use:
96+
97+
```bash
98+
$ cd ~/connectedhomeip
99+
$ rm -rf out/cyw30739-thermostat
100+
```
101+
102+
## Factory Data
103+
104+
### Commissionable Data
105+
106+
Infineon CYW30739 examples use test passcode, discriminator and PAKE parameters
107+
by default. For a production build, manufacturers should override commissionable
108+
data by the following arguments:
109+
110+
- `matter_passcode`, `matter_discriminator`, `matter_pake_iteration_count`,
111+
`matter_pake_salt`
112+
113+
```bash
114+
$ cd ~/connectedhomeip
115+
$ scripts/examples/gn_build_example.sh examples/thermostat/infineon/cyw30739 out/cyw30739-thermostat \
116+
'matter_passcode=20202021' \
117+
'matter_discriminator=3840' \
118+
'matter_pake_iteration_count=1000' \
119+
'matter_pake_salt="U1BBS0UyUCBLZXkgU2FsdA=="'
120+
```
121+
122+
### Device Information
123+
124+
Infineon CYW30739 examples support overriding the default device information by
125+
the following arguments:
126+
127+
- matter_vendor_name
128+
- matter_vendor_id
129+
- matter_product_name
130+
- matter_product_id
131+
- matter_serial_number
132+
- matter_hardware_version
133+
- matter_hardware_version_string
134+
135+
To override the default device information, pass the desired values to the
136+
`gn_build_example.sh` script as arguments.
137+
138+
```bash
139+
$ cd ~/connectedhomeip
140+
$ scripts/examples/gn_build_example.sh examples/thermostat/infineon/cyw30739 out/cyw30739-thermostat \
141+
'matter_vendor_name="Infineon"' \
142+
'matter_vendor_id="0x1388"' \
143+
'matter_product_name="TEST_PRODUCT"' \
144+
'matter_product_id="0x0001"' \
145+
'matter_serial_number="TEST_SN"' \
146+
'matter_hardware_version=30739' \
147+
'matter_hardware_version_string="30739"'
148+
```
149+
150+
### DAC / DAC Key / PAI Certificate / Certificate Declaration
151+
152+
Infineon CYW30739 examples use development certifications, keys, and CD by
153+
default. For a production build, manufacturers can provision certifications,
154+
keys, and CD by the following arguments:
155+
156+
- `matter_att_cert`, `matter_att_cert_password`, `matter_cd`
157+
158+
```bash
159+
$ cd ~/connectedhomeip
160+
$ scripts/examples/gn_build_example.sh examples/thermostat/infineon/cyw30739 out/cyw30739-thermostat \
161+
'matter_att_cert="/path/to/att_cert.p12"' \
162+
'matter_att_cert_password="password"' \
163+
'matter_cd="/path/to/cd.der"'
164+
```
165+
166+
## Flashing the Application
167+
168+
### Enter Recovery Mode
169+
170+
Put the CYW30739 in to the recovery mode before running the flash script.
171+
172+
1. Press and hold the `RECOVERY` button on the board.
173+
2. Press and hold the `RESET` button on the board.
174+
3. Release the `RESET` button.
175+
4. After one second, release the `RECOVERY` button.
176+
177+
### Run Flash Script
178+
179+
- On the command line:
180+
181+
```bash
182+
$ cd ~/connectedhomeip
183+
$ out/cyw30739-thermostat/thermostat-BOARD_NAME.flash.py --port <port>
184+
```
185+
186+
## Running the Complete Example
187+
188+
- It is assumed here that you already have an OpenThread border router
189+
configured and running. If not see the following guide
190+
[Openthread_border_router](https://github.com/project-chip/connectedhomeip/blob/master/docs/guides/openthread_border_router_pi.md)
191+
for more information on how to setup a border router on a raspberryPi.
192+
193+
- For this example to work, it is necessary to have a second CYW30739 device
194+
running the thermostat example commissioned on the same OpenThread network
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
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_overrides/chip.gni")
16+
import("${chip_root}/config/standalone/args.gni")
17+
import("${chip_root}/src/platform/Infineon/CYW30739/args.gni")
18+
19+
app_data_model = "${chip_root}/examples/thermostat/thermostat-common"
20+
21+
chip_openthread_ftd = false
22+
chip_enable_icd_server = true
23+
chip_enable_ota_requestor = true
24+
25+
matter_product_id = "0x0006"
26+
matter_product_name = "CYW30739 Thermostat App"
27+
matter_att_cert = "${chip_root}/examples/platform/infineon/credentials/development/attestation/Matter-Development-DAC-1388-0006.p12"
28+
29+
matter_wpan_sdk_board_list = [
30+
"CYW30739B2-P5-EVK-01",
31+
"CYW30739B2-P5-EVK-02",
32+
"CYW30739B2-P5-EVK-03",
33+
]
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
../../../build_overrides
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
/*
2+
*
3+
* Copyright (c) 2022 Project CHIP Authors
4+
* All rights reserved.
5+
*
6+
* Licensed under the Apache License, Version 2.0 (the "License");
7+
* you may not use this file except in compliance with the License.
8+
* You may obtain a copy of the License at
9+
*
10+
* http://www.apache.org/licenses/LICENSE-2.0
11+
*
12+
* Unless required by applicable law or agreed to in writing, software
13+
* distributed under the License is distributed on an "AS IS" BASIS,
14+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15+
* See the License for the specific language governing permissions and
16+
* limitations under the License.
17+
*/
18+
19+
#pragma once
20+
21+
#include <cstdint>
22+
23+
void AppTaskMain(intptr_t args);
24+
void UpdateThermoStatUI(intptr_t aArg);

0 commit comments

Comments
 (0)