Skip to content

Commit

Permalink
[Silabs] Example cleanup (#28160)
Browse files Browse the repository at this point in the history
* Move linker scripts to common place

* Move Board_config

* Move FreeRTOS Config

* Move FreeRTOS config

* Move Matter_config

* Move MatterConfig

* Move PW and uart header to common

* Move Temperature Sensor

* Delete init_efrplatform and init_ccpplatform

* Move Base Application

* Add missing lib

* fix wifi
  • Loading branch information
jepenven-silabs authored Jul 28, 2023
1 parent f4f9bfb commit c1d26c0
Show file tree
Hide file tree
Showing 50 changed files with 130 additions and 1,813 deletions.
2 changes: 1 addition & 1 deletion config/efr32/lib/pw_rpc/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ static_library("pw_rpc") {
public_deps = [
"$dir_pw_rpc:server",
"$dir_pw_rpc/nanopb:echo_service",
"${chip_root}/examples/platform/silabs/efr32/pw_sys_io:pw_sys_io_efr32",
"${chip_root}/examples/platform/silabs/pw_sys_io:pw_sys_io_silabs",
"${dir_pigweed}/pw_hdlc:pw_rpc",
dir_pw_assert,
dir_pw_checksum,
Expand Down
2 changes: 1 addition & 1 deletion config/efr32/lib/pw_rpc/pw_rpc.gni
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ pw_log_BACKEND = "$dir_pw_log_basic"
pw_assert_BACKEND = "$dir_pw_assert_log:check_backend"
pw_rpc_CONFIG = "$dir_pw_rpc:disable_global_mutex"
pw_sys_io_BACKEND =
"${chip_root}/examples/platform/silabs/efr32/pw_sys_io:pw_sys_io_efr32"
"${chip_root}/examples/platform/silabs/pw_sys_io:pw_sys_io_silabs"

pw_build_LINK_DEPS = [
"$dir_pw_assert:impl",
Expand Down
6 changes: 3 additions & 3 deletions examples/chef/silabs/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ chip_data_model("chef-common") {
efr32_sdk("sdk") {
sources = [
"${efr32_project_dir}/include/CHIPProjectConfig.h",
"${examples_plat_dir}/FreeRTOSConfig.h",
"${examples_common_plat_dir}/FreeRTOSConfig.h",
]

include_dirs = [
Expand Down Expand Up @@ -133,7 +133,7 @@ silabs_executable("chef_app") {
"${chip_root}/examples/common/pigweed:lighting_service.nanopb_rpc",
"${chip_root}/examples/common/pigweed:ot_cli_service.nanopb_rpc",
"${chip_root}/examples/common/pigweed:thread_service.nanopb_rpc",
"${examples_plat_dir}/pw_sys_io:pw_sys_io_efr32",
"${examples_common_plat_dir}/pw_sys_io:pw_sys_io_silabs",
]

deps += pw_build_LINK_DEPS
Expand All @@ -144,7 +144,7 @@ silabs_executable("chef_app") {
]
}

ldscript = "${examples_plat_dir}/ldscripts/${silabs_family}.ld"
ldscript = "${examples_common_plat_dir}/ldscripts/${silabs_family}.ld"

inputs = [ ldscript ]

Expand Down
8 changes: 4 additions & 4 deletions examples/light-switch-app/silabs/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ declare_args() {
if (wifi_soc) {
siwx917_sdk("sdk") {
sources = [
"${examples_plat_dir}/FreeRTOSConfig.h",
"${examples_common_plat_dir}/FreeRTOSConfig.h",
"${silabs_project_dir}/include/CHIPProjectConfig.h",
]

Expand All @@ -75,7 +75,7 @@ if (wifi_soc) {
} else {
efr32_sdk("sdk") {
sources = [
"${examples_plat_dir}/FreeRTOSConfig.h",
"${examples_common_plat_dir}/FreeRTOSConfig.h",
"${silabs_project_dir}/include/CHIPProjectConfig.h",
]

Expand Down Expand Up @@ -170,7 +170,7 @@ silabs_executable("light_switch_app") {
if (wifi_soc) {
deps += [ "${examples_plat_dir}/pw_sys_io:pw_sys_io_siwx917" ]
} else {
deps += [ "${examples_plat_dir}/pw_sys_io:pw_sys_io_efr32" ]
deps += [ "${examples_common_plat_dir}/pw_sys_io:pw_sys_io_silabs" ]
}

deps += pw_build_LINK_DEPS
Expand All @@ -181,7 +181,7 @@ silabs_executable("light_switch_app") {
]
}

ldscript = "${examples_plat_dir}/ldscripts/${silabs_family}.ld"
ldscript = "${examples_common_plat_dir}/ldscripts/${silabs_family}.ld"

inputs = [ ldscript ]

Expand Down
8 changes: 4 additions & 4 deletions examples/lighting-app/silabs/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ if (slc_generate) {
if (wifi_soc) {
siwx917_sdk("sdk") {
sources = [
"${examples_plat_dir}/FreeRTOSConfig.h",
"${examples_common_plat_dir}/FreeRTOSConfig.h",
"${silabs_project_dir}/include/CHIPProjectConfig.h",
]

Expand All @@ -91,7 +91,7 @@ if (wifi_soc) {
} else {
efr32_sdk("sdk") {
sources = [
"${examples_plat_dir}/FreeRTOSConfig.h",
"${examples_common_plat_dir}/FreeRTOSConfig.h",
"${silabs_project_dir}/include/CHIPProjectConfig.h",
]

Expand Down Expand Up @@ -191,7 +191,7 @@ silabs_executable("lighting_app") {
if (wifi_soc) {
deps += [ "${examples_plat_dir}/pw_sys_io:pw_sys_io_siwx917" ]
} else {
deps += [ "${examples_plat_dir}/pw_sys_io:pw_sys_io_efr32" ]
deps += [ "${examples_common_plat_dir}/pw_sys_io:pw_sys_io_silabs" ]
}

deps += pw_build_LINK_DEPS
Expand All @@ -202,7 +202,7 @@ silabs_executable("lighting_app") {
]
}

ldscript = "${examples_plat_dir}/ldscripts/${silabs_family}.ld"
ldscript = "${examples_common_plat_dir}/ldscripts/${silabs_family}.ld"

inputs = [ ldscript ]

Expand Down
8 changes: 4 additions & 4 deletions examples/lock-app/silabs/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ declare_args() {
if (wifi_soc) {
siwx917_sdk("sdk") {
sources = [
"${examples_plat_dir}/FreeRTOSConfig.h",
"${examples_common_plat_dir}/FreeRTOSConfig.h",
"${silabs_project_dir}/include/CHIPProjectConfig.h",
]

Expand All @@ -75,7 +75,7 @@ if (wifi_soc) {
} else {
efr32_sdk("sdk") {
sources = [
"${examples_plat_dir}/FreeRTOSConfig.h",
"${examples_common_plat_dir}/FreeRTOSConfig.h",
"${silabs_project_dir}/include/CHIPProjectConfig.h",
]

Expand Down Expand Up @@ -172,7 +172,7 @@ silabs_executable("lock_app") {
if (wifi_soc) {
deps += [ "${examples_plat_dir}/pw_sys_io:pw_sys_io_siwx917" ]
} else {
deps += [ "${examples_plat_dir}/pw_sys_io:pw_sys_io_efr32" ]
deps += [ "${examples_common_plat_dir}/pw_sys_io:pw_sys_io_silabs" ]
}

deps += pw_build_LINK_DEPS
Expand All @@ -183,7 +183,7 @@ silabs_executable("lock_app") {
]
}

ldscript = "${examples_plat_dir}/ldscripts/${silabs_family}.ld"
ldscript = "${examples_common_plat_dir}/ldscripts/${silabs_family}.ld"

inputs = [ ldscript ]

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -242,7 +242,12 @@ CHIP_ERROR BaseApplication::Init()
}

PlatformMgr().AddEventHandler(OnPlatformEvent, 0);
#ifdef SL_WIFI
sIsProvisioned = ConnectivityMgr().IsWiFiStationProvisioned();
#endif /* SL_WIFI */
#if CHIP_ENABLE_OPENTHREAD
sIsProvisioned = ConnectivityMgr().IsThreadProvisioned();
#endif

return err;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@
#include "AppEvent.h"
#include "FreeRTOS.h"
#include "timers.h" // provides FreeRTOS timer support
#include <app/clusters/identify-server/identify-server.h>
#include <app/util/config.h>
#include <ble/BLEEndPoint.h>
#include <lib/core/CHIPError.h>
Expand All @@ -47,10 +48,6 @@
#endif // QR_CODE_ENABLED
#endif // DISPLAY_ENABLED

#ifndef SL_STATUS_LED
#define SL_STATUS_LED 1
#endif

/**********************************************************
* Defines
*********************************************************/
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@

#include "AppConfig.h"
#include "OTAConfig.h"
#include <matter_config.h>
#include <MatterConfig.h>

#include <FreeRTOS.h>

Expand Down Expand Up @@ -165,6 +165,12 @@ CHIP_ERROR SilabsMatterConfig::InitMatter(const char * appName)
SILABS_LOG("Init CHIP Stack");
// Init Chip memory management before the stack
ReturnErrorOnFailure(chip::Platform::MemoryInit());

// WiFi needs to be initialized after Memory Init for some reason
#ifdef SL_WIFI
InitWiFi();
#endif

ReturnErrorOnFailure(PlatformMgr().InitChipStack());

SetDeviceInstanceInfoProvider(&Silabs::SilabsDeviceDataProvider::GetDeviceDataProvider());
Expand Down Expand Up @@ -231,10 +237,6 @@ CHIP_ERROR SilabsMatterConfig::InitMatter(const char * appName)
SILABS_LOG("Starting Platform Manager Event Loop");
ReturnErrorOnFailure(PlatformMgr().StartEventLoopTask());

#ifdef SL_WIFI
InitWiFi();
#endif

#ifdef ENABLE_CHIP_SHELL
chip::startShellTask();
#endif
Expand All @@ -251,15 +253,14 @@ void SilabsMatterConfig::InitWiFi(void)
#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 RS911X_WIFI
/*
* Start up any RSI interface stuff
* (Not required) - Note that wfx_wifi_start will deal with
* starting up a rsi task - which will initialize the SPI interface.
*/
#endif
#elif defined(SIWX_917)
SILABS_LOG("Init RSI 917 Platform");
if (wfx_rsi_platform() != SL_STATUS_OK)
{
SILABS_LOG("RSI init failed");
return CHIP_ERROR_INTERNAL;
}
#endif /* WF200_WIFI */
}
#endif // SL_WIFI

Expand Down
File renamed without changes.
5 changes: 2 additions & 3 deletions examples/platform/silabs/SiWx917/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -247,7 +247,9 @@ source_set("siwx917-common") {
]

sources = [
"${silabs_common_plat_dir}/BaseApplication.cpp",
"${silabs_common_plat_dir}/LEDWidget.cpp",
"${silabs_common_plat_dir}/MatterConfig.cpp",
"${silabs_common_plat_dir}/SoftwareFaultReports.cpp",
"${silabs_common_plat_dir}/heap_4_silabs.c",
"${silabs_common_plat_dir}/silabs_utils.cpp",
Expand All @@ -256,11 +258,8 @@ source_set("siwx917-common") {
"${wifi_sdk_dir}/ethernetif.cpp",
"${wifi_sdk_dir}/lwip_netif.cpp",
"${wifi_sdk_dir}/wfx_notify.cpp",
"BaseApplication.cpp",
"SiWx917/rsi_if.c",
"SiWx917/wfx_rsi_host.c",
"init_ccpPlatform.cpp",
"matter_config.cpp",
]

if (chip_enable_pw_rpc || chip_build_libshell) {
Expand Down
Loading

0 comments on commit c1d26c0

Please sign in to comment.