Skip to content

Commit

Permalink
[Silabs] Adds fix for hardfault in SiWx917 SoC and generator firmware…
Browse files Browse the repository at this point in the history
… updates (#36610)

* Update mbedTLS configuration

* Addressing comments

* Replace with use of public APIs

* Updated Support SDK pointer

* Updated Support SDK pointer

* WIP: Wiseconnect 3.4.0 support

* Adds IPMU changes

* Update pointers

* Add fix for LCD

* Cleanup of duplicate entry

* Refactor device attestation key handling in ProvisionStorageFlash.cpp

* Revert changes

---------

Co-authored-by: Andrei Litvin <[email protected]>
  • Loading branch information
rosahay-silabs and andy31415 authored Jan 16, 2025
1 parent 5055cbe commit e8196ff
Show file tree
Hide file tree
Showing 4 changed files with 30 additions and 6 deletions.
3 changes: 2 additions & 1 deletion examples/platform/silabs/ldscripts/SiWx917-common.ld
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,8 @@ SECTIONS
.text :
{
KEEP(*(.isr_vector))
KEEP(*(.reset_handler))
. = ALIGN(32);
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_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 *sl_sleeptimer.c.o *sl_sleeptimer_hal_si91x_sysrtc.c.o *rsi_sysrtc.c.o *sl_si91x_low_power_tickless_mode.c.o *heap_*.c.o *sl_core_cortexm.c.o) .text*)

