Skip to content

Commit

Permalink
Cleanup/updates tied with latest sdk update
Browse files Browse the repository at this point in the history
  • Loading branch information
jmartinez-silabs committed Aug 21, 2024
1 parent 03a14ef commit 9c53641
Show file tree
Hide file tree
Showing 9 changed files with 27 additions and 18 deletions.
2 changes: 1 addition & 1 deletion examples/platform/silabs/FreeRTOSConfig.h
Original file line number Diff line number Diff line change
Expand Up @@ -118,8 +118,8 @@ extern uint32_t SystemCoreClock;
#include "RTE_Components.h"
#include CMSIS_device_header

#include "em_assert.h"
#include "em_device.h"
#include "sl_assert.h"
#endif

#if defined(SL_COMPONENT_CATALOG_PRESENT)
Expand Down
2 changes: 1 addition & 1 deletion src/platform/silabs/ConfigurationManagerImpl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ CHIP_ERROR ConfigurationManagerImpl::GetBootReason(uint32_t & bootReason)
matterBootCause = BootReasonType::kPowerOnReboot;
}
else if (rebootCause & EMU_RSTCAUSE_AVDDBOD || rebootCause & EMU_RSTCAUSE_DVDDBOD || rebootCause & EMU_RSTCAUSE_DECBOD ||
rebootCause & EMU_RSTCAUSE_VREGIN || rebootCause & EMU_RSTCAUSE_IOVDD0BOD || rebootCause & EMU_RSTCAUSE_DVDDLEBOD)
rebootCause & EMU_RSTCAUSE_IOVDD0BOD || rebootCause & EMU_RSTCAUSE_DVDDLEBOD)
{
matterBootCause = BootReasonType::kBrownOutReset;
}
Expand Down
15 changes: 5 additions & 10 deletions src/platform/silabs/efr32/Efr32PsaOpaqueKeypair.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
#include "Efr32OpaqueKeypair.h"
#include "em_device.h"
#include <psa/crypto.h>
#include <sl_psa_crypto.h>

