From ea8d6318af7a477fdfb5b33fedf79f326a564d70 Mon Sep 17 00:00:00 2001 From: morris Date: Mon, 24 Feb 2020 11:15:36 +0800 Subject: [PATCH 1/4] add SOC_EMAC_SUPPORTED in soc_caps.h --- components/esp_eth/test/test_emac.c | 5 +++-- components/soc/soc/esp32/include/soc/soc_caps.h | 1 + 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/components/esp_eth/test/test_emac.c b/components/esp_eth/test/test_emac.c index b724c06eb3..2771cc01d9 100644 --- a/components/esp_eth/test/test_emac.c +++ b/components/esp_eth/test/test_emac.c @@ -14,8 +14,9 @@ #include "lwip/sockets.h" #include "ping/ping_sock.h" #include "esp32/rom/md5_hash.h" +#include "soc/soc_caps.h" -#if !TEMPORARY_DISABLED_FOR_TARGETS(ESP32S2) +#if SOC_EMAC_SUPPORTED static const char *TAG = "esp32_eth_test"; @@ -503,4 +504,4 @@ TEST_CASE("esp32 ethernet download test", "[ethernet][test_env=UT_T2_Ethernet][t vEventGroupDelete(eth_event_group); } -#endif \ No newline at end of file +#endif // SOC_EMAC_SUPPORTED \ No newline at end of file diff --git a/components/soc/soc/esp32/include/soc/soc_caps.h b/components/soc/soc/esp32/include/soc/soc_caps.h index bbc8e8f19f..283c7ae0c7 100644 --- a/components/soc/soc/esp32/include/soc/soc_caps.h +++ b/components/soc/soc/esp32/include/soc/soc_caps.h @@ -10,3 +10,4 @@ #define SOC_BT_SUPPORTED 1 #define SOC_SDIO_SLAVE_SUPPORTED 1 #define SOC_CAN_SUPPORTED 1 +#define SOC_EMAC_SUPPORTED 1 From da6742b91f195e74389b7263805c5f3eb8435b63 Mon Sep 17 00:00:00 2001 From: morris Date: Mon, 24 Feb 2020 11:59:25 +0800 Subject: [PATCH 2/4] resume iperf example on esp32s2 --- examples/ethernet/iperf/CMakeLists.txt | 1 - 1 file changed, 1 deletion(-) diff --git a/examples/ethernet/iperf/CMakeLists.txt b/examples/ethernet/iperf/CMakeLists.txt index a5952c9125..9433ad87ae 100644 --- a/examples/ethernet/iperf/CMakeLists.txt +++ b/examples/ethernet/iperf/CMakeLists.txt @@ -5,6 +5,5 @@ cmake_minimum_required(VERSION 3.5) set(EXTRA_COMPONENT_DIRS $ENV{IDF_PATH}/examples/system/console/components $ENV{IDF_PATH}/examples/wifi/iperf/components) -set(SUPPORTED_TARGETS esp32) include($ENV{IDF_PATH}/tools/cmake/project.cmake) project(ethernet_iperf) From 237f6448d37a2d206e419d1b7a01948ca59ee935 Mon Sep 17 00:00:00 2001 From: morris Date: Mon, 24 Feb 2020 12:02:18 +0800 Subject: [PATCH 3/4] resume pppos example on esp32s2 --- examples/protocols/pppos_client/CMakeLists.txt | 1 - 1 file changed, 1 deletion(-) diff --git a/examples/protocols/pppos_client/CMakeLists.txt b/examples/protocols/pppos_client/CMakeLists.txt index 048c790928..9609525782 100644 --- a/examples/protocols/pppos_client/CMakeLists.txt +++ b/examples/protocols/pppos_client/CMakeLists.txt @@ -2,6 +2,5 @@ # in this exact order for cmake to work correctly cmake_minimum_required(VERSION 3.5) -set(SUPPORTED_TARGETS esp32) include($ENV{IDF_PATH}/tools/cmake/project.cmake) project(pppos_client) From 2227e2505bc63e0a6189bfde638a8203f454b539 Mon Sep 17 00:00:00 2001 From: morris Date: Mon, 24 Feb 2020 14:03:25 +0800 Subject: [PATCH 4/4] resume wifi init test on esp32s2 --- components/esp_wifi/test/test_wifi_init.c | 59 +++++++++++------------ 1 file changed, 29 insertions(+), 30 deletions(-) diff --git a/components/esp_wifi/test/test_wifi_init.c b/components/esp_wifi/test/test_wifi_init.c index 7350b37305..8195f9c8dc 100644 --- a/components/esp_wifi/test/test_wifi_init.c +++ b/components/esp_wifi/test/test_wifi_init.c @@ -13,7 +13,6 @@ #define EVENT_HANDLER_FLAG_DO_NOT_AUTO_RECONNECT 0x00000001 #define EMPH_STR(s) "****** "s" ******" -#if !TEMPORARY_DISABLED_FOR_TARGETS(ESP32S2) static const char* TAG = "test_wifi_init"; static uint32_t wifi_event_handler_flag; static EventGroupHandle_t wifi_events; @@ -67,11 +66,18 @@ static esp_err_t event_init(void) return ESP_OK; } +static esp_err_t event_deinit(void) +{ + ESP_ERROR_CHECK(esp_event_handler_unregister(WIFI_EVENT,ESP_EVENT_ANY_ID,&wifi_event_handler)); + ESP_ERROR_CHECK(esp_event_handler_unregister(IP_EVENT,ESP_EVENT_ANY_ID,&ip_event_handler)); + ESP_ERROR_CHECK(esp_event_loop_delete_default()); + return ESP_OK; +} + static void wifi_driver_can_start_on_APP_CPU_task(void* arg) { SemaphoreHandle_t *sema = (SemaphoreHandle_t *) arg; wifi_init_config_t cfg = WIFI_INIT_CONFIG_DEFAULT(); - //init nvs ESP_LOGI(TAG, EMPH_STR("nvs_flash_init")); esp_err_t r = nvs_flash_init(); if (r == ESP_ERR_NVS_NO_FREE_PAGES || r == ESP_ERR_NVS_NEW_VERSION_FOUND) { @@ -80,18 +86,18 @@ static void wifi_driver_can_start_on_APP_CPU_task(void* arg) r = nvs_flash_init(); } TEST_ESP_OK(r); - //init event loop ESP_LOGI(TAG, EMPH_STR("event_init")); - event_init(); - unity_reset_leak_checks(); + TEST_ESP_OK(event_init()); ESP_LOGI(TAG, EMPH_STR("esp_wifi_init")); TEST_ESP_OK(esp_wifi_init(&cfg)); ESP_LOGI(TAG, EMPH_STR("esp_wifi_deinit...")); TEST_ESP_OK(esp_wifi_deinit()); + ESP_LOGI(TAG, EMPH_STR("event_deinit")); + TEST_ESP_OK(event_deinit()); ESP_LOGI(TAG, EMPH_STR("nvs_flash_deinit...")); - nvs_flash_deinit(); - ESP_LOGI(TAG, "test passed..."); + TEST_ESP_OK(nvs_flash_deinit()); xSemaphoreGive(*sema); + ESP_LOGI(TAG, "exit task..."); vTaskDelete(NULL); } @@ -108,14 +114,12 @@ TEST_CASE("wifi driver can start on APP CPU", "[wifi_init]") xSemaphoreTake(sema, portMAX_DELAY); vSemaphoreDelete(sema); sema = NULL; - TEST_IGNORE_MESSAGE("this test case is ignored due to the event_loop."); } static void wifi_start_stop_task(void* arg) { SemaphoreHandle_t *sema = (SemaphoreHandle_t *) arg; wifi_init_config_t cfg = WIFI_INIT_CONFIG_DEFAULT(); - //init nvs ESP_LOGI(TAG, EMPH_STR("nvs_flash_init")); esp_err_t r = nvs_flash_init(); if (r == ESP_ERR_NVS_NO_FREE_PAGES || r == ESP_ERR_NVS_NEW_VERSION_FOUND) { @@ -125,22 +129,21 @@ static void wifi_start_stop_task(void* arg) } TEST_ESP_OK(r); //init tcpip stack - ESP_LOGI(TAG, EMPH_STR("esp_netif_init")); - esp_netif_init(); - //init event loop + test_case_uses_tcpip(); ESP_LOGI(TAG, EMPH_STR("event_init")); - event_init(); - unity_reset_leak_checks(); + TEST_ESP_OK(event_init()); ESP_LOGI(TAG, EMPH_STR("esp_wifi_init")); - TEST_ASSERT(esp_wifi_init(&cfg) == ESP_OK); + TEST_ESP_OK(esp_wifi_init(&cfg)); ESP_LOGI(TAG, EMPH_STR("esp_wifi_start")); - TEST_ASSERT(esp_wifi_start() == ESP_OK); + TEST_ESP_OK(esp_wifi_start()); ESP_LOGI(TAG, EMPH_STR("esp_wifi_stop")); - TEST_ASSERT(esp_wifi_stop() == ESP_OK); + TEST_ESP_OK(esp_wifi_stop()); ESP_LOGI(TAG, EMPH_STR("esp_wifi_stop")); - TEST_ASSERT(esp_wifi_stop() == ESP_OK); + TEST_ESP_OK(esp_wifi_stop()); ESP_LOGI(TAG, EMPH_STR("esp_wifi_deinit")); - TEST_ASSERT(esp_wifi_deinit() == ESP_OK); + TEST_ESP_OK(esp_wifi_deinit()); + ESP_LOGI(TAG, EMPH_STR("event_deinit")); + TEST_ESP_OK(event_deinit()); ESP_LOGI(TAG, EMPH_STR("nvs_flash_deinit...")); nvs_flash_deinit(); ESP_LOGI(TAG, "test passed..."); @@ -161,14 +164,12 @@ TEST_CASE("Calling esp_wifi_stop() with start", "[wifi_init]") xSemaphoreTake(sema, portMAX_DELAY); vSemaphoreDelete(sema); sema = NULL; - TEST_IGNORE_MESSAGE("this test case is ignored due to the critical memory leak of tcpip_adapter and event_loop."); } static void wifi_stop_task(void* arg) { SemaphoreHandle_t *sema = (SemaphoreHandle_t *) arg; wifi_init_config_t cfg = WIFI_INIT_CONFIG_DEFAULT(); - //init nvs ESP_LOGI(TAG, EMPH_STR("nvs_flash_init")); esp_err_t r = nvs_flash_init(); if (r == ESP_ERR_NVS_NO_FREE_PAGES || r == ESP_ERR_NVS_NEW_VERSION_FOUND) { @@ -177,18 +178,18 @@ static void wifi_stop_task(void* arg) r = nvs_flash_init(); } TEST_ESP_OK(r); - //init event loop ESP_LOGI(TAG, EMPH_STR("event_init")); - event_init(); - unity_reset_leak_checks(); + TEST_ESP_OK(event_init()); ESP_LOGI(TAG, EMPH_STR("esp_wifi_init")); - TEST_ASSERT(esp_wifi_init(&cfg) == ESP_OK); + TEST_ESP_OK(esp_wifi_init(&cfg)); ESP_LOGI(TAG, EMPH_STR("esp_wifi_stop")); - TEST_ASSERT(esp_wifi_stop() == ESP_OK); + TEST_ESP_OK(esp_wifi_stop()); ESP_LOGI(TAG, EMPH_STR("esp_wifi_stop")); - TEST_ASSERT(esp_wifi_stop() == ESP_OK); + TEST_ESP_OK(esp_wifi_stop()); ESP_LOGI(TAG, EMPH_STR("esp_wifi_deinit")); - TEST_ASSERT(esp_wifi_deinit() == ESP_OK); + TEST_ESP_OK(esp_wifi_deinit()); + ESP_LOGI(TAG, EMPH_STR("event_deinit")); + TEST_ESP_OK(event_deinit()); ESP_LOGI(TAG, EMPH_STR("nvs_flash_deinit...")); nvs_flash_deinit(); ESP_LOGI(TAG, "test passed..."); @@ -209,6 +210,4 @@ TEST_CASE("Calling esp_wifi_stop() without start", "[wifi_init]") xSemaphoreTake(sema, portMAX_DELAY); vSemaphoreDelete(sema); sema = NULL; - TEST_IGNORE_MESSAGE("this test case is ignored due to the event_loop."); } -#endif //!TEMPORARY_DISABLED_FOR_TARGETS(ESP32S2)