Эх сурвалжийг харах

esp_phy: add phy multi init data bin test app

chenjianxing 4 жил өмнө
parent
commit
94c81b71b1

+ 6 - 0
tools/test_apps/phy/phy_multi_init_data_test/CMakeLists.txt

@@ -0,0 +1,6 @@
+# The following lines of boilerplate have to be in your project's
+# CMakeLists in this exact order for cmake to work correctly
+cmake_minimum_required(VERSION 3.5)
+
+include($ENV{IDF_PATH}/tools/cmake/project.cmake)
+project(phy_multi_init_data_test)

+ 33 - 0
tools/test_apps/phy/phy_multi_init_data_test/app_test.py

@@ -0,0 +1,33 @@
+#!/usr/bin/env python
+# SPDX-FileCopyrightText: 2021 Espressif Systems (Shanghai) CO LTD
+# SPDX-License-Identifier: Apache-2.0
+import glob
+import os
+
+import tiny_test_fw
+import ttfw_idf
+from tiny_test_fw import Utility
+
+
+@ttfw_idf.idf_custom_test(env_tag='Example_GENERIC', group='test-apps')
+def test_phy_multi_init_data_bin(env, _):
+    # type: (tiny_test_fw.Env.Env, None) -> None
+    config_files = glob.glob(os.path.join(os.path.dirname(__file__), 'sdkconfig.ci.*'))
+    config_names = [os.path.basename(s).replace('sdkconfig.ci.', '') for s in config_files]
+    for name in config_names:
+        dut = env.get_dut('phy_multi_init_data_test', 'tools/test_apps/phy/phy_multi_init_data_test',app_config_name=name)
+        dut.start_app()
+
+        if 'CONFIG_ESP_PHY_MULTIPLE_INIT_DATA_BIN_EMBED' in dut.app.get_sdkconfig().keys():
+            Utility.console_log('multi init data bin embed test')
+            dut.expect('load embedded multi phy init data')
+        else:
+            Utility.console_log('multi init data bin test')
+            dut.expect('Support multiple PHY init data bins')
+
+        dut.expect('wifi_init finished')
+        Utility.console_log('Test Success')
+
+
+if __name__ == '__main__':
+    test_phy_multi_init_data_bin()

+ 2 - 0
tools/test_apps/phy/phy_multi_init_data_test/main/CMakeLists.txt

@@ -0,0 +1,2 @@
+idf_component_register(SRCS "phy_init_data_main.c"
+                    INCLUDE_DIRS ".")

+ 55 - 0
tools/test_apps/phy/phy_multi_init_data_test/main/phy_init_data_main.c

@@ -0,0 +1,55 @@
+/*
+ * SPDX-FileCopyrightText: 2021 Espressif Systems (Shanghai) CO LTD
+ *
+ * SPDX-License-Identifier: Apache-2.0
+ */
+/* test phy init data bin options
+
+   This example code is in the Public Domain (or CC0 licensed, at your option.)
+
+   Unless required by applicable law or agreed to in writing, this
+   software is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
+   CONDITIONS OF ANY KIND, either express or implied.
+*/
+#include <string.h>
+#include "freertos/FreeRTOS.h"
+#include "freertos/task.h"
+#include "freertos/event_groups.h"
+#include "esp_system.h"
+#include "esp_wifi.h"
+#include "esp_event.h"
+#include "esp_log.h"
+#include "nvs_flash.h"
+
+static const char *TAG = "phy init";
+static EventGroupHandle_t s_wifi_event_group;
+
+void wifi_init(void)
+{
+    s_wifi_event_group = xEventGroupCreate();
+
+    ESP_ERROR_CHECK(esp_netif_init());
+
+    ESP_ERROR_CHECK(esp_event_loop_create_default());
+    esp_netif_create_default_wifi_sta();
+
+    wifi_init_config_t cfg = WIFI_INIT_CONFIG_DEFAULT();
+    ESP_ERROR_CHECK(esp_wifi_init(&cfg));
+    ESP_ERROR_CHECK(esp_wifi_set_mode(WIFI_MODE_STA) );
+    ESP_ERROR_CHECK(esp_wifi_start() );
+
+    ESP_LOGI(TAG, "wifi_init finished.");
+}
+
+void app_main(void)
+{
+    //Initialize NVS
+    esp_err_t ret = nvs_flash_init();
+    if (ret == ESP_ERR_NVS_NO_FREE_PAGES || ret == ESP_ERR_NVS_NEW_VERSION_FOUND) {
+      ESP_ERROR_CHECK(nvs_flash_erase());
+      ret = nvs_flash_init();
+    }
+    ESP_ERROR_CHECK(ret);
+
+    wifi_init();
+}

+ 3 - 0
tools/test_apps/phy/phy_multi_init_data_test/sdkconfig.ci.phy_multiple_init_data

@@ -0,0 +1,3 @@
+CONFIG_ESP_PHY_DEFAULT_INIT_IF_INVALID=y
+CONFIG_ESP_PHY_INIT_DATA_IN_PARTITION=y
+CONFIG_ESP_PHY_MULTIPLE_INIT_DATA_BIN=y

+ 4 - 0
tools/test_apps/phy/phy_multi_init_data_test/sdkconfig.ci.phy_multiple_init_data_embed

@@ -0,0 +1,4 @@
+CONFIG_ESP_PHY_DEFAULT_INIT_IF_INVALID=y
+CONFIG_ESP_PHY_INIT_DATA_IN_PARTITION=y
+CONFIG_ESP_PHY_MULTIPLE_INIT_DATA_BIN=y
+CONFIG_ESP_PHY_MULTIPLE_INIT_DATA_BIN_EMBED=y