Skip to content

Commit 1178112

Browse files
jmartinez-silabspull[bot]
authored andcommitted
[Silabs]Re-enable some compilation flags (#29020)
* remove some -wno flag that are not needed anymore. Root issue fixed in gsdk * fix array bounds error in rsi_if. some cleanup
1 parent ffe17f7 commit 1178112

File tree

4 files changed

+29
-45
lines changed

4 files changed

+29
-45
lines changed

examples/platform/silabs/efr32/rs911x/rsi_if.c

+28-33
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,11 @@
5454
#include "wfx_host_events.h"
5555
#include "wfx_rsi.h"
5656

57+
// TODO convert this file to cpp and use CodeUtils.h
58+
#ifndef MIN
59+
#define MIN(a, b) ((a) < (b) ? (a) : (b))
60+
#endif
61+
5762
/* Rsi driver Task will use as its stack */
5863
StackType_t driverRsiTaskStack[WFX_RSI_WLAN_TASK_SZ] = { 0 };
5964

@@ -691,50 +696,40 @@ void wfx_rsi_task(void * arg)
691696
{
692697
if (!(wfx_rsi.dev_state & WFX_RSI_ST_SCANSTARTED))
693698
{
694-
SILABS_LOG("%s: start SSID scan", __func__);
695-
int x;
696-
wfx_wifi_scan_result_t ap;
697-
rsi_scan_info_t * scan;
698-
int32_t status;
699-
uint8_t bgscan_results[BG_SCAN_RES_SIZE] = { 0 };
700-
status = rsi_wlan_bgscan_profile(1, (rsi_rsp_scan_t *) bgscan_results, BG_SCAN_RES_SIZE);
701-
702-
SILABS_LOG("%s: status: %02x size = %d", __func__, status, BG_SCAN_RES_SIZE);
703-
rsi_rsp_scan_t * rsp = (rsi_rsp_scan_t *) bgscan_results;
699+
rsi_rsp_scan_t scan_rsp = { 0 };
700+
int32_t status = rsi_wlan_bgscan_profile(1, &scan_rsp, sizeof(scan_rsp));
701+
704702
if (status)
705703
{
706-
/*
707-
* Scan is done - failed
708-
*/
704+
SILABS_LOG("SSID scan failed: %02x ", status);
709705
}
710706
else
711-
for (x = 0; x < rsp->scan_count[0]; x++)
707+
{
708+
rsi_scan_info_t * scan;
709+
wfx_wifi_scan_result_t ap;
710+
for (int x = 0; x < scan_rsp.scan_count[0]; x++)
712711
{
713-
scan = &rsp->scan_info[x];
714-
strcpy(&ap.ssid[0], (char *) &scan->ssid[0]);
715-
if (wfx_rsi.scan_ssid)
712+
scan = &scan_rsp.scan_info[x];
713+
// is it a scan all or target scan
714+
if (!wfx_rsi.scan_ssid ||
715+
(wfx_rsi.scan_ssid && strcmp(wfx_rsi.scan_ssid, (char *) scan->ssid) == CMP_SUCCESS))
716716
{
717-
SILABS_LOG("Inside scan_ssid");
718-
SILABS_LOG("SCAN SSID: %s , ap scan: %s", wfx_rsi.scan_ssid, ap.ssid);
719-
if (strcmp(wfx_rsi.scan_ssid, ap.ssid) == CMP_SUCCESS)
720-
{
721-
SILABS_LOG("Inside ap details");
722-
ap.security = scan->security_mode;
723-
ap.rssi = (-1) * scan->rssi_val;
724-
memcpy(&ap.bssid[0], &scan->bssid[0], BSSID_MAX_STR_LEN);
725-
(*wfx_rsi.scan_cb)(&ap);
726-
}
727-
}
728-
else
729-
{
730-
SILABS_LOG("Inside else");
717+
strncpy(ap.ssid, (char *) scan->ssid, MIN(sizeof(ap.ssid), sizeof(scan->ssid)));
731718
ap.security = scan->security_mode;
732719
ap.rssi = (-1) * scan->rssi_val;
733-
ap.chan = scan->rf_channel;
734-
memcpy(&ap.bssid[0], &scan->bssid[0], BSSID_MAX_STR_LEN);
720+
configASSERT(sizeof(ap.bssid) >= BSSID_MAX_STR_LEN);
721+
configASSERT(sizeof(scan->bssid) >= BSSID_MAX_STR_LEN);
722+
memcpy(ap.bssid, scan->bssid, BSSID_MAX_STR_LEN);
735723
(*wfx_rsi.scan_cb)(&ap);
724+
725+
if (wfx_rsi.scan_ssid)
726+
{
727+
break; // we found the targeted ssid.
728+
}
736729
}
737730
}
731+
}
732+
738733
wfx_rsi.dev_state &= ~WFX_RSI_ST_SCANSTARTED;
739734
/* Terminate with end of scan which is no ap sent back */
740735
(*wfx_rsi.scan_cb)((wfx_wifi_scan_result_t *) 0);

src/platform/silabs/SiWx917/wifi/wfx_host_events.h

-1
Original file line numberDiff line numberDiff line change
@@ -127,7 +127,6 @@
127127
#define SCAN_BITMAP_OPTN_1 (1)
128128
#define IP_CONF_RSP_BUFF_LENGTH_4 (4)
129129
#define STATION (0)
130-
#define BG_SCAN_RES_SIZE (500)
131130

132131
#define SPI_CONFIG_SUCCESS (0)
133132

src/platform/silabs/efr32/wifi/wfx_host_events.h

-1
Original file line numberDiff line numberDiff line change
@@ -214,7 +214,6 @@ typedef struct __attribute__((__packed__)) sl_wfx_mib_req_s
214214
#define SCAN_BITMAP_OPTN_1 1
215215
#define IP_CONF_RSP_BUFF_LENGTH_4 4
216216
#define STATION 0
217-
#define BG_SCAN_RES_SIZE 500
218217

219218
#define SPI_CONFIG_SUCESS 0
220219

third_party/silabs/efr32_sdk.gni

+1-10
Original file line numberDiff line numberDiff line change
@@ -516,16 +516,7 @@ template("efr32_sdk") {
516516
cflags += [ "-isystem" + rebase_path(include_dir, root_build_dir) ]
517517
}
518518

519-
cflags += [
520-
"-Wno-maybe-uninitialized",
521-
"-Wno-shadow",
522-
523-
# see https://github.com/project-chip/connectedhomeip/issues/26058
524-
"-Wno-error=array-parameter",
525-
526-
# see https://github.com/project-chip/connectedhomeip/issues/26170
527-
"-Wno-error=array-bounds",
528-
]
519+
cflags += [ "-Wno-shadow" ]
529520

530521
if (silabs_family == "efr32mg24" || silabs_family == "mgm24") {
531522
cflags += [ "-mcmse" ]

0 commit comments

Comments
 (0)