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] Update Silabs sdks version and related enablement #35083

Merged
merged 8 commits into from
Aug 20, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/examples-efr32.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ jobs:
if: github.actor != 'restyled-io[bot]'

container:
image: ghcr.io/project-chip/chip-build-efr32:73
image: ghcr.io/project-chip/chip-build-efr32:74
volumes:
- "/tmp/bloat_reports:/tmp/bloat_reports"
steps:
Expand Down
6 changes: 3 additions & 3 deletions .gitmodules
Original file line number Diff line number Diff line change
Expand Up @@ -213,17 +213,17 @@
[submodule "third_party/silabs/simplicity_sdk"]
path = third_party/silabs/simplicity_sdk
url = https://github.com/SiliconLabs/simplicity_sdk.git
branch = v2024.6.0
branch = v2024.6.1-0
platforms = silabs
[submodule "third_party/silabs/wiseconnect-wifi-bt-sdk"]
path = third_party/silabs/wiseconnect-wifi-bt-sdk
url = https://github.com/SiliconLabs/wiseconnect-wifi-bt-sdk.git
branch = 2.8.2
branch = 2.10.0
platforms = silabs
[submodule "third_party/silabs/wifi_sdk"]
path = third_party/silabs/wifi_sdk
url = https://github.com/SiliconLabs/wiseconnect.git
branch = v3.3.0
branch = v3.3.1
platforms = silabs
[submodule "editline"]
path = third_party/editline/repo
Expand Down
2 changes: 1 addition & 1 deletion examples/platform/silabs/FreeRTOSConfig.h
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,7 @@ extern uint32_t SystemCoreClock;
#define configEXPECTED_IDLE_TIME_BEFORE_SLEEP 70
#define configPRE_SLEEP_PROCESSING(x)
#define configPOST_SLEEP_PROCESSING(x)
#define configPRE_SUPPRESS_TICKS_AND_SLEEP_PROCESSING(x) sl_si91x_pre_supress_ticks_and_sleep(&x)
#define configPRE_SUPPRESS_TICKS_AND_SLEEP_PROCESSING(x)
#else
#define configUSE_TICKLESS_IDLE 0
#endif // SL_CATALOG_POWER_MANAGER_PRESENT
Expand Down
95 changes: 27 additions & 68 deletions examples/platform/silabs/SiWx917/SiWx917/sl_wifi_if.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,10 @@
* limitations under the License.
*/

/*
* This file implements the interface to the wifi sdk
*/

#include <stdio.h>
#include <stdlib.h>
#include <string.h>
Expand All @@ -23,38 +27,44 @@
#include "sl_matter_wifi_config.h"
#endif // SL_MATTER_GN_BUILD

#include "FreeRTOS.h"
#include "ble_config.h"
#include "dhcp_client.h"
#include "event_groups.h"
#include "sl_board_configuration.h"
#include "sl_status.h"
#include "task.h"
#include "wfx_host_events.h"
#include "wfx_rsi.h"
#include <app/icd/server/ICDServerConfig.h>
#include <inet/IPAddress.h>
#include <lib/support/logging/CHIPLogging.h>

#include "FreeRTOS.h"
#include "event_groups.h"
#include "sl_board_configuration.h"
extern "C" {
#include "sl_net.h"
#include "sl_si91x_driver.h"
#include "sl_si91x_host_interface.h"
#include "sl_si91x_types.h"
#include "sl_wifi.h"
#include "sl_wifi_callback_framework.h"
#include "sl_wifi_constants.h"
#include "sl_wifi_types.h"
#include "sl_wlan_config.h"
#include "wfx_host_events.h"
#if SL_MBEDTLS_USE_TINYCRYPT
#include "sl_si91x_constants.h"
#include "sl_si91x_trng.h"
#endif // SL_MBEDTLS_USE_TINYCRYPT
}
#include "task.h"

#if (EXP_BOARD)
#include "rsi_bt_common_apis.h"
#endif

#include "ble_config.h"

#if CHIP_CONFIG_ENABLE_ICD_SERVER && SLI_SI91X_MCU_INTERFACE
#include "rsi_rom_power_save.h"
#include "sl_si91x_button_pin_config.h"
#if DISPLAY_ENABLED
#include "sl_memlcd.h"
#endif // DISPLAY_ENABLED
extern "C" {
#include "sl_si91x_driver.h"
#include "sl_si91x_m4_ps.h"
}
#include "sl_si91x_power_manager.h"

