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 SDK versions #33229

Merged
merged 8 commits into from
Apr 30, 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:47
image: ghcr.io/project-chip/chip-build-efr32:49
volumes:
- "/tmp/bloat_reports:/tmp/bloat_reports"
steps:
Expand Down
11 changes: 6 additions & 5 deletions .github/workflows/release_artifacts.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ on:

env:
CHIP_NO_LOG_TIMESTAMPS: true

jobs:
esp32:
name: ESP32
Expand All @@ -38,7 +38,7 @@ jobs:
- name: Checkout
uses: actions/checkout@v4
with:
ref: "${{ github.event.inputs.releaseTag }}"
ref: "${{ github.event.inputs.releaseTag }}"
- name: Bootstrap
uses: ./.github/actions/bootstrap

Expand All @@ -64,17 +64,18 @@ jobs:
runs-on: ubuntu-latest

container:
image: ghcr.io/project-chip/chip-build-efr32:47
image: ghcr.io/project-chip/chip-build-efr32:49
steps:
- name: Checkout
uses: actions/checkout@v4
with:
ref: "${{ github.event.inputs.releaseTag }}"
ref: "${{ github.event.inputs.releaseTag }}"
- name: Bootstrap
uses: ./.github/actions/bootstrap

- name: Build example EFR32 Lock App
run: scripts/examples/gn_silabs_example.sh examples/lock-app/efr32/
run:
scripts/examples/gn_silabs_example.sh examples/lock-app/efr32/
out/lock_app_debug $SILABS_BOARD

- name: Upload artifact
Expand Down
5 changes: 2 additions & 3 deletions .gitmodules
Original file line number Diff line number Diff line change
Expand Up @@ -244,7 +244,7 @@
[submodule "third_party/silabs/gecko_sdk"]
path = third_party/silabs/gecko_sdk
url = https://github.com/SiliconLabs/gecko_sdk.git
branch = v4.4.1
branch = v4.4.2
platforms = silabs
[submodule "third_party/silabs/wiseconnect-wifi-bt-sdk"]
path = third_party/silabs/wiseconnect-wifi-bt-sdk
Expand All @@ -254,7 +254,7 @@
[submodule "third_party/silabs/wifi_sdk"]
path = third_party/silabs/wifi_sdk
url = https://github.com/SiliconLabs/wiseconnect.git
branch = v3.1.3
branch = v3.1.3-matter-hotfix.4
platforms = silabs
[submodule "editline"]
path = third_party/editline/repo
Expand Down Expand Up @@ -334,4 +334,3 @@
url = https://github.com/Infineon/optiga-trust-m.git
branch = matter_support
platforms = infineon

17 changes: 15 additions & 2 deletions examples/platform/silabs/FreeRTOSConfig.h
Original file line number Diff line number Diff line change
Expand Up @@ -141,11 +141,21 @@ extern uint32_t SystemCoreClock;
/* Energy saving modes. */
#if defined(SL_CATALOG_POWER_MANAGER_PRESENT)
#define configUSE_TICKLESS_IDLE 1
#elif SL_ICD_ENABLED && SI917_M4_SLEEP_ENABLED
#define configUSE_TICKLESS_IDLE 1
#define configEXPECTED_IDLE_TIME_BEFORE_SLEEP 70
#define configPRE_SUPPRESS_TICKS_AND_SLEEP_PROCESSING(x) vTaskPreSuppressTicksAndSleepProcessing(&x)
#define configPRE_SLEEP_PROCESSING(x) sl_wfx_host_si91x_sleep(&x)
#define configPOST_SLEEP_PROCESSING(x) sl_si91x_post_sleep_update_ticks(&x)
#else
#define configUSE_TICKLESS_IDLE 0
#endif // SL_CATALOG_POWER_MANAGER_PRESENT

#if defined(SLI_SI91X_MCU_INTERFACE)
#define configTICK_RATE_HZ (1000)
#else
#define configTICK_RATE_HZ (1024)
#endif // SLI_SI91X_MCU_INTERFACE
/* Definition used by Keil to replace default system clock source. */
#define configOVERRIDE_DEFAULT_TICK_CONFIGURATION 1

Expand Down Expand Up @@ -201,8 +211,11 @@ See http://www.FreeRTOS.org/RTOS-Cortex-M3-M4.html. */
#define configUSE_PORT_OPTIMISED_TASK_SELECTION (0)
#define configUSE_TICKLESS_IDLE_SIMPLE_DEBUG (1) /* See into vPortSuppressTicksAndSleep source code for explanation */
#define configMAX_PRIORITIES (56)
#define configMINIMAL_STACK_SIZE (320) /* Number of words to use for Idle and Timer stacks */

