Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Silabs] Refactor SiWx917 Wi-Fi Application implementation #284

Closed
wants to merge 11 commits into from
2 changes: 1 addition & 1 deletion build_overrides/efr32_sdk.gni
Original file line number Diff line number Diff line change
Expand Up @@ -14,5 +14,5 @@

declare_args() {
# Root directory for efr32 SDK build files.
efr32_sdk_build_root = "//third_party/silabs"
silabs_sdk_build_root = "//third_party/silabs"
}
4 changes: 2 additions & 2 deletions examples/air-quality-sensor-app/silabs/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ import("//build_overrides/efr32_sdk.gni")
import("//build_overrides/pigweed.gni")

import("${build_root}/config/defaults.gni")
import("${efr32_sdk_build_root}/silabs_executable.gni")
import("${silabs_sdk_build_root}/silabs_executable.gni")

import("${chip_root}/examples/common/pigweed/pigweed_rpcs.gni")
import("${chip_root}/src/platform/device.gni")
Expand All @@ -38,7 +38,7 @@ if (wifi_soc) {
import("${chip_root}/third_party/silabs/SiWx917_sdk.gni")
examples_plat_dir = "${chip_root}/examples/platform/silabs/SiWx917"
} else {
import("${efr32_sdk_build_root}/efr32_sdk.gni")
import("${silabs_sdk_build_root}/efr32_sdk.gni")
examples_plat_dir = "${chip_root}/examples/platform/silabs/efr32"
}

Expand Down
2 changes: 1 addition & 1 deletion examples/build_overrides/efr32_sdk.gni
Original file line number Diff line number Diff line change
Expand Up @@ -14,5 +14,5 @@

declare_args() {
# Root directory for erf32 SDK.
efr32_sdk_build_root = "//third_party/connectedhomeip/third_party/silabs"
silabs_sdk_build_root = "//third_party/connectedhomeip/third_party/silabs"
}
4 changes: 2 additions & 2 deletions examples/chef/silabs/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@ import("//build_overrides/efr32_sdk.gni")
import("//build_overrides/pigweed.gni")

import("${build_root}/config/defaults.gni")
import("${efr32_sdk_build_root}/efr32_sdk.gni")
import("${efr32_sdk_build_root}/silabs_executable.gni")
import("${silabs_sdk_build_root}/efr32_sdk.gni")
import("${silabs_sdk_build_root}/silabs_executable.gni")

import("${chip_root}/examples/common/pigweed/pigweed_rpcs.gni")
import("${chip_root}/src/platform/device.gni")
Expand Down
4 changes: 2 additions & 2 deletions examples/dishwasher-app/silabs/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ import("//build_overrides/efr32_sdk.gni")
import("//build_overrides/pigweed.gni")

import("${build_root}/config/defaults.gni")
import("${efr32_sdk_build_root}/silabs_executable.gni")
import("${silabs_sdk_build_root}/silabs_executable.gni")

import("${chip_root}/examples/common/pigweed/pigweed_rpcs.gni")
import("${chip_root}/src/platform/device.gni")
Expand All @@ -39,7 +39,7 @@ if (wifi_soc) {
import("${chip_root}/third_party/silabs/SiWx917_sdk.gni")
examples_plat_dir = "${chip_root}/examples/platform/silabs/SiWx917"
} else {
import("${efr32_sdk_build_root}/efr32_sdk.gni")
import("${silabs_sdk_build_root}/efr32_sdk.gni")
examples_plat_dir = "${chip_root}/examples/platform/silabs/efr32"
}

Expand Down
4 changes: 2 additions & 2 deletions examples/energy-management-app/silabs/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ import("//build_overrides/efr32_sdk.gni")
import("//build_overrides/pigweed.gni")

import("${build_root}/config/defaults.gni")
import("${efr32_sdk_build_root}/silabs_executable.gni")
import("${silabs_sdk_build_root}/silabs_executable.gni")

