Skip to content

Commit 2bce50b

Browse files
Add Onoff-Plug-App to repository
1 parent d1ff03c commit 2bce50b

22 files changed

+9186
-0
lines changed

.github/workflows/silabs-build-examples.yaml

+7
Original file line numberDiff line numberDiff line change
@@ -106,3 +106,10 @@ jobs:
106106
with:
107107
example-app: "multi-sensor-app"
108108
output-directory: "./out/multi-sensor-app"
109+
110+
build-onoff-plug-app:
111+
name: Build OnOff-Plug-App variations
112+
uses: ./.github/workflows/silabs-common-build.yaml
113+
with:
114+
example-app: "onoff-plug-app"
115+
output-directory: "./out/onoff-plug-app"

examples/onoff-plug-app/silabs/.gn

+29
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
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 = "freertos"
26+
chip_openthread_ftd = true
27+
28+
import("//openthread.gni")
29+
}
+215
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,215 @@
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+
import("//build_overrides/chip.gni")
17+
import("//build_overrides/efr32_sdk.gni")
18+
import("//build_overrides/pigweed.gni")
19+
20+
import("${build_root}/config/defaults.gni")
21+
import("${silabs_sdk_build_root}/silabs_executable.gni")
22+
23+
import("${chip_root}/examples/common/pigweed/pigweed_rpcs.gni")
24+
import("${chip_root}/src/platform/device.gni")
25+
import("${chip_root}/third_party/silabs/silabs_board.gni")
26+
27+
if (chip_enable_pw_rpc) {
28+
import("//build_overrides/pigweed.gni")
29+
import("$dir_pw_build/target_types.gni")
30+
}
31+
32+
assert(current_os == "freertos")
33+
34+
silabs_project_dir = "${chip_root}/examples/onoff-plug-app/silabs"
35+
examples_common_plat_dir = "${chip_root}/examples/platform/silabs"
36+
37+
if (wifi_soc) {
38+
import("${chip_root}/third_party/silabs/SiWx917_sdk.gni")
39+
examples_plat_dir = "${chip_root}/examples/platform/silabs/SiWx917"
40+
} else {
41+
import("${silabs_sdk_build_root}/efr32_sdk.gni")
42+
examples_plat_dir = "${chip_root}/examples/platform/silabs/efr32"
43+
}
44+
45+
import("${examples_common_plat_dir}/args.gni")
46+
47+
declare_args() {
48+
# Dump memory usage at link time.
49+
chip_print_memory_usage = false
50+
}
51+
if (wifi_soc) {
52+
siwx917_sdk("sdk") {
53+
sources = [
54+
"${examples_common_plat_dir}/FreeRTOSConfig.h",
55+
"${silabs_project_dir}/include/CHIPProjectConfig.h",
56+
]
57+
58+
include_dirs = [
59+
"${chip_root}/src/platform/silabs/SiWx917",
60+
"${silabs_project_dir}/include",
61+
"${examples_plat_dir}",
62+
"${chip_root}/src/lib",
63+
"${examples_common_plat_dir}",
64+
]
65+
66+
defines = []
67+
if (chip_enable_pw_rpc) {
68+
defines += [
69+
"HAL_VCOM_ENABLE=1",
70+
"PW_RPC_ENABLED",
71+
]
72+
}
73+
}
74+
} else {
75+
efr32_sdk("sdk") {
76+
sources = [
77+
"${examples_common_plat_dir}/FreeRTOSConfig.h",
78+
"${silabs_project_dir}/include/CHIPProjectConfig.h",
79+
]
80+
81+
include_dirs = [
82+
"${chip_root}/src/platform/silabs/efr32",
83+
"${silabs_project_dir}/include",
84+
"${examples_plat_dir}",
85+
"${chip_root}/src/lib",
86+
"${examples_common_plat_dir}",
87+
]
88+
89+
if (use_wf200) {
90+
# TODO efr32_sdk should not need a header from this location
91+
include_dirs += [ "${examples_plat_dir}/wf200" ]
92+
}
93+
94+
if (chip_enable_ble_rs911x) {
95+
# TODO efr32_sdk should not need a header from this location
96+
include_dirs += [
97+
"${examples_plat_dir}/rs911x",
98+
"${examples_plat_dir}/rs911x/hal",
99+
]
100+
}
101+
102+
defines = []
103+
if (chip_enable_pw_rpc) {
104+
defines += [
105+
"HAL_VCOM_ENABLE=1",
106+
"PW_RPC_ENABLED",
107+
]
108+
}
109+
}
110+
}
111+
112+
silabs_executable("onoff-plug-app") {
113+
output_name = "matter-silabs-onoff-plug-example.out"
114+
public_configs = []
115+
include_dirs = [ "include" ]
116+
defines = []
117+
118+
if (silabs_board == "BRD2704A") {
119+
defines += [ "SL_STATUS_LED=0" ]
120+
}
121+
122+
sources = [
123+
"${examples_common_plat_dir}/main.cpp",
124+
"src/AppTask.cpp",
125+
"src/OnOffPlugManager.cpp",
126+
"src/ZclCallbacks.cpp",
127+
]
128+
129+
deps = [
130+
":sdk",
131+
app_data_model,
132+
]
133+
134+
if (wifi_soc) {
135+
deps += [ "${examples_plat_dir}:siwx917-common" ]
136+
} else {
137+
deps += [ "${examples_plat_dir}:efr32-common" ]
138+
}
139+
140+
if (chip_enable_pw_rpc) {
141+
defines += [
142+
"PW_RPC_ENABLED",
143+
"PW_RPC_ATTRIBUTE_SERVICE=1",
144+
"PW_RPC_BUTTON_SERVICE=1",
145+
"PW_RPC_DESCRIPTOR_SERVICE=1",
146+
"PW_RPC_DEVICE_SERVICE=1",
147+
"PW_RPC_LIGHTING_SERVICE=1",
148+
"PW_RPC_OTCLI_SERVICE=1",
149+
"PW_RPC_THREAD_SERVICE=1",
150+
"PW_RPC_TRACING_SERVICE=1",
151+
]
152+
153+
sources += [
154+
"${chip_root}/examples/common/pigweed/RpcService.cpp",
155+
"${chip_root}/examples/common/pigweed/efr32/PigweedLoggerMutex.cpp",
156+
"${examples_common_plat_dir}/PigweedLogger.cpp",
157+
"${examples_common_plat_dir}/Rpc.cpp",
158+
]
159+
160+
deps += [
161+
"$dir_pw_hdlc:rpc_channel_output",
162+
"$dir_pw_stream:sys_io_stream",
163+
"$dir_pw_trace",
164+
"$dir_pw_trace_tokenized",
165+
"$dir_pw_trace_tokenized:trace_rpc_service",
166+
"${chip_root}/config/efr32/lib/pw_rpc:pw_rpc",
167+
"${chip_root}/examples/common/pigweed:attributes_service.nanopb_rpc",
168+
"${chip_root}/examples/common/pigweed:button_service.nanopb_rpc",
169+
"${chip_root}/examples/common/pigweed:descriptor_service.nanopb_rpc",
170+
"${chip_root}/examples/common/pigweed:device_service.nanopb_rpc",
171+
"${chip_root}/examples/common/pigweed:onoff-plug_service.nanopb_rpc",
172+
"${chip_root}/examples/common/pigweed:ot_cli_service.nanopb_rpc",
173+
"${chip_root}/examples/common/pigweed:thread_service.nanopb_rpc",
174+
"${examples_plat_dir}/pw_sys_io:pw_sys_io_efr32",
175+
]
176+
177+
deps += pw_build_LINK_DEPS
178+
179+
include_dirs += [
180+
"${chip_root}/examples/common",
181+
"${chip_root}/examples/common/pigweed/efr32",
182+
]
183+
}
184+
185+
ldscript = "${examples_common_plat_dir}/ldscripts/${silabs_family}.ld"
186+
187+
inputs = [ ldscript ]
188+
189+
ldflags = [ "-T" + rebase_path(ldscript, root_build_dir) ]
190+
191+
if (chip_print_memory_usage) {
192+
ldflags += [
193+
"-Wl,--print-memory-usage",
194+
"-fstack-usage",
195+
]
196+
}
197+
198+
# WiFi Settings
199+
if (chip_enable_wifi) {
200+
ldflags += [
201+
"-Wl,--defsym",
202+
"-Wl,SILABS_WIFI=1",
203+
]
204+
}
205+
206+
output_dir = root_out_dir
207+
}
208+
209+
group("efr32") {
210+
deps = [ ":onoff-plug-app" ]
211+
}
212+
213+
group("default") {
214+
deps = [ ":efr32" ]
215+
}

0 commit comments

Comments
 (0)