Skip to content

Commit 238abcc

Browse files
Update silabs_examples in line with csa examples
1 parent adc0e6a commit 238abcc

File tree

27 files changed

+1219
-1956
lines changed

27 files changed

+1219
-1956
lines changed

silabs_examples/lighting-lite-app/efr32/BUILD.gn

+14-226
Original file line numberDiff line numberDiff line change
@@ -35,101 +35,11 @@ efr32_project_dir = "${chip_root}/silabs_examples/lighting-lite-app/efr32"
3535
examples_plat_dir = "${chip_root}/examples/platform/silabs/efr32"
3636
examples_common_plat_dir = "${chip_root}/examples/platform/silabs"
3737

38+
import("${examples_plat_dir}/args.gni")
39+
3840
declare_args() {
3941
# Dump memory usage at link time.
4042
chip_print_memory_usage = false
41-
42-
# Monitor & log memory usage at runtime.
43-
enable_heap_monitoring = false
44-
45-
# Enable Sleepy end device
46-
enable_sleepy_device = false
47-
48-
# OTA timeout in seconds
49-
OTA_periodic_query_timeout = 86400
50-
51-
# Wifi related stuff - they are overridden by gn -args="use_wf200=true"
52-
use_wf200 = false
53-
use_rs911x = false
54-
use_rs911x_sockets = false
55-
sl_wfx_config_softap = false
56-
sl_wfx_config_scan = true
57-
58-
# Disable LCD on supported devices
59-
disable_lcd = false
60-
61-
# Argument to Disable IPv4 for wifi(rs911)
62-
chip_enable_wifi_ipv4 = false
63-
64-
# Argument to force enable WPA3 security on rs91x
65-
rs91x_wpa3_only = false
66-
67-
}
68-
69-
declare_args() {
70-
# Enables LCD Qr Code on supported devices
71-
show_qr_code = !disable_lcd
72-
}
73-
74-
# qr code cannot be true if lcd is disabled
75-
assert(!(disable_lcd && show_qr_code))
76-
77-
# Sanity check
78-
assert(!(chip_enable_wifi && chip_enable_openthread))
79-
assert(!(use_rs911x && chip_enable_openthread))
80-
assert(!(use_wf200 && chip_enable_openthread))
81-
if (chip_enable_wifi) {
82-
assert(use_rs911x || use_wf200)
83-
enable_openthread_cli = false
84-
import("${chip_root}/src/platform/silabs/EFR32/wifi_args.gni")
85-
}
86-
87-
# ThunderBoards, Explorer Kit and MGM240L do not support LCD (No LCD)
88-
if (silabs_board == "BRD4166A" || silabs_board == "BRD2601B" ||
89-
silabs_board == "BRD2703A" || silabs_board == "BRD4319A") {
90-
show_qr_code = false
91-
disable_lcd = true
92-
}
93-
94-
# WiFi settings
95-
if (chip_enable_wifi) {
96-
# disabling LCD for MG24 for wifi
97-
if (silabs_board == "BRD4186A" || silabs_board == "BRD4187A") {
98-
show_qr_code = false
99-
disable_lcd = true
100-
}
101-
wifi_sdk_dir = "${chip_root}/src/platform/silabs/EFR32/wifi"
102-
efr32_lwip_defs = [ "LWIP_NETIF_API=1" ]
103-
104-
if (lwip_ipv4) {
105-
efr32_lwip_defs += [
106-
"LWIP_IPV4=1",
107-
# adds following options to provide
108-
# them to .cpp source files
109-
# flags ported from lwipopts file
110-
# TODO: move lwipopts to one location
111-
"LWIP_ARP=1",
112-
"LWIP_ICMP=1",
113-
"LWIP_IGMP=1",
114-
"LWIP_DHCP=1",
115-
"LWIP_DNS=0",
116-
]
117-
} else {
118-
efr32_lwip_defs += [ "LWIP_IPV4=0" ]
119-
}
120-
if (lwip_ipv6) {
121-
efr32_lwip_defs += [ "LWIP_IPV6=1" ]
122-
} else {
123-
efr32_lwip_defs += [ "LWIP_IPV6=0" ]
124-
}
125-
126-
if (use_rs911x) {
127-
wiseconnect_sdk_root =
128-
"${chip_root}/third_party/silabs/wiseconnect-wifi-bt-sdk"
129-
import("${examples_plat_dir}/rs911x/rs911x.gni")
130-
} else {
131-
import("${examples_plat_dir}/wf200/wf200.gni")
132-
}
13343
}
13444

