Skip to content

Commit

Permalink
[Silabs] Adds changes in build system to support docker image change (#…
Browse files Browse the repository at this point in the history
…30181)

* refactors GN build system

* Restyled by shfmt

* Adds changes based on comments

* adds bugfix

---------

Co-authored-by: Restyled.io <commits@restyled.io>
  • Loading branch information
2 people authored and pull[bot] committed Nov 13, 2023
1 parent 67ef6b3 commit 83dcfe0
Show file tree
Hide file tree
Showing 10 changed files with 45 additions and 42 deletions.
2 changes: 1 addition & 1 deletion .gitmodules
Original file line number Diff line number Diff line change
Expand Up @@ -245,7 +245,7 @@
path = third_party/silabs/wiseconnect-wifi-bt-sdk
url = https://github.com/SiliconLabs/wiseconnect-wifi-bt-sdk.git
branch = 2.8.2
platforms = efr32,silabs_docker
platforms = efr32
[submodule "third_party/silabs/wifi_sdk"]
path = third_party/silabs/wifi_sdk
url = https://github.com/SiliconLabs/wiseconnect.git
Expand Down
18 changes: 8 additions & 10 deletions examples/platform/silabs/SiWx917/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,9 @@ import("//build_overrides/efr32_sdk.gni")
import("${chip_root}/examples/common/pigweed/pigweed_rpcs.gni")
import("${chip_root}/src/lib/lib.gni")
import("${chip_root}/src/platform/device.gni")
import("${chip_root}/src/platform/silabs/wifi_args.gni")
import("${chip_root}/third_party/silabs/silabs_board.gni")
import("${efr32_sdk_build_root}/SiWx917_sdk.gni")
silabs_common_plat_dir = "${chip_root}/examples/platform/silabs"
wifi_sdk_dir = "${chip_root}/src/platform/silabs/SiWx917/wifi"

