Skip to content

Commit a3d9050

Browse files
Add Fan-Control-App to repository
1 parent a883369 commit a3d9050

25 files changed

+13087
-0
lines changed

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

+7
Original file line numberDiff line numberDiff line change
@@ -92,3 +92,10 @@ jobs:
9292
with:
9393
example-app: "refrigerator-app"
9494
output-directory: "./out/refrigerator-app"
95+
96+
build-fan-control-app:
97+
name: Build Fan-Control-App variations
98+
uses: ./.github/workflows/silabs-common-build.yaml
99+
with:
100+
example-app: "fan-control-app"
101+
output-directory: "./out/fan-control-app"
+238
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,238 @@
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/fan-control-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+
52+
if (slc_generate) {
53+
# Generate Project Specific config (Board, hardware used etc..)
54+
print(exec_script("${chip_root}/third_party/silabs/slc_gen/run_slc.py",
55+
[
56+
rebase_path(chip_root),
57+
"${silabs_board}",
58+
"${disable_lcd}",
59+
"${use_wstk_buttons}",
60+
"${use_wstk_leds}",
61+
"${use_external_flash}",
62+
"${silabs_mcu}",
63+
rebase_path(slc_gen_path),
64+
],
65+
"list lines"))
66+
}
67+
68+
if (wifi_soc) {
69+
siwx917_sdk("sdk") {
70+
sources = [
71+
"${examples_common_plat_dir}/FreeRTOSConfig.h",
72+
"${silabs_project_dir}/include/CHIPProjectConfig.h",
73+
]
74+
75+
include_dirs = [
76+
"${chip_root}/src/platform/silabs/SiWx917",
77+
"${silabs_project_dir}/include",
78+
"${examples_plat_dir}",
79+
"${chip_root}/src/lib",
80+
"${examples_common_plat_dir}",
81+
]
82+
83+
defines = []
84+
if (chip_enable_pw_rpc) {
85+
defines += [
86+
"HAL_VCOM_ENABLE=1",
87+
"PW_RPC_ENABLED",
88+
]
89+
}
90+
}
91+
} else {
92+
efr32_sdk("sdk") {
93+
sources = [
94+
"${examples_common_plat_dir}/FreeRTOSConfig.h",
95+
"${silabs_project_dir}/include/CHIPProjectConfig.h",
96+
]
97+
98+
include_dirs = [
99+
"${chip_root}/src/platform/silabs/efr32",
100+
"${silabs_project_dir}/include",
101+
"${examples_plat_dir}",
102+
"${chip_root}/src/lib",
103+
"${examples_common_plat_dir}",
104+
]
105+
106+
if (use_wf200) {
107+
# TODO efr32_sdk should not need a header from this location
108+
include_dirs += [ "${examples_plat_dir}/wf200" ]
109+
}
110+
111+
if (chip_enable_ble_rs911x) {
112+
# TODO efr32_sdk should not need a header from this location
113+
include_dirs += [
114+
"${examples_plat_dir}/rs911x",
115+
"${examples_plat_dir}/rs911x/hal",
116+
]
117+
}
118+
119+
defines = []
120+
if (chip_enable_pw_rpc) {
121+
defines += [
122+
"HAL_VCOM_ENABLE=1",
123+
"PW_RPC_ENABLED",
124+
]
125+
}
126+
}
127+
}
128+
silabs_executable("fan-control-app") {
129+
output_name = "matter-silabs-fan-control-example.out"
130+
include_dirs = [ "include" ]
131+
defines = []
132+
133+
if (silabs_board == "BRD2704A") {
134+
defines += [ "SL_STATUS_LED=0" ]
135+
}
136+
137+
sources = [
138+
"${examples_common_plat_dir}/main.cpp",
139+
"src/AppTask.cpp",
140+
"src/DataModelCallbacks.cpp",
141+
"src/FanControlManager.cpp",
142+
"src/FanControlUI.cpp",
143+
]
144+
145+
deps = [
146+
":sdk",
147+
"${chip_root}/src/platform/logging:default",
148+
app_data_model,
149+
]
150+
151+
if (wifi_soc) {
152+
deps += [ "${examples_plat_dir}:siwx917-common" ]
153+
} else {
154+
deps += [ "${examples_plat_dir}:efr32-common" ]
155+
}
156+
157+
if (chip_enable_pw_rpc) {
158+
defines += [
159+
"PW_RPC_ENABLED",
160+
"PW_RPC_ATTRIBUTE_SERVICE=1",
161+
"PW_RPC_BUTTON_SERVICE=1",
162+
"PW_RPC_DESCRIPTOR_SERVICE=1",
163+
"PW_RPC_DEVICE_SERVICE=1",
164+
"PW_RPC_LIGHTING_SERVICE=1",
165+
"PW_RPC_OTCLI_SERVICE=1",
166+
"PW_RPC_THREAD_SERVICE=1",
167+
"PW_RPC_TRACING_SERVICE=1",
168+
]
169+
170+
sources += [
171+
"${chip_root}/examples/common/pigweed/RpcService.cpp",
172+
"${chip_root}/examples/common/pigweed/efr32/PigweedLoggerMutex.cpp",
173+
"${examples_common_plat_dir}/PigweedLogger.cpp",
174+
"${examples_common_plat_dir}/Rpc.cpp",
175+
]
176+
177+
deps += [
178+
"$dir_pw_hdlc:default_addresses",
179+
"$dir_pw_hdlc:rpc_channel_output",
180+
"$dir_pw_stream:sys_io_stream",
181+
"$dir_pw_trace",
182+
"$dir_pw_trace_tokenized",
183+
"$dir_pw_trace_tokenized:trace_rpc_service",
184+
"${chip_root}/config/efr32/lib/pw_rpc:pw_rpc",
185+
"${chip_root}/examples/common/pigweed:attributes_service.nanopb_rpc",
186+
"${chip_root}/examples/common/pigweed:button_service.nanopb_rpc",
187+
"${chip_root}/examples/common/pigweed:descriptor_service.nanopb_rpc",
188+
"${chip_root}/examples/common/pigweed:device_service.nanopb_rpc",
189+
"${chip_root}/examples/common/pigweed:lighting_service.nanopb_rpc",
190+
"${chip_root}/examples/common/pigweed:ot_cli_service.nanopb_rpc",
191+
"${chip_root}/examples/common/pigweed:thread_service.nanopb_rpc",
192+
]
193+
194+
if (wifi_soc) {
195+
deps += [ "${examples_plat_dir}/pw_sys_io:pw_sys_io_siwx917" ]
196+
} else {
197+
deps += [ "${examples_common_plat_dir}/pw_sys_io:pw_sys_io_silabs" ]
198+
}
199+
200+
deps += pw_build_LINK_DEPS
201+
202+
include_dirs += [
203+
"${chip_root}/examples/common",
204+
"${chip_root}/examples/common/pigweed/efr32",
205+
]
206+
}
207+
208+
ldscript = "${examples_common_plat_dir}/ldscripts/${silabs_family}.ld"
209+
210+
inputs = [ ldscript ]
211+
212+
ldflags = [ "-T" + rebase_path(ldscript, root_build_dir) ]
213+
214+
if (chip_print_memory_usage) {
215+
ldflags += [
216+
"-Wl,--print-memory-usage",
217+
"-fstack-usage",
218+
]
219+
}
220+
221+
# WiFi Settings
222+
if (chip_enable_wifi) {
223+
ldflags += [
224+
"-Wl,--defsym",
225+
"-Wl,SILABS_WIFI=1",
226+
]
227+
}
228+
229+
output_dir = root_out_dir
230+
}
231+
232+
group("silabs") {
233+
deps = [ ":fan-control-app" ]
234+
}
235+
236+
group("default") {
237+
deps = [ ":silabs" ]
238+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
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+
import("//build_overrides/chip.gni")
15+
import("${chip_root}/config/standalone/args.gni")
16+
17+
silabs_sdk_target = get_label_info(":sdk", "label_no_toolchain")
18+
chip_enable_openthread = false
19+
import("${chip_root}/src/platform/silabs/wifi/args.gni")
20+
21+
chip_enable_ota_requestor = true
22+
app_data_model =
23+
"${chip_root}/examples/fan-control-app/silabs/data_model:silabs-fan-control"
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_enable_wifi = true
27+
chip_device_platform = "SiWx917"
28+
import("//build_for_wifi_args.gni")
29+
}
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,26 @@
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}/src/app/chip_data_model.gni")
17+
import("${chip_root}/src/platform/device.gni")
18+
19+
chip_data_model("silabs-fan-control") {
20+
if (chip_enable_wifi) {
21+
zap_file = "fan-control-wifi-app.zap"
22+
} else {
23+
zap_file = "fan-control-thread-app.zap"
24+
}
25+
is_server = true
26+
}

0 commit comments

Comments
 (0)