Skip to content

Commit

Permalink
Adds changes to support docker change
Browse files Browse the repository at this point in the history
  • Loading branch information
brosahay committed Nov 2, 2023
1 parent ad04209 commit b6bf956
Show file tree
Hide file tree
Showing 10 changed files with 161 additions and 151 deletions.
2 changes: 1 addition & 1 deletion .gitmodules
Original file line number Diff line number Diff line change
Expand Up @@ -249,7 +249,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
6 changes: 2 additions & 4 deletions examples/platform/silabs/efr32/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -63,11 +63,9 @@ 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"
}
if (use_SiWx917) {
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 @@ -233,8 +233,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
224 changes: 116 additions & 108 deletions scripts/examples/gn_silabs_example.sh
Original file line number Diff line number Diff line change
Expand Up @@ -160,116 +160,116 @@ else
shift
while [ $# -gt 0 ]; do
case $1 in
--clean)
DIR_CLEAN=true
shift
;;
--wifi)
if [ -z "$2" ]; then
echo "--wifi requires rs9116 or SiWx917 or wf200"
exit 1
fi
if [ "$2" = "rs9116" ]; then
optArgs+="use_rs9116=true "
elif [ "$2" = "SiWx917" ]; then
optArgs+="use_SiWx917=true "
elif [ "$2" = "wf200" ]; then
optArgs+="use_wf200=true "
else
echo "Wifi usage: --wifi rs9116|SiWx917|wf200"
exit 1
fi
--clean)
DIR_CLEAN=true
shift
;;
--wifi)
if [ -z "$2" ]; then
echo "--wifi requires rs9116 or SiWx917 or wf200"
exit 1
fi
if [ "$2" = "rs9116" ]; then
optArgs+="use_rs9116=true "
elif [ "$2" = "SiWx917" ]; then
optArgs+="use_SiWx917=true "
elif [ "$2" = "wf200" ]; then
optArgs+="use_wf200=true "
else
echo "Wifi usage: --wifi rs9116|SiWx917|wf200"
exit 1
fi
USE_WIFI=true
optArgs+="chip_device_platform =\"efr32\" "
shift
shift
;;
--icd)
optArgs+="chip_enable_icd_server=true chip_openthread_ftd=false "
shift
;;
--low-power)
optArgs+="chip_build_libshell=false enable_openthread_cli=false show_qr_code=false disable_lcd=true "
shift
;;
--chip_enable_wifi_ipv4)
optArgs="chip_enable_wifi_ipv4=true chip_inet_config_enable_ipv4=true "
shift
;;
--additional_data_advertising)
optArgs+="chip_enable_additional_data_advertising=true chip_enable_rotating_device_id=true "
shift
;;
--use_ot_lib)
optArgs+="use_silabs_thread_lib=true chip_openthread_target=$SILABS_THREAD_TARGET openthread_external_platform=\"""\" "
shift
;;
--use_ot_coap_lib)
optArgs+="use_silabs_thread_lib=true chip_openthread_target=$SILABS_THREAD_TARGET openthread_external_platform=\"""\" use_thread_coap_lib=true "
shift
;;
--use_chip_lwip_lib)
optArgs+="lwip_root=\""//third_party/connectedhomeip/third_party/lwip"\" "
shift
;;
# Option not to be used until ot-efr32 github is updated
# --use_ot_github_sources)
# optArgs+="openthread_root=\"//third_party/connectedhomeip/third_party/openthread/ot-efr32/openthread\" openthread_efr32_root=\"//third_party/connectedhomeip/third_party/openthread/ot-efr32/src/src\""
# shift
# ;;
--release)
optArgs+="is_debug=false disable_lcd=true chip_build_libshell=false enable_openthread_cli=false use_external_flash=false chip_logging=false silabs_log_enabled=false "
shift
;;
--bootloader)
USE_BOOTLOADER=true
shift
;;
--docker)
optArgs+="efr32_sdk_root=\"$GSDK_ROOT\" "
USE_DOCKER=true
shift
;;
--uart_log)
optArgs+="sl_uart_log_output=true "
shift
;;

