Skip to content

Commit 6b99adb

Browse files
authored
[ASR] add more examples (project-chip#26622)
1 parent 212142b commit 6b99adb

File tree

151 files changed

+11712
-9
lines changed

Some content is hidden

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

151 files changed

+11712
-9
lines changed

.github/workflows/examples-asr.yaml

+8-1
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,14 @@ jobs:
6464
run: |
6565
./scripts/run_in_build_env.sh \
6666
"./scripts/build/build_examples.py \
67+
--target asr-asr582x-all-clusters \
68+
--target asr-asr582x-all-clusters-minimal \
6769
--target asr-asr582x-lighting \
68-
--target asr-asr582x-lighting-ota \
70+
--target asr-asr582x-light-switch \
71+
--target asr-asr582x-lock \
72+
--target asr-asr582x-ota-requestor \
73+
--target asr-asr582x-bridge \
74+
--target asr-asr582x-temperature-measurement \
75+
--target asr-asr582x-thermostat \
6976
build \
7077
"

docs/guides/asr_getting_started_guide.md

+18-5
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ platform that uses ASR FreeRTOS SDK.
1414
- [IP mode](#ip-mode)
1515
- [Shell](#shell)
1616
- [OTA](#ota)
17+
- [Factory](#factory)
1718

1819
---
1920

@@ -72,7 +73,8 @@ to speed up development. You can find them in the samples with `/asr` subfolder.
7273
`--target` when build the examples.
7374
7475
- After building the application, `DOGO` tool is used to flash it to the
75-
board.
76+
board, please refer to the
77+
[DOGO Tool User Guide](https://asriot.readthedocs.io/en/latest/ASR550X/Download-Tool/ASR_IoT_DOGO_Tool_User_Guide.html).
7678
7779
## Commissioning
7880
@@ -128,7 +130,18 @@ There are two commissioning modes supported by ASR platform:
128130
129131
## OTA
130132
131-
To build the example with the Matter OTA Requestor functionality, exactly the
132-
same steps as above but add argument `-ota` when using the `build_examples.py`
133-
script. For example:
134-
`./scripts/build/build_examples.py --target asr-$ASR_BOARD-lighting-ota build`
133+
1. To build the example with the Matter OTA Requestor functionality, exactly the
134+
same steps as above but add argument `-ota` when using the
135+
`build_examples.py` script. For example:
136+
`./scripts/build/build_examples.py --target asr-$ASR_BOARD-lighting-ota build`
137+
2. For more usage details, please refer to the
138+
[OTA example](../../examples/ota-requestor-app/asr/README.md)
139+
140+
## Factory
141+
142+
1. To build the example with the ASR Factory Data Provider, exactly the same
143+
steps as above but add argument `-factory` when using the `build_examples.py`
144+
script. For example:
145+
`./scripts/build/build_examples.py --target asr-$ASR_BOARD-lighting-factory build`
146+
2. For more usage details, please refer to the
147+
[Factory Tool User Guide](https://github.com/asriot/Tools/blob/main/factory_tool/README.md)

examples/all-clusters-app/asr/.gn

+29
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
# Copyright (c) 2023 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+
26+
target_os = "freertos"
27+
28+
import("//args.gni")
29+
}
+135
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,135 @@
1+
# Copyright (c) 2023 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/asr.gni")
16+
import("//build_overrides/build.gni")
17+
import("//build_overrides/chip.gni")
18+
import("${asr_sdk_build_root}/asr_sdk.gni")
19+
import("${build_root}/config/defaults.gni")
20+
import("${chip_root}/src/lib/lib.gni")
21+
import("${chip_root}/src/platform/device.gni")
22+
import("${chip_root}/third_party/asr/asr_executable.gni")
23+
24+
import("cfg.gni")
25+
26+
assert(current_os == "freertos")
27+
28+
asr_project_dir = "${chip_root}/examples/all-clusters-app/asr"
29+
examples_plat_dir = "${chip_root}/examples/platform/asr"
30+
31+
declare_args() {
32+
# Dump memory usage at link time.
33+
chip_print_memory_usage = false
34+
}
35+
36+
asr_sdk_sources("all_clusters_app_sdk_sources") {
37+
include_dirs = [
38+
"${chip_root}/src/platform/ASR",
39+
"${asr_project_dir}/include",
40+
"${examples_plat_dir}",
41+
]
42+
43+
defines = [
44+
"ASR_LOG_ENABLED=1",
45+
"CHIP_DEVICE_CONFIG_USE_TEST_SETUP_PIN_CODE=${setupPinCode}",
46+
"CHIP_DEVICE_CONFIG_USE_TEST_SETUP_DISCRIMINATOR=${setupDiscriminator}",
47+
]
48+
49+
if (chip_enable_factory_data) {
50+
defines += [
51+
"CONFIG_ENABLE_ASR_FACTORY_DATA_PROVIDER=1",
52+
"CONFIG_ENABLE_ASR_FACTORY_DEVICE_INFO_PROVIDER=1",
53+
]
54+
}
55+
56+
if (chip_lwip_ip6_hook) {
57+
defines += [
58+
"CONFIG_LWIP_HOOK_IP6_ROUTE_DEFAULT",
59+
"CONFIG_LWIP_HOOK_ND6_GET_GW_DEFAULT",
60+
]
61+
}
62+
63+
sources = [ "${asr_project_dir}/include/CHIPProjectConfig.h" ]
64+
65+
public_configs = [ "${asr_sdk_build_root}:asr_sdk_config" ]
66+
}
67+
68+
asr_executable("clusters_app") {
69+
include_dirs = []
70+
defines = []
71+
output_name = "chip-asr-clusters-example.out"
72+
73+
sources = [
74+
"${chip_root}/examples/all-clusters-app/all-clusters-common/src/bridged-actions-stub.cpp",
75+
"${chip_root}/examples/all-clusters-app/all-clusters-common/src/static-supported-modes-manager.cpp",
76+
"${examples_plat_dir}/CHIPDeviceManager.cpp",
77+
"${examples_plat_dir}/LEDWidget.cpp",
78+
"${examples_plat_dir}/init_Matter.cpp",
79+
"${examples_plat_dir}/init_asrPlatform.cpp",
80+
"${examples_plat_dir}/shell/matter_shell.cpp",
81+
"src/AppTask.cpp",
82+
"src/ButtonHandler.cpp",
83+
"src/DeviceCallbacks.cpp",
84+
"src/main.cpp",
85+
]
86+
87+
if (chip_enable_ota_requestor) {
88+
sources += [ "${examples_plat_dir}/init_OTARequestor.cpp" ]
89+
}
90+
91+
deps = [
92+
":all_clusters_app_sdk_sources",
93+
"${chip_root}/examples/all-clusters-app/all-clusters-common",
94+
"${chip_root}/examples/common/QRCode",
95+
"${chip_root}/examples/providers:device_info_provider",
96+
"${chip_root}/src/lib",
97+
"${chip_root}/src/setup_payload",
98+
]
99+
100+
include_dirs += [
101+
"include",
102+
"${examples_plat_dir}",
103+
"${asr_project_dir}/include",
104+
"${chip_root}/examples/all-clusters-app/all-clusters-common/include",
105+
"${chip_root}/src",
106+
"${chip_root}/src/lib",
107+
"${chip_root}/src/lib/support",
108+
"${chip_root}/src/app/util",
109+
]
110+
111+
defines = [ "ASR_NETWORK_LAYER_BLE=${chip_config_network_layer_ble}" ]
112+
113+
if (chip_build_libshell) {
114+
defines += [ "CONFIG_ENABLE_CHIP_SHELL=1" ]
115+
sources += [ "${examples_plat_dir}/shell/launch_shell.cpp" ]
116+
include_dirs += [ "${examples_plat_dir}/shell" ]
117+
}
118+
119+
if (chip_print_memory_usage) {
120+
ldflags += [
121+
"-Wl,--print-memory-usage",
122+
"-fstack-usage",
123+
]
124+
}
125+
126+
output_dir = root_out_dir
127+
}
128+
129+
group("asr") {
130+
deps = [ ":clusters_app" ]
131+
}
132+
133+
group("default") {
134+
deps = [ ":asr" ]
135+
}
+62
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
1+
# Matter ASR All Clusters Example
2+
3+
A prototype application that demonstrates device commissioning and cluster
4+
control on ASR platform.
5+
6+
---
7+
8+
- [Matter ASR All Clusters Example](#matter-asr-all-clusters-example)
9+
- [Supported Chips](#supported-chips)
10+
- [Building and Commissioning](#building-and-commissioning)
11+
- [Cluster Control](#cluster-control)
12+
- [Light switch press button and light status LED](#light-switch-press-button-and-light-status-led)
13+
14+
---
15+
16+
## Supported Chips
17+
18+
The Matter demo application is supported on:
19+
20+
- ASR582X
21+
- ASR595X
22+
23+
## Building and Commissioning
24+
25+
Please refer
26+
[Building and Commissioning](../../../docs/guides/asr_getting_started_guide.md#building-the-example-application)
27+
guides to get started
28+
29+
```
30+
./scripts/build/build_examples.py --target asr-$ASR_BOARD-all-clusters build
31+
```
32+
33+
## Cluster Control
34+
35+
After successful commissioning, use `chip-tool` to control the board
36+
37+
For example, read sensor measured value:
38+
39+
```
40+
./chip-tool temperaturemeasurement read measured-value <NODE ID> 1
41+
./chip-tool relativehumiditymeasurement read measured-value <NODE ID> 1
42+
./chip-tool pressuremeasurement read measured-value <NODE ID> 1
43+
```
44+
45+
Or,control the OnOff Cluster attribute:
46+
47+
```
48+
./chip-tool onoff read on-off <NODE ID> 1
49+
./chip-tool onoff on <NODE ID> 1
50+
./chip-tool onoff off <NODE ID> 1
51+
./chip-tool onoff toggle <NODE ID> 1
52+
```
53+
54+
## Light switch press button and light status LED
55+
56+
This demo uses button to test changing the light states and LED to show the
57+
state of these changes.
58+
59+
| Name | Pin |
60+
| :----: | :---: |
61+
| LED | PAD6 |
62+
| BUTTON | PAD12 |
+27
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
# Copyright (c) 2023 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/pigweed.gni")
17+
import("//cfg.gni")
18+
import("${chip_root}/src/platform/ASR/args.gni")
19+
20+
asr_target_project =
21+
get_label_info(":all_clusters_app_sdk_sources", "label_no_toolchain")
22+
23+
declare_args() {
24+
# Disable lock tracking, since our FreeRTOS configuration does not set
25+
# INCLUDE_xSemaphoreGetMutexHolder
26+
chip_stack_lock_tracking = "none"
27+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
../../build_overrides/

examples/all-clusters-app/asr/cfg.gni

+23
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
# Copyright (c) 2023 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+
chip_enable_factory_data = false
17+
18+
chip_lwip_ip6_hook = false
19+
20+
setupPinCode = 20202021
21+
22+
setupDiscriminator = 3840
23+
}

0 commit comments

Comments
 (0)