forked from project-chip/connectedhomeip
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathBUILD.gn
319 lines (256 loc) · 8.61 KB
/
BUILD.gn
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
# 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/efr32_sdk.gni")
import("${chip_root}/examples/common/pigweed/pigweed_rpcs.gni")
import("${chip_root}/src/app/icd/icd.gni")
import("${chip_root}/src/lib/lib.gni")
import("${chip_root}/src/platform/device.gni")
import("${efr32_sdk_build_root}/efr32_sdk.gni")
import("${efr32_sdk_build_root}/silabs_board.gni")
declare_args() {
enable_heap_monitoring = false
# OTA timeout in seconds
ota_periodic_query_timeout_sec = 86400
# Wifi related stuff - they are overridden by gn -args="use_wf200=true"
sl_wfx_config_softap = false
sl_wfx_config_scan = true
# Argument to force enable WPA3 security on rs91x
rs91x_wpa3_transition = true
#default WiFi SSID
chip_default_wifi_ssid = ""
#default Wifi Password
chip_default_wifi_psk = ""
# Enable TestEventTrigger in GeneralDiagnostics cluster
sl_enable_test_event_trigger = false
# The EnableKey in hex string format used by TestEventTrigger command in
# GeneralDiagnostics cluster. The length of the string should be 16 bytes.
sl_test_event_trigger_enable_key = "00112233445566778899AABBCCDDEEFF"
}
silabs_common_plat_dir = "${chip_root}/examples/platform/silabs"
import("${silabs_common_plat_dir}/args.gni")
# Sanity check
assert(!(chip_enable_wifi && chip_enable_openthread))
assert(!(use_rs9116 && chip_enable_openthread))
assert(!(use_SiWx917 && chip_enable_openthread))
assert(!(use_wf200 && chip_enable_openthread))
if (chip_enable_wifi) {
assert(use_rs9116 || use_wf200 || use_SiWx917)
import("${chip_root}/src/platform/silabs/wifi_args.gni")
if (use_rs9116) {
import("rs911x/rs911x.gni")
} else if (use_SiWx917) {
import("rs911x/rs9117.gni")
}
if (use_wf200) {
import("wf200/wf200.gni")
}
}
config("chip_examples_project_config") {
include_dirs = [ "project_include" ]
# Link options that provide a replacement for dynamic memory operations in standard
# library with the sl_memory_manager in platform code.
ldflags = [
"-Wl,--wrap=MemoryAlloc",
# Wrap these in case internal newlib call them (e.g. strdup will)
# directly call _malloc_r)
"-Wl,--wrap=_malloc_r",
"-Wl,--wrap=_realloc_r",
"-Wl,--wrap=_free_r",
"-Wl,--wrap=_calloc_r",
]
}
config("test-event-trigger-config") {
defines = [ "SL_MATTER_TEST_EVENT_TRIGGER_ENABLED" ]
if (is_debug) {
defines += [ "SL_MATTER_TEST_EVENT_TRIGGER_ENABLE_KEY=\"${sl_test_event_trigger_enable_key}\"" ]
}
}
source_set("test-event-trigger") {
sources = [
"${silabs_common_plat_dir}/SilabsTestEventTriggerDelegate.cpp",
"${silabs_common_plat_dir}/SilabsTestEventTriggerDelegate.h",
]
deps = [ "${chip_root}/src/platform/silabs/provision:provision-headers" ]
public_configs = [ ":test-event-trigger-config" ]
public_deps = [
"${chip_root}/src/app:test-event-trigger",
"${chip_root}/src/lib/core",
"${chip_root}/src/lib/support",
]
}
source_set("openthread_core_config_efr32_chip_examples") {
if (chip_enable_openthread) {
sources = [ "project_include/OpenThreadConfig.h" ]
public_deps = [ "${efr32_sdk_build_root}:efr32_sdk" ]
if (use_silabs_thread_lib) {
public_deps += [ "${efr32_sdk_build_root}:openthread_core_config_efr32" ]
} else {
public_deps += [ "${chip_root}/third_party/openthread/platforms/efr32:openthread_core_config_efr32" ]
}
public_configs = [ ":chip_examples_project_config" ]
}
}
source_set("efr-matter-shell") {
if (chip_build_libshell) {
defines = [ "ENABLE_CHIP_SHELL" ]
sources = [ "${silabs_common_plat_dir}/matter_shell.cpp" ]
include_dirs = [
".",
"${silabs_common_plat_dir}",
]
public_deps = [
"${chip_root}/examples/shell/shell_common:shell_common",
"${chip_root}/src/lib/shell:shell",
"${chip_root}/src/lib/shell:shell_core",
]
}
}
config("efr32-common-config") {
defines = [ "OTA_PERIODIC_TIMEOUT=${ota_periodic_query_timeout_sec}" ]
if (!disable_lcd) {
include_dirs = [ "${silabs_common_plat_dir}/display" ]
defines += [ "DISPLAY_ENABLED" ]
}
if (show_qr_code) {
defines += [ "QR_CODE_ENABLED" ]
}
if (chip_enable_ota_requestor) {
defines += [ "SILABS_OTA_ENABLED" ]
}
if (enable_heap_monitoring) {
defines += [ "HEAP_MONITORING" ]
}
if (chip_enable_multi_ota_requestor) {
defines += [ "CHIP_DEVICE_CONFIG_ENABLE_MULTI_OTA_REQUESTOR=1" ]
}
ldflags = [ "-Wl,--no-warn-rwx-segment" ]
}
config("silabs-wifi-config") {
defines = []
include_dirs = []
if (chip_default_wifi_ssid != "") {
defines += [
"SL_ONNETWORK_PAIRING=1",
"SL_WIFI_SSID=\"${chip_default_wifi_ssid}\"",
]
}
if (chip_default_wifi_psk != "") {
assert(chip_default_wifi_ssid != "",
"ssid can't be null if psk is provided")
defines += [ "SL_WIFI_PSK=\"${chip_default_wifi_psk}\"" ]
}
if (sl_wfx_config_softap) {
defines += [ "SL_WFX_CONFIG_SOFTAP" ]
}
if (sl_wfx_config_scan) {
defines += [ "SL_WFX_CONFIG_SCAN" ]
}
if (chip_enable_wifi_ipv4) {
defines += [ "CHIP_DEVICE_CONFIG_ENABLE_IPV4" ]
}
if (rs91x_wpa3_transition) {
# TODO: Change this macro once WF200 support is provided
defines += [ "WIFI_ENABLE_SECURITY_WPA3_TRANSITION=1" ]
}
}
source_set("efr32-common") {
deps = [ "${silabs_common_plat_dir}/provision:provision-storage" ]
defines = []
public_deps = []
public_configs = [
":efr32-common-config",
"${efr32_sdk_build_root}:silabs_config",
":chip_examples_project_config",
]
# DIC
if (enable_dic) {
public_deps +=
[ "${silabs_common_plat_dir}/DIC/matter_abs_interface:silabs-dic" ]
}
# AWS SDK OTA
if (aws_sdk_ota) {
public_deps += [
"${silabs_common_plat_dir}/DIC/matter_abs_interface:silabs-aws-sdk-ota",
]
}
include_dirs = [ "." ]
sources = [
"${silabs_common_plat_dir}/BaseApplication.cpp",
"${silabs_common_plat_dir}/LEDWidget.cpp",
"${silabs_common_plat_dir}/MatterConfig.cpp",
"${silabs_common_plat_dir}/SoftwareFaultReports.cpp",
"${silabs_common_plat_dir}/silabs_utils.cpp",
"${silabs_common_plat_dir}/syscalls_stubs.cpp",
]
if (chip_enable_pw_rpc || chip_build_libshell || enable_openthread_cli) {
sources += [ "uart.cpp" ]
}
if (chip_enable_ota_requestor) {
sources += [ "${silabs_common_plat_dir}/OTAConfig.cpp" ]
}
if (!disable_lcd) {
sources += [
"${silabs_common_plat_dir}/display/demo-ui.c",
"${silabs_common_plat_dir}/display/lcd.cpp",
]
include_dirs += [ "${silabs_common_plat_dir}/display" ]
public_deps += [ "${chip_root}/examples/common/QRCode" ]
}
if (enable_heap_monitoring) {
sources += [ "${silabs_common_plat_dir}/MemMonitoring.cpp" ]
}
# OpenThread Settings
if (chip_enable_openthread) {
deps += [
"${chip_root}/third_party/openthread:openthread",
"${chip_root}/third_party/openthread:openthread-platform",
]
}
if (chip_enable_wifi) {
if (use_rs9116) {
sources += rs911x_src_plat
# All the stuff from wiseconnect
sources += rs911x_src_sapi
include_dirs += rs911x_inc_plat
#add compilation flags for rs991x build. This will be addressed directly in wiseconnect sdk in the next version release of that sdk
cflags = rs911x_cflags
} else if (use_SiWx917) {
sources += rs911x_src_plat
# All the stuff from wiseconnect
sources += rs9117_src_sapi
include_dirs += rs9117_inc_plat
#add compilation flags for rs991x build. This will be addressed directly in wiseconnect sdk in the next version release of that sdk
} else if (use_wf200) {
sources += wf200_plat_src
include_dirs += wf200_plat_incs
}
public_configs += [ ":silabs-wifi-config" ]
}
if (chip_build_libshell) {
deps += [ ":efr-matter-shell" ]
}
public_deps += [
"${chip_root}/examples/providers:device_info_provider",
"${chip_root}/src/app/server",
"${chip_root}/src/lib",
"${chip_root}/src/setup_payload",
]
if (sl_enable_test_event_trigger) {
public_deps += [ ":test-event-trigger" ]
}
if (app_data_model != "") {
public_deps += [ app_data_model ]
}
}