Skip to content

Commit 6b60c62

Browse files
[Silabs] Adds changes in build system to support docker image change (#30181)
* refactors GN build system * Restyled by shfmt * Adds changes based on comments * adds bugfix --------- Co-authored-by: Restyled.io <commits@restyled.io>
1 parent 1c376e9 commit 6b60c62

File tree

10 files changed

+45
-42
lines changed

10 files changed

+45
-42
lines changed

.gitmodules

+1-1
Original file line numberDiff line numberDiff line change
@@ -245,7 +245,7 @@
245245
path = third_party/silabs/wiseconnect-wifi-bt-sdk
246246
url = https://github.com/SiliconLabs/wiseconnect-wifi-bt-sdk.git
247247
branch = 2.8.2
248-
platforms = efr32,silabs_docker
248+
platforms = efr32
249249
[submodule "third_party/silabs/wifi_sdk"]
250250
path = third_party/silabs/wifi_sdk
251251
url = https://github.com/SiliconLabs/wiseconnect.git

examples/platform/silabs/SiWx917/BUILD.gn

+8-10
Original file line numberDiff line numberDiff line change
@@ -17,10 +17,9 @@ import("//build_overrides/efr32_sdk.gni")
1717
import("${chip_root}/examples/common/pigweed/pigweed_rpcs.gni")
1818
import("${chip_root}/src/lib/lib.gni")
1919
import("${chip_root}/src/platform/device.gni")
20+
import("${chip_root}/src/platform/silabs/wifi_args.gni")
2021
import("${chip_root}/third_party/silabs/silabs_board.gni")
2122
import("${efr32_sdk_build_root}/SiWx917_sdk.gni")
22-
silabs_common_plat_dir = "${chip_root}/examples/platform/silabs"
23-
wifi_sdk_dir = "${chip_root}/src/platform/silabs/SiWx917/wifi"
2423

2524
declare_args() {
2625
enable_heap_monitoring = false
@@ -52,13 +51,12 @@ declare_args() {
5251
silabs_test_event_trigger_enable_key = "00112233445566778899aabbccddeeff"
5352
}
5453

55-
import("${chip_root}/src/platform/silabs/wifi_args.gni")
56-
import("${silabs_common_plat_dir}/args.gni")
57-
5854
# Sanity check
5955
assert(chip_enable_wifi)
6056

6157
silabs_common_plat_dir = "${chip_root}/examples/platform/silabs"
58+
silabs_plat_si91x_wifi_dir = "${chip_root}/src/platform/silabs/SiWx917/wifi"
59+
import("${silabs_common_plat_dir}/args.gni")
6260

6361
config("chip_examples_project_config") {
6462
include_dirs = [ "project_include" ]
@@ -207,7 +205,7 @@ source_set("siwx917-common") {
207205
include_dirs = [
208206
".",
209207
"SiWx917/",
210-
"${wifi_sdk_dir}",
208+
"${silabs_plat_si91x_wifi_dir}",
211209
]
212210

213211
sources = [
@@ -218,10 +216,10 @@ source_set("siwx917-common") {
218216
"${silabs_common_plat_dir}/heap_4_silabs.c",
219217
"${silabs_common_plat_dir}/silabs_utils.cpp",
220218
"${silabs_common_plat_dir}/syscalls_stubs.cpp",
221-
"${wifi_sdk_dir}/dhcp_client.cpp",
222-
"${wifi_sdk_dir}/ethernetif.cpp",
223-
"${wifi_sdk_dir}/lwip_netif.cpp",
224-
"${wifi_sdk_dir}/wfx_notify.cpp",
219+
"${silabs_plat_si91x_wifi_dir}/dhcp_client.cpp",
220+
"${silabs_plat_si91x_wifi_dir}/ethernetif.cpp",
221+
"${silabs_plat_si91x_wifi_dir}/lwip_netif.cpp",
222+
"${silabs_plat_si91x_wifi_dir}/wfx_notify.cpp",
225223
"SiWx917/sl_wifi_if.c",
226224
"SiWx917/wfx_rsi_host.c",
227225
]

examples/platform/silabs/efr32/BUILD.gn

-3
Original file line numberDiff line numberDiff line change
@@ -63,11 +63,8 @@ if (chip_enable_wifi) {
6363
import("${chip_root}/src/platform/silabs/wifi_args.gni")
6464

6565
if (use_rs9116) {
66-
wiseconnect_sdk_root =
67-
"${chip_root}/third_party/silabs/wiseconnect-wifi-bt-sdk"
6866
import("rs911x/rs911x.gni")
6967
} else if (use_SiWx917) {
70-
wifi_sdk_root = "${chip_root}/third_party/silabs/wifi_sdk"
7168
import("rs911x/rs9117.gni")
7269
}
7370
if (use_wf200) {

examples/platform/silabs/efr32/rs911x/rs9117.gni

+3-5
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,13 @@
11
import("//build_overrides/chip.gni")
2-
3-
examples_plat_dir = "${chip_root}/examples/platform/silabs/efr32"
4-
wifi_sdk_dir = "${chip_root}/src/platform/silabs/efr32/wifi"
5-
wifi_sdk_root = "${chip_root}/third_party/silabs/wifi_sdk"
2+
import("//build_overrides/efr32_sdk.gni")
3+
import("${efr32_sdk_build_root}/efr32_sdk.gni")
64

75
rs911x_src_plat = [
86
"${examples_plat_dir}/rs911x/sl_wifi_if.c",
97
"${examples_plat_dir}/rs911x/wfx_rsi_host.c",
108
"${examples_plat_dir}/rs911x/hal/rsi_hal_mcu_interrupt.c",
119
"${examples_plat_dir}/rs911x/hal/efx_spi.c",
12-
"${wifi_sdk_dir}/wfx_notify.cpp",
10+
"${silabs_plat_efr32_wifi_dir}/wfx_notify.cpp",
1311
]
1412

1513
rs911x_inc_plat = [

examples/platform/silabs/efr32/rs911x/rs911x.gni

+3-5
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,6 @@
11
import("//build_overrides/chip.gni")
2-
3-
examples_plat_dir = "${chip_root}/examples/platform/silabs/efr32"
4-
wifi_sdk_dir = "${chip_root}/src/platform/silabs/efr32/wifi"
5-
wiseconnect_sdk_root = "${chip_root}/third_party/silabs/wiseconnect-wifi-bt-sdk"
2+
import("//build_overrides/efr32_sdk.gni")
3+
import("${efr32_sdk_build_root}/efr32_sdk.gni")
64

75
rs911x_src_plat = [
86
"${examples_plat_dir}/rs911x/rsi_if.c",
@@ -11,7 +9,7 @@ rs911x_src_plat = [
119
"${examples_plat_dir}/rs911x/hal/rsi_hal_mcu_ioports.c",
1210
"${examples_plat_dir}/rs911x/hal/rsi_hal_mcu_timer.c",
1311
"${examples_plat_dir}/rs911x/hal/efx_spi.c",
14-
"${wifi_sdk_dir}/wfx_notify.cpp",
12+
"${silabs_plat_efr32_wifi_dir}/wfx_notify.cpp",
1513
]
1614

1715
#

examples/platform/silabs/efr32/wf200/wf200.gni

+3-4
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,10 @@
11
import("//build_overrides/chip.gni")
2-
3-
examples_plat_dir = "${chip_root}/examples/platform/silabs/efr32"
4-
wifi_sdk_dir = "${chip_root}/src/platform/silabs/efr32/wifi"
2+
import("//build_overrides/efr32_sdk.gni")
3+
import("${efr32_sdk_build_root}/efr32_sdk.gni")
54

65
wf200_plat_incs = [ "${examples_plat_dir}/wf200" ]
76
wf200_plat_src = [
8-
"${wifi_sdk_dir}/wfx_notify.cpp",
7+
"${silabs_plat_efr32_wifi_dir}/wfx_notify.cpp",
98
"${examples_plat_dir}/wf200/sl_wfx_task.c",
109
"${examples_plat_dir}/wf200/wf200_init.c",
1110
"${examples_plat_dir}/wf200/efr_spi.c",

scripts/build/builders/efr32.py

+6
Original file line numberDiff line numberDiff line change
@@ -230,8 +230,14 @@ def __init__(self,
230230
# case for pre-installed images), use it directly.
231231
sdk_path = shlex.quote(os.environ['GSDK_ROOT'])
232232
self.extra_gn_options.append(f"efr32_sdk_root=\"{sdk_path}\"")
233+
234+
if "GSDK_ROOT" in os.environ and not enable_wifi:
233235
self.extra_gn_options.append(f"openthread_root=\"{sdk_path}/util/third_party/openthread\"")
234236

237+
if "WISECONNECT_SDK_ROOT" in os.environ and enable_rs911x:
238+
wiseconnect_sdk_path = shlex.quote(os.environ['WISECONNECT_SDK_ROOT'])
239+
self.extra_gn_options.append(f"wiseconnect_sdk_root=\"{wiseconnect_sdk_path}\"")
240+
235241
def GnBuildArgs(self):
236242
return self.extra_gn_options
237243

scripts/examples/gn_silabs_example.sh

+2
Original file line numberDiff line numberDiff line change
@@ -227,6 +227,8 @@ else
227227
;;
228228
--docker)
229229
optArgs+="efr32_sdk_root=\"$GSDK_ROOT\" "
230+
optArgs+="wiseconnect_sdk_root=\"$WISECONNECT_SDK_ROOT\" "
231+
optArgs+="wifi_sdk_root=\"$WIFI_SDK_ROOT\" "
230232
USE_DOCKER=true
231233
shift
232234
;;

third_party/silabs/SiWx917_sdk.gni

+1-3
Original file line numberDiff line numberDiff line change
@@ -23,15 +23,13 @@ import("${chip_root}/src/lib/lib.gni")
2323
import("silabs_board.gni")
2424

2525
declare_args() {
26-
wifi_sdk_root = "${chip_root}/third_party/silabs/wifi_sdk"
27-
examples_plat_dir = "${chip_root}/examples/platform/silabs/SiWx917"
28-
2926
if (silabs_board == "BRD4338A") {
3027
sdk_support_board = "BRD4338A"
3128
} else {
3229
sdk_support_board = "BRD4325x"
3330
}
3431
}
32+
examples_plat_dir = "${chip_root}/examples/platform/silabs/SiWx917"
3533

3634
# Defines an siwx917 SDK build target.
3735
#

third_party/silabs/efr32_sdk.gni

+18-11
Original file line numberDiff line numberDiff line change
@@ -21,16 +21,13 @@ import("${chip_root}/src/app/icd/icd.gni")
2121
import("${chip_root}/src/lib/lib.gni")
2222
import("silabs_board.gni")
2323

24-
if (use_rs9116) {
25-
wifi_sapi_root = "${chip_root}/third_party/silabs/wiseconnect-wifi-bt-sdk"
26-
} else if (use_SiWx917) {
27-
wifi_sdk_root = "${chip_root}/third_party/silabs/wifi_sdk"
28-
}
29-
3024
declare_args() {
3125
# Location of the efr32 SDK.
3226
efr32_sdk_root = "${chip_root}/third_party/silabs/gecko_sdk"
3327
sdk_support_root = "${chip_root}/third_party/silabs/matter_support"
28+
wiseconnect_sdk_root =
29+
"${chip_root}/third_party/silabs/wiseconnect-wifi-bt-sdk"
30+
wifi_sdk_root = "${chip_root}/third_party/silabs/wifi_sdk"
3431

3532
# Build openthread with prebuilt silabs lib
3633
use_silabs_thread_lib = false
@@ -72,9 +69,19 @@ declare_args() {
7269
# Use SLC generated files
7370
slc_reuse_files = false
7471
}
72+
examples_plat_dir = "${chip_root}/examples/platform/silabs/efr32"
73+
silabs_plat_efr32_wifi_dir = "${chip_root}/src/platform/silabs/efr32/wifi"
7574

7675
assert(efr32_sdk_root != "", "efr32_sdk_root must be specified")
7776

77+
if (use_rs9116) {
78+
assert(wiseconnect_sdk_root != "", "wiseconnect_sdk_root must be specified")
79+
}
80+
81+
if (use_SiWx917) {
82+
assert(wifi_sdk_root != "", "wifi_sdk_root must be specified")
83+
}
84+
7885
declare_args() {
7986
sl_ot_libs_path = "${efr32_sdk_root}/protocol/openthread"
8087
sl_ot_platform_abstraction =
@@ -228,7 +235,7 @@ template("efr32_sdk") {
228235

229236
if (chip_enable_ble_rs911x) {
230237
if (use_rs9116) {
231-
_include_dirs += [ "${wifi_sapi_root}/sapi/include" ]
238+
_include_dirs += [ "${wiseconnect_sdk_root}/sapi/include" ]
232239
} else {
233240
_include_dirs += [ "${wifi_sdk_root}/components/si91x/ble/inc" ]
234241
}
@@ -750,10 +757,10 @@ template("efr32_sdk") {
750757
if (chip_enable_ble_rs911x) {
751758
if (use_rs9116) {
752759
sources += [
753-
"${wifi_sapi_root}/sapi/bluetooth/rsi_ble_gap_apis.c",
754-
"${wifi_sapi_root}/sapi/bluetooth/rsi_ble_gatt_apis.c",
755-
"${wifi_sapi_root}/sapi/bluetooth/rsi_bt_common_apis.c",
756-
"${wifi_sapi_root}/sapi/driver/rsi_bt_ble.c",
760+
"${wiseconnect_sdk_root}/sapi/bluetooth/rsi_ble_gap_apis.c",
761+
"${wiseconnect_sdk_root}/sapi/bluetooth/rsi_ble_gatt_apis.c",
762+
"${wiseconnect_sdk_root}/sapi/bluetooth/rsi_bt_common_apis.c",
763+
"${wiseconnect_sdk_root}/sapi/driver/rsi_bt_ble.c",
757764
]
758765
} else {
759766
sources += [

0 commit comments

Comments
 (0)