From 89d611c7e308030beb8657fd0601b6b17738fb41 Mon Sep 17 00:00:00 2001 From: srningap Date: Mon, 10 Apr 2023 19:18:17 +0530 Subject: [PATCH 1/5] Addressed warnings for 917 --- .../silabs/SiWx917/SiWx917/hal/rsi_hal_mcu_timer.c | 2 +- examples/platform/silabs/SiWx917/SiWx917/rsi_if.c | 8 ++++---- examples/platform/silabs/SiWx917/SiWx917/wfx_rsi.h | 1 + .../silabs/SiWx917/device/src/startup_RS1xxxx.c | 10 +++++----- .../silabs/SiWx917/CHIPCryptoPALTinyCrypt.cpp | 14 ++++++++------ 5 files changed, 19 insertions(+), 16 deletions(-) diff --git a/examples/platform/silabs/SiWx917/SiWx917/hal/rsi_hal_mcu_timer.c b/examples/platform/silabs/SiWx917/SiWx917/hal/rsi_hal_mcu_timer.c index e7141d4646060c..023fb47497ca1f 100644 --- a/examples/platform/silabs/SiWx917/SiWx917/hal/rsi_hal_mcu_timer.c +++ b/examples/platform/silabs/SiWx917/SiWx917/hal/rsi_hal_mcu_timer.c @@ -23,7 +23,7 @@ #ifdef RSI_WITH_OS /* FreeRTOS includes. */ #include "FreeRTOS.h" -#include "StackMacros.h" +#include "stack_macros.h" #include "task.h" #include "timers.h" diff --git a/examples/platform/silabs/SiWx917/SiWx917/rsi_if.c b/examples/platform/silabs/SiWx917/SiWx917/rsi_if.c index 403dff68ce6a2f..745586a9868852 100644 --- a/examples/platform/silabs/SiWx917/SiWx917/rsi_if.c +++ b/examples/platform/silabs/SiWx917/SiWx917/rsi_if.c @@ -491,14 +491,14 @@ static void wfx_rsi_do_join(void) void wfx_rsi_task(void * arg) { EventBits_t flags; - int32_t status = 0; + int32_t status; TickType_t last_dhcp_poll, now; struct netif * sta_netif; (void) arg; - uint32_t rsi_status = wfx_rsi_init(); - if (rsi_status != RSI_SUCCESS) + status = wfx_rsi_init(); + if (status != RSI_SUCCESS) { - SILABS_LOG("%s: error: wfx_rsi_init with status: %02x", __func__, rsi_status); + SILABS_LOG("%s: error: wfx_rsi_init with status: %02x", __func__, status); return; } wfx_lwip_start(); diff --git a/examples/platform/silabs/SiWx917/SiWx917/wfx_rsi.h b/examples/platform/silabs/SiWx917/SiWx917/wfx_rsi.h index 1a586931be5f18..09a44344bafb45 100644 --- a/examples/platform/silabs/SiWx917/SiWx917/wfx_rsi.h +++ b/examples/platform/silabs/SiWx917/SiWx917/wfx_rsi.h @@ -89,6 +89,7 @@ int32_t wfx_rsi_get_ap_info(wfx_wifi_scan_result_t * ap); int32_t wfx_rsi_get_ap_ext(wfx_wifi_scan_ext_t * extra_info); int32_t wfx_rsi_reset_count(); int32_t wfx_rsi_disconnect(); +int32_t wfx_rsi_init_platform(); #define SILABS_LOG(...) efr32Log(__VA_ARGS__); #ifdef __cplusplus diff --git a/examples/platform/silabs/SiWx917/device/src/startup_RS1xxxx.c b/examples/platform/silabs/SiWx917/device/src/startup_RS1xxxx.c index a62ea68bbbef12..d0936c34073c2b 100644 --- a/examples/platform/silabs/SiWx917/device/src/startup_RS1xxxx.c +++ b/examples/platform/silabs/SiWx917/device/src/startup_RS1xxxx.c @@ -37,11 +37,11 @@ __attribute__((section(".co_stack"))) unsigned long pulStack[STACK_SIZE]; #define WEAK __attribute__((weak)) /*----------Declaration of the default fault handlers-------------------------*/ -// #ifndef __START -// extern void _start(void) __attribute__((noreturn)); /* Pre Main (C library entry point) */ -// #else -// extern int __START(void) __attribute__((noreturn)); /* main entry point */ -// #endif + #ifndef __START + extern void _start(void) __attribute__((noreturn)); /* Pre Main (C library entry point) */ + #else + extern int __START(void) __attribute__((noreturn)); /* main entry point */ + #endif /* System exception vector handler */ __attribute__((used)) void WEAK Reset_Handler(void); diff --git a/src/platform/silabs/SiWx917/CHIPCryptoPALTinyCrypt.cpp b/src/platform/silabs/SiWx917/CHIPCryptoPALTinyCrypt.cpp index 9f88a1937f8eb7..35f84b8c100648 100644 --- a/src/platform/silabs/SiWx917/CHIPCryptoPALTinyCrypt.cpp +++ b/src/platform/silabs/SiWx917/CHIPCryptoPALTinyCrypt.cpp @@ -842,7 +842,6 @@ static inline Spake2p_Context * to_inner_spake2p_context(Spake2pOpaqueContext * CHIP_ERROR Spake2p_P256_SHA256_HKDF_HMAC::InitInternal(void) { CHIP_ERROR error = CHIP_NO_ERROR; - int result = 0; Spake2p_Context * context = to_inner_spake2p_context(&mSpake2pContext); @@ -865,10 +864,12 @@ CHIP_ERROR Spake2p_P256_SHA256_HKDF_HMAC::InitInternal(void) return error; +/* commenting since this exit is defined but not used exit: _log_mbedTLS_error(result); Clear(); return error; +*/ } void Spake2p_P256_SHA256_HKDF_HMAC::Clear() @@ -926,20 +927,22 @@ CHIP_ERROR Spake2p_P256_SHA256_HKDF_HMAC::MacVerify(const uint8_t * key, size_t CHIP_ERROR Spake2p_P256_SHA256_HKDF_HMAC::FELoad(const uint8_t * in, size_t in_len, void * fe) { CHIP_ERROR error = CHIP_NO_ERROR; - int result = 0; uECC_word_t tmp[2 * NUM_ECC_WORDS] = { 0 }; uECC_vli_bytesToNative(tmp, in, NUM_ECC_BYTES); uECC_vli_mmod((uECC_word_t *) fe, tmp, curve_n); -exit: +/* commenting since this exit is defined but not used + exit: _log_mbedTLS_error(result); +*/ return error; } CHIP_ERROR Spake2p_P256_SHA256_HKDF_HMAC::FEWrite(const void * fe, uint8_t * out, size_t out_len) { + (void)out_len; uECC_vli_nativeToBytes(out, NUM_ECC_BYTES, (const unsigned int *) fe); return CHIP_NO_ERROR; @@ -967,12 +970,13 @@ CHIP_ERROR Spake2p_P256_SHA256_HKDF_HMAC::FEGenerate(void * fe) CHIP_ERROR Spake2p_P256_SHA256_HKDF_HMAC::FEMul(void * fer, const void * fe1, const void * fe2) { CHIP_ERROR error = CHIP_NO_ERROR; - int result = 0; uECC_vli_modMult((uECC_word_t *) fer, (const uECC_word_t *) fe1, (const uECC_word_t *) fe2, (const uECC_word_t *) curve_n); +/* commenting since this exit is defined but not used exit: _log_mbedTLS_error(result); +*/ return error; } @@ -1018,7 +1022,6 @@ CHIP_ERROR Spake2p_P256_SHA256_HKDF_HMAC::PointAddMul(void * R, const void * P1, uECC_word_t R1[2 * NUM_ECC_WORDS]; uECC_word_t R2[2 * NUM_ECC_WORDS]; uECC_word_t z[NUM_ECC_WORDS]; - uint8_t ret = UECC_SUCCESS; if (EccPoint_mult_safer(R1, (const uECC_word_t *) P1, (const uECC_word_t *) fe1) != UECC_SUCCESS) { @@ -1490,7 +1493,6 @@ CHIP_ERROR ExtractPubkeyFromX509Cert(const ByteSpan & certificate, Crypto::P256P CHIP_ERROR error = CHIP_NO_ERROR; mbedtls_x509_crt mbed_cert; mbedtls_uecc_keypair * keypair = nullptr; - size_t pubkey_size = 0; mbedtls_x509_crt_init(&mbed_cert); From 8da89da6d3ca43a1e79445a3390d832f2c5b8ac3 Mon Sep 17 00:00:00 2001 From: srningap Date: Tue, 11 Apr 2023 19:43:51 +0530 Subject: [PATCH 2/5] removed cflags from gni, removed comments --- .../silabs/SiWx917/CHIPCryptoPALTinyCrypt.cpp | 15 --------------- third_party/silabs/SiWx917_sdk.gni | 8 -------- 2 files changed, 23 deletions(-) diff --git a/src/platform/silabs/SiWx917/CHIPCryptoPALTinyCrypt.cpp b/src/platform/silabs/SiWx917/CHIPCryptoPALTinyCrypt.cpp index 35f84b8c100648..4c897aa7c8e30c 100644 --- a/src/platform/silabs/SiWx917/CHIPCryptoPALTinyCrypt.cpp +++ b/src/platform/silabs/SiWx917/CHIPCryptoPALTinyCrypt.cpp @@ -863,13 +863,6 @@ CHIP_ERROR Spake2p_P256_SHA256_HKDF_HMAC::InitInternal(void) G = curve_G; return error; - -/* commenting since this exit is defined but not used -exit: - _log_mbedTLS_error(result); - Clear(); - return error; -*/ } void Spake2p_P256_SHA256_HKDF_HMAC::Clear() @@ -933,10 +926,6 @@ CHIP_ERROR Spake2p_P256_SHA256_HKDF_HMAC::FELoad(const uint8_t * in, size_t in_l uECC_vli_mmod((uECC_word_t *) fe, tmp, curve_n); -/* commenting since this exit is defined but not used - exit: - _log_mbedTLS_error(result); -*/ return error; } @@ -973,10 +962,6 @@ CHIP_ERROR Spake2p_P256_SHA256_HKDF_HMAC::FEMul(void * fer, const void * fe1, co uECC_vli_modMult((uECC_word_t *) fer, (const uECC_word_t *) fe1, (const uECC_word_t *) fe2, (const uECC_word_t *) curve_n); -/* commenting since this exit is defined but not used -exit: - _log_mbedTLS_error(result); -*/ return error; } diff --git a/third_party/silabs/SiWx917_sdk.gni b/third_party/silabs/SiWx917_sdk.gni index e56d949feaca46..22a24c9fa69215 100644 --- a/third_party/silabs/SiWx917_sdk.gni +++ b/third_party/silabs/SiWx917_sdk.gni @@ -181,15 +181,7 @@ template("siwx917_sdk") { cflags += [ "-Wno-maybe-uninitialized", "-Wno-shadow", - "-Wno-empty-body", - "-Wno-cpp", - "-Wno-missing-braces", - "-Wno-sign-compare", "-Wno-error", - "-Wno-unknown-warning-option", - "-Wno-unused-variable", - "-Wno-implicit-function-declaration", - "-Wno-unused-function", ] if (defined(invoker.defines)) { From 4ad4d3114b63604fddd2777e8540c76e79b89c3b Mon Sep 17 00:00:00 2001 From: srningap Date: Tue, 11 Apr 2023 20:22:45 +0530 Subject: [PATCH 3/5] Applied restyle --- .../silabs/SiWx917/device/src/startup_RS1xxxx.c | 10 +++++----- src/platform/silabs/SiWx917/CHIPCryptoPALTinyCrypt.cpp | 2 +- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/examples/platform/silabs/SiWx917/device/src/startup_RS1xxxx.c b/examples/platform/silabs/SiWx917/device/src/startup_RS1xxxx.c index d0936c34073c2b..db9b05fad220bb 100644 --- a/examples/platform/silabs/SiWx917/device/src/startup_RS1xxxx.c +++ b/examples/platform/silabs/SiWx917/device/src/startup_RS1xxxx.c @@ -37,11 +37,11 @@ __attribute__((section(".co_stack"))) unsigned long pulStack[STACK_SIZE]; #define WEAK __attribute__((weak)) /*----------Declaration of the default fault handlers-------------------------*/ - #ifndef __START - extern void _start(void) __attribute__((noreturn)); /* Pre Main (C library entry point) */ - #else - extern int __START(void) __attribute__((noreturn)); /* main entry point */ - #endif +#ifndef __START +extern void _start(void) __attribute__((noreturn)); /* Pre Main (C library entry point) */ +#else +extern int __START(void) __attribute__((noreturn)); /* main entry point */ +#endif /* System exception vector handler */ __attribute__((used)) void WEAK Reset_Handler(void); diff --git a/src/platform/silabs/SiWx917/CHIPCryptoPALTinyCrypt.cpp b/src/platform/silabs/SiWx917/CHIPCryptoPALTinyCrypt.cpp index 4c897aa7c8e30c..1d8c9a293d438d 100644 --- a/src/platform/silabs/SiWx917/CHIPCryptoPALTinyCrypt.cpp +++ b/src/platform/silabs/SiWx917/CHIPCryptoPALTinyCrypt.cpp @@ -931,7 +931,7 @@ CHIP_ERROR Spake2p_P256_SHA256_HKDF_HMAC::FELoad(const uint8_t * in, size_t in_l CHIP_ERROR Spake2p_P256_SHA256_HKDF_HMAC::FEWrite(const void * fe, uint8_t * out, size_t out_len) { - (void)out_len; + (void) out_len; uECC_vli_nativeToBytes(out, NUM_ECC_BYTES, (const unsigned int *) fe); return CHIP_NO_ERROR; From 3cc4617f53ff64b20bdb2e834da8526a7b17f2b2 Mon Sep 17 00:00:00 2001 From: srningap Date: Fri, 14 Apr 2023 10:24:22 +0530 Subject: [PATCH 4/5] updated matter_support pointer to latest commit --- third_party/silabs/matter_support | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/third_party/silabs/matter_support b/third_party/silabs/matter_support index 060f2a7bd92b4a..53c27ef4ed0cff 160000 --- a/third_party/silabs/matter_support +++ b/third_party/silabs/matter_support @@ -1 +1 @@ -Subproject commit 060f2a7bd92b4ac42a90415e59a07d25bf4dab42 +Subproject commit 53c27ef4ed0cff01ad913b9e25d57ccb58cd49f4 From fab62f0abb569e2263d79902f4623c79b3f6c766 Mon Sep 17 00:00:00 2001 From: srningap Date: Fri, 14 Apr 2023 17:17:11 +0530 Subject: [PATCH 5/5] addressed redefined warning --- src/platform/silabs/SiWx917/bluetooth/wfx_sl_ble_init.h | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/platform/silabs/SiWx917/bluetooth/wfx_sl_ble_init.h b/src/platform/silabs/SiWx917/bluetooth/wfx_sl_ble_init.h index 02f835d62ad6e0..bdc93f3a3ccbf9 100644 --- a/src/platform/silabs/SiWx917/bluetooth/wfx_sl_ble_init.h +++ b/src/platform/silabs/SiWx917/bluetooth/wfx_sl_ble_init.h @@ -17,7 +17,9 @@ #ifndef WFX_SL_BLE_INIT #define WFX_SL_BLE_INIT +#ifndef RSI_BLE_ENABLE #define RSI_BLE_ENABLE (1) +#endif // RSI_BLE_ENABLE // BLE include file to refer BLE APIs #include "FreeRTOS.h"