namespace {
// TODO: should be removed once we are getting the press interrupt for button 0 with sleep
Expand All @@ -67,9 +77,6 @@ bool ps_requirement_added = false;
} // namespace
#endif // CHIP_CONFIG_ENABLE_ICD_SERVER && SLI_SI91X_MCU_INTERFACE

#include "dhcp_client.h"
#include "wfx_host_events.h"
#include "wfx_rsi.h"
#define ADV_SCAN_THRESHOLD -40
#define ADV_RSSI_TOLERANCE_THRESHOLD 5
#define ADV_ACTIVE_SCAN_DURATION 15
Expand All @@ -79,17 +86,9 @@ bool ps_requirement_added = false;

// TODO: Confirm that this value works for size and timing
#define WFX_QUEUE_SIZE 10
extern "C" {
#include "sl_net.h"
#include "sl_si91x_host_interface.h"
#include "sl_wifi.h"
#include "sl_wifi_callback_framework.h"
#include "wfx_host_events.h"
#if SL_MBEDTLS_USE_TINYCRYPT
#include "sl_si91x_constants.h"
#include "sl_si91x_trng.h"
#endif // SL_MBEDTLS_USE_TINYCRYPT
}

// TODO: Figure out why we actually need this, we are already handling failure and retries somewhere else.
#define WIFI_SCAN_TIMEOUT_TICK 10000

WfxRsi_t wfx_rsi;

Expand All @@ -109,20 +108,9 @@ bool is_wifi_disconnection_event = false;
uint32_t retryInterval = WLAN_MIN_RETRY_TIMER_MS;
volatile bool scan_results_complete = false;
volatile bool bg_scan_results_complete = false;

// TODO: Figure out why we actually need this, we are already handling failure and retries somewhere else.
#define WIFI_SCAN_TIMEOUT_TICK 10000

extern osSemaphoreId_t sl_rs_ble_init_sem;

/*
* This file implements the interface to the wifi sdk
*/

static wfx_wifi_scan_ext_t temp_reset;

volatile sl_status_t callback_status = SL_STATUS_OK;

// Scan semaphore
static osSemaphoreId_t sScanSemaphore;
// DHCP Poll timer
Expand Down Expand Up @@ -319,28 +307,6 @@ void sl_si91x_invoke_btn_press_event()
}
#endif // ENABLE_CHIP_SHELL
}

/******************************************************************
* @fn sl_app_sleep_ready()
* @brief
* Called from the supress ticks from tickless to check if it
* is ok to go to sleep
* @param[in] None
* @return
* None
*********************************************************************/
uint32_t sl_app_sleep_ready()
{
if (wfx_rsi.dev_state & WFX_RSI_ST_SLEEP_READY)
{
#if DISPLAY_ENABLED
// Powering down the LCD
sl_memlcd_power_on(NULL, false);
#endif /* DISPLAY_ENABLED */
return true;
}
return false;
}
#endif // SLI_SI91X_MCU_INTERFACE

/******************************************************************
Expand Down Expand Up @@ -370,14 +336,7 @@ int32_t wfx_rsi_power_save(rsi_power_save_profile_mode_t sl_si91x_ble_state, sl_
ChipLogError(DeviceLayer, "sl_wifi_set_performance_profile failed: 0x%lx", static_cast<uint32_t>(status));
return status;
}
if (sl_si91x_wifi_state == HIGH_PERFORMANCE)
{
wfx_rsi.dev_state &= ~(WFX_RSI_ST_SLEEP_READY);
}
else
{
wfx_rsi.dev_state |= WFX_RSI_ST_SLEEP_READY;
}

return status;
}
#endif /* CHIP_CONFIG_ENABLE_ICD_SERVER */
Expand Down
14 changes: 12 additions & 2 deletions examples/platform/silabs/display/demo-ui.c
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
#include "glib.h"
#include "sl_component_catalog.h"
#include "sl_memlcd.h"
#include <app/icd/server/ICDServerConfig.h>
#if SL_WIFI && !SLI_SI91X_MCU_INTERFACE
#include "spi_multiplex.h"
#endif // SL_WIFI && !SLI_SI91X_MCU_INTERFACE
Expand Down Expand Up @@ -106,9 +107,12 @@ void demoUIInit(GLIB_Context_t * context)
sl_status_t updateDisplay(void)
{
sl_status_t status = SL_STATUS_OK;
#if SLI_SI91X_MCU_INTERFACE && SL_ICD_ENABLED && DISPLAY_ENABLED

#if SLI_SI91X_MCU_INTERFACE && CHIP_CONFIG_ENABLE_ICD_SERVER
// In sleep, memlcd will not be retained so re-initialize MEMLCD interface after sleep wakeup
sl_memlcd_post_wakeup_init();
#endif // SLI_SI91X_MCU_INTERFACE && SL_ICD_ENABLED && DISPLAY_ENABLED
#endif // SLI_SI91X_MCU_INTERFACE && SL_ICD_ENABLED && CHIP_CONFIG_ENABLE_ICD_SERVER

#if SL_LCDCTRL_MUX
status = sl_wfx_host_pre_lcd_spi_transfer();
if (status != SL_STATUS_OK)
Expand All @@ -123,6 +127,12 @@ sl_status_t updateDisplay(void)
return status;
#endif // SL_LCDCTRL_MUX

#if SLI_SI91X_MCU_INTERFACE && CHIP_CONFIG_ENABLE_ICD_SERVER
// MEMLCD is not a UULP component and not available in sleep so powering down before sleep and need to be re-initialized after
// sleep-wakeup
sl_memlcd_power_on(NULL, false);
#endif // SLI_SI91X_MCU_INTERFACE && CHIP_CONFIG_ENABLE_ICD_SERVER

return SL_STATUS_OK;
}