13545
efr32_sdk("sdk") {
@@ -139,50 +49,25 @@ efr32_sdk("sdk") {
13949
]
14050

14151
include_dirs = [
142-
"${chip_root}/src/platform/silabs/EFR32",
52+
"${chip_root}/src/platform/silabs/efr32",
14353
"${efr32_project_dir}/include",
14454
"${examples_plat_dir}",
14555
"${chip_root}/src/lib",
14656
"${examples_common_plat_dir}",
14757
]
14858

149-
defines = [
150-
"BOARD_ID=${silabs_board}",
151-
"OTA_PERIODIC_TIMEOUT=${OTA_periodic_query_timeout}",
152-
]
59+
if (use_wf200) {
60+
# TODO efr32_sdk should not need a header from this location
61+
include_dirs += [ "${examples_plat_dir}/wf200" ]
62+
}
15363

64+
defines = []
15465
if (chip_enable_pw_rpc) {
15566
defines += [
15667
"HAL_VCOM_ENABLE=1",
15768
"PW_RPC_ENABLED",
15869
]
15970
}
160-
161-
# WiFi Settings
162-
if (chip_enable_wifi) {
163-
if (use_rs911x) {
164-
defines += rs911x_defs
165-
include_dirs += rs911x_plat_incs
166-
} else if (use_wf200) {
167-
defines += wf200_defs
168-
include_dirs += wf200_plat_incs
169-
}
170-
171-
if (use_rs911x_sockets) {
172-
include_dirs += [ "${examples_plat_dir}/wifi/rsi-sockets" ]
173-
defines += rs911x_sock_defs
174-
} else {
175-
# Using LWIP instead of the native TCP/IP stack
176-
defines += efr32_lwip_defs
177-
}
178-
179-
if (sl_wfx_config_softap) {
180-
defines += [ "SL_WFX_CONFIG_SOFTAP" ]
181-
}
182-
if (sl_wfx_config_scan) {
183-
defines += [ "SL_WFX_CONFIG_SCAN" ]
184-
}
185-
}
18671
}
18772

