Skip to content

Commit 234648f

Browse files
[EFR32] Add comments to examples BUILD.gn (#16575)
* Add coments to examples BUILD.gn * fix CI
1 parent 035911e commit 234648f

File tree

5 files changed

+285
-209
lines changed

5 files changed

+285
-209
lines changed

examples/light-switch-app/efr32/BUILD.gn

+72-51
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,14 @@ declare_args() {
6262
show_qr_code = true
6363
}
6464

65+
# Sanity check
66+
assert(!(chip_enable_wifi && chip_enable_openthread))
67+
assert(!(use_rs911x && chip_enable_openthread))
68+
assert(!(use_wf200 && chip_enable_openthread))
69+
if (chip_enable_wifi) {
70+
assert(use_rs911x || use_wf200)
71+
}
72+
6573
# BRD4166A --> ThunderBoard Sense 2 (No LCD)
6674
if (efr32_board == "BRD4166A" || efr32_board == "BRD4180A") {
6775
show_qr_code = false
@@ -70,17 +78,10 @@ if (efr32_board == "BRD4166A" || efr32_board == "BRD4180A") {
7078
# Enables LCD on supported devices
7179
lcd_on = show_qr_code
7280

73-
if (use_rs911x || use_wf200) {
81+
# WiFi settings
82+
if (chip_enable_wifi) {
7483
wifi_sdk_dir = "${chip_root}/third_party/efr32_sdk/repo/matter/wifi"
75-
if (use_rs911x) {
76-
wiseconnect_sdk_root = "${chip_root}/third_party/wiseconnect-wifi-bt-sdk"
77-
import("${wifi_sdk_dir}/rs911x/rs911x.gni")
78-
} else {
79-
import("${wifi_sdk_dir}/wf200/wf200.gni")
80-
}
81-
}
82-
efr32_lwip_defs = [ "LWIP_NETIF_API=1" ]
83-
if (use_rs911x || use_wf200) {
84+
efr32_lwip_defs = [ "LWIP_NETIF_API=1" ]
8485
efr32_lwip_defs += [
8586
"LWIP_IPV4=1",
8687
"LWIP_ARP=1",
@@ -89,6 +90,13 @@ if (use_rs911x || use_wf200) {
8990
"LWIP_IPV6_ND=1",
9091
"LWIP_IGMP=1",
9192
]
93+
94+
if (use_rs911x) {
95+
wiseconnect_sdk_root = "${chip_root}/third_party/wiseconnect-wifi-bt-sdk"
96+
import("${wifi_sdk_dir}/rs911x/rs911x.gni")
97+
} else {
98+
import("${wifi_sdk_dir}/wf200/wf200.gni")
99+
}
92100
}
93101

94102
efr32_sdk("sdk") {
@@ -117,25 +125,25 @@ efr32_sdk("sdk") {
117125
"PW_RPC_ENABLED",
118126
]
119127
}
120-
if (use_rs911x) {
121-
defines += rs911x_defs
122-
include_dirs += rs911x_plat_incs
123-
} else if (use_wf200) {
124-
defines += wf200_defs
125-
include_dirs += wf200_plat_incs
126-
}
127128

128-
if (use_rs911x_sockets) {
129-
include_dirs += [ "${examples_plat_dir}/wifi/rsi-sockets" ]
130-
defines += rs911x_sock_defs
131-
} else {
132-
# Using LWIP instead of the native TCP/IP stack
133-
# Thread also uses LWIP
134-
#
135-
defines += efr32_lwip_defs
136-
}
129+
# WiFi Settings
130+
if (chip_enable_wifi) {
131+
if (use_rs911x) {
132+
defines += rs911x_defs
133+
include_dirs += rs911x_plat_incs
134+
} else if (use_wf200) {
135+
defines += wf200_defs
136+
include_dirs += wf200_plat_incs
137+
}
138+
139+
if (use_rs911x_sockets) {
140+
include_dirs += [ "${examples_plat_dir}/wifi/rsi-sockets" ]
141+
defines += rs911x_sock_defs
142+
} else {
143+
# Using LWIP instead of the native TCP/IP stack
144+
defines += efr32_lwip_defs
145+
}
137146

138-
if (use_rs911x || use_wf200) {
139147
if (sl_wfx_config_softap) {
140148
defines += [ "SL_WFX_CONFIG_SOFTAP" ]
141149
}
@@ -171,7 +179,9 @@ efr32_executable("light_switch_app") {
171179
"${chip_root}/src/lib",
172180
"${chip_root}/src/setup_payload",
173181
]
174-
if (!use_rs911x && !use_wf200) {
182+
183+
# OpenThread Settings
184+
if (chip_enable_openthread) {
175185
deps += [
176186
"${chip_root}/third_party/openthread/platforms:libopenthread-platform",
177187
"${chip_root}/third_party/openthread/platforms:libopenthread-platform-utils",
@@ -195,30 +205,33 @@ efr32_executable("light_switch_app") {
195205
sources += [ "${examples_plat_dir}/OTAConfig.cpp" ]
196206
}
197207

198-
if (use_rs911x) {
199-
sources += rs911x_src_plat
200-
201-
# All the stuff from wiseconnect
202-
sources += rs911x_src_sapi
203-
204-
# Apparently - the rsi library needs this (though we may not use use it)
205-
sources += rs911x_src_sock
206-
include_dirs += rs911x_inc_plat
207-
208-
if (use_rs911x_sockets) {
209-
#
210-
# Using native sockets inside RS911x
211-
#
212-
include_dirs += rs911x_sock_inc
213-
} else {
214-
#
215-
# We use LWIP - not built-in sockets
216-
#
217-
sources += rs911x_src_lwip
208+
# WiFi Settings
209+
if (chip_enable_wifi) {
210+
if (use_rs911x) {
211+
sources += rs911x_src_plat
212+
213+
# All the stuff from wiseconnect
214+
sources += rs911x_src_sapi
215+
216+
# Apparently - the rsi library needs this (though we may not use use it)
217+
sources += rs911x_src_sock
218+
include_dirs += rs911x_inc_plat
219+
220+
if (use_rs911x_sockets) {
221+
#
222+
# Using native sockets inside RS911x
223+
#
224+
include_dirs += rs911x_sock_inc
225+
} else {
226+
#
227+
# We use LWIP - not built-in sockets
228+
#
229+
sources += rs911x_src_lwip
230+
}
231+
} else if (use_wf200) {
232+
sources += wf200_plat_src
233+
include_dirs += wf200_plat_incs
218234
}
219-
} else if (use_wf200) {
220-
sources += wf200_plat_src
221-
include_dirs += wf200_plat_incs
222235
}
223236

224237
if (lcd_on) {
@@ -285,6 +298,14 @@ efr32_executable("light_switch_app") {
285298
]
286299
}
287300

301+
# WiFi Settings
302+
if (chip_enable_wifi) {
303+
ldflags += [
304+
"-Wl,--defsym",
305+
"-Wl,SILABS_WIFI=1",
306+
]
307+
}
308+
288309
output_dir = root_out_dir
289310
}
290311

examples/lighting-app/efr32/BUILD.gn

+68-52
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,14 @@ declare_args() {
6262
show_qr_code = true
6363
}
6464

65+
# Sanity check
66+
assert(!(chip_enable_wifi && chip_enable_openthread))
67+
assert(!(use_rs911x && chip_enable_openthread))
68+
assert(!(use_wf200 && chip_enable_openthread))
69+
if (chip_enable_wifi) {
70+
assert(use_rs911x || use_wf200)
71+
}
72+
6573
# BRD4166A --> ThunderBoard Sense 2 (No LCD)
6674
if (efr32_board == "BRD4166A" || efr32_board == "BRD4180A") {
6775
show_qr_code = false
@@ -70,17 +78,10 @@ if (efr32_board == "BRD4166A" || efr32_board == "BRD4180A") {
7078
# Enables LCD on supported devices
7179
lcd_on = show_qr_code
7280

73-
if (use_rs911x || use_wf200) {
81+
# WiFi settings
82+
if (chip_enable_wifi) {
7483
wifi_sdk_dir = "${chip_root}/third_party/efr32_sdk/repo/matter/wifi"
75-
if (use_rs911x) {
76-
wiseconnect_sdk_root = "${chip_root}/third_party/wiseconnect-wifi-bt-sdk"
77-
import("${wifi_sdk_dir}/rs911x/rs911x.gni")
78-
} else {
79-
import("${wifi_sdk_dir}/wf200/wf200.gni")
80-
}
81-
}
82-
efr32_lwip_defs = [ "LWIP_NETIF_API=1" ]
83-
if (use_rs911x || use_wf200) {
84+
efr32_lwip_defs = [ "LWIP_NETIF_API=1" ]
8485
efr32_lwip_defs += [
8586
"LWIP_IPV4=1",
8687
"LWIP_ARP=1",
@@ -89,6 +90,13 @@ if (use_rs911x || use_wf200) {
8990
"LWIP_IPV6_ND=1",
9091
"LWIP_IGMP=1",
9192
]
93+
94+
if (use_rs911x) {
95+
wiseconnect_sdk_root = "${chip_root}/third_party/wiseconnect-wifi-bt-sdk"
96+
import("${wifi_sdk_dir}/rs911x/rs911x.gni")
97+
} else {
98+
import("${wifi_sdk_dir}/wf200/wf200.gni")
99+
}
92100
}
93101

94102
efr32_sdk("sdk") {
@@ -117,24 +125,25 @@ efr32_sdk("sdk") {
117125
"PW_RPC_ENABLED",
118126
]
119127
}
120-
if (use_rs911x) {
121-
defines += rs911x_defs
122-
include_dirs += rs911x_plat_incs
123-
} else if (use_wf200) {
124-
defines += wf200_defs
125-
include_dirs += wf200_plat_incs
126-
}
127128

128-
if (use_rs911x_sockets) {
129-
include_dirs += [ "${examples_plat_dir}/wifi/rsi-sockets" ]
130-
defines += rs911x_sock_defs
131-
} else {
132-
# Using LWIP instead of the native TCP/IP stack
133-
# Thread also uses LWIP
134-
#
135-
defines += efr32_lwip_defs
136-
}
137-
if (use_rs911x || use_wf200) {
129+
# WiFi Settings
130+
if (chip_enable_wifi) {
131+
if (use_rs911x) {
132+
defines += rs911x_defs
133+
include_dirs += rs911x_plat_incs
134+
} else if (use_wf200) {
135+
defines += wf200_defs
136+
include_dirs += wf200_plat_incs
137+
}
138+
139+
if (use_rs911x_sockets) {
140+
include_dirs += [ "${examples_plat_dir}/wifi/rsi-sockets" ]
141+
defines += rs911x_sock_defs
142+
} else {
143+
# Using LWIP instead of the native TCP/IP stack
144+
defines += efr32_lwip_defs
145+
}
146+
138147
if (sl_wfx_config_softap) {
139148
defines += [ "SL_WFX_CONFIG_SOFTAP" ]
140149
}
@@ -169,7 +178,9 @@ efr32_executable("lighting_app") {
169178
"${chip_root}/src/lib",
170179
"${chip_root}/src/setup_payload",
171180
]
172-
if (!use_rs911x && !use_wf200) {
181+
182+
# OpenThread Settings
183+
if (chip_enable_openthread) {
173184
deps += [
174185
"${chip_root}/third_party/openthread/platforms:libopenthread-platform",
175186
"${chip_root}/third_party/openthread/platforms:libopenthread-platform-utils",
@@ -193,30 +204,33 @@ efr32_executable("lighting_app") {
193204
sources += [ "${examples_plat_dir}/OTAConfig.cpp" ]
194205
}
195206

196-
if (use_rs911x) {
197-
sources += rs911x_src_plat
198-
199-
# All the stuff from wiseconnect
200-
sources += rs911x_src_sapi
201-
202-
# Apparently - the rsi library needs this (though we may not use use it)
203-
sources += rs911x_src_sock
204-
include_dirs += rs911x_inc_plat
205-
206-
if (use_rs911x_sockets) {
207-
#
208-
# Using native sockets inside RS911x
209-
#
210-
include_dirs += rs911x_sock_inc
211-
} else {
212-
#
213-
# We use LWIP - not built-in sockets
214-
#
215-
sources += rs911x_src_lwip
207+
# WiFi Settings
208+
if (chip_enable_wifi) {
209+
if (use_rs911x) {
210+
sources += rs911x_src_plat
211+
212+
# All the stuff from wiseconnect
213+
sources += rs911x_src_sapi
214+
215+
# Apparently - the rsi library needs this (though we may not use use it)
216+
sources += rs911x_src_sock
217+
include_dirs += rs911x_inc_plat
218+
219+
if (use_rs911x_sockets) {
220+
#
221+
# Using native sockets inside RS911x
222+
#
223+
include_dirs += rs911x_sock_inc
224+
} else {
225+
#
226+
# We use LWIP - not built-in sockets
227+
#
228+
sources += rs911x_src_lwip
229+
}
230+
} else if (use_wf200) {
231+
sources += wf200_plat_src
232+
include_dirs += wf200_plat_incs
216233
}
217-
} else if (use_wf200) {
218-
sources += wf200_plat_src
219-
include_dirs += wf200_plat_incs
220234
}
221235

222236
if (lcd_on) {
@@ -287,7 +301,9 @@ efr32_executable("lighting_app") {
287301
"-fstack-usage",
288302
]
289303
}
290-
if (use_rs911x || use_wf200) {
304+
305+
# WiFi Settings
306+
if (chip_enable_wifi) {
291307
ldflags += [
292308
"-Wl,--defsym",
293309
"-Wl,SILABS_WIFI=1",

0 commit comments

Comments
 (0)