From 202758f40087c506f014e5217273834cf256c151 Mon Sep 17 00:00:00 2001 From: Gunar Schorcht Date: Fri, 16 Aug 2019 15:45:16 +0200 Subject: [PATCH] cpu/esp32/esp_wifi: changes for wpa_supplicant in WPA2 Enterprise mode `nvs_flash` functions have to be set to 0 if module `esp_idf_nvs_flash` is not enabled. Otherwise wpa_supplicant will crash in WPA2 Enterprise mode. --- cpu/esp32/include/sdk_conf.h | 4 +++- cpu/esp32/vendor/esp-idf/esp32/wifi_os_adapter.c | 15 +++++++++++++++ 2 files changed, 18 insertions(+), 1 deletion(-) diff --git a/cpu/esp32/include/sdk_conf.h b/cpu/esp32/include/sdk_conf.h index 867cddc171..94d66c1c4c 100644 --- a/cpu/esp32/include/sdk_conf.h +++ b/cpu/esp32/include/sdk_conf.h @@ -157,7 +157,9 @@ extern "C" { #define CONFIG_ESP32_WIFI_CSI_ENABLED 0 #define CONFIG_ESP32_WIFI_TASK_PINNED_TO_CORE_0 1 #define CONFIG_ESP32_WIFI_TASK_PINNED_TO_CORE_1 0 -#define CONFIG_ESP32_WIFI_NVS_ENABLED 0 +#if MODULE_ESP_IDF_NVS_ENABLED +#define CONFIG_ESP32_WIFI_NVS_ENABLED 1 +#endif /** * PHY configuration diff --git a/cpu/esp32/vendor/esp-idf/esp32/wifi_os_adapter.c b/cpu/esp32/vendor/esp-idf/esp32/wifi_os_adapter.c index d4a7fb97ef..e766c300ed 100644 --- a/cpu/esp32/vendor/esp-idf/esp32/wifi_os_adapter.c +++ b/cpu/esp32/vendor/esp-idf/esp32/wifi_os_adapter.c @@ -476,6 +476,7 @@ wifi_osi_funcs_t g_wifi_osi_funcs = { ._periph_module_enable = periph_module_enable, ._periph_module_disable = periph_module_disable, ._esp_timer_get_time = esp_timer_get_time, +#if MODULE_ESP_IDF_NVS_FLASH ._nvs_set_i8 = nvs_set_i8, ._nvs_get_i8 = nvs_get_i8, ._nvs_set_u8 = nvs_set_u8, @@ -488,6 +489,20 @@ wifi_osi_funcs_t g_wifi_osi_funcs = { ._nvs_set_blob = nvs_set_blob, ._nvs_get_blob = nvs_get_blob, ._nvs_erase_key = nvs_erase_key, +#else + ._nvs_set_i8 = NULL, + ._nvs_get_i8 = NULL, + ._nvs_set_u8 = NULL, + ._nvs_get_u8 = NULL, + ._nvs_set_u16 = NULL, + ._nvs_get_u16 = NULL, + ._nvs_open = NULL, + ._nvs_close = NULL, + ._nvs_commit = NULL, + ._nvs_set_blob = NULL, + ._nvs_get_blob = NULL, + ._nvs_erase_key = NULL, +#endif ._get_random = os_get_random, ._get_time = get_time_wrapper, ._random = os_random,