From df667041c0e42e37cd88b3f65a4226779d5311db Mon Sep 17 00:00:00 2001 From: senthil kumar E K Date: Mon, 20 Mar 2023 21:19:51 +0530 Subject: [PATCH 1/4] Fix to SiWx917 SoC MCU Reset issue --- src/platform/silabs/SilabsConfig.cpp | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/platform/silabs/SilabsConfig.cpp b/src/platform/silabs/SilabsConfig.cpp index 1d5fab99c71e5b..199bfb1c925311 100644 --- a/src/platform/silabs/SilabsConfig.cpp +++ b/src/platform/silabs/SilabsConfig.cpp @@ -34,6 +34,9 @@ #include "nvm3_default.h" #include "nvm3_hal_flash.h" #include +#ifdef BRD4325A +#include "rsi_ccp_common.h" +#endif // Substitute the GSDK weak nvm3_lockBegin and nvm3_lockEnd // for an application controlled re-entrance protection @@ -43,6 +46,9 @@ static StaticSemaphore_t nvm3_SemStruct; void nvm3_lockBegin(void) { VerifyOrDie(nvm3_Sem != NULL); +#ifdef BRD4325A + __disable_irq(); +#endif xSemaphoreTake(nvm3_Sem, portMAX_DELAY); } @@ -50,6 +56,9 @@ void nvm3_lockEnd(void) { VerifyOrDie(nvm3_Sem != NULL); xSemaphoreGive(nvm3_Sem); +#ifdef BRD4325A + __enable_irq(); +#endif } namespace chip { From a874fb2b7acd2c183d3fa56c3315cb6e86144d13 Mon Sep 17 00:00:00 2001 From: senthil kumar E K Date: Thu, 23 Mar 2023 12:48:21 +0530 Subject: [PATCH 2/4] use nvm3_lock weak implementation for 917SoC --- src/platform/silabs/SilabsConfig.cpp | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/platform/silabs/SilabsConfig.cpp b/src/platform/silabs/SilabsConfig.cpp index 199bfb1c925311..beb4e5db828431 100644 --- a/src/platform/silabs/SilabsConfig.cpp +++ b/src/platform/silabs/SilabsConfig.cpp @@ -38,6 +38,7 @@ #include "rsi_ccp_common.h" #endif +#ifndef BRD4325A // TODO: fix semaphore usage in nvm3_lock for siwx917. use weak implementation for that board instead // Substitute the GSDK weak nvm3_lockBegin and nvm3_lockEnd // for an application controlled re-entrance protection static SemaphoreHandle_t nvm3_Sem; @@ -46,9 +47,6 @@ static StaticSemaphore_t nvm3_SemStruct; void nvm3_lockBegin(void) { VerifyOrDie(nvm3_Sem != NULL); -#ifdef BRD4325A - __disable_irq(); -#endif xSemaphoreTake(nvm3_Sem, portMAX_DELAY); } @@ -56,10 +54,8 @@ void nvm3_lockEnd(void) { VerifyOrDie(nvm3_Sem != NULL); xSemaphoreGive(nvm3_Sem); -#ifdef BRD4325A - __enable_irq(); -#endif } +#endif // not BRD4325A namespace chip { namespace DeviceLayer { @@ -72,6 +68,7 @@ namespace Internal { CHIP_ERROR SilabsConfig::Init() { +#ifndef BRD4325A // TODO: fix semaphore usage in nvm3_lock for siwx917. use weak implementation for that board instead nvm3_Sem = xSemaphoreCreateBinaryStatic(&nvm3_SemStruct); if (nvm3_Sem == NULL) @@ -79,12 +76,15 @@ CHIP_ERROR SilabsConfig::Init() return CHIP_ERROR_NO_MEMORY; } xSemaphoreGive(nvm3_Sem); +#endif // not BRD4325A return MapNvm3Error(nvm3_open(nvm3_defaultHandle, nvm3_defaultInit)); } void SilabsConfig::DeInit() { +#ifndef BRD4325A // TODO: fix semaphore usage in nvm3_lock for siwx917. use weak implementation for that board instead vSemaphoreDelete(nvm3_Sem); +#endif // not BRD4325A nvm3_close(nvm3_defaultHandle); } From fb11aa6af73afa5b1a69e24db9e3ccc804f54f1d Mon Sep 17 00:00:00 2001 From: senthil kumar E K Date: Thu, 23 Mar 2023 12:54:58 +0530 Subject: [PATCH 3/4] applied restyle --- src/platform/silabs/SilabsConfig.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/platform/silabs/SilabsConfig.cpp b/src/platform/silabs/SilabsConfig.cpp index beb4e5db828431..cf4b225127609e 100644 --- a/src/platform/silabs/SilabsConfig.cpp +++ b/src/platform/silabs/SilabsConfig.cpp @@ -38,7 +38,7 @@ #include "rsi_ccp_common.h" #endif -#ifndef BRD4325A // TODO: fix semaphore usage in nvm3_lock for siwx917. use weak implementation for that board instead +#ifndef BRD4325A // TODO: fix semaphore usage in nvm3_lock for siwx917. use weak implementation for that board instead // Substitute the GSDK weak nvm3_lockBegin and nvm3_lockEnd // for an application controlled re-entrance protection static SemaphoreHandle_t nvm3_Sem; @@ -68,7 +68,7 @@ namespace Internal { CHIP_ERROR SilabsConfig::Init() { -#ifndef BRD4325A // TODO: fix semaphore usage in nvm3_lock for siwx917. use weak implementation for that board instead +#ifndef BRD4325A // TODO: fix semaphore usage in nvm3_lock for siwx917. use weak implementation for that board instead nvm3_Sem = xSemaphoreCreateBinaryStatic(&nvm3_SemStruct); if (nvm3_Sem == NULL) @@ -82,7 +82,7 @@ CHIP_ERROR SilabsConfig::Init() void SilabsConfig::DeInit() { -#ifndef BRD4325A // TODO: fix semaphore usage in nvm3_lock for siwx917. use weak implementation for that board instead +#ifndef BRD4325A // TODO: fix semaphore usage in nvm3_lock for siwx917. use weak implementation for that board instead vSemaphoreDelete(nvm3_Sem); #endif // not BRD4325A nvm3_close(nvm3_defaultHandle); From b1adb663fa2df0b30bab3c9469d186fd124799d4 Mon Sep 17 00:00:00 2001 From: senthil kumar E K Date: Thu, 23 Mar 2023 14:21:32 +0530 Subject: [PATCH 4/4] SoC header file is removed --- src/platform/silabs/SilabsConfig.cpp | 3 --- 1 file changed, 3 deletions(-) diff --git a/src/platform/silabs/SilabsConfig.cpp b/src/platform/silabs/SilabsConfig.cpp index cf4b225127609e..c887e6f2d0ac8c 100644 --- a/src/platform/silabs/SilabsConfig.cpp +++ b/src/platform/silabs/SilabsConfig.cpp @@ -34,9 +34,6 @@ #include "nvm3_default.h" #include "nvm3_hal_flash.h" #include -#ifdef BRD4325A -#include "rsi_ccp_common.h" -#endif #ifndef BRD4325A // TODO: fix semaphore usage in nvm3_lock for siwx917. use weak implementation for that board instead // Substitute the GSDK weak nvm3_lockBegin and nvm3_lockEnd