#include <lib/core/CHIPSafeCasts.h>
#include <lib/support/CHIPMem.h>
Expand Down Expand Up @@ -47,14 +48,6 @@ namespace Internal {
static_assert((kEFR32OpaqueKeyIdPersistentMax - kEFR32OpaqueKeyIdPersistentMin) < PSA_KEY_ID_FOR_MATTER_SIZE,
"Not enough PSA range to store all allowed opaque key IDs");

#if defined(SEMAILBOX_PRESENT) && (_SILICON_LABS_SECURITY_FEATURE == _SILICON_LABS_SECURITY_FEATURE_VAULT)
#define PSA_CRYPTO_LOCATION_FOR_DEVICE PSA_KEY_LOCATION_SL_SE_OPAQUE
#elif defined(CRYPTOACC_PRESENT) && defined(SEPUF_PRESENT) && defined(SL_TRUSTZONE_NONSECURE)
#define PSA_CRYPTO_LOCATION_FOR_DEVICE PSA_KEY_LOCATION_SL_CRYPTOACC_OPAQUE
#else
#define PSA_CRYPTO_LOCATION_FOR_DEVICE PSA_KEY_LOCATION_LOCAL_STORAGE
#endif

static void _log_PSA_error(psa_status_t status)
{
if (status != PSA_SUCCESS)
Expand Down Expand Up @@ -190,7 +183,8 @@ CHIP_ERROR EFR32OpaqueKeypair::Create(EFR32OpaqueKeyId opaque_id, EFR32OpaqueKey
if (opaque_id == kEFR32OpaqueKeyIdVolatile)
{
psa_set_key_lifetime(
&attr, PSA_KEY_LIFETIME_FROM_PERSISTENCE_AND_LOCATION(PSA_KEY_LIFETIME_VOLATILE, PSA_CRYPTO_LOCATION_FOR_DEVICE));
&attr,
PSA_KEY_LIFETIME_FROM_PERSISTENCE_AND_LOCATION(PSA_KEY_LIFETIME_VOLATILE, sl_psa_get_most_secure_key_location()));
}
else
{
Expand All @@ -210,7 +204,8 @@ CHIP_ERROR EFR32OpaqueKeypair::Create(EFR32OpaqueKeyId opaque_id, EFR32OpaqueKey

psa_set_key_id(&attr, key_id);
psa_set_key_lifetime(
&attr, PSA_KEY_LIFETIME_FROM_PERSISTENCE_AND_LOCATION(PSA_KEY_LIFETIME_PERSISTENT, PSA_CRYPTO_LOCATION_FOR_DEVICE));
&attr,
PSA_KEY_LIFETIME_FROM_PERSISTENCE_AND_LOCATION(PSA_KEY_LIFETIME_PERSISTENT, sl_psa_get_most_secure_key_location()));
}

switch (usage)
Expand Down
2 changes: 1 addition & 1 deletion src/platform/silabs/efr32/OTAImageProcessorImpl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@

extern "C" {
#include "btl_interface.h"
#include "em_bus.h" // For CORE_CRITICAL_SECTION
#include "sl_core.h"
#if SL_WIFI
#include "spi_multiplex.h"
#endif // SL_WIFI
Expand Down
2 changes: 1 addition & 1 deletion src/platform/silabs/multi-ota/OTACustomProcessor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@

extern "C" {
#include "btl_interface.h"
#include "em_bus.h" // For CORE_CRITICAL_SECTION
#include "sl_core.h"
#if SL_WIFI
#include "spi_multiplex.h"
#endif // SL_WIFI
Expand Down
2 changes: 1 addition & 1 deletion src/platform/silabs/multi-ota/OTAFirmwareProcessor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@

extern "C" {
#include "btl_interface.h"
#include "em_bus.h" // For CORE_CRITICAL_SECTION
#include "sl_core.h"
#if SL_WIFI
#include "spi_multiplex.h"
#endif // SL_WIFI
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ static chip::OTAMultiImageProcessorImpl gImageProcessor;

extern "C" {
#include "btl_interface.h"
#include "em_bus.h" // For CORE_CRITICAL_SECTION
#include "sl_core.h"
#if SL_WIFI
#include "spi_multiplex.h"
#endif // SL_WIFI
Expand Down
16 changes: 15 additions & 1 deletion src/platform/silabs/platformAbstraction/GsdkSpam.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,11 @@

#include <platform/silabs/platformAbstraction/SilabsPlatform.h>

#if defined(_SILICON_LABS_32B_SERIES_2)
#include "em_rmu.h"
#else
#include "sl_hal_emu.h"
#endif
#include "sl_system_kernel.h"

#ifdef ENABLE_WSTK_LEDS
Expand Down Expand Up @@ -71,9 +75,19 @@ SilabsPlatform::SilabsButtonCb SilabsPlatform::mButtonCallback = nullptr;

CHIP_ERROR SilabsPlatform::Init(void)
{
#ifdef _SILICON_LABS_32B_SERIES_2
// Read the cause of last reset.
mRebootCause = RMU_ResetCauseGet();
// Clear register so it does accumualate the causes of each reset

// Clear the register, as the causes cumulate over resets.
RMU_ResetCauseClear();
#else
// Read the cause of last reset.
mRebootCause = sl_hal_emu_get_reset_cause();

// Clear the register, as the causes cumulate over resets.
sl_hal_emu_clear_reset_cause();
#endif // _SILICON_LABS_32B_SERIES_2

#if SILABS_LOG_OUT_UART && defined(SL_CATALOG_CLI_PRESENT)
sl_iostream_set_default(sl_iostream_stdio_handle);
Expand Down
2 changes: 1 addition & 1 deletion src/test_driver/efr32/include/FreeRTOSConfig.h
Original file line number Diff line number Diff line change
Expand Up @@ -108,8 +108,8 @@ extern "C" {
#include "RTE_Components.h"
#include CMSIS_device_header

#include "em_assert.h"
#include "em_device.h"
#include "sl_assert.h"

#if defined(SL_COMPONENT_CATALOG_PRESENT)
#include "sl_component_catalog.h"
Expand Down

0 comments on commit 9c53641

Please sign in to comment.