import("${chip_root}/examples/common/pigweed/pigweed_rpcs.gni")
import("${chip_root}/src/platform/device.gni")
Expand All @@ -38,7 +38,7 @@ if (wifi_soc) {
import("${chip_root}/third_party/silabs/SiWx917_sdk.gni")
examples_plat_dir = "${chip_root}/examples/platform/silabs/SiWx917"
} else {
import("${efr32_sdk_build_root}/efr32_sdk.gni")
import("${silabs_sdk_build_root}/efr32_sdk.gni")
examples_plat_dir = "${chip_root}/examples/platform/silabs/efr32"
}

Expand Down
4 changes: 2 additions & 2 deletions examples/light-switch-app/silabs/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ import("//build_overrides/efr32_sdk.gni")
import("//build_overrides/pigweed.gni")

import("${build_root}/config/defaults.gni")
import("${efr32_sdk_build_root}/silabs_executable.gni")
import("${silabs_sdk_build_root}/silabs_executable.gni")

import("${chip_root}/examples/common/pigweed/pigweed_rpcs.gni")
import("${chip_root}/src/platform/device.gni")
Expand All @@ -38,7 +38,7 @@ if (wifi_soc) {
import("${chip_root}/third_party/silabs/SiWx917_sdk.gni")
examples_plat_dir = "${chip_root}/examples/platform/silabs/SiWx917"
} else {
import("${efr32_sdk_build_root}/efr32_sdk.gni")
import("${silabs_sdk_build_root}/efr32_sdk.gni")
examples_plat_dir = "${chip_root}/examples/platform/silabs/efr32"
}

Expand Down
4 changes: 2 additions & 2 deletions examples/lighting-app/silabs/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ import("//build_overrides/efr32_sdk.gni")
import("//build_overrides/pigweed.gni")

import("${build_root}/config/defaults.gni")
import("${efr32_sdk_build_root}/silabs_executable.gni")
import("${silabs_sdk_build_root}/silabs_executable.gni")

import("${chip_root}/examples/common/pigweed/pigweed_rpcs.gni")
import("${chip_root}/src/platform/device.gni")
Expand All @@ -38,7 +38,7 @@ if (wifi_soc) {
import("${chip_root}/third_party/silabs/SiWx917_sdk.gni")
examples_plat_dir = "${chip_root}/examples/platform/silabs/SiWx917"
} else {
import("${efr32_sdk_build_root}/efr32_sdk.gni")
import("${silabs_sdk_build_root}/efr32_sdk.gni")
examples_plat_dir = "${chip_root}/examples/platform/silabs/efr32"
}

Expand Down
4 changes: 2 additions & 2 deletions examples/lit-icd-app/silabs/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ import("//build_overrides/efr32_sdk.gni")
import("//build_overrides/pigweed.gni")

import("${build_root}/config/defaults.gni")
import("${efr32_sdk_build_root}/silabs_executable.gni")
import("${silabs_sdk_build_root}/silabs_executable.gni")

import("${chip_root}/examples/common/pigweed/pigweed_rpcs.gni")
import("${chip_root}/src/platform/device.gni")
Expand All @@ -39,7 +39,7 @@ if (wifi_soc) {
import("${chip_root}/third_party/silabs/SiWx917_sdk.gni")
examples_plat_dir = "${chip_root}/examples/platform/silabs/SiWx917"
} else {
import("${efr32_sdk_build_root}/efr32_sdk.gni")
import("${silabs_sdk_build_root}/efr32_sdk.gni")
examples_plat_dir = "${chip_root}/examples/platform/silabs/efr32"
}

Expand Down
4 changes: 2 additions & 2 deletions examples/lock-app/silabs/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ import("//build_overrides/efr32_sdk.gni")
import("//build_overrides/pigweed.gni")

import("${build_root}/config/defaults.gni")
import("${efr32_sdk_build_root}/silabs_executable.gni")
import("${silabs_sdk_build_root}/silabs_executable.gni")