/* .ctors */
Expand Down
9 changes: 8 additions & 1 deletion examples/platform/silabs/provision/ProvisionStorageFlash.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -649,7 +649,6 @@ CHIP_ERROR Storage::GetDeviceAttestationCSR(uint16_t vid, uint16_t pid, const Ch

CHIP_ERROR Storage::SignWithDeviceAttestationKey(const ByteSpan & message, MutableByteSpan & signature)
{
AttestationKey key;
uint8_t temp[kDeviceAttestationKeySizeMax] = { 0 };
size_t size = 0;
CHIP_ERROR err = Flash::Get(Parameters::ID::kDacKey, temp, sizeof(temp), size);
Expand All @@ -661,8 +660,16 @@ CHIP_ERROR Storage::SignWithDeviceAttestationKey(const ByteSpan & message, Mutab
}
#endif // CHIP_DEVICE_CONFIG_ENABLE_EXAMPLE_CREDENTIALS
ReturnErrorOnFailure(err);
#if (defined(SLI_SI91X_MCU_INTERFACE) && SLI_SI91X_MCU_INTERFACE)
uint8_t key_buffer[kDeviceAttestationKeySizeMax] = { 0 };
MutableByteSpan private_key(key_buffer);
AttestationKey::Unwrap(temp, size, private_key);
return AttestationKey::SignMessageWithKey((const uint8_t *) key_buffer, message, signature);
#else
AttestationKey key;
ReturnErrorOnFailure(key.Import(temp, size));
return key.SignMessage(message, signature);
#endif // SLI_SI91X_MCU_INTERFACE
}

//
Expand Down
5 changes: 5 additions & 0 deletions src/platform/silabs/provision/AttestationKey.h
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,11 @@ class AttestationKey
CHIP_ERROR GenerateCSR(uint16_t vid, uint16_t pid, const CharSpan & cn, MutableCharSpan & csr);
CHIP_ERROR SignMessage(const ByteSpan & message, MutableByteSpan & out_span);

#if (defined(SLI_SI91X_MCU_INTERFACE) && SLI_SI91X_MCU_INTERFACE)
static CHIP_ERROR Unwrap(const uint8_t * asn1, size_t size, MutableByteSpan & private_key);
static CHIP_ERROR SignMessageWithKey(const uint8_t * private_key, const ByteSpan & message, MutableByteSpan & out_span);
#endif // SLI_SI91X_MCU_INTERFACE

protected:
uint32_t mId = 0;
};
Expand Down
19 changes: 15 additions & 4 deletions third_party/silabs/SiWx917_sdk.gni
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ template("siwx917_sdk") {
# Treat these includes as system includes, so warnings in them are not fatal.
_include_dirs = [
"${chip_root}",
"${chip_root}/examples/platform/silabs/SiWx917/SiWx917",
"${chip_root}/examples/platform/silabs/",
"${efr32_sdk_root}/platform/emdrv/nvm3/config",
"${efr32_sdk_root}/platform/emdrv/nvm3/inc",
"${efr32_sdk_root}/platform/emdrv/common/inc",
Expand All @@ -79,7 +79,7 @@ template("siwx917_sdk") {
"${wifi_sdk_root}/components/device/silabs/si91x/wireless/sl_net/inc",

# siwx917_soc component
"${wifi_sdk_root}/components/board/silabs/config/brd4338a",
"${wifi_sdk_root}/components/board/silabs/config/${silabs_board}",
"${wifi_sdk_root}/components/board/silabs/inc",
"${wifi_sdk_root}/components/common/inc",
"${wifi_sdk_root}/components/device/silabs/si91x/mcu/core/chip/inc",
Expand Down Expand Up @@ -251,6 +251,8 @@ template("siwx917_sdk") {
"TIMER_ROMDRIVER_PRESENT=1",
"UDMA_ROMDRIVER_PRESENT=1",
"PLL_ROMDRIVER_PRESENT=1",
"SL_CODE_COMPONENT_FREERTOS_KERNEL=freertos_kernel",
"SLI_CODE_CLASSIFICATION_DISABLE=1",
"SL_MATTER_GN_BUILD=1",
"SILABS_LOG_OUT_UART=${sl_uart_log_output}",
]
Expand All @@ -261,7 +263,10 @@ template("siwx917_sdk") {
defines += [ "SILABS_LOG_ENABLED=0" ]
}

defines += [ "LWIP_NETIF_API=1" ]
defines += [
"LWIP_NETIF_API=1",
"SLI_SI91X_LWIP_HOSTED_NETWORK_STACK=1",
]
if (chip_enable_wifi_ipv4) {
defines += [
"LWIP_IPV4=1",
Expand Down Expand Up @@ -300,6 +305,7 @@ template("siwx917_sdk") {

if (!disable_lcd) {
defines += [
"SI917_MEMLCD=1",
"SYSCALLS_WRITE",
"SPI_MULTI_SLAVE",
"SL_ULP_TIMER",
Expand Down Expand Up @@ -612,7 +618,7 @@ template("siwx917_sdk") {
"${sdk_support_root}/matter/mbedtls/tinycrypt/src/ecc_dsa.c",
"${sdk_support_root}/matter/mbedtls/tinycrypt/src/tinycrypt_util.c",

# Sisdk platform/security
# GECKO SDK
"${efr32_sdk_root}/platform/security/sl_component/sli_psec_osal/src/sli_psec_osal_cmsis_rtos2.c",
]

Expand All @@ -630,9 +636,11 @@ template("siwx917_sdk") {
# si91x component
"${efr32_sdk_root}/platform/CMSIS/RTOS2/Source/os_systick.c",
"${efr32_sdk_root}/platform/common/src/sl_assert.c",
"${efr32_sdk_root}/platform/common/src/sl_cmsis_os2_common.c",
"${efr32_sdk_root}/platform/common/src/sl_core_cortexm.c",
"${efr32_sdk_root}/platform/common/src/sl_slist.c",
"${efr32_sdk_root}/platform/common/src/sl_string.c",
"${efr32_sdk_root}/platform/common/src/sl_syscalls.c",
"${efr32_sdk_root}/platform/common/src/sli_cmsis_os2_ext_task_register.c",
"${efr32_sdk_root}/platform/security/sl_component/sl_mbedtls_support/src/sl_mbedtls.c",
"${efr32_sdk_root}/util/third_party/freertos/cmsis/Source/cmsis_os2.c",
Expand Down Expand Up @@ -692,10 +700,12 @@ template("siwx917_sdk") {
"${wifi_sdk_root}/components/device/silabs/si91x/mcu/drivers/peripheral_drivers/src/rsi_udma.c",
"${wifi_sdk_root}/components/device/silabs/si91x/mcu/drivers/peripheral_drivers/src/rsi_udma_wrapper.c",
"${wifi_sdk_root}/components/device/silabs/si91x/mcu/drivers/peripheral_drivers/src/rsi_usart.c",
"${wifi_sdk_root}/components/device/silabs/si91x/mcu/drivers/rom_driver/src/rsi_rom_table_si91x.c",
"${wifi_sdk_root}/components/device/silabs/si91x/mcu/drivers/systemlevel/src/rsi_bod.c",
"${wifi_sdk_root}/components/device/silabs/si91x/mcu/drivers/systemlevel/src/rsi_ipmu.c",
"${wifi_sdk_root}/components/device/silabs/si91x/mcu/drivers/systemlevel/src/rsi_pll.c",
"${wifi_sdk_root}/components/device/silabs/si91x/mcu/drivers/systemlevel/src/rsi_power_save.c",
"${wifi_sdk_root}/components/device/silabs/si91x/mcu/drivers/systemlevel/src/rsi_rtc.c",
"${wifi_sdk_root}/components/device/silabs/si91x/mcu/drivers/systemlevel/src/rsi_temp_sensor.c",
"${wifi_sdk_root}/components/device/silabs/si91x/mcu/drivers/systemlevel/src/rsi_ulpss_clk.c",
"${wifi_sdk_root}/components/device/silabs/si91x/mcu/drivers/unified_api/src/sl_si91x_adc.c",
Expand Down Expand Up @@ -750,6 +760,7 @@ template("siwx917_sdk") {
"${efr32_sdk_root}/platform/service/memory_manager/src/sl_memory_manager_cpp.cpp",
"${efr32_sdk_root}/platform/service/memory_manager/src/sl_memory_manager_dynamic_reservation.c",
"${efr32_sdk_root}/platform/service/memory_manager/src/sl_memory_manager_pool.c",
"${efr32_sdk_root}/platform/service/memory_manager/src/sl_memory_manager_pool_common.c",
"${efr32_sdk_root}/platform/service/memory_manager/src/sl_memory_manager_region.c",
"${efr32_sdk_root}/platform/service/memory_manager/src/sl_memory_manager_retarget.c",
"${efr32_sdk_root}/platform/service/memory_manager/src/sli_memory_manager_common.c",
Expand Down

0 comments on commit e8196ff

Please sign in to comment.