Remove -Wno-format in esp_phy, esp_wifi and part of wpa_supplicat components

This commit is contained in:
muhaidong
2023-03-27 17:33:32 +08:00
parent 149a2cfc5e
commit b6be20a95d
11 changed files with 32 additions and 31 deletions

View File

@@ -112,5 +112,3 @@ if(CONFIG_ESP_PHY_INIT_DATA_IN_PARTITION)
esptool_py_flash_target_image(${phy_name}-flash ${phy_name} "${phy_partition_offset}" "${phy_init_data_bin}") esptool_py_flash_target_image(${phy_name}-flash ${phy_name} "${phy_partition_offset}" "${phy_init_data_bin}")
esptool_py_flash_target_image(flash ${phy_name} "${phy_partition_offset}" "${phy_init_data_bin}") esptool_py_flash_target_image(flash ${phy_name} "${phy_partition_offset}" "${phy_init_data_bin}")
endif() endif()
target_compile_options(${COMPONENT_LIB} PRIVATE "-Wno-format")

View File

@@ -7,6 +7,7 @@
#include <stddef.h> #include <stddef.h>
#include <stdlib.h> #include <stdlib.h>
#include <string.h> #include <string.h>
#include <inttypes.h>
#include <stdbool.h> #include <stdbool.h>
#include <sys/lock.h> #include <sys/lock.h>
@@ -426,7 +427,7 @@ const esp_phy_init_data_t* esp_phy_get_init_data(void)
ESP_LOGE(TAG, "PHY data partition not found"); ESP_LOGE(TAG, "PHY data partition not found");
return NULL; return NULL;
} }
ESP_LOGD(TAG, "loading PHY init data from partition at offset 0x%x", partition->address); ESP_LOGD(TAG, "loading PHY init data from partition at offset 0x%" PRIx32 "", partition->address);
size_t init_data_store_length = sizeof(phy_init_magic_pre) + size_t init_data_store_length = sizeof(phy_init_magic_pre) +
sizeof(esp_phy_init_data_t) + sizeof(phy_init_magic_post); sizeof(esp_phy_init_data_t) + sizeof(phy_init_magic_post);
uint8_t* init_data_store = (uint8_t*) malloc(init_data_store_length); uint8_t* init_data_store = (uint8_t*) malloc(init_data_store_length);
@@ -593,9 +594,9 @@ static esp_err_t load_cal_data_from_nvs_handle(nvs_handle_t handle,
return err; return err;
} }
uint32_t cal_format_version = phy_get_rf_cal_version() & (~BIT(16)); uint32_t cal_format_version = phy_get_rf_cal_version() & (~BIT(16));
ESP_LOGV(TAG, "phy_get_rf_cal_version: %d\n", cal_format_version); ESP_LOGV(TAG, "phy_get_rf_cal_version: %" PRId32 "\n", cal_format_version);
if (cal_data_version != cal_format_version) { if (cal_data_version != cal_format_version) {
ESP_LOGD(TAG, "%s: expected calibration data format %d, found %d", ESP_LOGD(TAG, "%s: expected calibration data format %" PRId32 ", found %" PRId32 "",
__func__, cal_format_version, cal_data_version); __func__, cal_format_version, cal_data_version);
return ESP_FAIL; return ESP_FAIL;
} }
@@ -651,7 +652,7 @@ static esp_err_t store_cal_data_to_nvs_handle(nvs_handle_t handle,
} }
uint32_t cal_format_version = phy_get_rf_cal_version() & (~BIT(16)); uint32_t cal_format_version = phy_get_rf_cal_version() & (~BIT(16));
ESP_LOGV(TAG, "phy_get_rf_cal_version: %d\n", cal_format_version); ESP_LOGV(TAG, "phy_get_rf_cal_version: %" PRId32 "\n", cal_format_version);
err = nvs_set_u32(handle, PHY_CAL_VERSION_KEY, cal_format_version); err = nvs_set_u32(handle, PHY_CAL_VERSION_KEY, cal_format_version);
if (err != ESP_OK) { if (err != ESP_OK) {
ESP_LOGE(TAG, "%s: store calibration version failed(0x%x)\n", __func__, err); ESP_LOGE(TAG, "%s: store calibration version failed(0x%x)\n", __func__, err);

View File

@@ -2,4 +2,3 @@ idf_component_register(SRC_DIRS .
PRIV_INCLUDE_DIRS . ${CMAKE_CURRENT_BINARY_DIR} PRIV_INCLUDE_DIRS . ${CMAKE_CURRENT_BINARY_DIR}
PRIV_REQUIRES cmock test_utils nvs_flash ulp esp_common esp_phy esp_wifi PRIV_REQUIRES cmock test_utils nvs_flash ulp esp_common esp_phy esp_wifi
) )
target_compile_options(${COMPONENT_LIB} PRIVATE "-Wno-format")

View File

@@ -58,5 +58,4 @@ if(CONFIG_ESP32_WIFI_ENABLED)
endforeach() endforeach()
endif() endif()
target_compile_options(${COMPONENT_LIB} PRIVATE "-Wno-format")
endif() endif()

View File

@@ -10,6 +10,7 @@
#include "esp_private/wifi.h" #include "esp_private/wifi.h"
#include "esp_wifi_netif.h" #include "esp_wifi_netif.h"
#include <string.h> #include <string.h>
#include <inttypes.h>
// //
// Purpose of this module is to provide basic wifi initialization setup for // Purpose of this module is to provide basic wifi initialization setup for
@@ -34,7 +35,7 @@ static void wifi_start(void *esp_netif, esp_event_base_t base, int32_t event_id,
uint8_t mac[6]; uint8_t mac[6];
esp_err_t ret; esp_err_t ret;
ESP_LOGD(TAG, "%s esp-netif:%p event-id%d", __func__, esp_netif, event_id); ESP_LOGD(TAG, "%s esp-netif:%p event-id%" PRId32 "", __func__, esp_netif, event_id);
wifi_netif_driver_t driver = esp_netif_get_io_driver(esp_netif); wifi_netif_driver_t driver = esp_netif_get_io_driver(esp_netif);

View File

@@ -5,7 +5,7 @@
*/ */
#include <string.h> #include <string.h>
#include <inttypes.h>
#include "esp_err.h" #include "esp_err.h"
#include "utils/includes.h" #include "utils/includes.h"
@@ -199,7 +199,7 @@ void wpa2_task(void *pvParameters )
if(sm->wpa2_sig_cnt[e->sig]) { if(sm->wpa2_sig_cnt[e->sig]) {
sm->wpa2_sig_cnt[e->sig]--; sm->wpa2_sig_cnt[e->sig]--;
} else { } else {
wpa_printf(MSG_ERROR, "wpa2_task: invalid sig cnt, sig=%d cnt=%d", e->sig, sm->wpa2_sig_cnt[e->sig]); wpa_printf(MSG_ERROR, "wpa2_task: invalid sig cnt, sig=%" PRId32 " cnt=%d", e->sig, sm->wpa2_sig_cnt[e->sig]);
} }
DATA_MUTEX_GIVE(); DATA_MUTEX_GIVE();
} }
@@ -230,7 +230,7 @@ void wpa2_task(void *pvParameters )
break; break;
} else { } else {
if (s_wifi_wpa2_sync_sem) { if (s_wifi_wpa2_sync_sem) {
wpa_printf(MSG_DEBUG, "WPA2: wifi->wpa2 api completed sig(%d)", e->sig); wpa_printf(MSG_DEBUG, "WPA2: wifi->wpa2 api completed sig(%" PRId32 ")", e->sig);
os_semphr_give(s_wifi_wpa2_sync_sem); os_semphr_give(s_wifi_wpa2_sync_sem);
} else { } else {
wpa_printf(MSG_ERROR, "WPA2: null wifi->wpa2 sync sem"); wpa_printf(MSG_ERROR, "WPA2: null wifi->wpa2 sync sem");
@@ -243,7 +243,7 @@ void wpa2_task(void *pvParameters )
wpa_printf(MSG_DEBUG, "WPA2: task deleted"); wpa_printf(MSG_DEBUG, "WPA2: task deleted");
s_wpa2_queue = NULL; s_wpa2_queue = NULL;
if (s_wifi_wpa2_sync_sem) { if (s_wifi_wpa2_sync_sem) {
wpa_printf(MSG_DEBUG, "WPA2: wifi->wpa2 api completed sig(%d)", e->sig); wpa_printf(MSG_DEBUG, "WPA2: wifi->wpa2 api completed sig(%" PRId32 ")", e->sig);
os_semphr_give(s_wifi_wpa2_sync_sem); os_semphr_give(s_wifi_wpa2_sync_sem);
} else { } else {
wpa_printf(MSG_ERROR, "WPA2: null wifi->wpa2 sync sem"); wpa_printf(MSG_ERROR, "WPA2: null wifi->wpa2 sync sem");
@@ -385,10 +385,10 @@ int eap_sm_process_request(struct eap_sm *sm, struct wpabuf *reqData)
} }
if (!eap_sm_allowMethod(sm, reqVendor, reqVendorMethod)) { if (!eap_sm_allowMethod(sm, reqVendor, reqVendorMethod)) {
wpa_printf(MSG_DEBUG, "EAP: vendor %u method %u not allowed", wpa_printf(MSG_DEBUG, "EAP: vendor %" PRIu32 " method %" PRIu32 " not allowed",
reqVendor, reqVendorMethod); reqVendor, reqVendorMethod);
wpa_msg(sm->msg_ctx, MSG_INFO, WPA_EVENT_EAP_PROPOSED_METHOD wpa_msg(sm->msg_ctx, MSG_INFO, WPA_EVENT_EAP_PROPOSED_METHOD
"vendor=%u method=%u -> NAK", "vendor=%" PRIu32 " method=%" PRIu32 " -> NAK",
reqVendor, reqVendorMethod); reqVendor, reqVendorMethod);
goto build_nak; goto build_nak;
} }
@@ -538,7 +538,7 @@ static int eap_sm_rx_eapol_internal(u8 *src_addr, u8 *buf, u32 len, uint8_t *bss
data_len = plen + sizeof(*hdr); data_len = plen + sizeof(*hdr);
#ifdef DEBUG_PRINT #ifdef DEBUG_PRINT
wpa_printf(MSG_DEBUG, "IEEE 802.1X RX: version=%d type=%d length=%d\n", wpa_printf(MSG_DEBUG, "IEEE 802.1X RX: version=%d type=%d length=%" PRId32 "",
hdr->version, hdr->type, plen); hdr->version, hdr->type, plen);
#endif #endif
if (hdr->version < EAPOL_VERSION) { if (hdr->version < EAPOL_VERSION) {

View File

@@ -10,6 +10,7 @@
#include "common/ieee802_11_defs.h" #include "common/ieee802_11_defs.h"
#include "esp_wifi_driver.h" #include "esp_wifi_driver.h"
#include "rsn_supp/wpa.h" #include "rsn_supp/wpa.h"
#include <inttypes.h>
static struct sae_pt *g_sae_pt; static struct sae_pt *g_sae_pt;
static struct sae_data g_sae_data; static struct sae_data g_sae_data;
@@ -246,7 +247,7 @@ static int wpa3_parse_sae_msg(u8 *buf, size_t len, u32 sae_msg_type, u16 status)
esp_wpa3_free_sae_data(); esp_wpa3_free_sae_data();
break; break;
default: default:
wpa_printf(MSG_ERROR, "wpa3: Invalid SAE msg type(%d)!", sae_msg_type); wpa_printf(MSG_ERROR, "wpa3: Invalid SAE msg type(%" PRId32 ")!", sae_msg_type);
ret = ESP_FAIL; ret = ESP_FAIL;
break; break;
} }

View File

@@ -5,6 +5,7 @@
*/ */
#include <string.h> #include <string.h>
#include <inttypes.h>
#include "utils/includes.h" #include "utils/includes.h"
#include "common.h" #include "common.h"
@@ -147,12 +148,12 @@ void wps_task(void *pvParameters )
if (s_wps_sig_cnt[e->sig]) { if (s_wps_sig_cnt[e->sig]) {
s_wps_sig_cnt[e->sig]--; s_wps_sig_cnt[e->sig]--;
} else { } else {
wpa_printf(MSG_ERROR, "wpsT: invalid sig cnt, sig=%d cnt=%d", e->sig, s_wps_sig_cnt[e->sig]); wpa_printf(MSG_ERROR, "wpsT: invalid sig cnt, sig=%" PRId32 " cnt=%d", e->sig, s_wps_sig_cnt[e->sig]);
} }
DATA_MUTEX_GIVE(); DATA_MUTEX_GIVE();
} }
wpa_printf(MSG_DEBUG, "wpsT: rx sig=%d", e->sig); wpa_printf(MSG_DEBUG, "wpsT: rx sig=%" PRId32 "", e->sig);
switch (e->sig) { switch (e->sig) {
case SIG_WPS_ENABLE: case SIG_WPS_ENABLE:
@@ -160,7 +161,7 @@ void wps_task(void *pvParameters )
case SIG_WPS_START: case SIG_WPS_START:
param = (wps_ioctl_param_t *)e->par; param = (wps_ioctl_param_t *)e->par;
if (!param) { if (!param) {
wpa_printf(MSG_ERROR, "wpsT: invalid param sig=%d", e->sig); wpa_printf(MSG_ERROR, "wpsT: invalid param sig=%" PRId32 "", e->sig);
os_semphr_give(s_wps_api_sem); os_semphr_give(s_wps_api_sem);
break; break;
} }
@@ -209,7 +210,7 @@ void wps_task(void *pvParameters )
break; break;
default: default:
wpa_printf(MSG_ERROR, "wpsT: invalid sig=%d", e->sig); wpa_printf(MSG_ERROR, "wpsT: invalid sig=%" PRId32 "", e->sig);
break; break;
} }
os_free(e); os_free(e);
@@ -228,11 +229,11 @@ void wps_task(void *pvParameters )
*/ */
int wps_post(uint32_t sig, uint32_t par) int wps_post(uint32_t sig, uint32_t par)
{ {
wpa_printf(MSG_DEBUG, "wps post: sig=%d cnt=%d", sig, s_wps_sig_cnt[sig]); wpa_printf(MSG_DEBUG, "wps post: sig=%" PRId32 " cnt=%d", sig, s_wps_sig_cnt[sig]);
DATA_MUTEX_TAKE(); DATA_MUTEX_TAKE();
if (s_wps_sig_cnt[sig]) { if (s_wps_sig_cnt[sig]) {
wpa_printf(MSG_DEBUG, "wps post: sig=%d processing", sig); wpa_printf(MSG_DEBUG, "wps post: sig=%" PRId32 " processing", sig);
DATA_MUTEX_GIVE(); DATA_MUTEX_GIVE();
return ESP_OK; return ESP_OK;
} else { } else {
@@ -866,13 +867,13 @@ int wps_start_msg_timer(void)
if (sm->wps->state == WPS_FINISHED) { if (sm->wps->state == WPS_FINISHED) {
msg_timeout = 100; msg_timeout = 100;
wpa_printf(MSG_DEBUG, "start msg timer WPS_FINISHED %d ms", msg_timeout); wpa_printf(MSG_DEBUG, "start msg timer WPS_FINISHED %" PRId32 " ms", msg_timeout);
eloop_cancel_timeout(wifi_station_wps_msg_timeout, NULL, NULL); eloop_cancel_timeout(wifi_station_wps_msg_timeout, NULL, NULL);
eloop_register_timeout(0, msg_timeout*1000, wifi_station_wps_msg_timeout, NULL, NULL); eloop_register_timeout(0, msg_timeout*1000, wifi_station_wps_msg_timeout, NULL, NULL);
ret = 0; ret = 0;
} else if (sm->wps->state == RECV_M2) { } else if (sm->wps->state == RECV_M2) {
msg_timeout = 5; msg_timeout = 5;
wpa_printf(MSG_DEBUG, "start msg timer RECV_M2 %d ms", msg_timeout); wpa_printf(MSG_DEBUG, "start msg timer RECV_M2 %" PRId32 " ms", msg_timeout);
eloop_cancel_timeout(wifi_station_wps_msg_timeout, NULL, NULL); eloop_cancel_timeout(wifi_station_wps_msg_timeout, NULL, NULL);
eloop_register_timeout(msg_timeout, 0, wifi_station_wps_msg_timeout, NULL, NULL); eloop_register_timeout(msg_timeout, 0, wifi_station_wps_msg_timeout, NULL, NULL);
ret = 0; ret = 0;
@@ -963,7 +964,7 @@ int wps_sm_rx_eapol_internal(u8 *src_addr, u8 *buf, u32 len)
eap_len = be_to_host16(ehdr->length); eap_len = be_to_host16(ehdr->length);
#ifdef DEBUG_PRINT #ifdef DEBUG_PRINT
wpa_printf(MSG_DEBUG, "IEEE 802.1X RX: version=%d type=%d length=%d", wpa_printf(MSG_DEBUG, "IEEE 802.1X RX: version=%d type=%d length=%" PRId32 "",
hdr->version, hdr->type, plen); hdr->version, hdr->type, plen);
#endif #endif
@@ -1033,7 +1034,7 @@ int wps_sm_rx_eapol_internal(u8 *src_addr, u8 *buf, u32 len)
eloop_register_timeout(3, 0, wifi_station_wps_eapol_start_handle, NULL, NULL); eloop_register_timeout(3, 0, wifi_station_wps_eapol_start_handle, NULL, NULL);
break; break;
case EAP_TYPE_EXPANDED: case EAP_TYPE_EXPANDED:
wpa_printf(MSG_DEBUG, "=========expanded plen[%d], %d===========", plen, sizeof(*ehdr)); wpa_printf(MSG_DEBUG, "=========expanded plen[%" PRId32 "], %d===========", plen, sizeof(*ehdr));
if (ehdr->identifier == sm->current_identifier) { if (ehdr->identifier == sm->current_identifier) {
ret = 0; ret = 0;
wpa_printf(MSG_DEBUG, "wps: ignore overlap identifier"); wpa_printf(MSG_DEBUG, "wps: ignore overlap identifier");

View File

@@ -2,7 +2,6 @@ idf_component_register(SRC_DIRS "."
PRIV_INCLUDE_DIRS "." "${CMAKE_CURRENT_BINARY_DIR}" PRIV_INCLUDE_DIRS "." "${CMAKE_CURRENT_BINARY_DIR}"
PRIV_INCLUDE_DIRS "../src" "../esp_supplicant/src" PRIV_INCLUDE_DIRS "../src" "../esp_supplicant/src"
PRIV_REQUIRES cmock esp_common test_utils wpa_supplicant mbedtls esp_wifi esp_event) PRIV_REQUIRES cmock esp_common test_utils wpa_supplicant mbedtls esp_wifi esp_event)
target_compile_options(${COMPONENT_LIB} PRIVATE "-Wno-format")
idf_component_get_property(esp_supplicant_dir wpa_supplicant COMPONENT_DIR) idf_component_get_property(esp_supplicant_dir wpa_supplicant COMPONENT_DIR)

View File

@@ -1,9 +1,10 @@
/* /*
* SPDX-FileCopyrightText: 2022 Espressif Systems (Shanghai) CO LTD * SPDX-FileCopyrightText: 2022-2023 Espressif Systems (Shanghai) CO LTD
* *
* SPDX-License-Identifier: Unlicense OR CC0-1.0 * SPDX-License-Identifier: Unlicense OR CC0-1.0
*/ */
#include "string.h" #include "string.h"
#include <inttypes.h>
#include "esp_system.h" #include "esp_system.h"
#include "unity.h" #include "unity.h"
#include "esp_system.h" #include "esp_system.h"
@@ -45,7 +46,7 @@ void callback(void *a, void *b)
} }
t++; t++;
ESP_LOGI("Eloop Test", "timer[%d] ran after %d msec of scheduled time", ESP_LOGI("Eloop Test", "timer[%d] ran after %" PRId32 " msec of scheduled time",
*i, ms_diff); *i, ms_diff);
} }

View File

@@ -11,6 +11,7 @@
*/ */
#include "string.h" #include "string.h"
#include <inttypes.h>
#include "esp_system.h" #include "esp_system.h"
#include "unity.h" #include "unity.h"
#include "esp_system.h" #include "esp_system.h"
@@ -135,7 +136,7 @@ void esp_send_action_frame(uint8_t *dest_mac, const uint8_t *buf, uint32_t len,
req->rx_cb = dummy_rx_action; req->rx_cb = dummy_rx_action;
memcpy(req->data, buf, req->data_len); memcpy(req->data, buf, req->data_len);
ESP_LOGI(TAG, "Action Tx - MAC:" MACSTR ", Channel-%d, WaitT-%d", ESP_LOGI(TAG, "Action Tx - MAC:" MACSTR ", Channel-%d, WaitT-%" PRId32 "",
MAC2STR(dest_mac), channel, wait_time_ms); MAC2STR(dest_mac), channel, wait_time_ms);
TEST_ESP_OK(esp_wifi_action_tx_req(WIFI_OFFCHAN_TX_REQ, channel, wait_time_ms, req)); TEST_ESP_OK(esp_wifi_action_tx_req(WIFI_OFFCHAN_TX_REQ, channel, wait_time_ms, req));