--slc_generate)
optArgs+="slc_generate=true "
USE_SLC=true
shift
;;
--slc_reuse_files)
optArgs+="slc_reuse_files=true "
USE_SLC=true
shift
;;
--gn_path)
if [ -z "$2" ]; then
echo "--gn_path requires a path to GN"
exit 1
else
GN_PATH="$2"
fi
GN_PATH_PROVIDED=true
shift
shift
;;
*"sl_matter_version_str="*)
optArgs+="$1 "
USE_GIT_SHA_FOR_VERSION=false
shift
;;
*)
if [ "$1" =~ *"use_rs9116=true"* ] || [ "$1" =~ *"use_SiWx917=true"* ] || [ "$1" =~ *"use_wf200=true"* ]; then
USE_WIFI=true
# NCP Mode so base MCU is an EFR32
optArgs+="chip_device_platform =\"efr32\" "
shift
shift
;;
--icd)
optArgs+="chip_enable_icd_server=true chip_openthread_ftd=false "
shift
;;
--low-power)
optArgs+="chip_build_libshell=false enable_openthread_cli=false show_qr_code=false disable_lcd=true "
shift
;;
--chip_enable_wifi_ipv4)
optArgs="chip_enable_wifi_ipv4=true chip_inet_config_enable_ipv4=true "
shift
;;
--additional_data_advertising)
optArgs+="chip_enable_additional_data_advertising=true chip_enable_rotating_device_id=true "
shift
;;
--use_ot_lib)
optArgs+="use_silabs_thread_lib=true chip_openthread_target=$SILABS_THREAD_TARGET openthread_external_platform=\"""\" "
shift
;;
--use_ot_coap_lib)
optArgs+="use_silabs_thread_lib=true chip_openthread_target=$SILABS_THREAD_TARGET openthread_external_platform=\"""\" use_thread_coap_lib=true "
shift
;;
--use_chip_lwip_lib)
optArgs+="lwip_root=\""//third_party/connectedhomeip/third_party/lwip"\" "
shift
;;
# Option not to be used until ot-efr32 github is updated
# --use_ot_github_sources)
# optArgs+="openthread_root=\"//third_party/connectedhomeip/third_party/openthread/ot-efr32/openthread\" openthread_efr32_root=\"//third_party/connectedhomeip/third_party/openthread/ot-efr32/src/src\""
# shift
# ;;
--release)
optArgs+="is_debug=false disable_lcd=true chip_build_libshell=false enable_openthread_cli=false use_external_flash=false chip_logging=false silabs_log_enabled=false "
shift
;;
--bootloader)
USE_BOOTLOADER=true
shift
;;
--docker)
optArgs+="efr32_sdk_root=\"$GSDK_ROOT\" "
USE_DOCKER=true
shift
;;
--uart_log)
optArgs+="sl_uart_log_output=true "
shift
;;

--slc_generate)
optArgs+="slc_generate=true "
USE_SLC=true
shift
;;
--slc_reuse_files)
optArgs+="slc_reuse_files=true "
USE_SLC=true
shift
;;
--gn_path)
if [ -z "$2" ]; then
echo "--gn_path requires a path to GN"
exit 1
else
GN_PATH="$2"
fi
GN_PATH_PROVIDED=true
shift
shift
;;
*"sl_matter_version_str="*)
optArgs+="$1 "
USE_GIT_SHA_FOR_VERSION=false
shift
;;
*)
if [ "$1" =~ *"use_rs9116=true"* ] || [ "$1" =~ *"use_SiWx917=true"* ] || [ "$1" =~ *"use_wf200=true"* ]; then
USE_WIFI=true
# NCP Mode so base MCU is an EFR32
optArgs+="chip_device_platform =\"efr32\" "
fi
optArgs+=$1" "
shift
;;
fi
optArgs+=$1" "
shift
;;
esac
done

Expand Down Expand Up @@ -322,6 +322,14 @@ else
optArgs+="openthread_root=\"$GSDK_ROOT/util/third_party/openthread\" "
fi

if [ "$USE_DOCKER" == true ] && [ "$USE_WIFI" == true ]; then
echo "Switching WiseConnect 2 SDK ROOT"
optArgs+="wiseconnect_sdk_root=\"$WISECONNECT_SDK_ROOT\" "

echo "Switching WiseConnect 3 SDK ROOT"
optArgs+="wifi_sdk_root=\"$WIFI_SDK_ROOT\" "
fi

"$GN_PATH" gen --check --script-executable="$PYTHON_PATH" --fail-on-unused-args --export-compile-commands --root="$ROOT" --dotfile="$DOTFILE" --args="silabs_board=\"$SILABS_BOARD\" $optArgs" "$BUILD_DIR"

if [ "$USE_SLC" == true ]; then
Expand Down
Loading

0 comments on commit b6bf956

Please sign in to comment.