From a8483eb8caf6efa0bd19bedcad79425642ab435e Mon Sep 17 00:00:00 2001 From: Junior Martinez <67972863+jmartinez-silabs@users.noreply.github.com> Date: Wed, 1 Feb 2023 12:08:16 -0500 Subject: [PATCH] [Silabs] Refactor/Cleanup examples build files (#24742) * WIP : Move common example platform source files to a common source_set. Move some build args to better/generic locations to reduce code duplication and build system complexity. Lighting-app mainly done * Bring efr32_common to the others efr32 efr32 app and some more cleanup. Fix thread lib build with new gsdk * WIP WiFi build cleanup. Rs911x Lighting-app builds * WIP more clean up for wifi platform. wf200 now builds lighting app * Apply refactore to the other examples builg.gn * Fix window_app build for wifi, fix thermostat build.gn. fix test_driver build * Fix so SiWx917 platform builds with the efr32 refactor. SiWx917 Refactor will come at another time Remove a Todo. It is not needed remove extra bracket in chef's build.gn * fix build with pw rpc Fix lock-rpc build --- examples/chef/efr32/BUILD.gn | 203 ++------------ .../light-switch-app/silabs/SiWx917/BUILD.gn | 14 - .../light-switch-app/silabs/efr32/BUILD.gn | 254 +----------------- .../light-switch-app/silabs/efr32/args.gni | 1 + .../silabs/efr32/build_for_wifi_args.gni | 1 + examples/lighting-app/silabs/SiWx917/BUILD.gn | 14 - examples/lighting-app/silabs/efr32/BUILD.gn | 248 +---------------- examples/lighting-app/silabs/efr32/args.gni | 1 + .../silabs/efr32/build_for_wifi_args.gni | 1 + .../lighting-app/silabs/efr32/with_pw_rpc.gni | 1 + examples/lock-app/silabs/SiWx917/BUILD.gn | 14 - examples/lock-app/silabs/efr32/BUILD.gn | 250 +---------------- examples/lock-app/silabs/efr32/args.gni | 1 + .../silabs/efr32/build_for_wifi_args.gni | 1 + .../lock-app/silabs/efr32/with_pw_rpc.gni | 1 + examples/platform/silabs/efr32/BUILD.gn | 203 +++++++++++++- examples/platform/silabs/efr32/args.gni | 5 + .../platform/silabs/efr32/rs911x/rs911x.gni | 49 +--- .../platform/silabs/efr32/wf200/wf200.gni | 19 +- examples/thermostat/silabs/efr32/BUILD.gn | 238 +--------------- examples/thermostat/silabs/efr32/args.gni | 1 + .../silabs/efr32/build_for_wifi_args.gni | 1 + examples/window-app/silabs/SiWx917/BUILD.gn | 14 - examples/window-app/silabs/efr32/BUILD.gn | 240 +---------------- examples/window-app/silabs/efr32/args.gni | 3 + .../silabs/efr32/build_for_wifi_args.gni | 2 + src/platform/silabs/EFR32/BUILD.gn | 29 ++ src/test_driver/efr32/BUILD.gn | 1 - third_party/ot-br-posix/repo | 2 +- third_party/silabs/SiWx917_sdk.gni | 15 -- third_party/silabs/efr32_sdk.gni | 128 ++++----- third_party/silabs/silabs_board.gni | 67 +++++ 32 files changed, 458 insertions(+), 1564 deletions(-) diff --git a/examples/chef/efr32/BUILD.gn b/examples/chef/efr32/BUILD.gn index e5464094d29cf3..dd843668af0fdc 100644 --- a/examples/chef/efr32/BUILD.gn +++ b/examples/chef/efr32/BUILD.gn @@ -35,51 +35,17 @@ assert(current_os == "freertos") chef_project_dir = "${chip_root}/examples/chef" efr32_project_dir = "${chef_project_dir}/efr32" -examples_plat_dir = "${chip_root}/examples/platform/efr32" +examples_plat_dir = "${chip_root}/examples/platform/silabs/efr32" +examples_common_plat_dir = "${chip_root}/examples/platform/silabs" +app_data_model = "${efr32_project_dir}:chef-comon" +import("${examples_plat_dir}/args.gni") declare_args() { # Dump memory usage at link time. chip_print_memory_usage = false - - # Monitor & log memory usage at runtime. - enable_heap_monitoring = false - - # Enable Sleepy end device - enable_sleepy_device = false - - # OTA timeout in seconds - OTA_periodic_query_timeout = 86400 - - # Wifi related stuff - they are overridden by gn -args="use_wf200=true" - use_wf200 = false - use_rs911x = false - use_rs911x_sockets = false - sl_wfx_config_softap = false - sl_wfx_config_scan = true - - # Disable LCD on supported devices - disable_lcd = false - sample_name = "" } -declare_args() { - # Enables LCD Qr Code on supported devices - show_qr_code = !disable_lcd -} - -# qr code cannot be true if lcd is disabled -assert(!(disable_lcd && show_qr_code)) - -# Sanity check -assert(!(chip_enable_wifi && chip_enable_openthread)) -assert(!(use_rs911x && chip_enable_openthread)) -assert(!(use_wf200 && chip_enable_openthread)) -if (chip_enable_wifi) { - assert(use_rs911x || use_wf200) - enable_openthread_cli = false -} - chip_data_model("chef-common") { zap_file = "${chef_project_dir}/devices/${sample_name}.zap" @@ -87,35 +53,6 @@ chip_data_model("chef-common") { is_server = true } -# ThunderBoards, Explorer Kit and MGM240L do not support LCD (No LCD) -if (silabs_board == "BRD4166A" || silabs_board == "BRD2601B" || - silabs_board == "BRD2703A" || silabs_board == "BRD4319A") { - show_qr_code = false - disable_lcd = true -} - -# WiFi settings -if (chip_enable_wifi) { - wifi_sdk_dir = "${chip_root}/third_party/efr32_sdk/repo/matter/wifi" - efr32_lwip_defs = [ "LWIP_NETIF_API=1" ] - efr32_lwip_defs += [ - "LWIP_IPV4=1", - "LWIP_ARP=1", - "LWIP_ICMP=1", - "LWIP_DHCP=1", - "LWIP_IPV6_ND=1", - "LWIP_IGMP=1", - ] - - if (use_rs911x) { - wiseconnect_sdk_root = - "${chip_root}/third_party/efr32_sdk/wiseconnect-wifi-bt-sdk" - import("${wifi_sdk_dir}/rs911x/rs911x.gni") - } else { - import("${wifi_sdk_dir}/wf200/wf200.gni") - } -} - efr32_sdk("sdk") { sources = [ "${efr32_project_dir}/include/CHIPProjectConfig.h", @@ -123,141 +60,46 @@ efr32_sdk("sdk") { ] include_dirs = [ - "${chip_root}/src/platform/EFR32", + "${chip_root}/src/platform/silabs/EFR32", "${efr32_project_dir}/include", "${examples_plat_dir}", "${chip_root}/src/lib", + "${examples_common_plat_dir}", ] - defines = [ - "BOARD_ID=${silabs_board}", - "OTA_PERIODIC_TIMEOUT=${OTA_periodic_query_timeout}", - ] + if (use_wf200) { + # TODO efr32_sdk should not need a header from this location + include_dirs += [ "${examples_plat_dir}/wf200" ] + } + defines = [] if (chip_enable_pw_rpc) { defines += [ "HAL_VCOM_ENABLE=1", "PW_RPC_ENABLED", ] } - - # WiFi Settings - if (chip_enable_wifi) { - if (use_rs911x) { - defines += rs911x_defs - include_dirs += rs911x_plat_incs - } else if (use_wf200) { - defines += wf200_defs - include_dirs += wf200_plat_incs - } - - if (use_rs911x_sockets) { - include_dirs += [ "${examples_plat_dir}/wifi/rsi-sockets" ] - defines += rs911x_sock_defs - } else { - # Using LWIP instead of the native TCP/IP stack - defines += efr32_lwip_defs - } - - if (sl_wfx_config_softap) { - defines += [ "SL_WFX_CONFIG_SOFTAP" ] - } - if (sl_wfx_config_scan) { - defines += [ "SL_WFX_CONFIG_SCAN" ] - } - } } efr32_executable("chef_app") { output_name = "chip-efr32-chef-example.out" + public_configs = [ "${efr32_sdk_build_root}:silabs_config" ] include_dirs = [ "include" ] defines = [] sources = [ - "${examples_plat_dir}/BaseApplication.cpp", - "${examples_plat_dir}/efr32_utils.cpp", - "${examples_plat_dir}/heap_4_silabs.c", - "${examples_plat_dir}/init_efrPlatform.cpp", - "${examples_plat_dir}/matter_config.cpp", "src/AppTask.cpp", "src/LightingManager.cpp", "src/ZclCallbacks.cpp", "src/main.cpp", ] - if (use_wstk_leds) { - sources += [ "${examples_plat_dir}/LEDWidget.cpp" ] - } - - if (chip_enable_pw_rpc || chip_build_libshell || enable_openthread_cli || - use_wf200 || use_rs911x) { - sources += [ "${examples_plat_dir}/uart.cpp" ] - } - deps = [ ":chef-common", ":sdk", - "${chip_root}/examples/providers:device_info_provider", - "${chip_root}/src/lib", - "${chip_root}/src/setup_payload", + "${examples_plat_dir}:efr32-common", ] - # OpenThread Settings - if (chip_enable_openthread) { - deps += [ - "${chip_root}/third_party/openthread:openthread", - "${chip_root}/third_party/openthread:openthread-platform", - "${examples_plat_dir}:efr-matter-shell", - ] - } - - if (chip_enable_ota_requestor) { - defines += [ "EFR32_OTA_ENABLED" ] - sources += [ "${examples_plat_dir}/OTAConfig.cpp" ] - } - - # WiFi Settings - if (chip_enable_wifi) { - if (use_rs911x) { - sources += rs911x_src_plat - - # All the stuff from wiseconnect - sources += rs911x_src_sapi - - # Apparently - the rsi library needs this (though we may not use use it) - sources += rs911x_src_sock - include_dirs += rs911x_inc_plat - - if (use_rs911x_sockets) { - # - # Using native sockets inside RS911x - # - include_dirs += rs911x_sock_inc - } else { - # - # We use LWIP - not built-in sockets - # - sources += rs911x_src_lwip - } - } else if (use_wf200) { - sources += wf200_plat_src - include_dirs += wf200_plat_incs - } - } - - if (!disable_lcd) { - sources += [ - "${examples_plat_dir}/display/demo-ui.c", - "${examples_plat_dir}/display/lcd.cpp", - ] - include_dirs += [ "${examples_plat_dir}/display" ] - defines += [ "DISPLAY_ENABLED" ] - if (show_qr_code) { - defines += [ "QR_CODE_ENABLED" ] - deps += [ "${chip_root}/examples/common/QRCode" ] - } - } - if (chip_enable_pw_rpc) { defines += [ "PW_RPC_ENABLED", @@ -274,8 +116,8 @@ efr32_executable("chef_app") { sources += [ "${chip_root}/examples/common/pigweed/RpcService.cpp", "${chip_root}/examples/common/pigweed/efr32/PigweedLoggerMutex.cpp", - "${examples_plat_dir}/PigweedLogger.cpp", - "${examples_plat_dir}/Rpc.cpp", + "${examples_common_plat_dir}/PigweedLogger.cpp", + "${examples_common_plat_dir}/Rpc.cpp", ] deps += [ @@ -303,11 +145,6 @@ efr32_executable("chef_app") { ] } - if (enable_heap_monitoring) { - sources += [ "${examples_plat_dir}/MemMonitoring.cpp" ] - defines += [ "HEAP_MONITORING" ] - } - ldscript = "${examples_plat_dir}/ldscripts/${silabs_family}.ld" inputs = [ ldscript ] @@ -329,16 +166,6 @@ efr32_executable("chef_app") { ] } - # Attestation Credentials - if (chip_build_platform_attestation_credentials_provider) { - deps += [ "${examples_plat_dir}:efr32-attestation-credentials" ] - } - - # Factory Data Provider - if (use_efr32_factory_data_provider) { - deps += [ "${examples_plat_dir}:efr32-factory-data-provider" ] - } - output_dir = root_out_dir } diff --git a/examples/light-switch-app/silabs/SiWx917/BUILD.gn b/examples/light-switch-app/silabs/SiWx917/BUILD.gn index ad139445fec618..5972ad7265fbc4 100644 --- a/examples/light-switch-app/silabs/SiWx917/BUILD.gn +++ b/examples/light-switch-app/silabs/SiWx917/BUILD.gn @@ -49,15 +49,9 @@ declare_args() { OTA_periodic_query_timeout = 86400 # Wifi related stuff - they are overridden by gn -args="use_wf200=true" - use_wf200 = false - use_rs911x = false - use_rs911x_sockets = false sl_wfx_config_softap = false sl_wfx_config_scan = true - # Disable LCD on supported devices - disable_lcd = true - # Argument to Disable IPv4 for wifi(rs911) chip_enable_wifi_ipv4 = false @@ -71,14 +65,6 @@ declare_args() { chip_default_wifi_psk = "" } -declare_args() { - # Enables LCD Qr Code on supported devices - show_qr_code = !disable_lcd -} - -# qr code cannot be true if lcd is disabled -assert(!(disable_lcd && show_qr_code)) - # Sanity check assert(!(chip_enable_wifi && chip_enable_openthread)) assert(!(use_rs911x && chip_enable_openthread)) diff --git a/examples/light-switch-app/silabs/efr32/BUILD.gn b/examples/light-switch-app/silabs/efr32/BUILD.gn index 64c42eccbd9113..f989b0de1d337b 100644 --- a/examples/light-switch-app/silabs/efr32/BUILD.gn +++ b/examples/light-switch-app/silabs/efr32/BUILD.gn @@ -35,120 +35,11 @@ efr32_project_dir = "${chip_root}/examples/light-switch-app/silabs/efr32" examples_plat_dir = "${chip_root}/examples/platform/silabs/efr32" examples_common_plat_dir = "${chip_root}/examples/platform/silabs" +import("${examples_plat_dir}/args.gni") + declare_args() { # Dump memory usage at link time. chip_print_memory_usage = false - - # Monitor & log memory usage at runtime. - enable_heap_monitoring = false - - # Enable Sleepy end device - enable_sleepy_device = false - - # OTA timeout in seconds - OTA_periodic_query_timeout = 86400 - - # Wifi related stuff - they are overridden by gn -args="use_wf200=true" - use_wf200 = false - use_rs911x = false - use_rs911x_sockets = false - sl_wfx_config_softap = false - sl_wfx_config_scan = true - - # Disable LCD on supported devices - disable_lcd = false - - # Argument to Disable IPv4 for wifi(rs911) - chip_enable_wifi_ipv4 = false - - # Argument to force enable WPA3 security - rs91x_wpa3_only = false - - #default WiFi SSID - chip_default_wifi_ssid = "" - - #default Wifi Password - chip_default_wifi_psk = "" -} - -declare_args() { - # Enables LCD Qr Code on supported devices - show_qr_code = !disable_lcd - - # Use default handler to negotiate subscription max interval - chip_config_use_icd_subscription_callbacks = enable_sleepy_device -} - -# qr code cannot be true if lcd is disabled -assert(!(disable_lcd && show_qr_code)) - -# default read handler cannot be used without being an IC device (SED) -assert(!chip_config_use_icd_subscription_callbacks || enable_sleepy_device) - -# Sanity check -assert(!(chip_enable_wifi && chip_enable_openthread)) -assert(!(use_rs911x && chip_enable_openthread)) -assert(!(use_wf200 && chip_enable_openthread)) -if (chip_enable_wifi) { - assert(use_rs911x || use_wf200) - enable_openthread_cli = false - import("${chip_root}/src/platform/silabs/EFR32/wifi_args.gni") -} - -# ThunderBoards, Explorer Kit and MGM240L do not support LCD (No LCD) -if (silabs_board == "BRD4166A" || silabs_board == "BRD2601B" || - silabs_board == "BRD2703A" || silabs_board == "BRD4319A") { - show_qr_code = false - disable_lcd = true -} - -defines = [] - -# WiFi settings -if (chip_enable_wifi) { - if (chip_default_wifi_ssid != "") { - defines += [ - "CHIP_ONNETWORK_PAIRING=1", - "CHIP_WIFI_SSID=\"${chip_default_wifi_ssid}\"", - ] - } - if (chip_default_wifi_psk != "") { - assert(chip_default_wifi_ssid != "", - "ssid can't be null if psk is provided") - defines += [ "CHIP_WIFI_PSK=\"${chip_default_wifi_psk}\"" ] - } - wifi_sdk_dir = "${chip_root}/src/platform/silabs/EFR32/wifi" - efr32_lwip_defs = [ "LWIP_NETIF_API=1" ] - if (lwip_ipv4) { - efr32_lwip_defs += [ - "LWIP_IPV4=1", - - # adds following options to provide - # them to .cpp source files - # flags ported from lwipopts file - # TODO: move lwipopts to one location - "LWIP_ARP=1", - "LWIP_ICMP=1", - "LWIP_IGMP=1", - "LWIP_DHCP=1", - "LWIP_DNS=0", - ] - } else { - efr32_lwip_defs += [ "LWIP_IPV4=0" ] - } - if (lwip_ipv6) { - efr32_lwip_defs += [ "LWIP_IPV6=1" ] - } else { - efr32_lwip_defs += [ "LWIP_IPV6=0" ] - } - - if (use_rs911x) { - wiseconnect_sdk_root = - "${chip_root}/third_party/silabs/wiseconnect-wifi-bt-sdk" - import("${examples_plat_dir}/rs911x/rs911x.gni") - } else { - import("${examples_plat_dir}/wf200/wf200.gni") - } } efr32_sdk("sdk") { @@ -166,43 +57,18 @@ efr32_sdk("sdk") { "${examples_common_plat_dir}", ] - defines += [ - "BOARD_ID=${silabs_board}", - "OTA_PERIODIC_TIMEOUT=${OTA_periodic_query_timeout}", - ] + if (use_wf200) { + # TODO efr32_sdk should not need a header from this location + include_dirs += [ "${examples_plat_dir}/wf200" ] + } + defines = [] if (chip_enable_pw_rpc) { defines += [ "HAL_VCOM_ENABLE=1", "PW_RPC_ENABLED", ] } - - # WiFi Settings - if (chip_enable_wifi) { - if (use_rs911x) { - defines += rs911x_defs - include_dirs += rs911x_plat_incs - } else if (use_wf200) { - defines += wf200_defs - include_dirs += wf200_plat_incs - } - - if (use_rs911x_sockets) { - include_dirs += [ "${examples_plat_dir}/wifi/rsi-sockets" ] - defines += rs911x_sock_defs - } else { - # Using LWIP instead of the native TCP/IP stack - defines += efr32_lwip_defs - } - - if (sl_wfx_config_softap) { - defines += [ "SL_WFX_CONFIG_SOFTAP" ] - } - if (sl_wfx_config_scan) { - defines += [ "SL_WFX_CONFIG_SCAN" ] - } - } } efr32_executable("light_switch_app") { @@ -214,31 +80,15 @@ efr32_executable("light_switch_app") { sources = [ "${chip_root}/examples/light-switch-app/silabs/common/BindingHandler.cpp", "${chip_root}/examples/light-switch-app/silabs/common/LightSwitchMgr.cpp", - "${examples_common_plat_dir}/heap_4_silabs.c", - "${examples_plat_dir}/BaseApplication.cpp", - "${examples_plat_dir}/efr32_utils.cpp", - "${examples_plat_dir}/init_efrPlatform.cpp", - "${examples_plat_dir}/matter_config.cpp", "src/AppTask.cpp", "src/ZclCallbacks.cpp", "src/main.cpp", ] - if (use_wstk_leds) { - sources += [ "${examples_plat_dir}/LEDWidget.cpp" ] - } - - if (chip_enable_pw_rpc || chip_build_libshell || enable_openthread_cli || - use_wf200 || use_rs911x) { - sources += [ "${examples_plat_dir}/uart.cpp" ] - } - deps = [ ":sdk", - "${chip_root}/examples/light-switch-app/light-switch-common", - "${chip_root}/examples/providers:device_info_provider", - "${chip_root}/src/lib", - "${chip_root}/src/setup_payload", + "${examples_plat_dir}:efr32-common", + app_data_model, ] if (chip_build_libshell) { @@ -247,87 +97,8 @@ efr32_executable("light_switch_app") { ] } - # OpenThread Settings - if (chip_enable_openthread) { - deps += [ - "${chip_root}/third_party/openthread:openthread", - "${chip_root}/third_party/openthread:openthread-platform", - "${examples_plat_dir}:efr-matter-shell", - ] - } - - # Attestation Credentials - if (chip_build_platform_attestation_credentials_provider) { - deps += [ "${examples_plat_dir}:efr32-attestation-credentials" ] - } - - # Factory Data Provider - if (use_efr32_factory_data_provider) { - deps += [ "${examples_plat_dir}:efr32-factory-data-provider" ] - } - - # Default Read handler for SED - if (chip_config_use_icd_subscription_callbacks) { - deps += [ "${examples_plat_dir}:efr32-ICD-subscription-callback" ] - } - - if (chip_enable_ota_requestor) { - defines += [ "EFR32_OTA_ENABLED" ] - sources += [ "${examples_plat_dir}/OTAConfig.cpp" ] - } - - # WiFi Settings - if (chip_enable_wifi) { - if (use_rs911x) { - sources += rs911x_src_plat - - # All the stuff from wiseconnect - sources += rs911x_src_sapi - - # Apparently - the rsi library needs this (though we may not use use it) - sources += rs911x_src_sock - include_dirs += rs911x_inc_plat - - if (use_rs911x_sockets) { - # - # Using native sockets inside RS911x - # - include_dirs += rs911x_sock_inc - } else { - # - # We use LWIP - not built-in sockets - # - sources += rs911x_src_lwip - } - } else if (use_wf200) { - sources += wf200_plat_src - include_dirs += wf200_plat_incs - } - - if (chip_enable_wifi_ipv4) { - defines += [ "CHIP_DEVICE_CONFIG_ENABLE_IPV4" ] - } - - if (rs91x_wpa3_only) { - # TODO: Change this macro once WF200 support is provided - defines += [ "WIFI_ENABLE_SECURITY_WPA3=1" ] - } - } - if (!disable_lcd) { - sources += [ - "${examples_plat_dir}/display/demo-ui.c", - "${examples_plat_dir}/display/lcd.cpp", - ] - include_dirs += [ "${examples_plat_dir}/display" ] - defines += [ - "DISPLAY_ENABLED", - "IS_DEMO_SWITCH=1", - ] - if (show_qr_code) { - defines += [ "QR_CODE_ENABLED" ] - deps += [ "${chip_root}/examples/common/QRCode" ] - } + defines += [ "IS_DEMO_SWITCH=1" ] } if (chip_enable_pw_rpc) { @@ -367,11 +138,6 @@ efr32_executable("light_switch_app") { ] } - if (enable_heap_monitoring) { - sources += [ "${examples_common_plat_dir}/MemMonitoring.cpp" ] - defines += [ "HEAP_MONITORING" ] - } - ldscript = "${examples_plat_dir}/ldscripts/${silabs_family}.ld" inputs = [ ldscript ] diff --git a/examples/light-switch-app/silabs/efr32/args.gni b/examples/light-switch-app/silabs/efr32/args.gni index c7b087a4ee4f49..5ca79b0919f47b 100644 --- a/examples/light-switch-app/silabs/efr32/args.gni +++ b/examples/light-switch-app/silabs/efr32/args.gni @@ -18,6 +18,7 @@ import("${chip_root}/src/platform/silabs/EFR32/args.gni") efr32_sdk_target = get_label_info(":sdk", "label_no_toolchain") +app_data_model = "${chip_root}/examples/light-switch-app/light-switch-common" chip_enable_ota_requestor = true chip_enable_openthread = true openthread_external_platform = diff --git a/examples/light-switch-app/silabs/efr32/build_for_wifi_args.gni b/examples/light-switch-app/silabs/efr32/build_for_wifi_args.gni index 86d8a19bbc36ce..7069bd4823a499 100644 --- a/examples/light-switch-app/silabs/efr32/build_for_wifi_args.gni +++ b/examples/light-switch-app/silabs/efr32/build_for_wifi_args.gni @@ -19,3 +19,4 @@ chip_enable_openthread = false import("${chip_root}/src/platform/silabs/EFR32/wifi_args.gni") chip_enable_ota_requestor = true +app_data_model = "${chip_root}/examples/light-switch-app/light-switch-common" diff --git a/examples/lighting-app/silabs/SiWx917/BUILD.gn b/examples/lighting-app/silabs/SiWx917/BUILD.gn index dbedc37a233b5c..8abb554a67c3be 100644 --- a/examples/lighting-app/silabs/SiWx917/BUILD.gn +++ b/examples/lighting-app/silabs/SiWx917/BUILD.gn @@ -49,15 +49,9 @@ declare_args() { OTA_periodic_query_timeout = 86400 # Wifi related stuff - they are overridden by gn -args="use_wf200=true" - use_wf200 = false - use_rs911x = false - use_rs911x_sockets = false sl_wfx_config_softap = false sl_wfx_config_scan = true - # Disable LCD on supported devices - disable_lcd = true - # Argument to Disable IPv4 for wifi(rs911) chip_enable_wifi_ipv4 = false @@ -71,14 +65,6 @@ declare_args() { psk = "" } -declare_args() { - # Enables LCD Qr Code on supported devices - show_qr_code = !disable_lcd -} - -# qr code cannot be true if lcd is disabled -assert(!(disable_lcd && show_qr_code)) - # Sanity check assert(!(chip_enable_wifi && chip_enable_openthread)) assert(!(use_rs911x && chip_enable_openthread)) diff --git a/examples/lighting-app/silabs/efr32/BUILD.gn b/examples/lighting-app/silabs/efr32/BUILD.gn index dcda82dc8d9dea..5a0c94254b0d37 100644 --- a/examples/lighting-app/silabs/efr32/BUILD.gn +++ b/examples/lighting-app/silabs/efr32/BUILD.gn @@ -35,115 +35,11 @@ efr32_project_dir = "${chip_root}/examples/lighting-app/silabs/efr32" examples_plat_dir = "${chip_root}/examples/platform/silabs/efr32" examples_common_plat_dir = "${chip_root}/examples/platform/silabs" +import("${examples_plat_dir}/args.gni") + declare_args() { # Dump memory usage at link time. chip_print_memory_usage = false - - # Monitor & log memory usage at runtime. - enable_heap_monitoring = false - - # Enable Sleepy end device - enable_sleepy_device = false - - # OTA timeout in seconds - OTA_periodic_query_timeout = 86400 - - # Wifi related stuff - they are overridden by gn -args="use_wf200=true" - use_wf200 = false - use_rs911x = false - use_rs911x_sockets = false - sl_wfx_config_softap = false - sl_wfx_config_scan = true - - # Disable LCD on supported devices - disable_lcd = false - - # Argument to Disable IPv4 for wifi(rs911) - chip_enable_wifi_ipv4 = false - - # Argument to force enable WPA3 security on rs91x - rs91x_wpa3_only = false - - #default WiFi SSID - chip_default_wifi_ssid = "" - - #default Wifi Password - chip_default_wifi_psk = "" -} - -declare_args() { - # Enables LCD Qr Code on supported devices - show_qr_code = !disable_lcd -} - -# qr code cannot be true if lcd is disabled -assert(!(disable_lcd && show_qr_code)) - -# Sanity check -assert(!(chip_enable_wifi && chip_enable_openthread)) -assert(!(use_rs911x && chip_enable_openthread)) -assert(!(use_wf200 && chip_enable_openthread)) -if (chip_enable_wifi) { - assert(use_rs911x || use_wf200) - enable_openthread_cli = false - import("${chip_root}/src/platform/silabs/EFR32/wifi_args.gni") -} - -# ThunderBoards, Explorer Kit and MGM240L do not support LCD (No LCD) -if (silabs_board == "BRD4166A" || silabs_board == "BRD2601B" || - silabs_board == "BRD2703A" || silabs_board == "BRD4319A" || - silabs_board == "BRD2704A") { - show_qr_code = false - disable_lcd = true -} - -defines = [] - -# WiFi settings -if (chip_enable_wifi) { - if (chip_default_wifi_ssid != "") { - defines += [ - "CHIP_ONNETWORK_PAIRING=1", - "CHIP_WIFI_SSID=\"${chip_default_wifi_ssid}\"", - ] - } - if (chip_default_wifi_psk != "") { - assert(chip_default_wifi_ssid != "", - "ssid can't be null if psk is provided") - defines += [ "CHIP_WIFI_PSK=\"${chip_default_wifi_psk}\"" ] - } - wifi_sdk_dir = "${chip_root}/src/platform/silabs/EFR32/wifi" - efr32_lwip_defs = [ "LWIP_NETIF_API=1" ] - if (lwip_ipv4) { - efr32_lwip_defs += [ - "LWIP_IPV4=1", - - # adds following options to provide - # them to .cpp source files - # flags ported from lwipopts file - # TODO: move lwipopts to one location - "LWIP_ARP=1", - "LWIP_ICMP=1", - "LWIP_IGMP=1", - "LWIP_DHCP=1", - "LWIP_DNS=0", - ] - } else { - efr32_lwip_defs += [ "LWIP_IPV4=0" ] - } - if (lwip_ipv6) { - efr32_lwip_defs += [ "LWIP_IPV6=1" ] - } else { - efr32_lwip_defs += [ "LWIP_IPV6=0" ] - } - - if (use_rs911x) { - wiseconnect_sdk_root = - "${chip_root}/third_party/silabs/wiseconnect-wifi-bt-sdk" - import("${examples_plat_dir}/rs911x/rs911x.gni") - } else { - import("${examples_plat_dir}/wf200/wf200.gni") - } } efr32_sdk("sdk") { @@ -160,47 +56,18 @@ efr32_sdk("sdk") { "${examples_common_plat_dir}", ] - defines += [ - "BOARD_ID=${silabs_board}", - "OTA_PERIODIC_TIMEOUT=${OTA_periodic_query_timeout}", - ] - - if (enable_heap_monitoring) { - defines += [ "HEAP_MONITORING" ] + if (use_wf200) { + # TODO efr32_sdk should not need a header from this location + include_dirs += [ "${examples_plat_dir}/wf200" ] } + defines = [] if (chip_enable_pw_rpc) { defines += [ "HAL_VCOM_ENABLE=1", "PW_RPC_ENABLED", ] } - - # WiFi Settings - if (chip_enable_wifi) { - if (use_rs911x) { - defines += rs911x_defs - include_dirs += rs911x_plat_incs - } else if (use_wf200) { - defines += wf200_defs - include_dirs += wf200_plat_incs - } - - if (use_rs911x_sockets) { - include_dirs += [ "${examples_plat_dir}/wifi/rsi-sockets" ] - defines += rs911x_sock_defs - } else { - # Using LWIP instead of the native TCP/IP stack - defines += efr32_lwip_defs - } - - if (sl_wfx_config_softap) { - defines += [ "SL_WFX_CONFIG_SOFTAP" ] - } - if (sl_wfx_config_scan) { - defines += [ "SL_WFX_CONFIG_SCAN" ] - } - } } efr32_executable("lighting_app") { @@ -214,102 +81,20 @@ efr32_executable("lighting_app") { } sources = [ - "${examples_common_plat_dir}/heap_4_silabs.c", - "${examples_plat_dir}/BaseApplication.cpp", - "${examples_plat_dir}/efr32_utils.cpp", - "${examples_plat_dir}/init_efrPlatform.cpp", - "${examples_plat_dir}/matter_config.cpp", "src/AppTask.cpp", "src/LightingManager.cpp", "src/ZclCallbacks.cpp", "src/main.cpp", ] - if (use_wstk_leds) { - sources += [ "${examples_plat_dir}/LEDWidget.cpp" ] - } - - if (chip_enable_pw_rpc || chip_build_libshell || enable_openthread_cli || - use_wf200 || use_rs911x) { - sources += [ "${examples_plat_dir}/uart.cpp" ] - } - deps = [ ":sdk", - "${chip_root}/examples/lighting-app/lighting-common", - "${chip_root}/examples/providers:device_info_provider", - "${chip_root}/src/lib", - "${chip_root}/src/setup_payload", + "${examples_plat_dir}:efr32-common", + app_data_model, ] - # OpenThread Settings - if (chip_enable_openthread) { - deps += [ - "${chip_root}/third_party/openthread:openthread", - "${chip_root}/third_party/openthread:openthread-platform", - "${examples_plat_dir}:efr-matter-shell", - ] - } - - if (chip_enable_ota_requestor) { - defines += [ "EFR32_OTA_ENABLED" ] - sources += [ "${examples_plat_dir}/OTAConfig.cpp" ] - } - - # WiFi Settings - if (chip_enable_wifi) { - if (use_rs911x) { - sources += rs911x_src_plat - - # All the stuff from wiseconnect - sources += rs911x_src_sapi - - # Apparently - the rsi library needs this (though we may not use use it) - sources += rs911x_src_sock - include_dirs += rs911x_inc_plat - - if (use_rs911x_sockets) { - # - # Using native sockets inside RS911x - # - include_dirs += rs911x_sock_inc - } else { - # - # We use LWIP - not built-in sockets - # - sources += rs911x_src_lwip - } - } else if (use_wf200) { - sources += wf200_plat_src - include_dirs += wf200_plat_incs - } - - if (chip_enable_wifi_ipv4) { - defines += [ "CHIP_DEVICE_CONFIG_ENABLE_IPV4" ] - } - - if (rs91x_wpa3_only) { - # TODO: Change this macro once WF200 support is provided - defines += [ "WIFI_ENABLE_SECURITY_WPA3=1" ] - } - } - if (!disable_lcd) { - sources += [ - "${examples_plat_dir}/display/demo-ui.c", - "${examples_plat_dir}/display/lcd.cpp", - ] - - include_dirs += [ "${examples_plat_dir}/display" ] - defines += [ - "DISPLAY_ENABLED", - "IS_DEMO_LIGHT=1", - ] - if (show_qr_code) { - defines += [ "QR_CODE_ENABLED" ] - - deps += [ "${chip_root}/examples/common/QRCode" ] - } + defines += [ "IS_DEMO_LIGHT=1" ] } if (chip_enable_pw_rpc) { @@ -357,11 +142,6 @@ efr32_executable("lighting_app") { ] } - if (enable_heap_monitoring) { - sources += [ "${examples_common_plat_dir}/MemMonitoring.cpp" ] - defines += [ "HEAP_MONITORING" ] - } - ldscript = "${examples_plat_dir}/ldscripts/${silabs_family}.ld" inputs = [ ldscript ] @@ -383,16 +163,6 @@ efr32_executable("lighting_app") { ] } - # Attestation Credentials - if (chip_build_platform_attestation_credentials_provider) { - deps += [ "${examples_plat_dir}:efr32-attestation-credentials" ] - } - - # Factory Data Provider - if (use_efr32_factory_data_provider) { - deps += [ "${examples_plat_dir}:efr32-factory-data-provider" ] - } - output_dir = root_out_dir } diff --git a/examples/lighting-app/silabs/efr32/args.gni b/examples/lighting-app/silabs/efr32/args.gni index 6b0d9a8e2eb8a6..75b21eaef170aa 100644 --- a/examples/lighting-app/silabs/efr32/args.gni +++ b/examples/lighting-app/silabs/efr32/args.gni @@ -18,6 +18,7 @@ import("${chip_root}/src/platform/silabs/EFR32/args.gni") efr32_sdk_target = get_label_info(":sdk", "label_no_toolchain") +app_data_model = "${chip_root}/examples/lighting-app/lighting-common" chip_enable_ota_requestor = true chip_enable_openthread = true diff --git a/examples/lighting-app/silabs/efr32/build_for_wifi_args.gni b/examples/lighting-app/silabs/efr32/build_for_wifi_args.gni index 86d8a19bbc36ce..a1e4b995d96b1a 100644 --- a/examples/lighting-app/silabs/efr32/build_for_wifi_args.gni +++ b/examples/lighting-app/silabs/efr32/build_for_wifi_args.gni @@ -19,3 +19,4 @@ chip_enable_openthread = false import("${chip_root}/src/platform/silabs/EFR32/wifi_args.gni") chip_enable_ota_requestor = true +app_data_model = "${chip_root}/examples/lighting-app/lighting-common" diff --git a/examples/lighting-app/silabs/efr32/with_pw_rpc.gni b/examples/lighting-app/silabs/efr32/with_pw_rpc.gni index 40a8bb79d84b6a..3ee366c51ad498 100644 --- a/examples/lighting-app/silabs/efr32/with_pw_rpc.gni +++ b/examples/lighting-app/silabs/efr32/with_pw_rpc.gni @@ -21,6 +21,7 @@ import("${chip_root}/examples/platform/silabs/efr32/args.gni") efr32_sdk_target = get_label_info(":sdk", "label_no_toolchain") +app_data_model = "${chip_root}/examples/lighting-app/lighting-common" chip_enable_pw_rpc = true chip_enable_openthread = true chip_build_pw_trace_lib = true diff --git a/examples/lock-app/silabs/SiWx917/BUILD.gn b/examples/lock-app/silabs/SiWx917/BUILD.gn index dd196fa421303b..01710fc7ef48fc 100644 --- a/examples/lock-app/silabs/SiWx917/BUILD.gn +++ b/examples/lock-app/silabs/SiWx917/BUILD.gn @@ -49,15 +49,9 @@ declare_args() { OTA_periodic_query_timeout = 86400 # Wifi related stuff - they are overridden by gn -args="use_wf200=true" - use_wf200 = false - use_rs911x = false - use_rs911x_sockets = false sl_wfx_config_softap = false sl_wfx_config_scan = true - # Disable LCD on supported devices - disable_lcd = true - # Argument to Disable IPv4 for wifi(rs911) chip_enable_wifi_ipv4 = false @@ -71,14 +65,6 @@ declare_args() { chip_default_wifi_psk = "" } -declare_args() { - # Enables LCD Qr Code on supported devices - show_qr_code = !disable_lcd -} - -# qr code cannot be true if lcd is disabled -assert(!(disable_lcd && show_qr_code)) - # Sanity check assert(!(chip_enable_wifi && chip_enable_openthread)) assert(!(use_rs911x && chip_enable_openthread)) diff --git a/examples/lock-app/silabs/efr32/BUILD.gn b/examples/lock-app/silabs/efr32/BUILD.gn index f07593e26bdc1f..cbf45096592f8d 100644 --- a/examples/lock-app/silabs/efr32/BUILD.gn +++ b/examples/lock-app/silabs/efr32/BUILD.gn @@ -35,114 +35,11 @@ efr32_project_dir = "${chip_root}/examples/lock-app/silabs/efr32" examples_plat_dir = "${chip_root}/examples/platform/silabs/efr32" examples_common_plat_dir = "${chip_root}/examples/platform/silabs" +import("${examples_plat_dir}/args.gni") + declare_args() { # Dump memory usage at link time. chip_print_memory_usage = false - - # Monitor & log memory usage at runtime. - enable_heap_monitoring = false - - # Enable Sleepy end device - enable_sleepy_device = false - - # OTA timeout in seconds - OTA_periodic_query_timeout = 86400 - - # Wifi related stuff - they are overridden by gn -args="use_wf200=true" - use_wf200 = false - use_rs911x = false - use_rs911x_sockets = false - sl_wfx_config_softap = false - sl_wfx_config_scan = true - - # Disable LCD on supported devices - disable_lcd = false - - # Argument to Disable IPv4 for wifi(rs911) - chip_enable_wifi_ipv4 = false - - # Argument to force enable WPA3 security - rs91x_wpa3_only = false - - #default WiFi SSID - chip_default_wifi_ssid = "" - - #default Wifi Password - chip_default_wifi_psk = "" -} - -declare_args() { - # Enables LCD Qr Code on supported devices - show_qr_code = !disable_lcd -} - -# qr code cannot be true if lcd is disabled -assert(!(disable_lcd && show_qr_code)) - -# Sanity check -assert(!(chip_enable_wifi && chip_enable_openthread)) -assert(!(use_rs911x && chip_enable_openthread)) -assert(!(use_wf200 && chip_enable_openthread)) -if (chip_enable_wifi) { - assert(use_rs911x || use_wf200) - enable_openthread_cli = false - import("${chip_root}/src/platform/silabs/EFR32/wifi_args.gni") -} - -# ThunderBoards, Explorer Kit and MGM240L do not support LCD (No LCD) -if (silabs_board == "BRD4166A" || silabs_board == "BRD2601B" || - silabs_board == "BRD2703A" || silabs_board == "BRD4319A") { - show_qr_code = false - disable_lcd = true -} - -defines = [] - -# WiFi settings -if (chip_enable_wifi) { - if (chip_default_wifi_ssid != "") { - defines += [ - "CHIP_ONNETWORK_PAIRING=1", - "CHIP_WIFI_SSID=\"${chip_default_wifi_ssid}\"", - ] - } - if (chip_default_wifi_psk != "") { - assert(chip_default_wifi_ssid != "", - "ssid can't be null if psk is provided") - defines += [ "CHIP_WIFI_PSK=\"${chip_default_wifi_psk}\"" ] - } - wifi_sdk_dir = "${chip_root}/src/platform/silabs/EFR32/wifi" - efr32_lwip_defs = [ "LWIP_NETIF_API=1" ] - if (lwip_ipv4) { - efr32_lwip_defs += [ - "LWIP_IPV4=1", - - # adds following options to provide - # them to .cpp source files - # flags ported from lwipopts file - # TODO: move lwipopts to one location - "LWIP_ARP=1", - "LWIP_ICMP=1", - "LWIP_IGMP=1", - "LWIP_DHCP=1", - "LWIP_DNS=0", - ] - } else { - efr32_lwip_defs += [ "LWIP_IPV4=0" ] - } - if (lwip_ipv6) { - efr32_lwip_defs += [ "LWIP_IPV6=1" ] - } else { - efr32_lwip_defs += [ "LWIP_IPV6=0" ] - } - - if (use_rs911x) { - wiseconnect_sdk_root = - "${chip_root}/third_party/silabs/wiseconnect-wifi-bt-sdk" - import("${examples_plat_dir}/rs911x/rs911x.gni") - } else { - import("${examples_plat_dir}/wf200/wf200.gni") - } } efr32_sdk("sdk") { @@ -159,42 +56,18 @@ efr32_sdk("sdk") { "${examples_common_plat_dir}", ] - defines += [ - "BOARD_ID=${silabs_board}", - "OTA_PERIODIC_TIMEOUT=${OTA_periodic_query_timeout}", - ] + if (use_wf200) { + # TODO efr32_sdk should not need a header from this location + include_dirs += [ "${examples_plat_dir}/wf200" ] + } + defines = [] if (chip_enable_pw_rpc) { defines += [ "HAL_VCOM_ENABLE=1", "PW_RPC_ENABLED", ] } - - # WiFi Settings - if (chip_enable_wifi) { - if (use_rs911x) { - defines += rs911x_defs - include_dirs += rs911x_plat_incs - } else if (use_wf200) { - defines += wf200_defs - include_dirs += wf200_plat_incs - } - - if (use_rs911x_sockets) { - include_dirs += [ "${examples_plat_dir}/wifi/rsi-sockets" ] - defines += rs911x_sock_defs - } else { - # Using LWIP instead of the native TCP/IP stack - defines += efr32_lwip_defs - } - if (sl_wfx_config_softap) { - defines += [ "SL_WFX_CONFIG_SOFTAP" ] - } - if (sl_wfx_config_scan) { - defines += [ "SL_WFX_CONFIG_SCAN" ] - } - } } efr32_executable("lock_app") { @@ -204,107 +77,20 @@ efr32_executable("lock_app") { defines = [] sources = [ - "${examples_common_plat_dir}/heap_4_silabs.c", - "${examples_plat_dir}/BaseApplication.cpp", - "${examples_plat_dir}/efr32_utils.cpp", - "${examples_plat_dir}/init_efrPlatform.cpp", - "${examples_plat_dir}/matter_config.cpp", "src/AppTask.cpp", "src/LockManager.cpp", "src/ZclCallbacks.cpp", "src/main.cpp", ] - if (use_wstk_leds) { - sources += [ "${examples_plat_dir}/LEDWidget.cpp" ] - } - - if (chip_enable_pw_rpc || chip_build_libshell || enable_openthread_cli || - use_wf200 || use_rs911x) { - sources += [ "${examples_plat_dir}/uart.cpp" ] - } - - if (chip_build_libshell) { - sources += [ "src/EventHandlerLibShell.cpp" ] - } - deps = [ ":sdk", - "${chip_root}/examples/lock-app/lock-common", - "${chip_root}/examples/providers:device_info_provider", - "${chip_root}/src/lib", - "${chip_root}/src/setup_payload", - "${chip_root}/third_party/openthread/platforms:libopenthread-platform", - "${chip_root}/third_party/openthread/platforms:libopenthread-platform-utils", - "${examples_plat_dir}:efr-matter-shell", + "${examples_plat_dir}:efr32-common", + app_data_model, ] - # OpenThread Settings - if (chip_enable_openthread) { - deps += [ - "${chip_root}/third_party/openthread:openthread", - "${chip_root}/third_party/openthread:openthread-platform", - "${examples_plat_dir}:efr-matter-shell", - ] - } - - if (chip_enable_ota_requestor) { - defines += [ "EFR32_OTA_ENABLED" ] - sources += [ "${examples_plat_dir}/OTAConfig.cpp" ] - } - - # WiFi Settings - if (chip_enable_wifi) { - if (use_rs911x) { - sources += rs911x_src_plat - - # All the stuff from wiseconnect - sources += rs911x_src_sapi - - # Apparently - the rsi library needs this (though we may not use use it) - sources += rs911x_src_sock - include_dirs += rs911x_inc_plat - - if (use_rs911x_sockets) { - # - # Using native sockets inside RS911x - # - include_dirs += rs911x_sock_inc - } else { - # - # We use LWIP - not built-in sockets - # - sources += rs911x_src_lwip - } - } else if (use_wf200) { - sources += wf200_plat_src - include_dirs += wf200_plat_incs - } - - if (chip_enable_wifi_ipv4) { - defines += [ "CHIP_DEVICE_CONFIG_ENABLE_IPV4" ] - } - - if (rs91x_wpa3_only) { - # TODO: Change this macro once WF200 support is provided - defines += [ "WIFI_ENABLE_SECURITY_WPA3=1" ] - } - } - if (!disable_lcd) { - sources += [ - "${examples_plat_dir}/display/demo-ui.c", - "${examples_plat_dir}/display/lcd.cpp", - ] - include_dirs += [ "${examples_plat_dir}/display" ] - defines += [ - "DISPLAY_ENABLED", - "IS_DEMO_LOCK=1", - ] - if (show_qr_code) { - defines += [ "QR_CODE_ENABLED" ] - deps += [ "${chip_root}/examples/common/QRCode" ] - } + defines += [ "IS_DEMO_LOCK=1" ] } if (chip_enable_pw_rpc) { @@ -348,11 +134,6 @@ efr32_executable("lock_app") { ] } - if (enable_heap_monitoring) { - sources += [ "${examples_common_plat_dir}/MemMonitoring.cpp" ] - defines += [ "HEAP_MONITORING" ] - } - ldscript = "${examples_plat_dir}/ldscripts/${silabs_family}.ld" inputs = [ ldscript ] @@ -374,18 +155,9 @@ efr32_executable("lock_app") { ] } - # Attestation Credentials - if (chip_build_platform_attestation_credentials_provider) { - deps += [ "${examples_plat_dir}:efr32-attestation-credentials" ] - } - - # Factory Data Provider - if (use_efr32_factory_data_provider) { - deps += [ "${examples_plat_dir}:efr32-factory-data-provider" ] - } - output_dir = root_out_dir } + group("efr32") { deps = [ ":lock_app" ] } diff --git a/examples/lock-app/silabs/efr32/args.gni b/examples/lock-app/silabs/efr32/args.gni index c7b087a4ee4f49..2795c9453cd48b 100644 --- a/examples/lock-app/silabs/efr32/args.gni +++ b/examples/lock-app/silabs/efr32/args.gni @@ -18,6 +18,7 @@ import("${chip_root}/src/platform/silabs/EFR32/args.gni") efr32_sdk_target = get_label_info(":sdk", "label_no_toolchain") +app_data_model = "${chip_root}/examples/lock-app/lock-common" chip_enable_ota_requestor = true chip_enable_openthread = true openthread_external_platform = diff --git a/examples/lock-app/silabs/efr32/build_for_wifi_args.gni b/examples/lock-app/silabs/efr32/build_for_wifi_args.gni index 86d8a19bbc36ce..556c097dcf568c 100644 --- a/examples/lock-app/silabs/efr32/build_for_wifi_args.gni +++ b/examples/lock-app/silabs/efr32/build_for_wifi_args.gni @@ -19,3 +19,4 @@ chip_enable_openthread = false import("${chip_root}/src/platform/silabs/EFR32/wifi_args.gni") chip_enable_ota_requestor = true +app_data_model = "${chip_root}/examples/lock-app/lock-common" diff --git a/examples/lock-app/silabs/efr32/with_pw_rpc.gni b/examples/lock-app/silabs/efr32/with_pw_rpc.gni index faa281a6a4597c..b691609e6bf2d0 100644 --- a/examples/lock-app/silabs/efr32/with_pw_rpc.gni +++ b/examples/lock-app/silabs/efr32/with_pw_rpc.gni @@ -21,6 +21,7 @@ import("${chip_root}/examples/platform/silabs/efr32/args.gni") efr32_sdk_target = get_label_info(":sdk", "label_no_toolchain") +app_data_model = "${chip_root}/examples/lock-app/lock-common" chip_enable_pw_rpc = true chip_enable_openthread = true chip_openthread_ftd = true diff --git a/examples/platform/silabs/efr32/BUILD.gn b/examples/platform/silabs/efr32/BUILD.gn index 4c62826c7c4a8a..b1c4f9eda57e34 100644 --- a/examples/platform/silabs/efr32/BUILD.gn +++ b/examples/platform/silabs/efr32/BUILD.gn @@ -14,12 +14,60 @@ import("//build_overrides/chip.gni") 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("${efr32_sdk_build_root}/efr32_sdk.gni") +import("${efr32_sdk_build_root}/silabs_board.gni") + +declare_args() { + enable_heap_monitoring = false + + # OTA timeout in seconds + OTA_periodic_query_timeout = 86400 + + # Wifi related stuff - they are overridden by gn -args="use_wf200=true" + sl_wfx_config_softap = false + sl_wfx_config_scan = true + + # Argument to Disable IPv4 for wifi(rs911) + chip_enable_wifi_ipv4 = false + + # Argument to force enable WPA3 security on rs91x + rs91x_wpa3_only = false + + #default WiFi SSID + chip_default_wifi_ssid = "" + + #default Wifi Password + chip_default_wifi_psk = "" +} silabs_common_plat_dir = "${chip_root}/examples/platform/silabs" +import("${silabs_common_plat_dir}/efr32/args.gni") + +# Sanity check +assert(!(chip_enable_wifi && chip_enable_openthread)) +assert(!(use_rs911x && chip_enable_openthread)) +assert(!(use_wf200 && chip_enable_openthread)) + +if (chip_enable_wifi) { + assert(use_rs911x || use_wf200) + enable_openthread_cli = false + import("${chip_root}/src/platform/silabs/EFR32/wifi_args.gni") + + if (use_rs911x) { + wiseconnect_sdk_root = + "${chip_root}/third_party/silabs/wiseconnect-wifi-bt-sdk" + import("rs911x/rs911x.gni") + } + + if (use_wf200) { + import("wf200/wf200.gni") + } +} + config("chip_examples_project_config") { include_dirs = [ "project_include" ] @@ -118,11 +166,162 @@ config("ICD-subscription-callback-config") { source_set("efr32-ICD-subscription-callback") { sources = [ - "../ICDSubscriptionCallback.cpp", - "../ICDSubscriptionCallback.h", + "${silabs_common_plat_dir}/ICDSubscriptionCallback.cpp", + "${silabs_common_plat_dir}/ICDSubscriptionCallback.h", ] public_deps = [ "${chip_root}/src/app:app" ] public_configs = [ ":ICD-subscription-callback-config" ] } + +config("efr32-common-config") { + defines = [ "OTA_PERIODIC_TIMEOUT=${OTA_periodic_query_timeout}" ] + + if (!disable_lcd) { + include_dirs = [ "display" ] + + defines += [ "DISPLAY_ENABLED" ] + } + + if (show_qr_code) { + defines += [ "QR_CODE_ENABLED" ] + } + + if (chip_enable_ota_requestor) { + defines += [ "EFR32_OTA_ENABLED" ] + } + + if (enable_heap_monitoring) { + defines += [ "HEAP_MONITORING" ] + } +} + +config("silabs-wifi-config") { + defines = [] + include_dirs = [] + + if (chip_default_wifi_ssid != "") { + defines += [ + "CHIP_ONNETWORK_PAIRING=1", + "CHIP_WIFI_SSID=\"${chip_default_wifi_ssid}\"", + ] + } + if (chip_default_wifi_psk != "") { + assert(chip_default_wifi_ssid != "", + "ssid can't be null if psk is provided") + defines += [ "CHIP_WIFI_PSK=\"${chip_default_wifi_psk}\"" ] + } + + if (sl_wfx_config_softap) { + defines += [ "SL_WFX_CONFIG_SOFTAP" ] + } + if (sl_wfx_config_scan) { + defines += [ "SL_WFX_CONFIG_SCAN" ] + } + + if (chip_enable_wifi_ipv4) { + defines += [ "CHIP_DEVICE_CONFIG_ENABLE_IPV4" ] + } + + if (rs91x_wpa3_only) { + # TODO: Change this macro once WF200 support is provided + defines += [ "WIFI_ENABLE_SECURITY_WPA3=1" ] + } +} + +source_set("efr32-common") { + deps = [] + public_deps = [] + public_configs = [ ":efr32-common-config" ] + + include_dirs = [ "." ] + + sources = [ + "${silabs_common_plat_dir}/heap_4_silabs.c", + "efr32_utils.cpp", + "init_efrPlatform.cpp", + "matter_config.cpp", + ] + + if (use_base_app) { + sources += [ "BaseApplication.cpp" ] + } + + if (use_wstk_leds) { + sources += [ "LEDWidget.cpp" ] + } + + if (chip_enable_pw_rpc || chip_build_libshell || enable_openthread_cli || + use_wf200 || use_rs911x) { + sources += [ "uart.cpp" ] + } + + if (chip_enable_ota_requestor) { + sources += [ "OTAConfig.cpp" ] + } + + if (!disable_lcd) { + sources += [ + "display/demo-ui.c", + "display/lcd.cpp", + ] + + include_dirs += [ "display" ] + public_deps += [ "${chip_root}/examples/common/QRCode" ] + } + + if (enable_heap_monitoring) { + sources += [ "${silabs_common_plat_dir}/MemMonitoring.cpp" ] + } + + # OpenThread Settings + if (chip_enable_openthread) { + deps += [ + "${chip_root}/third_party/openthread:openthread", + "${chip_root}/third_party/openthread:openthread-platform", + ] + } + + if (chip_enable_wifi) { + if (use_rs911x) { + sources += rs911x_src_plat + + # All the stuff from wiseconnect + sources += rs911x_src_sapi + include_dirs += rs911x_inc_plat + + #add compilation flags for rs991x build. This will be addressed directly in wiseconnect sdk in the next version release of that sdk + cflags = rs911x_cflags + } else if (use_wf200) { + sources += wf200_plat_src + include_dirs += wf200_plat_incs + } + + public_configs += [ ":silabs-wifi-config" ] + } + + if (chip_build_libshell) { + deps += [ "${examples_plat_dir}:efr-matter-shell" ] + } + + # Attestation Credentials + if (chip_build_platform_attestation_credentials_provider) { + deps += [ ":efr32-attestation-credentials" ] + } + + # Factory Data Provider + if (use_efr32_factory_data_provider) { + public_deps += [ ":efr32-factory-data-provider" ] + } + + public_deps += [ + "${chip_root}/examples/providers:device_info_provider", + "${chip_root}/src/lib", + "${chip_root}/src/setup_payload", + ] + + if (app_data_model != "") { + public_deps += [ app_data_model ] + } +} diff --git a/examples/platform/silabs/efr32/args.gni b/examples/platform/silabs/efr32/args.gni index 1726b62a75d86b..47d4cbb5c7bc20 100644 --- a/examples/platform/silabs/efr32/args.gni +++ b/examples/platform/silabs/efr32/args.gni @@ -19,3 +19,8 @@ chip_device_project_config_include = "" chip_project_config_include = "" chip_inet_project_config_include = "" chip_system_project_config_include = "" + +declare_args() { + app_data_model = "" + use_base_app = true +} diff --git a/examples/platform/silabs/efr32/rs911x/rs911x.gni b/examples/platform/silabs/efr32/rs911x/rs911x.gni index f11981023e35f2..40e6412cc8648a 100644 --- a/examples/platform/silabs/efr32/rs911x/rs911x.gni +++ b/examples/platform/silabs/efr32/rs911x/rs911x.gni @@ -1,25 +1,17 @@ import("//build_overrides/chip.gni") -import("//build_overrides/efr32_sdk.gni") -import("//build_overrides/pigweed.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" -rs911x_cflags = [] rs911x_src_plat = [ "${examples_plat_dir}/rs911x/rsi_if.c", "${examples_plat_dir}/rs911x/wfx_rsi_host.c", - "${wifi_sdk_dir}/wfx_notify.cpp", "${examples_plat_dir}/rs911x/hal/rsi_hal_mcu_interrupt.c", "${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", -] -rs911x_plat_incs = [ - "${wifi_sdk_dir}", - "${wifi_sdk_dir}/hal", - "${chip_root}/src/platform/EFR32", + "${wifi_sdk_dir}/wfx_notify.cpp", ] # @@ -57,45 +49,16 @@ rs911x_src_sapi = [ "${wiseconnect_sdk_root}/sapi/driver/rsi_utils.c", "${wiseconnect_sdk_root}/sapi/driver/rsi_wlan.c", "${wiseconnect_sdk_root}/sapi/rtos/freertos_wrapper/rsi_os_wrapper.c", + + # Apparently - the rsi library needs this (though we may not use use it) + "${wiseconnect_sdk_root}/sapi/network/socket/rsi_socket.c", + "${wiseconnect_sdk_root}/sapi/network/socket/rsi_socket_rom.c", ] -foreach(src_file, rs911x_src_sapi) { - rs911x_cflags += [ "-Wno-empty-body" ] -} +rs911x_cflags = [ "-Wno-empty-body" ] rs911x_inc_plat = [ - "${wifi_sdk_dir}", "${examples_plat_dir}/rs911x", "${examples_plat_dir}/rs911x/hal", "${wiseconnect_sdk_root}/sapi/include", ] - -# Apparently - the rsi library needs this -rs911x_src_sock = [ - "${wiseconnect_sdk_root}/sapi/network/socket/rsi_socket.c", - "${wiseconnect_sdk_root}/sapi/network/socket/rsi_socket_rom.c", -] -rs911x_sock_inc = [ "${wifi_sdk_dir}/rsi-sockets" ] - -# -# If we use LWIP - not built-in sockets -# -rs911x_src_lwip = [ - "${wifi_sdk_dir}/ethernetif.cpp", - "${wifi_sdk_dir}/dhcp_client.cpp", - "${wifi_sdk_dir}/lwip_netif.cpp", -] -rs911x_defs = [ - "SL_HEAP_SIZE=32768", - "SL_WIFI=1", - "SL_WFX_USE_SPI", - "EFX32_RS911X=1", - "RS911X_WIFI", - "RSI_WLAN_ENABLE", - "RSI_SPI_INTERFACE", - "RSI_WITH_OS", -] -rs911x_sock_defs = [ - "RS911X_SOCKETS", - "RSI_IPV6_ENABLE", -] diff --git a/examples/platform/silabs/efr32/wf200/wf200.gni b/examples/platform/silabs/efr32/wf200/wf200.gni index fbe67d002faf67..2c0ac803c3c443 100644 --- a/examples/platform/silabs/efr32/wf200/wf200.gni +++ b/examples/platform/silabs/efr32/wf200/wf200.gni @@ -1,27 +1,10 @@ import("//build_overrides/chip.gni") -import("//build_overrides/efr32_sdk.gni") -import("//build_overrides/pigweed.gni") examples_plat_dir = "${chip_root}/examples/platform/silabs/efr32" wifi_sdk_dir = "${chip_root}/src/platform/silabs/EFR32/wifi" -wf200_defs = [ - "SL_HEAP_SIZE=24576", - "WF200_WIFI=1", - "SL_WIFI=1", - "SL_WFX_USE_SPI", - "SL_WFX_DEBUG_MASK=0x0003", -] -softap_defs = "SL_WFX_CONFIG_SOFTAP" -wifi_scan_defs = "SL_WFX_CONFIG_SCAN" -wf200_plat_incs = [ - "${wifi_sdk_dir}/", - "${examples_plat_dir}/wf200", -] +wf200_plat_incs = [ "${examples_plat_dir}/wf200" ] wf200_plat_src = [ - "${wifi_sdk_dir}/dhcp_client.cpp", - "${wifi_sdk_dir}/ethernetif.cpp", - "${wifi_sdk_dir}/lwip_netif.cpp", "${wifi_sdk_dir}/wfx_notify.cpp", "${examples_plat_dir}/wf200/sl_wfx_task.c", "${examples_plat_dir}/wf200/wf200_init.c", diff --git a/examples/thermostat/silabs/efr32/BUILD.gn b/examples/thermostat/silabs/efr32/BUILD.gn index a2ad43efcfa945..b6c7f81671501b 100644 --- a/examples/thermostat/silabs/efr32/BUILD.gn +++ b/examples/thermostat/silabs/efr32/BUILD.gn @@ -35,117 +35,17 @@ efr32_project_dir = "${chip_root}/examples/thermostat/silabs/efr32" examples_plat_dir = "${chip_root}/examples/platform/silabs/efr32" examples_common_plat_dir = "${chip_root}/examples/platform/silabs" +import("${examples_plat_dir}/args.gni") + declare_args() { # Dump memory usage at link time. chip_print_memory_usage = false - # Monitor & log memory usage at runtime. - enable_heap_monitoring = false - - # Enable Sleepy end device - enable_sleepy_device = false - - # OTA timeout in seconds - OTA_periodic_query_timeout = 86400 - - # Wifi related stuff - they are overridden by gn -args="use_wf200=true" - use_wf200 = false - use_rs911x = false - use_rs911x_sockets = false - sl_wfx_config_softap = false - sl_wfx_config_scan = true - - # Disable LCD on supported devices - disable_lcd = false - - # Argument to Disable IPv4 for wifi(rs911) - chip_enable_wifi_ipv4 = false - - #default WiFi SSID - chip_default_wifi_ssid = "" - - #default Wifi Password - chip_default_wifi_psk = "" - # Enable the temperature sensor # Some boards do not have a temperature sensor use_temp_sensor = silabs_board != "BRD2703A" && silabs_board != "BRD4319A" } -declare_args() { - # Enables LCD Qr Code on supported devices - show_qr_code = !disable_lcd -} - -# qr code cannot be true if lcd is disabled -assert(!(disable_lcd && show_qr_code)) - -# Sanity check -assert(!(chip_enable_wifi && chip_enable_openthread)) -assert(!(use_rs911x && chip_enable_openthread)) -assert(!(use_wf200 && chip_enable_openthread)) -if (chip_enable_wifi) { - assert(use_rs911x || use_wf200) - enable_openthread_cli = false - import("${chip_root}/src/platform/silabs/EFR32/wifi_args.gni") -} - -# ThunderBoards, Explorer Kit and MGM240L do not support LCD (No LCD) -if (silabs_board == "BRD4166A" || silabs_board == "BRD2601B" || - silabs_board == "BRD2703A" || silabs_board == "BRD4319A") { - show_qr_code = false - disable_lcd = true -} - -defines = [] - -# WiFi settings -if (chip_enable_wifi) { - if (chip_default_wifi_ssid != "") { - defines += [ - "CHIP_ONNETWORK_PAIRING=1", - "CHIP_WIFI_SSID=\"${chip_default_wifi_ssid}\"", - ] - } - if (chip_default_wifi_psk != "") { - assert(chip_default_wifi_ssid != "", - "ssid can't be null if psk is provided") - defines += [ "CHIP_WIFI_PSK=\"${chip_default_wifi_psk}\"" ] - } - wifi_sdk_dir = "${chip_root}/src/platform/silabs/EFR32/wifi" - efr32_lwip_defs = [ "LWIP_NETIF_API=1" ] - if (lwip_ipv4) { - efr32_lwip_defs += [ - "LWIP_IPV4=1", - - # adds following options to provide - # them to .cpp source files - # flags ported from lwipopts file - # TODO: move lwipopts to one location - "LWIP_ARP=1", - "LWIP_ICMP=1", - "LWIP_IGMP=1", - "LWIP_DHCP=1", - "LWIP_DNS=0", - ] - } else { - efr32_lwip_defs += [ "LWIP_IPV4=0" ] - } - if (lwip_ipv6) { - efr32_lwip_defs += [ "LWIP_IPV6=1" ] - } else { - efr32_lwip_defs += [ "LWIP_IPV6=0" ] - } - - if (use_rs911x) { - wiseconnect_sdk_root = - "${chip_root}/third_party/silabs/wiseconnect-wifi-bt-sdk" - import("${examples_plat_dir}/rs911x/rs911x.gni") - } else { - import("${examples_plat_dir}/wf200/wf200.gni") - } -} - efr32_sdk("sdk") { sources = [ "${efr32_project_dir}/include/CHIPProjectConfig.h", @@ -160,11 +60,12 @@ efr32_sdk("sdk") { "${examples_common_plat_dir}", ] - defines += [ - "BOARD_ID=${silabs_board}", - "OTA_PERIODIC_TIMEOUT=${OTA_periodic_query_timeout}", - ] + if (use_wf200) { + # TODO efr32_sdk should not need a header from this location + include_dirs += [ "${examples_plat_dir}/wf200" ] + } + defines = [] if (chip_enable_pw_rpc) { defines += [ "HAL_VCOM_ENABLE=1", @@ -172,31 +73,6 @@ efr32_sdk("sdk") { ] } - # WiFi Settings - if (chip_enable_wifi) { - if (use_rs911x) { - defines += rs911x_defs - include_dirs += rs911x_plat_incs - } else if (use_wf200) { - defines += wf200_defs - include_dirs += wf200_plat_incs - } - - if (use_rs911x_sockets) { - include_dirs += [ "${examples_plat_dir}/wifi/rsi-sockets" ] - defines += rs911x_sock_defs - } else { - # Using LWIP instead of the native TCP/IP stack - defines += efr32_lwip_defs - } - - if (sl_wfx_config_softap) { - defines += [ "SL_WFX_CONFIG_SOFTAP" ] - } - if (sl_wfx_config_scan) { - defines += [ "SL_WFX_CONFIG_SCAN" ] - } - } if (use_temp_sensor) { include_dirs += [ "${efr32_sdk_root}/platform/driver/i2cspm/inc", @@ -218,11 +94,6 @@ efr32_executable("thermostat_app") { defines = [] sources = [ - "${examples_common_plat_dir}/heap_4_silabs.c", - "${examples_plat_dir}/BaseApplication.cpp", - "${examples_plat_dir}/efr32_utils.cpp", - "${examples_plat_dir}/init_efrPlatform.cpp", - "${examples_plat_dir}/matter_config.cpp", "src/AppTask.cpp", "src/SensorManager.cpp", "src/TemperatureManager.cpp", @@ -230,10 +101,6 @@ efr32_executable("thermostat_app") { "src/main.cpp", ] - if (use_wstk_leds) { - sources += [ "${examples_plat_dir}/LEDWidget.cpp" ] - } - if (use_temp_sensor) { sources += [ "${efr32_sdk_root}/app/bluetooth/common/sensor_rht/sl_sensor_rht.c", @@ -247,93 +114,17 @@ efr32_executable("thermostat_app") { ] } - if (chip_enable_pw_rpc || chip_build_libshell || enable_openthread_cli || - use_wf200 || use_rs911x) { - sources += [ "${examples_plat_dir}/uart.cpp" ] + if (!disable_lcd) { + sources += [ "src/ThermostatUI.cpp" ] + defines += [ "IS_DEMO_THERMOSTAT=1" ] } deps = [ ":sdk", - "${chip_root}/examples/providers:device_info_provider", - "${chip_root}/examples/thermostat/thermostat-common", - "${chip_root}/src/lib", - "${chip_root}/src/setup_payload", + "${examples_plat_dir}:efr32-common", + app_data_model, ] - # OpenThread Settings - if (chip_enable_openthread) { - deps += [ - "${chip_root}/third_party/openthread:openthread", - "${chip_root}/third_party/openthread:openthread-platform", - "${examples_plat_dir}:efr-matter-shell", - ] - } - - # Attestation Credentials - if (chip_build_platform_attestation_credentials_provider) { - deps += [ "${examples_plat_dir}:efr32-attestation-credentials" ] - } - - # Factory Data Provider - if (use_efr32_factory_data_provider) { - deps += [ "${examples_plat_dir}:efr32-factory-data-provider" ] - } - - if (chip_enable_ota_requestor) { - defines += [ "EFR32_OTA_ENABLED" ] - sources += [ "${examples_plat_dir}/OTAConfig.cpp" ] - } - - if (chip_enable_wifi_ipv4) { - defines += [ "CHIP_DEVICE_CONFIG_ENABLE_IPV4" ] - } - - # WiFi Settings - if (chip_enable_wifi) { - if (use_rs911x) { - sources += rs911x_src_plat - - # All the stuff from wiseconnect - sources += rs911x_src_sapi - - # Apparently - the rsi library needs this (though we may not use use it) - sources += rs911x_src_sock - include_dirs += rs911x_inc_plat - - if (use_rs911x_sockets) { - # - # Using native sockets inside RS911x - # - include_dirs += rs911x_sock_inc - } else { - # - # We use LWIP - not built-in sockets - # - sources += rs911x_src_lwip - } - } else if (use_wf200) { - sources += wf200_plat_src - include_dirs += wf200_plat_incs - } - } - - if (!disable_lcd) { - sources += [ - "${examples_plat_dir}/display/demo-ui.c", - "${examples_plat_dir}/display/lcd.cpp", - "src/ThermostatUI.cpp", - ] - include_dirs += [ "${examples_plat_dir}/display" ] - defines += [ - "DISPLAY_ENABLED", - "IS_DEMO_THERMOSTAT=1", - ] - if (show_qr_code) { - defines += [ "QR_CODE_ENABLED" ] - deps += [ "${chip_root}/examples/common/QRCode" ] - } - } - if (chip_enable_pw_rpc) { defines += [ "PW_RPC_ENABLED", @@ -371,11 +162,6 @@ efr32_executable("thermostat_app") { ] } - if (enable_heap_monitoring) { - sources += [ "${examples_common_plat_dir}/MemMonitoring.cpp" ] - defines += [ "HEAP_MONITORING" ] - } - ldscript = "${examples_plat_dir}/ldscripts/${silabs_family}.ld" inputs = [ ldscript ] diff --git a/examples/thermostat/silabs/efr32/args.gni b/examples/thermostat/silabs/efr32/args.gni index 6b0d9a8e2eb8a6..542ac00f3e41b2 100644 --- a/examples/thermostat/silabs/efr32/args.gni +++ b/examples/thermostat/silabs/efr32/args.gni @@ -18,6 +18,7 @@ import("${chip_root}/src/platform/silabs/EFR32/args.gni") efr32_sdk_target = get_label_info(":sdk", "label_no_toolchain") +app_data_model = "${chip_root}/examples/thermostat/thermostat-common" chip_enable_ota_requestor = true chip_enable_openthread = true diff --git a/examples/thermostat/silabs/efr32/build_for_wifi_args.gni b/examples/thermostat/silabs/efr32/build_for_wifi_args.gni index 86d8a19bbc36ce..0124f6a2f0f455 100644 --- a/examples/thermostat/silabs/efr32/build_for_wifi_args.gni +++ b/examples/thermostat/silabs/efr32/build_for_wifi_args.gni @@ -19,3 +19,4 @@ chip_enable_openthread = false import("${chip_root}/src/platform/silabs/EFR32/wifi_args.gni") chip_enable_ota_requestor = true +app_data_model = "${chip_root}/examples/thermostat/thermostat-common" diff --git a/examples/window-app/silabs/SiWx917/BUILD.gn b/examples/window-app/silabs/SiWx917/BUILD.gn index 5aea21172c38f0..007831481970b7 100644 --- a/examples/window-app/silabs/SiWx917/BUILD.gn +++ b/examples/window-app/silabs/SiWx917/BUILD.gn @@ -43,15 +43,9 @@ declare_args() { OTA_periodic_query_timeout = 86400 # Wifi related stuff - they are overridden by gn -args="use_wf200=true" - use_wf200 = false - use_rs911x = false - use_rs911x_sockets = false sl_wfx_config_softap = false sl_wfx_config_scan = true - # Disable LCD on supported devices - disable_lcd = true - # Argument to Disable IPv4 for wifi(rs911) chip_enable_wifi_ipv4 = false @@ -65,14 +59,6 @@ declare_args() { chip_default_wifi_psk = "" } -declare_args() { - # Enables LCD Qr Code on supported devices - show_qr_code = !disable_lcd -} - -# qr code cannot be true if lcd is disabled -assert(!(disable_lcd && show_qr_code)) - # Sanity check assert(!(chip_enable_wifi && chip_enable_openthread)) assert(!(use_rs911x && chip_enable_openthread)) diff --git a/examples/window-app/silabs/efr32/BUILD.gn b/examples/window-app/silabs/efr32/BUILD.gn index 7b832a852375df..7bc1bc4133727f 100644 --- a/examples/window-app/silabs/efr32/BUILD.gn +++ b/examples/window-app/silabs/efr32/BUILD.gn @@ -29,114 +29,11 @@ efr32_project_dir = "${project_dir}/silabs/efr32" examples_plat_dir = "${chip_root}/examples/platform/silabs/efr32" examples_common_plat_dir = "${chip_root}/examples/platform/silabs" +import("${examples_plat_dir}/args.gni") + declare_args() { # Dump memory usage at link time. chip_print_memory_usage = false - - # Monitor & log memory usage at runtime. - enable_heap_monitoring = false - - # Enable Sleepy end device - enable_sleepy_device = false - - # OTA timeout in seconds - OTA_periodic_query_timeout = 86400 - - # Wifi related stuff - they are overridden by gn -args="use_wf200=true" - use_wf200 = false - use_rs911x = false - use_rs911x_sockets = false - sl_wfx_config_softap = false - sl_wfx_config_scan = true - - # Disable LCD on supported devices - disable_lcd = false - - # Argument to Disable IPv4 for wifi(rs911) - chip_enable_wifi_ipv4 = false - - # Argument to force enable WPA3 security - rs91x_wpa3_only = false - - #default WiFi SSID - chip_default_wifi_ssid = "" - - #default Wifi Password - chip_default_wifi_psk = "" -} - -declare_args() { - # Enables LCD Qr Code on supported devices - show_qr_code = !disable_lcd -} - -# qr code cannot be true if lcd is disabled -assert(!(disable_lcd && show_qr_code)) - -# Sanity check -assert(!(chip_enable_wifi && chip_enable_openthread)) -assert(!(use_rs911x && chip_enable_openthread)) -assert(!(use_wf200 && chip_enable_openthread)) -if (chip_enable_wifi) { - assert(use_rs911x || use_wf200) - enable_openthread_cli = false - import("${chip_root}/src/platform/silabs/EFR32/wifi_args.gni") -} - -# ThunderBoards, Explorer Kit and MGM240L do not support LCD (No LCD) -if (silabs_board == "BRD4166A" || silabs_board == "BRD2601B" || - silabs_board == "BRD2703A" || silabs_board == "BRD4319A") { - show_qr_code = false - disable_lcd = true -} - -defines = [] - -# WiFi settings -if (chip_enable_wifi) { - if (chip_default_wifi_ssid != "") { - defines += [ - "CHIP_ONNETWORK_PAIRING=1", - "CHIP_WIFI_SSID=\"${chip_default_wifi_ssid}\"", - ] - } - if (chip_default_wifi_psk != "") { - assert(chip_default_wifi_ssid != "", - "ssid can't be null if psk is provided") - defines += [ "CHIP_WIFI_PSK=\"${chip_default_wifi_psk}\"" ] - } - wifi_sdk_dir = "${chip_root}/src/platform/silabs/EFR32/wifi" - efr32_lwip_defs = [ "LWIP_NETIF_API=1" ] - if (lwip_ipv4) { - efr32_lwip_defs += [ - "LWIP_IPV4=1", - - # adds following options to provide - # them to .cpp source files - # flags ported from lwipopts file - # TODO: move lwipopts to one location - "LWIP_ARP=1", - "LWIP_ICMP=1", - "LWIP_IGMP=1", - "LWIP_DHCP=1", - "LWIP_DNS=0", - ] - } else { - efr32_lwip_defs += [ "LWIP_IPV4=0" ] - } - if (lwip_ipv6) { - efr32_lwip_defs += [ "LWIP_IPV6=1" ] - } else { - efr32_lwip_defs += [ "LWIP_IPV6=0" ] - } - - if (use_rs911x) { - wiseconnect_sdk_root = - "${chip_root}/third_party/silabs/wiseconnect-wifi-bt-sdk" - import("${examples_plat_dir}/rs911x/rs911x.gni") - } else { - import("${examples_plat_dir}/wf200/wf200.gni") - } } efr32_sdk("sdk") { @@ -153,35 +50,9 @@ efr32_sdk("sdk") { "${examples_common_plat_dir}", ] - defines += [ - "BOARD_ID=${silabs_board}", - "OTA_PERIODIC_TIMEOUT=${OTA_periodic_query_timeout}", - ] - - # WiFi Settings - if (chip_enable_wifi) { - if (use_rs911x) { - defines += rs911x_defs - include_dirs += rs911x_plat_incs - } else if (use_wf200) { - defines += wf200_defs - include_dirs += wf200_plat_incs - } - - if (use_rs911x_sockets) { - include_dirs += [ "${examples_plat_dir}/wifi/rsi-sockets" ] - defines += rs911x_sock_defs - } else { - # Using LWIP instead of the native TCP/IP stack - defines += efr32_lwip_defs - } - - if (sl_wfx_config_softap) { - defines += [ "SL_WFX_CONFIG_SOFTAP" ] - } - if (sl_wfx_config_scan) { - defines += [ "SL_WFX_CONFIG_SCAN" ] - } + if (use_wf200) { + # TODO efr32_sdk should not need a header from this location + include_dirs += [ "${examples_plat_dir}/wf200" ] } } @@ -196,105 +67,22 @@ efr32_executable("window_app") { defines = [] sources = [ - "${examples_common_plat_dir}/heap_4_silabs.c", - "${examples_plat_dir}/efr32_utils.cpp", - "${examples_plat_dir}/init_efrPlatform.cpp", - "${examples_plat_dir}/matter_config.cpp", "${project_dir}/common/src/WindowApp.cpp", "${project_dir}/common/src/ZclCallbacks.cpp", "src/WindowAppImpl.cpp", "src/main.cpp", ] - if (use_wstk_leds) { - sources += [ "${examples_plat_dir}/LEDWidget.cpp" ] - } - - if (chip_build_libshell || enable_openthread_cli || use_wf200 || use_rs911x) { - sources += [ "${examples_plat_dir}/uart.cpp" ] + if (!disable_lcd) { + sources += [ "src/LcdPainter.cpp" ] } deps = [ ":sdk", - "${chip_root}/examples/providers:device_info_provider", - "${chip_root}/examples/window-app/common:window-common", - "${chip_root}/src/lib", - "${chip_root}/src/setup_payload", + "${examples_plat_dir}:efr32-common", + app_data_model, ] - # OpenThread Settings - if (chip_enable_openthread) { - deps += [ - "${chip_root}/third_party/openthread:openthread", - "${chip_root}/third_party/openthread:openthread-platform", - "${examples_plat_dir}:efr-matter-shell", - ] - } - - if (chip_enable_ota_requestor) { - defines += [ "EFR32_OTA_ENABLED" ] - sources += [ "${examples_plat_dir}/OTAConfig.cpp" ] - } - - # WiFi Settings - if (chip_enable_wifi) { - if (use_rs911x) { - sources += rs911x_src_plat - - # All the stuff from wiseconnect - sources += rs911x_src_sapi - - # Apparently - the rsi library needs this (though we may not use use it) - sources += rs911x_src_sock - include_dirs += rs911x_inc_plat - - if (use_rs911x_sockets) { - # - # Using native sockets inside RS911x - # - include_dirs += rs911x_sock_inc - } else { - # - # We use LWIP - not built-in sockets - # - sources += rs911x_src_lwip - } - } else if (use_wf200) { - sources += wf200_plat_src - include_dirs += wf200_plat_incs - } - - if (chip_enable_wifi_ipv4) { - defines += [ "CHIP_DEVICE_CONFIG_ENABLE_IPV4" ] - } - - if (rs91x_wpa3_only) { - # TODO: Change this macro once WF200 support is provided - defines += [ "WIFI_ENABLE_SECURITY_WPA3=1" ] - } - } - - if (!disable_lcd) { - sources += [ - "${examples_plat_dir}/display/demo-ui.c", - "${examples_plat_dir}/display/lcd.cpp", - "src/LcdPainter.cpp", - ] - include_dirs += [ "${examples_plat_dir}/display" ] - defines += [ "DISPLAY_ENABLED" ] - - if (show_qr_code) { - deps += [ "${chip_root}/examples/common/QRCode" ] - defines += [ "QR_CODE_ENABLED" ] - } - } - - if (enable_heap_monitoring) { - defines += [ "HEAP_MONITORING" ] - - sources += [ "${examples_common_plat_dir}/MemMonitoring.cpp" ] - } - ldscript = "${examples_plat_dir}/ldscripts/${silabs_family}.ld" inputs = [ ldscript ] @@ -315,16 +103,6 @@ efr32_executable("window_app") { "-Wl,SILABS_WIFI=1", ] } - - # Attestation Credentials - if (chip_build_platform_attestation_credentials_provider) { - deps += [ "${examples_plat_dir}:efr32-attestation-credentials" ] - } - - # Factory Data Provider - if (use_efr32_factory_data_provider) { - deps += [ "${examples_plat_dir}:efr32-factory-data-provider" ] - } } group("efr32") { diff --git a/examples/window-app/silabs/efr32/args.gni b/examples/window-app/silabs/efr32/args.gni index c7b087a4ee4f49..979b3fda6ce2dd 100644 --- a/examples/window-app/silabs/efr32/args.gni +++ b/examples/window-app/silabs/efr32/args.gni @@ -18,7 +18,10 @@ import("${chip_root}/src/platform/silabs/EFR32/args.gni") efr32_sdk_target = get_label_info(":sdk", "label_no_toolchain") +app_data_model = "${chip_root}/examples/window-app/common:window-common" chip_enable_ota_requestor = true chip_enable_openthread = true openthread_external_platform = "${chip_root}/third_party/openthread/platforms/efr32:libopenthread-efr32" + +use_base_app = false diff --git a/examples/window-app/silabs/efr32/build_for_wifi_args.gni b/examples/window-app/silabs/efr32/build_for_wifi_args.gni index 8a00db97bd958d..0110df318f0955 100644 --- a/examples/window-app/silabs/efr32/build_for_wifi_args.gni +++ b/examples/window-app/silabs/efr32/build_for_wifi_args.gni @@ -18,3 +18,5 @@ chip_enable_openthread = false import("${chip_root}/src/platform/silabs/EFR32/wifi_args.gni") chip_enable_ota_requestor = true +app_data_model = "${chip_root}/examples/window-app/common:window-common" +use_base_app = false diff --git a/src/platform/silabs/EFR32/BUILD.gn b/src/platform/silabs/EFR32/BUILD.gn index bce4f104280e5e..e47ed30848a072 100644 --- a/src/platform/silabs/EFR32/BUILD.gn +++ b/src/platform/silabs/EFR32/BUILD.gn @@ -18,6 +18,7 @@ import("${chip_root}/src/platform/device.gni") import("${chip_root}/build/chip/buildconfig_header.gni") import("${chip_root}/src/crypto/crypto.gni") +import("${chip_root}/third_party/silabs/silabs_board.gni") silabs_platform_dir = "${chip_root}/src/platform/silabs" @@ -31,6 +32,19 @@ if (chip_crypto == "platform") { import("//build_overrides/mbedtls.gni") } +config("efr32-platform-wifi-config") { + include_dirs = [ "wifi" ] + defines = [] + + if (use_rs911x && use_rs911x_sockets) { + include_dirs += [ "wifi/rsi-sockets" ] + defines += [ + "RS911X_SOCKETS", + "RSI_IPV6_ENABLE", + ] + } +} + static_library("EFR32") { sources = [ "${silabs_platform_dir}/BLEManagerImpl.h", @@ -110,6 +124,21 @@ static_library("EFR32") { "${silabs_platform_dir}/ConnectivityManagerImpl_WIFI.cpp", "${silabs_platform_dir}/NetworkCommissioningWiFiDriver.cpp", "${silabs_platform_dir}/NetworkCommissioningWiFiDriver.h", + "wifi/wfx_host_events.h", + "wifi/wfx_msgs.h", + "wifi/wifi_config.h", ] + + if (use_wf200 || !use_rs911x_sockets) { + sources += [ + "wifi/dhcp_client.cpp", + "wifi/dhcp_client.h", + "wifi/ethernetif.cpp", + "wifi/ethernetif.h", + "wifi/lwip_netif.cpp", + ] + } + + public_configs = [ ":efr32-platform-wifi-config" ] } } diff --git a/src/test_driver/efr32/BUILD.gn b/src/test_driver/efr32/BUILD.gn index 5b9573ba9fa607..56f89dd3128390 100644 --- a/src/test_driver/efr32/BUILD.gn +++ b/src/test_driver/efr32/BUILD.gn @@ -56,7 +56,6 @@ efr32_sdk("sdk") { ] defines = [ - "BOARD_ID=${silabs_board}", "SILABS_LOG_ENABLED=1", "PW_RPC_ENABLED", diff --git a/third_party/ot-br-posix/repo b/third_party/ot-br-posix/repo index a032a864d21983..1813352247aa60 160000 --- a/third_party/ot-br-posix/repo +++ b/third_party/ot-br-posix/repo @@ -1 +1 @@ -Subproject commit a032a864d219835691ab2dbf74b3624f57ecbddf +Subproject commit 1813352247aa60fb8993773918f1e5b4af6f3b79 diff --git a/third_party/silabs/SiWx917_sdk.gni b/third_party/silabs/SiWx917_sdk.gni index 7b5b3fbecbfc9f..7bcc4638879ca6 100644 --- a/third_party/silabs/SiWx917_sdk.gni +++ b/third_party/silabs/SiWx917_sdk.gni @@ -34,7 +34,6 @@ declare_args() { enable_openthread_cli = true kvs_max_entries = 75 - use_external_flash = true # Use Silabs factory data provider example. # Users can implement their own. @@ -44,20 +43,6 @@ declare_args() { use_system_view = false } -# Explorer Kit and MGM240L do not have external flash -if (silabs_board == "BRD2703A" || silabs_board == "BRD4319A") { - use_external_flash = false -} - -# Enable LEDs by default -use_wstk_leds = true - -# Board does not support LEDs and Buttons at the same time -if (silabs_board == "BRD4317A" || silabs_board == "BRD4316A" || - silabs_board == "BRD4319A") { - use_wstk_leds = false -} - assert(efr32_sdk_root != "", "efr32_sdk_root must be specified") # Defines an efr32 SDK build target. diff --git a/third_party/silabs/efr32_sdk.gni b/third_party/silabs/efr32_sdk.gni index 1807e5b97ee754..99cbca17994d9f 100644 --- a/third_party/silabs/efr32_sdk.gni +++ b/third_party/silabs/efr32_sdk.gni @@ -30,7 +30,6 @@ declare_args() { enable_openthread_cli = true kvs_max_entries = 75 - use_external_flash = true # Use Silabs factory data provider example. # Users can implement their own. @@ -39,31 +38,10 @@ declare_args() { # Enable Segger System View use_system_view = false - # Enable Buttons by default - use_wstk_buttons = true - - # Enable LEDs by default - use_wstk_leds = true - sleep_time_ms = 3300000 # 55 mins sleep -} - -# Explorer Kit and MGM240L do not have external flash -if (silabs_board == "BRD2703A" || silabs_board == "BRD4318A" || - silabs_board == "BRD4319A") { - use_external_flash = false -} - -# Board does not support LEDs and Buttons at the same time -if (silabs_board == "BRD4317A" || silabs_board == "BRD4316A" || - silabs_board == "BRD4319A" || silabs_board == "BRD4318A") { - use_wstk_leds = false -} -# Board does not support buttons -if (silabs_board == "BRD2704A") { - use_wstk_buttons = false - use_external_flash = false + # Enable Sleepy end device + enable_sleepy_device = false } assert(efr32_sdk_root != "", "efr32_sdk_root must be specified") @@ -79,12 +57,6 @@ template("efr32_sdk") { } assert(efr32_sdk_root != "", "efr32_sdk_root must be specified") - use_wf200 = false - if (defined(invoker.use_wf200)) { - if (invoker.use_wf200) { - use_wf200 = true - } - } sdk_target_name = target_name @@ -110,7 +82,6 @@ template("efr32_sdk") { "${efr32_sdk_root}/platform/CMSIS/Core/Include", "${efr32_sdk_root}/platform/CMSIS/RTOS2/Include", "${efr32_sdk_root}/platform/common/inc", - "${efr32_sdk_root}/platform/driver/button/inc", "${efr32_sdk_root}/platform/emdrv/common/inc", "${efr32_sdk_root}/platform/emdrv/gpiointerrupt/inc", "${efr32_sdk_root}/platform/emdrv/dmadrv/config", @@ -217,6 +188,57 @@ template("efr32_sdk") { #"__STACK_SIZE=0", ] + if (defined(invoker.chip_enable_wifi) && invoker.chip_enable_wifi) { + if (use_rs911x) { + defines += [ + "SL_HEAP_SIZE=32768", + "SL_WIFI=1", + "SL_WFX_USE_SPI", + "EFX32_RS911X=1", + "RS911X_WIFI", + "RSI_WLAN_ENABLE", + "RSI_SPI_INTERFACE", + "RSI_WITH_OS", + ] + } else if (use_wf200) { + defines += [ + "SL_HEAP_SIZE=24576", + "WF200_WIFI=1", + "SL_WIFI=1", + "SL_WFX_USE_SPI", + "SL_WFX_DEBUG_MASK=0x0003", + ] + } + + if (use_wf200 || !use_rs911x_sockets) { + import("${chip_root}/src/platform/silabs/EFR32/wifi_args.gni") + + defines += [ "LWIP_NETIF_API=1" ] + if (lwip_ipv4) { + defines += [ + "LWIP_IPV4=1", + + # adds following options to provide + # them to .cpp source files + # flags ported from lwipopts file + # TODO: move lwipopts to one location + "LWIP_ARP=1", + "LWIP_ICMP=1", + "LWIP_IGMP=1", + "LWIP_DHCP=1", + "LWIP_DNS=0", + ] + } else { + defines += [ "LWIP_IPV4=0" ] + } + if (lwip_ipv4) { + defines += [ "LWIP_IPV6=1" ] + } else { + defines += [ "LWIP_IPV6=0" ] + } + } + } + if (use_system_view) { _include_dirs += [ "${efr32_sdk_root}/util/third_party/segger/systemview/SEGGER", @@ -249,15 +271,13 @@ template("efr32_sdk") { _include_dirs += [ "${efr32_sdk_root}/platform/driver/button/inc" ] } - if (defined(invoker.enable_sleepy_device)) { - if (invoker.enable_sleepy_device) { - defines += [ - "CHIP_DEVICE_CONFIG_ENABLE_SED=1", - "SL_CATALOG_POWER_MANAGER_PRESENT", - "SL_CATALOG_SLEEPTIMER_PRESENT", - "SL_SLEEP_TIME_MS=${sleep_time_ms}", - ] - } + if (enable_sleepy_device) { + defines += [ + "CHIP_DEVICE_CONFIG_ENABLE_SED=1", + "SL_CATALOG_POWER_MANAGER_PRESENT", + "SL_CATALOG_SLEEPTIMER_PRESENT", + "SL_SLEEP_TIME_MS=${sleep_time_ms}", + ] } if (chip_build_libshell) { # matter shell @@ -276,12 +296,10 @@ template("efr32_sdk") { if ((defined(invoker.chip_enable_pw_rpc) && invoker.chip_enable_pw_rpc) || chip_build_libshell || enable_openthread_cli || (defined(invoker.chip_enable_wifi) && invoker.chip_enable_wifi) || - (defined(invoker.show_qr_code) && invoker.show_qr_code) || - (defined(invoker.disable_lcd) && !invoker.disable_lcd) || - (defined(invoker.use_external_flash) && use_external_flash)) { + show_qr_code || disable_lcd || use_external_flash) { defines += [ "CONFIG_ENABLE_UART" ] - if (defined(invoker.use_external_flash) && use_external_flash) { + if (use_external_flash) { defines += [ "CONFIG_USE_EXTERNAL_FLASH" ] _include_dirs += [ "${efr32_sdk_root}/hardware/driver/mx25_flash_shutdown/inc/sl_mx25_flash_shutdown_usart" ] @@ -425,13 +443,6 @@ template("efr32_sdk") { cflags += [ "-mcmse" ] } - if (defined(invoker.use_rs911x)) { - if (invoker.use_rs911x == true) { - #add compilation flags for rs991x build. This will be addressed directly in wiseconnect sdk in the next version release of that sdk - cflags += invoker.rs911x_cflags - } - } - if (defined(invoker.defines)) { defines += invoker.defines } @@ -667,10 +678,8 @@ template("efr32_sdk") { ] } - if (defined(invoker.enable_sleepy_device)) { - if (invoker.enable_sleepy_device) { - sources += [ "${efr32_sdk_root}/util/third_party/freertos/kernel/portable/SiliconLabs/tick_power_manager.c" ] - } + if (enable_sleepy_device) { + sources += [ "${efr32_sdk_root}/util/third_party/freertos/kernel/portable/SiliconLabs/tick_power_manager.c" ] } if (defined(enable_fem)) { @@ -683,9 +692,7 @@ template("efr32_sdk") { if ((defined(invoker.chip_enable_pw_rpc) && invoker.chip_enable_pw_rpc) || chip_build_libshell || enable_openthread_cli || (defined(invoker.chip_enable_wifi) && invoker.chip_enable_wifi) || - (defined(invoker.show_qr_code) && invoker.show_qr_code) || - (defined(invoker.disable_lcd) && !invoker.disable_lcd) || - (defined(invoker.use_external_flash) && use_external_flash)) { + show_qr_code || !disable_lcd || use_external_flash) { sources += [ "${efr32_sdk_root}/hardware/driver/memlcd/src/memlcd_usart/sl_memlcd_spi.c", "${efr32_sdk_root}/platform/emdrv/uartdrv/src/uartdrv.c", @@ -695,13 +702,12 @@ template("efr32_sdk") { "${sdk_support_root}/matter/efr32/${silabs_family}/${silabs_board}/autogen/sl_uartdrv_init.c", ] - if (defined(invoker.use_external_flash) && use_external_flash) { + if (use_external_flash) { sources += [ "${efr32_sdk_root}/hardware/driver/mx25_flash_shutdown/src/sl_mx25_flash_shutdown_usart/sl_mx25_flash_shutdown.c" ] } } - if ((defined(invoker.show_qr_code) && invoker.show_qr_code) || - (defined(invoker.disable_lcd) && !invoker.disable_lcd)) { + if (show_qr_code || !disable_lcd) { sources += [ "${efr32_sdk_root}/hardware/driver/memlcd/src/sl_memlcd.c", "${efr32_sdk_root}/hardware/driver/memlcd/src/sl_memlcd_display.c", diff --git a/third_party/silabs/silabs_board.gni b/third_party/silabs/silabs_board.gni index dd944c47f51039..eb6d674894b243 100644 --- a/third_party/silabs/silabs_board.gni +++ b/third_party/silabs/silabs_board.gni @@ -15,6 +15,30 @@ declare_args() { # EFR32 board used silabs_board = "" + + # LCD is enabled by default + # Boards BRD4166A, BRD2601B, BRD2703A and BRD4319A do not have a LCD so they disable it explicitly + disable_lcd = false + + # Enable Buttons by default + use_wstk_buttons = true + + # Enable LEDs on development board by default + # Boards BRD4317A, BRD4316A and BRD4319A disable this explicitly + use_wstk_leds = true + + # Boards BRD2703A and BRD4319A disable this explicitly + use_external_flash = true + + # WIFI rcp boards options for wifi apps. + use_wf200 = false + use_rs911x = false + use_rs911x_sockets = false +} + +declare_args() { + # Enables LCD Qr Code on supported devices + show_qr_code = !disable_lcd } if (silabs_board == "") { @@ -56,12 +80,18 @@ if (silabs_board == "BRD4304A") { } else if (silabs_board == "BRD4166A") { silabs_family = "efr32mg12" silabs_mcu = "EFR32MG12P332F1024GL125" + + # ThunderBoards don't have a LCD + show_qr_code = false + disable_lcd = true } else if (silabs_board == "BRD4170A") { silabs_family = "efr32mg12" silabs_mcu = "EFR32MG12P433F1024GM68" } else if (silabs_board == "BRD4325A") { silabs_family = "SiWx917" silabs_mcu = "EFR32MG12P432F1024GL125" + disable_lcd = true + show_qr_code = false } else if (silabs_board == "BRD4180A") { assert( false, @@ -81,26 +111,63 @@ if (silabs_board == "BRD4304A") { } else if (silabs_board == "BRD2601B") { silabs_family = "efr32mg24" silabs_mcu = "EFR32MG24B310F1536IM48" + + # ThunderBoards don't have a LCD, + show_qr_code = false + disable_lcd = true } else if (silabs_board == "BRD2703A") { silabs_family = "efr32mg24" silabs_mcu = "EFR32MG24B020F1536IM48" + + # Explorer Kits do not have an external flash nor a LCD + use_external_flash = false + show_qr_code = false + disable_lcd = true } else if (silabs_board == "BRD4316A") { silabs_family = "mgm24" silabs_mcu = "MGM240PB22VNA" + + # Board does not support LEDs and Buttons at the same time + use_wstk_leds = false } else if (silabs_board == "BRD4317A") { silabs_family = "mgm24" silabs_mcu = "MGM240PB32VNA" + + # Board does not support LEDs and Buttons at the same time + use_wstk_leds = false } else if (silabs_board == "BRD4319A") { silabs_family = "mgm24" silabs_mcu = "MGM240L022RNF" + + # Board does not support LEDs and Buttons at the same time + use_wstk_leds = false + + # MGM240L do not have an external flash or LCD + use_external_flash = false + show_qr_code = false + disable_lcd = true } else if (silabs_board == "BRD2704A") { silabs_family = "mgm24" silabs_mcu = "MGM240PB32VNA" + + # Explorer Kits do not have an external flash, buttons nor a LCD + use_wstk_buttons = false + use_external_flash = false + show_qr_code = false + disable_lcd = true } else if (silabs_board == "BRD4318A") { silabs_family = "mgm24" silabs_mcu = "MGM240SD22VNA" + + use_wstk_leds = false + use_external_flash = false + show_qr_code = false + disable_lcd = true } else { print( "Please provide a valid value for SILABS_BOARD env variable (currently supported BRD4304A, BRD4161A, BRD4163A, BRD4164A BRD4166A, BRD4170A, BRD4186C, BRD4187C, BRD2601B, BRD2703A, BRD4317A, BRD2704A)") assert(false, "The board ${silabs_board} is unsupported") } + +# qr code cannot be true if lcd is disabled +assert(!(disable_lcd && show_qr_code))