Expand Down
6 changes: 3 additions & 3 deletions examples/platform/silabs/efr32/rs911x/rsi_if.c
Original file line number Diff line number Diff line change
Expand Up @@ -511,9 +511,9 @@ static void wfx_rsi_save_ap_info() // translation
case SME_WEP:
wfx_rsi.sec.security = WFX_SEC_WEP;
break;
case SME_WPA3_TRANSITION:
case SME_WPA3_PERSONAL_TRANSITION:
#if WIFI_ENABLE_SECURITY_WPA3_TRANSITION
case SME_WPA3:
case SME_WPA3_PERSONAL:
wfx_rsi.sec.security = WFX_SEC_WPA3;
#else
wfx_rsi.sec.security = WFX_SEC_WPA2;
Expand Down Expand Up @@ -557,7 +557,7 @@ static void wfx_rsi_do_join(void)
break;
#if WIFI_ENABLE_SECURITY_WPA3_TRANSITION
case WFX_SEC_WPA3:
connect_security_mode = RSI_WPA3_TRANSITION;
connect_security_mode = RSI_WPA3_PERSONAL_TRANSITION;
break;
#endif // WIFI_ENABLE_SECURITY_WPA3_TRANSITION
case WFX_SEC_NONE:
Expand Down
21 changes: 13 additions & 8 deletions examples/platform/silabs/provision/ProvisionStorageDefault.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ size_t RoundNearest(size_t n, size_t multiple)
CHIP_ERROR WriteFile(Storage & store, SilabsConfig::Key offset_key, SilabsConfig::Key size_key, const ByteSpan & value)
{
uint32_t base_addr = 0;
ReturnErrorOnFailure(store.GetBaseAddress(base_addr));
ReturnErrorOnFailure(store.GetCredentialsBaseAddress(base_addr));
if (0 == sCredentialsOffset)
{
ReturnErrorOnFailure(ErasePage(base_addr));
Expand Down Expand Up @@ -120,7 +120,7 @@ CHIP_ERROR WriteFile(Storage & store, SilabsConfig::Key offset_key, SilabsConfig
CHIP_ERROR ReadFileByOffset(Storage & store, const char * description, uint32_t offset, uint32_t size, MutableByteSpan & value)
{
uint32_t base_addr = 0;
ReturnErrorOnFailure(store.GetBaseAddress(base_addr));
ReturnErrorOnFailure(store.GetCredentialsBaseAddress(base_addr));

uint8_t * address = (uint8_t *) (base_addr + offset);
ByteSpan span(address, size);
Expand Down Expand Up @@ -167,12 +167,7 @@ CHIP_ERROR Storage::Initialize(uint32_t flash_addr, uint32_t flash_size)
setNvm3End(base_addr);
#endif
}
return SilabsConfig::WriteConfigValue(SilabsConfig::kConfigKey_Creds_Base_Addr, base_addr);
}

CHIP_ERROR Storage::GetBaseAddress(uint32_t & value)
{
return SilabsConfig::ReadConfigValue(SilabsConfig::kConfigKey_Creds_Base_Addr, value);
return SetCredentialsBaseAddress(base_addr);
}

CHIP_ERROR Storage::Commit()
Expand Down Expand Up @@ -625,6 +620,16 @@ CHIP_ERROR Storage::SignWithDeviceAttestationKey(const ByteSpan & message, Mutab
// Other
//

CHIP_ERROR Storage::SetCredentialsBaseAddress(uint32_t addr)
{
return SilabsConfig::WriteConfigValue(SilabsConfig::kConfigKey_Creds_Base_Addr, addr);
}

CHIP_ERROR Storage::GetCredentialsBaseAddress(uint32_t & addr)
{
return SilabsConfig::ReadConfigValue(SilabsConfig::kConfigKey_Creds_Base_Addr, addr);
}

CHIP_ERROR Storage::SetProvisionVersion(const char * value, size_t size)
{
return SilabsConfig::WriteConfigValueStr(SilabsConfig::kConfigKey_Provision_Version, value, size);
Expand Down
18 changes: 12 additions & 6 deletions examples/platform/silabs/provision/ProvisionStorageFlash.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -296,12 +296,6 @@ CHIP_ERROR Storage::Commit()
return CHIP_NO_ERROR;
}

CHIP_ERROR Storage::GetBaseAddress(uint32_t & value)
{
value = (uint32_t) Flash::sReadOnlyPage;
return CHIP_NO_ERROR;
}

//
// DeviceInstanceInfoProvider
//
Expand Down Expand Up @@ -675,6 +669,18 @@ CHIP_ERROR Storage::SignWithDeviceAttestationKey(const ByteSpan & message, Mutab
// Other
//

CHIP_ERROR Storage::SetCredentialsBaseAddress(uint32_t addr)
{
Flash::sReadOnlyPage = (uint8_t *) addr;
return CHIP_NO_ERROR;
}

CHIP_ERROR Storage::GetCredentialsBaseAddress(uint32_t & addr)
{
addr = (uint32_t) Flash::sReadOnlyPage;
return CHIP_NO_ERROR;
}

CHIP_ERROR Storage::SetProvisionVersion(const char * value, size_t size)
{
return Flash::Set(Parameters::ID::kVersion, value, size);
Expand Down
1 change: 0 additions & 1 deletion examples/platform/silabs/wfx_rsi.h
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,6 @@ typedef enum
WFX_RSI_ST_STA_READY = (WFX_RSI_ST_STA_CONNECTED | WFX_RSI_ST_STA_DHCP_DONE),
WFX_RSI_ST_STARTED = (1 << 9), /* RSI task started */
WFX_RSI_ST_SCANSTARTED = (1 << 10), /* Scan Started */
WFX_RSI_ST_SLEEP_READY = (1 << 11) /* Notify the M4 to go to sleep*/
} WfxStateType_e;

typedef struct WfxEvent_s
Expand Down
5 changes: 3 additions & 2 deletions src/platform/silabs/provision/ProvisionStorage.h
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ enum ID : uint16_t
kFlashAddress = 0x0101,
kFlashSize = 0x0102,
kFlashPageSize = 0x0103,
kBaseAddress = 0x0104,
kCredsAddress = 0x0104,
kCsrFile = 0x0105,
// Options,
kVersion = 0x0111,
Expand Down Expand Up @@ -175,7 +175,6 @@ struct Storage : public GenericStorage,

CHIP_ERROR Initialize(uint32_t flash_addr = 0, uint32_t flash_size = 0);
CHIP_ERROR Commit();
CHIP_ERROR GetBaseAddress(uint32_t & value);

//
// Generic Interface
Expand Down Expand Up @@ -233,6 +232,8 @@ struct Storage : public GenericStorage,
// Other
//

CHIP_ERROR SetCredentialsBaseAddress(uint32_t addr);
CHIP_ERROR GetCredentialsBaseAddress(uint32_t & addr);
CHIP_ERROR GetSetupPayload(chip::MutableCharSpan & value);
CHIP_ERROR SetProvisionRequest(bool value);
CHIP_ERROR GetProvisionRequest(bool & value);
Expand Down
1 change: 0 additions & 1 deletion src/platform/silabs/rs911x/ble_config.h

This file was deleted.

18 changes: 18 additions & 0 deletions src/platform/silabs/rs911x/ble_config.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
/*******************************************************************************
* @file ble_config.h
* @brief
*******************************************************************************
* # License
* <b>Copyright 2020 Silicon Laboratories Inc. www.silabs.com</b>
*******************************************************************************
*
* The licensor of this software is Silicon Laboratories Inc. Your use of this
* software is governed by the terms of Silicon Labs Master Software License
* Agreement (MSLA) available at
* www.silabs.com/about-us/legal/master-software-license-agreement. This
* software is distributed to you in Source Code format and is governed by the
* sections of the MSLA applicable to Source Code.
*
******************************************************************************/

#include <rsi_ble_config.h>
Loading
Loading