import("${chip_root}/examples/common/pigweed/pigweed_rpcs.gni")
import("${chip_root}/src/platform/device.gni")
Expand All @@ -38,7 +38,7 @@ if (wifi_soc) {
import("${chip_root}/third_party/silabs/SiWx917_sdk.gni")
examples_plat_dir = "${chip_root}/examples/platform/silabs/SiWx917"
} else {
import("${efr32_sdk_build_root}/efr32_sdk.gni")
import("${silabs_sdk_build_root}/efr32_sdk.gni")
examples_plat_dir = "${chip_root}/examples/platform/silabs/efr32"
}

Expand Down
2 changes: 0 additions & 2 deletions examples/platform/silabs/FreeRTOSConfig.h
Original file line number Diff line number Diff line change
Expand Up @@ -103,8 +103,6 @@
extern "C" {
#endif

#include <CHIPProjectConfig.h>

#include <stdint.h>
#include <stdio.h>

Expand Down
39 changes: 18 additions & 21 deletions examples/platform/silabs/MatterConfig.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -40,9 +40,9 @@
#include "MemMonitoring.h"
#endif

#ifdef SLI_SI91X_MCU_INTERFACE
#if defined(SLI_SI91X_MCU_INTERFACE) && SLI_SI91X_MCU_INTERFACE == 1
#include "wfx_rsi.h"
#endif /* SLI_SI91X_MCU_INTERFACE */
#endif // SLI_SI91X_MCU_INTERFACE

#include <crypto/CHIPCryptoPAL.h>
// If building with the EFR32-provided crypto backend, we can use the
Expand Down Expand Up @@ -121,7 +121,7 @@ void UnlockOpenThreadTask(void)

CHIP_ERROR SilabsMatterConfig::InitOpenThread(void)
{
SILABS_LOG("Initializing OpenThread stack");
ChipLogProgress(DeviceLayer, "Initializing OpenThread stack");
ReturnErrorOnFailure(ThreadStackMgr().InitThreadStack());

#if CHIP_DEVICE_CONFIG_THREAD_FTD
Expand All @@ -138,7 +138,7 @@ CHIP_ERROR SilabsMatterConfig::InitOpenThread(void)
#endif // CHIP_CONFIG_ENABLE_ICD_SERVER
#endif // CHIP_DEVICE_CONFIG_THREAD_FTD

SILABS_LOG("Starting OpenThread task");
ChipLogProgress(DeviceLayer, "Starting OpenThread task");
return ThreadStackMgrImpl().StartThreadTask();
}
#endif // CHIP_ENABLE_OPENTHREAD
Expand Down Expand Up @@ -171,7 +171,7 @@ void ApplicationStart(void * unused)
SetDeviceAttestationCredentialsProvider(&Provision::Manager::GetInstance().GetStorage());
chip::DeviceLayer::PlatformMgr().UnlockChipStack();

SILABS_LOG("Starting App Task");
ChipLogProgress(DeviceLayer, "Starting App Task");
err = AppTask::GetAppTask().StartAppTask();
if (err != CHIP_NO_ERROR)
appError(err);
Expand All @@ -185,13 +185,13 @@ void SilabsMatterConfig::AppInit()
{
GetPlatform().Init();
sMainTaskHandle = osThreadNew(ApplicationStart, nullptr, &kMainTaskAttr);
SILABS_LOG("Starting scheduler");
ChipLogProgress(DeviceLayer, "Starting scheduler");
mkardous-silabs marked this conversation as resolved.
Show resolved Hide resolved
VerifyOrDie(sMainTaskHandle); // We can't proceed if the Main Task creation failed.
GetPlatform().StartScheduler();

// Should never get here.
chip::Platform::MemoryShutdown();
SILABS_LOG("Start Scheduler Failed");
ChipLogProgress(DeviceLayer, "Start Scheduler Failed");
appError(CHIP_ERROR_INTERNAL);
}

Expand All @@ -204,9 +204,9 @@ CHIP_ERROR SilabsMatterConfig::InitMatter(const char * appName)
// initialization.
mbedtls_platform_set_calloc_free(CHIPPlatformMemoryCalloc, CHIPPlatformMemoryFree);
#endif
SILABS_LOG("==================================================");
SILABS_LOG("%s starting", appName);
SILABS_LOG("==================================================");
ChipLogProgress(DeviceLayer, "==================================================");
ChipLogProgress(DeviceLayer, "%s starting", appName);
ChipLogProgress(DeviceLayer, "==================================================");

#if PW_RPC_ENABLED
chip::rpc::Init();
Expand All @@ -219,7 +219,7 @@ CHIP_ERROR SilabsMatterConfig::InitMatter(const char * appName)
//==============================================
// Init Matter Stack
//==============================================
SILABS_LOG("Init CHIP Stack");
ChipLogProgress(DeviceLayer, "Init CHIP Stack");

#ifdef SL_WIFI
// Init Chip memory management before the stack
Expand Down Expand Up @@ -309,16 +309,13 @@ CHIP_ERROR SilabsMatterConfig::InitWiFi(void)
// Start wfx bus communication task.
wfx_bus_start();
#ifdef SL_WFX_USE_SECURE_LINK
wfx_securelink_task_start(); // start securelink key renegotiation task
#endif // SL_WFX_USE_SECURE_LINK
#endif /* WF200_WIFI */

#ifdef SLI_SI91X_MCU_INTERFACE
sl_status_t status;
if ((status = wfx_wifi_rsi_init()) != SL_STATUS_OK)
{
ReturnErrorOnFailure((CHIP_ERROR) status);
}
// start securelink key renegotiation task
wfx_securelink_task_start();
#endif // SL_WFX_USE_SECURE_LINK
#endif // WF200_WIFI

#if defined(SLI_SI91X_MCU_INTERFACE) && SLI_SI91X_MCU_INTERFACE == 1
VerifyOrReturnError(sl_matter_wifi_platform_init() == SL_STATUS_OK, CHIP_ERROR_INTERNAL);
#endif // SLI_SI91X_MCU_INTERFACE

return CHIP_NO_ERROR;
Expand Down
1 change: 1 addition & 0 deletions examples/platform/silabs/MatterConfig.h
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#pragma once

#include <lib/support/CHIPMem.h>
#include <lib/support/CHIPPlatformMemory.h>
Expand Down
17 changes: 8 additions & 9 deletions examples/platform/silabs/SiWx917/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ 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")
import("${silabs_sdk_build_root}/SiWx917_sdk.gni")

declare_args() {
enable_heap_monitoring = false
Expand Down Expand Up @@ -167,18 +167,17 @@ config("silabs-wifi-config") {
source_set("siwx917-common") {
deps = [ "${silabs_common_plat_dir}/provision:storage" ]
defines = []
public_deps = []
public_deps = [ "${lwip_root}:lwip" ]
public_configs = [
":siwx917-common-config",
"${efr32_sdk_build_root}:silabs_config",
"${silabs_sdk_build_root}:silabs_config",
":chip_examples_project_config",
]

include_dirs = [
".",
"SiWx917/",
"${silabs_plat_dir}/wifi",
"${silabs_plat_si91x_wifi_dir}",
"${silabs_common_plat_dir}",
]

#TO-DO Cleanup to be done for all the wifi files into common folder
Expand All @@ -191,10 +190,10 @@ source_set("siwx917-common") {
"${silabs_common_plat_dir}/syscalls_stubs.cpp",
"${silabs_common_plat_dir}/wifi/wfx_notify.cpp",
"${silabs_common_plat_dir}/wifi/wfx_rsi_host.cpp",
"${silabs_plat_dir}/wifi/dhcp_client.cpp",
"${silabs_plat_si91x_wifi_dir}/ethernetif.cpp",
"${silabs_plat_si91x_wifi_dir}/lwip_netif.cpp",
"SiWx917/sl_wifi_if.cpp",
"SiWxWifiInterface.cpp",

# Wi-Fi Config - Using the file sdk support until the wiseconnect file is fixed
"${sdk_support_root}/components/service/network_manager/src/sl_net_for_lwip.c",
]

if (chip_enable_pw_rpc || chip_build_libshell || sl_uart_log_output) {
Expand Down
Loading
Loading