#if SLI_SI91X_MCU_INTERFACE && SL_ICD_ENABLED
#define configMINIMAL_STACK_SIZE (1024) /* Number of words to use for Idle and Timer stacks */
#else // For EFR32
#define configMINIMAL_STACK_SIZE (320) /* Number of words to use for Idle and Timer stacks */
#endif // SLI_SI91X_MCU_INTERFACE && SL_ICD_ENABLED
#ifdef HEAP_MONITORING
#define configMAX_TASK_NAME_LEN (24)
#else
Expand Down
66 changes: 61 additions & 5 deletions examples/platform/silabs/MatterConfig.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,10 @@

#ifdef SLI_SI91X_MCU_INTERFACE
#include "wfx_rsi.h"
#endif /* SLI_SI91X_MCU_INTERFACE */
#if CHIP_CONFIG_ENABLE_ICD_SERVER && SI917_M4_SLEEP_ENABLED
#include "rsi_m4.h"
#endif // CHIP_CONFIG_ENABLE_ICD_SERVER && SI917_M4_SLEEP_ENABLED
#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 @@ -342,7 +345,6 @@ CHIP_ERROR SilabsMatterConfig::InitWiFi(void)
sl_status_t status;
if ((status = wfx_wifi_rsi_init()) != SL_STATUS_OK)
{
SILABS_LOG("wfx_wifi_rsi_init failed with status: %x", status);
ReturnErrorOnFailure((CHIP_ERROR) status);
}
#endif // SLI_SI91X_MCU_INTERFACE
Expand All @@ -354,9 +356,63 @@ CHIP_ERROR SilabsMatterConfig::InitWiFi(void)
// ================================================================================
// FreeRTOS Callbacks
// ================================================================================
extern "C" void vApplicationIdleHook(void)
#if CHIP_CONFIG_ENABLE_ICD_SERVER && SI917_M4_SLEEP_ENABLED
static bool is_sleep_ready = false;
void vTaskPreSuppressTicksAndSleepProcessing(uint16_t * xExpectedIdleTime)
{
#if SLI_SI91X_MCU_INTERFACE && CHIP_CONFIG_ENABLE_ICD_SERVER
sl_wfx_host_si91x_sleep_wakeup();
// pointer check
if (xExpectedIdleTime == NULL)
{
return;
}

if (!is_sleep_ready)
{
*xExpectedIdleTime = 0;
}
else
{
// a preliminary check of the expected idle time is performed without making M4 inactive
if (*xExpectedIdleTime >= configEXPECTED_IDLE_TIME_BEFORE_SLEEP)
{
// Indicate M4 is Inactive
P2P_STATUS_REG &= ~M4_is_active;
// Waiting for one more clock cycle to make sure M4 H/W Register is updated
P2P_STATUS_REG;

// TODO: This delay is added to sync between M4 and TA. It should be removed once the logic is moved to wifi SDK
for (uint8_t delay = 0; delay < 10; delay++)
{
__ASM("NOP");
}
// Checking if TA has already triggered a packet to M4
// RX_BUFFER_VALID will be cleared by TA if any packet is triggered
if ((P2P_STATUS_REG & TA_wakeup_M4) || (P2P_STATUS_REG & M4_wakeup_TA) || (!(M4SS_P2P_INTR_SET_REG & RX_BUFFER_VALID)))
{
P2P_STATUS_REG |= M4_is_active;
*xExpectedIdleTime = 0;
}
else
{
M4SS_P2P_INTR_CLR_REG = RX_BUFFER_VALID;
M4SS_P2P_INTR_CLR_REG;

TASS_P2P_INTR_MASK_SET = (TX_PKT_TRANSFER_DONE_INTERRUPT | RX_PKT_TRANSFER_DONE_INTERRUPT |
TA_WRITING_ON_COMM_FLASH | NWP_DEINIT_IN_COMM_FLASH
#ifdef SL_SI91X_SIDE_BAND_CRYPTO
| SIDE_BAND_CRYPTO_DONE
#endif
);
}
}
}
}
#endif // CHIP_CONFIG_ENABLE_ICD_SERVER && SI917_M4_SLEEP_ENABLED
extern "C" void vApplicationIdleHook(void)
{
#if CHIP_CONFIG_ENABLE_ICD_SERVER && SI917_M4_SLEEP_ENABLED
invoke_btn_press_event();
// is_sleep_ready is required since wfx_is_sleep_ready() is not FreeRTOS scheduler agnostic
is_sleep_ready = wfx_is_sleep_ready();
#endif // CHIP_CONFIG_ENABLE_ICD_SERVER && SI917_M4_SLEEP_ENABLED
}
86 changes: 54 additions & 32 deletions examples/platform/silabs/SiWx917/SiWx917/sl_wifi_if.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,11 @@ extern "C" {

WfxRsi_t wfx_rsi;

// TODO: remove this. Added only to monitor how many watch dog reset have happened during testing.
#ifdef SLI_SI91X_MCU_INTERFACE
volatile uint32_t watchdog_reset = 0;
#endif // SLI_SI91X_MCU_INTERFACE

/* Declare a variable to hold the data associated with the created event group. */
StaticEventGroup_t rsiDriverEventGroup;

Expand Down Expand Up @@ -274,42 +279,52 @@ sl_status_t join_callback_handler(sl_wifi_event_t event, char * result, uint32_t

#if SL_ICD_ENABLED

#if SLI_SI91X_MCU_INTERFACE
/******************************************************************
* @fn sl_wfx_host_si91x_sleep_wakeup()
* @brief
* M4 going to sleep
*
* @param[in] None
* @return
* None
*********************************************************************/
void sl_wfx_host_si91x_sleep_wakeup()
#if SI917_M4_SLEEP_ENABLED
// Required to invoke button press event during sleep as falling edge is not detected
void invoke_btn_press_event()
{
if (wfx_rsi.dev_state & WFX_RSI_ST_SLEEP_READY)
// TODO: should be removed once we are getting the press interrupt for button 0 with sleep
if (!RSI_NPSSGPIO_GetPin(SL_BUTTON_BTN0_PIN) && !btn0_pressed)
{
// TODO: should be removed once we are getting the press interrupt for button 0 with sleep
if (!RSI_NPSSGPIO_GetPin(SL_BUTTON_BTN0_PIN) && !btn0_pressed)
{
sl_button_on_change(SL_BUTTON_BTN0_NUMBER, BUTTON_PRESSED);
btn0_pressed = true;
}
if (RSI_NPSSGPIO_GetPin(SL_BUTTON_BTN0_PIN))
{
#ifdef DISPLAY_ENABLED
// if LCD is enabled, power down the lcd before setting the M4 to sleep
sl_si91x_hardware_setup();
#endif
btn0_pressed = false;
/* Configure RAM Usage and Retention Size */
sl_si91x_m4_sleep_wakeup();
#if SILABS_LOG_ENABLED
silabsInitLog();
#endif
}
sl_button_on_change(SL_BUTTON_BTN0_NUMBER, BUTTON_PRESSED);
btn0_pressed = true;
}
if (RSI_NPSSGPIO_GetPin(SL_BUTTON_BTN0_PIN))
{
btn0_pressed = false;
}
}
#endif // SLI_SI91X_MCU_INTERFACE

/**
* @brief Checks if the Wi-Fi module is ready for sleep.
*
* This function checks if the Wi-Fi module is ready to enter sleep mode.
*
* @return true if the Wi-Fi module is ready for sleep, false otherwise.
*/
bool wfx_is_sleep_ready()
{
// BRD4002A board BTN_PRESS is 0 when pressed, release is 1
// sli_si91x_is_sleep_ready requires OS Scheduler to be active
return ((RSI_NPSSGPIO_GetPin(SL_BUTTON_BTN0_PIN) != 0) && (wfx_rsi.dev_state & WFX_RSI_ST_SLEEP_READY) &&
sli_si91x_is_sleep_ready());
}

/**
* @brief Sleeps for a specified duration and then wakes up.
*
* This function puts the SI91x host into sleep mode for the specified duration
* in milliseconds and then wakes it up.
*
* @param sleep_time_ms The duration in milliseconds to sleep.
*/
void sl_wfx_host_si91x_sleep(uint16_t * sleep_time_ms)
{
SL_ASSERT(sleep_time_ms != NULL);
sl_si91x_m4_sleep_wakeup(sleep_time_ms);
}

#endif // SI917_M4_SLEEP_ENABLED

/******************************************************************
* @fn wfx_rsi_power_save()
Expand Down Expand Up @@ -363,6 +378,13 @@ int32_t wfx_wifi_rsi_init(void)
SILABS_LOG("wfx_wifi_rsi_init started");
sl_status_t status;
status = sl_wifi_init(&config, NULL, sl_wifi_default_event_handler);
#ifdef SLI_SI91X_MCU_INTERFACE
// TODO: remove this. Added only to monitor how many watch dog reset have happened during testing.
if ((MCU_FSM->MCU_FSM_WAKEUP_STATUS_REG) & BIT(5))
{
watchdog_reset++;
}
#endif // SLI_SI91X_MCU_INTERFACE
if (status != SL_STATUS_OK)
{
return status;
Expand Down
10 changes: 7 additions & 3 deletions examples/platform/silabs/ldscripts/SiWx917-common.ld
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ SECTIONS
{
KEEP(*(.isr_vector))
KEEP(*(.reset_handler))
*(EXCLUDE_FILE(*sl_si91x_bus.c.o *sl_si91x_driver.c.o *sli_si91x_multithreaded.c.o *rsi_hal_mcu_m4_ram.c.o *rsi_deepsleep_soc.c.o *croutine.c.o *event_groups.c.o *list.c.o *queue.c.o *stream_buffer.c.o *tasks.c.o *timers.c.o *cmsis_os2.c.o *freertos_umm_malloc_host.c.o *malloc_buffers.c.o *sl_rsi_utility.c.o *port.c.o *heap_*.c.o) .text*)
*(EXCLUDE_FILE(*sl_si91x_bus.c.o *sl_si91x_driver.c.o *sli_si91x_multithreaded.c.o *rsi_hal_mcu_m4_ram.c.o *rsi_hal_mcu_m4_rom.c.o *rsi_deepsleep_soc.c.o *croutine.c.o *event_groups.c.o *list.c.o *queue.c.o *stream_buffer.c.o *tasks.c.o *timers.c.o *cmsis_os2.c.o *freertos_umm_malloc_host.c.o *malloc_buffers.c.o *sl_rsi_utility.c.o *port.c.o *heap_*.c.o *os_systick.c.o *sl_wifi_if.c.o *sl_si91x_m4_ps.c.o *sl_platform_wireless.c.o) .text*)

/* .ctors */
*crtbegin.o(.ctors)
Expand Down Expand Up @@ -131,7 +131,8 @@ SECTIONS
*sl_si91x_driver.c.o(.text*)
*sli_si91x_multithreaded.c.o(.text*)
*rsi_hal_mcu_m4_ram.c.o(.text*)
*rsi_deepsleep_soc.c.o(.text*)
*rsi_hal_mcu_m4_rom.c.o(.text*)
*rsi_deepsleep_soc.c.o(.text*)
*croutine.c.o(.text*)
*event_groups.c.o(.text*)
*list.c.o(.text*)
Expand All @@ -145,6 +146,10 @@ SECTIONS
*sl_rsi_utility.c.o(.text*)
*port.c.o(.text*)
*heap_*.c.o(.text*)
*os_systick.c.o(.text*)
*sl_wifi_if.c.o(.text*)
*sl_si91x_m4_ps.c.o(.text*)
*sl_platform_wireless.c.o(.text*)

. = ALIGN(4);
/* preinit data */
Expand Down Expand Up @@ -252,4 +257,3 @@ SECTIONS
app_flash_end = 0x8202000 + 0x1fe000;
ASSERT( (linker_nvm_begin + SIZEOF(.nvm)) <= app_flash_end, "NVM3 is excessing the flash size !")
}

2 changes: 1 addition & 1 deletion examples/platform/silabs/matter-platform.slcp
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ include:
file_list:
- {path: app.h}
- {path: reset_util.h}
sdk: {id: gecko_sdk, version: 4.3.1}
sdk: {id: gecko_sdk, version: 4.4.2}
toolchain_settings: []

component:
Expand Down
2 changes: 1 addition & 1 deletion integrations/cloudbuild/smoke-test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ steps:
- name: pwenv
path: /pwenv

- name: "ghcr.io/project-chip/chip-build-vscode:47"
- name: "ghcr.io/project-chip/chip-build-vscode:49"
id: EFR32
env:
- PW_ENVIRONMENT_ROOT=/pwenv
Expand Down
5 changes: 4 additions & 1 deletion src/platform/silabs/SiWx917/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,10 @@ static_library("SiWx917") {
]
}

public_deps = [ "${chip_root}/src/platform:platform_base" ]
public_deps = [
"${chip_root}/src/app/icd/server:icd-server-config",
"${chip_root}/src/platform:platform_base",
]
deps = [ "${chip_root}/src/platform/logging:headers" ]

# Add platform crypto implementation
Expand Down
Loading
Loading