18873
efr32_executable("lighting-lite_app") {
@@ -191,104 +76,22 @@ efr32_executable("lighting-lite_app") {
19176
include_dirs = [ "include" ]
19277
defines = []
19378

79+
if (silabs_board == "BRD2704A") {
80+
defines += [ "SL_STATUS_LED=0" ]
81+
}
82+
19483
sources = [
195-
"${examples_common_plat_dir}/heap_4_silabs.c",
196-
"${examples_plat_dir}/BaseApplication.cpp",
197-
"${examples_plat_dir}/efr32_utils.cpp",
198-
"${examples_plat_dir}/init_efrPlatform.cpp",
199-
"${examples_plat_dir}/matter_config.cpp",
20084
"src/AppTask.cpp",
20185
"src/LightingManager.cpp",
20286
"src/ZclCallbacks.cpp",
20387
"src/main.cpp",
20488
]
20589

206-
if (use_wstk_leds) {
207-
sources += [ "${examples_plat_dir}/LEDWidget.cpp" ]
208-
}
209-
210-
if (chip_enable_pw_rpc || chip_build_libshell || enable_openthread_cli ||
211-
use_wf200 || use_rs911x) {
212-
sources += [ "${examples_plat_dir}/uart.cpp" ]
213-
}
214-
21590
deps = [
21691
":sdk",
217-
"${chip_root}/silabs_examples/lighting-lite-app/lighting-lite-common",
218-
"${chip_root}/examples/providers:device_info_provider",
219-
"${chip_root}/src/lib",
220-
"${chip_root}/src/setup_payload",
221-
]
222-
223-
# OpenThread Settings
224-
if (chip_enable_openthread) {
225-
deps += [
226-
"${chip_root}/third_party/openthread:openthread",
227-
"${chip_root}/third_party/openthread:openthread-platform",
228-
"${examples_plat_dir}:efr-matter-shell",
229-
]
230-
}
231-
232-
if (chip_enable_ota_requestor) {
233-
defines += [ "EFR32_OTA_ENABLED" ]
234-
sources += [ "${examples_plat_dir}/OTAConfig.cpp" ]
235-
}
236-
237-
# WiFi Settings
238-
if (chip_enable_wifi) {
239-
if (use_rs911x) {
240-
sources += rs911x_src_plat
241-
242-
# All the stuff from wiseconnect
243-
sources += rs911x_src_sapi
244-
245-
# Apparently - the rsi library needs this (though we may not use use it)
246-
sources += rs911x_src_sock
247-
include_dirs += rs911x_inc_plat
248-
249-
if (use_rs911x_sockets) {
250-
#
251-
# Using native sockets inside RS911x
252-
#
253-
include_dirs += rs911x_sock_inc
254-
} else {
255-
#
256-
# We use LWIP - not built-in sockets
257-
#
258-
sources += rs911x_src_lwip
259-
}
260-
} else if (use_wf200) {
261-
sources += wf200_plat_src
262-
include_dirs += wf200_plat_incs
263-
}
264-
265-
if (chip_enable_wifi_ipv4) {
266-
defines += [ "CHIP_DEVICE_CONFIG_ENABLE_IPV4" ]
267-
}
268-
269-
if (rs91x_wpa3_only) {
270-
# TODO: Change this macro once WF200 support is provided
271-
defines += [ "WIFI_ENABLE_SECURITY_WPA3=1" ]
272-
}
273-
}
274-
275-
if (!disable_lcd) {
276-
sources += [
277-
"${examples_plat_dir}/display/demo-ui.c",
278-
"${examples_plat_dir}/display/lcd.cpp",
279-
]
280-
281-
include_dirs += [ "${examples_plat_dir}/display" ]
282-
defines += [
283-
"DISPLAY_ENABLED",
284-
"IS_DEMO_LIGHT=1",
92+
"${examples_plat_dir}:efr32-common",
93+
app_data_model,
28594
]
286-
if (show_qr_code) {
287-
defines += [ "QR_CODE_ENABLED" ]
288-
289-
deps += [ "${chip_root}/examples/common/QRCode" ]
290-
}
291-
}
29295

29396
if (chip_enable_pw_rpc) {
29497
defines += [
@@ -335,11 +138,6 @@ efr32_executable("lighting-lite_app") {
335138
]
336139
}
337140

338-
if (enable_heap_monitoring) {
339-
sources += [ "${examples_plat_dir}/MemMonitoring.cpp" ]
340-
defines += [ "HEAP_MONITORING" ]
341-
}
342-
343141
ldscript = "${examples_plat_dir}/ldscripts/${silabs_family}.ld"
344142

345143
inputs = [ ldscript ]
@@ -361,16 +159,6 @@ efr32_executable("lighting-lite_app") {
361159
]
362160
}
363161

364-
# Attestation Credentials
365-
if (chip_build_platform_attestation_credentials_provider) {
366-
deps += [ "${examples_plat_dir}:efr32-attestation-credentials" ]
367-
}
368-
369-
# Factory Data Provider
370-
if (use_efr32_factory_data_provider) {
371-
deps += [ "${examples_plat_dir}:efr32-factory-data-provider" ]
372-
}
373-
374162
output_dir = root_out_dir
375163
}
376164

silabs_examples/lighting-lite-app/efr32/args.gni

+3-6
Original file line numberDiff line numberDiff line change
@@ -13,18 +13,15 @@
1313
# limitations under the License.
1414

1515
import("//build_overrides/chip.gni")
16-
import("//build_overrides/pigweed.gni")
1716
import("${chip_root}/config/standalone/args.gni")
18-
import("${chip_root}/src/platform/silabs/EFR32/args.gni")
17+
import("${chip_root}/src/platform/silabs/efr32/args.gni")
1918

2019
efr32_sdk_target = get_label_info(":sdk", "label_no_toolchain")
2120

21+
app_data_model =
22+
"${chip_root}/silabs_examples/lighting-lite-app/lighting-lite-common"
2223
chip_enable_ota_requestor = true
23-
24-
pw_log_BACKEND = "${chip_root}/src/lib/support/pw_log_chip"
25-
pw_assert_BACKEND = "$dir_pw_assert_log:check_backend"
2624
chip_enable_openthread = true
27-
pw_rpc_CONFIG = "$dir_pw_rpc:disable_global_mutex"
2825

2926
openthread_external_platform =
3027
"${chip_root}/third_party/openthread/platforms/efr32:libopenthread-efr32"

silabs_examples/lighting-lite-app/efr32/build_for_wifi_args.gni

+2-5
Original file line numberDiff line numberDiff line change
@@ -12,14 +12,11 @@
1212
# See the License for the specific language governing permissions and
1313
# limitations under the License.
1414
import("//build_overrides/chip.gni")
15-
import("//build_overrides/pigweed.gni")
1615
import("${chip_root}/config/standalone/args.gni")
1716

1817
efr32_sdk_target = get_label_info(":sdk", "label_no_toolchain")
1918
chip_enable_openthread = false
20-
import("${chip_root}/src/platform/silabs/EFR32/wifi_args.gni")
19+
import("${chip_root}/src/platform/silabs/efr32/wifi_args.gni")
2120

2221
chip_enable_ota_requestor = true
23-
24-
pw_log_BACKEND = "${chip_root}/src/lib/support/pw_log_chip"
25-
pw_assert_BACKEND = "$dir_pw_assert_log:check_backend"
22+
app_data_model = "${chip_root}/silabs_examples/lighting-lite-app/lighting-lite-common"

0 commit comments

Comments
 (0)