declare_args() {
enable_heap_monitoring = false
Expand Down Expand Up @@ -52,13 +51,12 @@ declare_args() {
silabs_test_event_trigger_enable_key = "00112233445566778899aabbccddeeff"
}

import("${chip_root}/src/platform/silabs/wifi_args.gni")
import("${silabs_common_plat_dir}/args.gni")

# Sanity check
assert(chip_enable_wifi)

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

config("chip_examples_project_config") {
include_dirs = [ "project_include" ]
Expand Down Expand Up @@ -207,7 +205,7 @@ source_set("siwx917-common") {
include_dirs = [
".",
"SiWx917/",
"${wifi_sdk_dir}",
"${silabs_plat_si91x_wifi_dir}",
]

sources = [
Expand All @@ -218,10 +216,10 @@ source_set("siwx917-common") {
"${silabs_common_plat_dir}/heap_4_silabs.c",
"${silabs_common_plat_dir}/silabs_utils.cpp",
"${silabs_common_plat_dir}/syscalls_stubs.cpp",
"${wifi_sdk_dir}/dhcp_client.cpp",
"${wifi_sdk_dir}/ethernetif.cpp",
"${wifi_sdk_dir}/lwip_netif.cpp",
"${wifi_sdk_dir}/wfx_notify.cpp",
"${silabs_plat_si91x_wifi_dir}/dhcp_client.cpp",
"${silabs_plat_si91x_wifi_dir}/ethernetif.cpp",
"${silabs_plat_si91x_wifi_dir}/lwip_netif.cpp",
"${silabs_plat_si91x_wifi_dir}/wfx_notify.cpp",
"SiWx917/sl_wifi_if.c",
"SiWx917/wfx_rsi_host.c",
]
Expand Down
3 changes: 0 additions & 3 deletions examples/platform/silabs/efr32/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -63,11 +63,8 @@ if (chip_enable_wifi) {
import("${chip_root}/src/platform/silabs/wifi_args.gni")

if (use_rs9116) {
wiseconnect_sdk_root =
"${chip_root}/third_party/silabs/wiseconnect-wifi-bt-sdk"
import("rs911x/rs911x.gni")
} else if (use_SiWx917) {
wifi_sdk_root = "${chip_root}/third_party/silabs/wifi_sdk"
import("rs911x/rs9117.gni")
}
if (use_wf200) {
Expand Down
8 changes: 3 additions & 5 deletions examples/platform/silabs/efr32/rs911x/rs9117.gni
Original file line number Diff line number Diff line change
@@ -1,15 +1,13 @@
import("//build_overrides/chip.gni")

examples_plat_dir = "${chip_root}/examples/platform/silabs/efr32"
wifi_sdk_dir = "${chip_root}/src/platform/silabs/efr32/wifi"
wifi_sdk_root = "${chip_root}/third_party/silabs/wifi_sdk"
import("//build_overrides/efr32_sdk.gni")
import("${efr32_sdk_build_root}/efr32_sdk.gni")

rs911x_src_plat = [
"${examples_plat_dir}/rs911x/sl_wifi_if.c",
"${examples_plat_dir}/rs911x/wfx_rsi_host.c",
"${examples_plat_dir}/rs911x/hal/rsi_hal_mcu_interrupt.c",
"${examples_plat_dir}/rs911x/hal/efx_spi.c",
"${wifi_sdk_dir}/wfx_notify.cpp",
"${silabs_plat_efr32_wifi_dir}/wfx_notify.cpp",
]

rs911x_inc_plat = [
Expand Down
8 changes: 3 additions & 5 deletions examples/platform/silabs/efr32/rs911x/rs911x.gni
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
import("//build_overrides/chip.gni")

examples_plat_dir = "${chip_root}/examples/platform/silabs/efr32"
wifi_sdk_dir = "${chip_root}/src/platform/silabs/efr32/wifi"
wiseconnect_sdk_root = "${chip_root}/third_party/silabs/wiseconnect-wifi-bt-sdk"
import("//build_overrides/efr32_sdk.gni")
import("${efr32_sdk_build_root}/efr32_sdk.gni")

rs911x_src_plat = [
"${examples_plat_dir}/rs911x/rsi_if.c",
Expand All @@ -11,7 +9,7 @@ rs911x_src_plat = [
"${examples_plat_dir}/rs911x/hal/rsi_hal_mcu_ioports.c",
"${examples_plat_dir}/rs911x/hal/rsi_hal_mcu_timer.c",
"${examples_plat_dir}/rs911x/hal/efx_spi.c",
"${wifi_sdk_dir}/wfx_notify.cpp",
"${silabs_plat_efr32_wifi_dir}/wfx_notify.cpp",
]

#
Expand Down
7 changes: 3 additions & 4 deletions examples/platform/silabs/efr32/wf200/wf200.gni
Original file line number Diff line number Diff line change
@@ -1,11 +1,10 @@
import("//build_overrides/chip.gni")

examples_plat_dir = "${chip_root}/examples/platform/silabs/efr32"
wifi_sdk_dir = "${chip_root}/src/platform/silabs/efr32/wifi"
import("//build_overrides/efr32_sdk.gni")
import("${efr32_sdk_build_root}/efr32_sdk.gni")

wf200_plat_incs = [ "${examples_plat_dir}/wf200" ]
wf200_plat_src = [
"${wifi_sdk_dir}/wfx_notify.cpp",
"${silabs_plat_efr32_wifi_dir}/wfx_notify.cpp",
"${examples_plat_dir}/wf200/sl_wfx_task.c",
"${examples_plat_dir}/wf200/wf200_init.c",
"${examples_plat_dir}/wf200/efr_spi.c",
Expand Down
6 changes: 6 additions & 0 deletions scripts/build/builders/efr32.py
Original file line number Diff line number Diff line change
Expand Up @@ -230,8 +230,14 @@ def __init__(self,
# case for pre-installed images), use it directly.
sdk_path = shlex.quote(os.environ['GSDK_ROOT'])
self.extra_gn_options.append(f"efr32_sdk_root=\"{sdk_path}\"")

if "GSDK_ROOT" in os.environ and not enable_wifi:
self.extra_gn_options.append(f"openthread_root=\"{sdk_path}/util/third_party/openthread\"")

if "WISECONNECT_SDK_ROOT" in os.environ and enable_rs911x:
wiseconnect_sdk_path = shlex.quote(os.environ['WISECONNECT_SDK_ROOT'])
self.extra_gn_options.append(f"wiseconnect_sdk_root=\"{wiseconnect_sdk_path}\"")

def GnBuildArgs(self):
return self.extra_gn_options

Expand Down
2 changes: 2 additions & 0 deletions scripts/examples/gn_silabs_example.sh
Original file line number Diff line number Diff line change
Expand Up @@ -227,6 +227,8 @@ else
;;
--docker)
optArgs+="efr32_sdk_root=\"$GSDK_ROOT\" "
optArgs+="wiseconnect_sdk_root=\"$WISECONNECT_SDK_ROOT\" "
optArgs+="wifi_sdk_root=\"$WIFI_SDK_ROOT\" "
USE_DOCKER=true
shift
;;
Expand Down
4 changes: 1 addition & 3 deletions third_party/silabs/SiWx917_sdk.gni
Original file line number Diff line number Diff line change
Expand Up @@ -23,15 +23,13 @@ import("${chip_root}/src/lib/lib.gni")
import("silabs_board.gni")

declare_args() {
wifi_sdk_root = "${chip_root}/third_party/silabs/wifi_sdk"
examples_plat_dir = "${chip_root}/examples/platform/silabs/SiWx917"

if (silabs_board == "BRD4338A") {
sdk_support_board = "BRD4338A"
} else {
sdk_support_board = "BRD4325x"
}
}
examples_plat_dir = "${chip_root}/examples/platform/silabs/SiWx917"

# Defines an siwx917 SDK build target.
#
Expand Down
29 changes: 18 additions & 11 deletions third_party/silabs/efr32_sdk.gni
Original file line number Diff line number Diff line change
Expand Up @@ -21,16 +21,13 @@ import("${chip_root}/src/app/icd/icd.gni")
import("${chip_root}/src/lib/lib.gni")
import("silabs_board.gni")

if (use_rs9116) {
wifi_sapi_root = "${chip_root}/third_party/silabs/wiseconnect-wifi-bt-sdk"
} else if (use_SiWx917) {
wifi_sdk_root = "${chip_root}/third_party/silabs/wifi_sdk"
}

declare_args() {
# Location of the efr32 SDK.
efr32_sdk_root = "${chip_root}/third_party/silabs/gecko_sdk"
sdk_support_root = "${chip_root}/third_party/silabs/matter_support"
wiseconnect_sdk_root =
"${chip_root}/third_party/silabs/wiseconnect-wifi-bt-sdk"
wifi_sdk_root = "${chip_root}/third_party/silabs/wifi_sdk"

# Build openthread with prebuilt silabs lib
use_silabs_thread_lib = false
Expand Down Expand Up @@ -72,9 +69,19 @@ declare_args() {
# Use SLC generated files
slc_reuse_files = false
}
examples_plat_dir = "${chip_root}/examples/platform/silabs/efr32"
silabs_plat_efr32_wifi_dir = "${chip_root}/src/platform/silabs/efr32/wifi"

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

if (use_rs9116) {
assert(wiseconnect_sdk_root != "", "wiseconnect_sdk_root must be specified")
}

if (use_SiWx917) {
assert(wifi_sdk_root != "", "wifi_sdk_root must be specified")
}

declare_args() {
sl_ot_libs_path = "${efr32_sdk_root}/protocol/openthread"
sl_ot_platform_abstraction =
Expand Down Expand Up @@ -228,7 +235,7 @@ template("efr32_sdk") {

if (chip_enable_ble_rs911x) {
if (use_rs9116) {
_include_dirs += [ "${wifi_sapi_root}/sapi/include" ]
_include_dirs += [ "${wiseconnect_sdk_root}/sapi/include" ]
} else {
_include_dirs += [ "${wifi_sdk_root}/components/si91x/ble/inc" ]
}
Expand Down Expand Up @@ -750,10 +757,10 @@ template("efr32_sdk") {
if (chip_enable_ble_rs911x) {
if (use_rs9116) {
sources += [
"${wifi_sapi_root}/sapi/bluetooth/rsi_ble_gap_apis.c",
"${wifi_sapi_root}/sapi/bluetooth/rsi_ble_gatt_apis.c",
"${wifi_sapi_root}/sapi/bluetooth/rsi_bt_common_apis.c",
"${wifi_sapi_root}/sapi/driver/rsi_bt_ble.c",
"${wiseconnect_sdk_root}/sapi/bluetooth/rsi_ble_gap_apis.c",
"${wiseconnect_sdk_root}/sapi/bluetooth/rsi_ble_gatt_apis.c",
"${wiseconnect_sdk_root}/sapi/bluetooth/rsi_bt_common_apis.c",
"${wiseconnect_sdk_root}/sapi/driver/rsi_bt_ble.c",
]
} else {
sources += [
Expand Down

0 comments on commit 83dcfe0

Please sign in to comment.