From c85d949c1fc865d7e079554240be1144237baeb8 Mon Sep 17 00:00:00 2001 From: Marius Vikhammer Date: Fri, 12 Mar 2021 14:05:17 +0800 Subject: [PATCH] ci: run Example_GENERIC for C3 Add support for running example_GENERIC tests for C3 on label. Fix examples that fail. --- .gitlab/ci/dependencies/dependencies.yml | 18 +++++++++++ .gitlab/ci/dependencies/generate_rules.py | 4 +++ .gitlab/ci/rules.yml | 19 +++--------- .gitlab/ci/target-test.yml | 13 ++++++++ components/esp32s3/Kconfig | 30 +++++++++---------- components/esp_hw_support/Kconfig | 6 ---- components/esp_hw_support/mac_addr.c | 10 ++++++- components/esp_system/include/esp_system.h | 2 ++ examples/cxx/exceptions/example_test.py | 4 +-- examples/cxx/pthread/example_test.py | 2 +- examples/cxx/rtti/example_test.py | 4 +-- examples/get-started/blink/example_test.py | 4 +-- .../get-started/hello_world/example_test.py | 2 +- .../asio/ssl_client_server/example_test.py | 2 +- examples/storage/nvs_rw_blob/README.md | 12 ++++---- .../nvs_rw_blob/main/nvs_blob_example_main.c | 14 ++++++--- .../nvs_rw_blob/nvs_rw_blob_example_test.py | 4 +-- .../nvs_rw_value/nvs_rw_value_example_test.py | 2 +- .../nvs_rw_value_cxx_example_test.py | 2 +- .../partition_find_example_test.py | 2 +- .../partition_mmap_example_test.py | 2 +- .../partition_ops_example_test.py | 2 +- examples/storage/parttool/example_test.py | 4 +-- .../storage/spiffs/spiffs_example_test.py | 2 +- examples/storage/spiffsgen/example_test.py | 4 +-- .../wear_levelling_example_test.py | 2 +- .../system/base_mac_address/example_test.py | 2 +- examples/system/console/example_test.py | 2 +- examples/system/deep_sleep/example_test.py | 16 ++++++++-- examples/system/efuse/example_test.py | 2 +- .../default_event_loop/example_test.py | 6 ++-- .../user_event_loops/example_test.py | 4 +-- examples/system/esp_timer/README.md | 12 ++++---- examples/system/esp_timer/example_test.py | 4 +-- .../freertos/real_time_stats/example_test.py | 4 +-- examples/system/light_sleep/README.md | 2 ++ examples/system/light_sleep/example_test.py | 4 +-- examples/system/perfmon/example_test.py | 2 +- examples/system/select/example_test.py | 2 +- examples/system/task_watchdog/example_test.py | 2 +- .../main/task_watchdog_example_main.c | 2 +- examples/system/ulp/example_test.py | 2 +- examples/system/ulp_adc/example_test.py | 2 +- examples/system/unit_test/example_test.py | 2 +- 44 files changed, 145 insertions(+), 99 deletions(-) diff --git a/.gitlab/ci/dependencies/dependencies.yml b/.gitlab/ci/dependencies/dependencies.yml index c11c998d9c..3d48b4d195 100644 --- a/.gitlab/ci/dependencies/dependencies.yml +++ b/.gitlab/ci/dependencies/dependencies.yml @@ -90,6 +90,16 @@ - build_components - build_system +"build:example_test-esp32c3": # esp32c3 test is only run by label, but build jobs should always be triggered + labels: + - build + - example_test + patterns: + - build_components + - build_system + - build-example_test + - example_test + #################### # Target Test Jobs # #################### @@ -138,6 +148,14 @@ included_in: - "build:unit_test-esp32c3" +"test:example_test-esp32c3": # For esp32c3 we trigger only with label + +"labels:example_test-esp32c3": + labels: + - example_test_esp32c3 + included_in: + - "build:example_test-esp32c3" + "test:integration_test": labels: - "integration_test" diff --git a/.gitlab/ci/dependencies/generate_rules.py b/.gitlab/ci/dependencies/generate_rules.py index 7d3ece85b1..11f7746af7 100755 --- a/.gitlab/ci/dependencies/generate_rules.py +++ b/.gitlab/ci/dependencies/generate_rules.py @@ -119,6 +119,8 @@ class RulesWriter: res.update(self._expand_matrix(k, v)) for k, v in self.cfg.items(): + if not v: + continue deploy = v.get('deploy') if deploy: for item in _list(deploy): @@ -147,6 +149,8 @@ class RulesWriter: def expand_rules(self): # type: () -> dict[str, dict[str, list]] res = defaultdict(lambda: defaultdict(set)) # type: dict[str, dict[str, set]] for k, v in self.cfg.items(): + if not v: + continue for vk, vv in v.items(): if vk in self.KEYWORDS: res[k][vk] = set(_list(vv)) diff --git a/.gitlab/ci/rules.yml b/.gitlab/ci/rules.yml index 0e5d14adaf..e9b080f55b 100644 --- a/.gitlab/ci/rules.yml +++ b/.gitlab/ci/rules.yml @@ -602,7 +602,6 @@ - <<: *if-label-custom_test_esp32s3 - <<: *if-label-example_test - <<: *if-label-example_test_esp32 - - <<: *if-label-example_test_esp32c3 - <<: *if-label-example_test_esp32s2 - <<: *if-label-example_test_esp32s3 - <<: *if-label-integration_test @@ -687,6 +686,10 @@ - <<: *if-dev-push changes: *patterns-windows +.rules:labels:example_test-esp32c3: + rules: + - <<: *if-label-example_test_esp32c3 + .rules:labels:fuzzer_test-weekend_test: rules: - <<: *if-label-fuzzer_test @@ -721,7 +724,6 @@ - <<: *if-label-custom_test_esp32s3 - <<: *if-label-example_test - <<: *if-label-example_test_esp32 - - <<: *if-label-example_test_esp32c3 - <<: *if-label-example_test_esp32s2 - <<: *if-label-example_test_esp32s3 - <<: *if-label-host_test @@ -846,18 +848,6 @@ - <<: *if-dev-push changes: *patterns-example_test -.rules:test:example_test-esp32c3: - rules: - - <<: *if-protected - - <<: *if-label-build-only - when: never - - <<: *if-label-example_test - - <<: *if-label-example_test_esp32c3 - - <<: *if-dev-push - changes: *patterns-build-example_test - - <<: *if-dev-push - changes: *patterns-example_test - .rules:test:example_test-esp32s2: rules: - <<: *if-protected @@ -926,7 +916,6 @@ - <<: *if-label-custom_test_esp32s3 - <<: *if-label-example_test - <<: *if-label-example_test_esp32 - - <<: *if-label-example_test_esp32c3 - <<: *if-label-example_test_esp32s2 - <<: *if-label-example_test_esp32s3 - <<: *if-label-integration_test diff --git a/.gitlab/ci/target-test.yml b/.gitlab/ci/target-test.yml index 4a11cf7a3b..5c1eb9de95 100644 --- a/.gitlab/ci/target-test.yml +++ b/.gitlab/ci/target-test.yml @@ -82,6 +82,11 @@ test_weekend_network: - .example_test_template - .rules:test:example_test-esp32s2 +.example_test_esp32c3_template: + extends: + - .example_test_template + - .rules:labels:example_test-esp32c3 + example_test_001A: extends: .example_test_esp32_template parallel: 4 @@ -240,6 +245,14 @@ example_test_017: - ESP32S2 - Example_GENERIC +example_test_C3_GENERIC: + extends: .example_test_esp32c3_template + parallel: 3 + tags: + - ESP32C3 + - Example_GENERIC + + .test_app_template: extends: .target_test_job_template variables: diff --git a/components/esp32s3/Kconfig b/components/esp32s3/Kconfig index 40e6737e0b..0ffeea963c 100644 --- a/components/esp32s3/Kconfig +++ b/components/esp32s3/Kconfig @@ -284,41 +284,39 @@ menu "ESP32S3-Specific" choice ESP32S3_UNIVERSAL_MAC_ADDRESSES bool "Number of universally administered (by IEEE) MAC address" - default ESP32S3_UNIVERSAL_MAC_ADDRESSES_TWO + default ESP32S3_UNIVERSAL_MAC_ADDRESSES_FOUR help Configure the number of universally administered (by IEEE) MAC addresses. During initialization, MAC addresses for each network interface are generated or derived from a single base MAC address. - If the number of universal MAC addresses is Two, all interfaces (WiFi station, WiFi softap) receive a - universally administered MAC address. They are generated sequentially by adding 0, and 1 (respectively) - to the final octet of the base MAC address. If the number of universal MAC addresses is one, - only WiFi station receives a universally administered MAC address. - It's generated by adding 0 to the base MAC address. - The WiFi softap receives local MAC addresses. It's derived from the universal WiFi station MAC addresses. + If the number of universal MAC addresses is four, all four interfaces (WiFi station, WiFi softap, + Bluetooth and Ethernet) receive a universally administered MAC address. These are generated + sequentially by adding 0, 1, 2 and 3 (respectively) to the final octet of the base MAC address. + If the number of universal MAC addresses is two, only two interfaces (WiFi station and Bluetooth) + receive a universally administered MAC address. These are generated sequentially by adding 0 + and 1 (respectively) to the base MAC address. The remaining two interfaces (WiFi softap and Ethernet) + receive local MAC addresses. These are derived from the universal WiFi station and Bluetooth MAC + addresses, respectively. When using the default (Espressif-assigned) base MAC address, either setting can be used. When using a custom universal MAC address range, the correct setting will depend on the allocation of MAC - addresses in this range (either 1 or 2 per device.) + addresses in this range (either 2 or 4 per device.) config ESP32S3_UNIVERSAL_MAC_ADDRESSES_TWO bool "Two" select ESP_MAC_ADDR_UNIVERSE_WIFI_STA select ESP_MAC_ADDR_UNIVERSE_BT - config ESP32S3_UNIVERSAL_MAC_ADDRESSES_THREE - bool "Three" + config ESP32S3_UNIVERSAL_MAC_ADDRESSES_FOUR + bool "Four" select ESP_MAC_ADDR_UNIVERSE_WIFI_STA select ESP_MAC_ADDR_UNIVERSE_WIFI_AP select ESP_MAC_ADDR_UNIVERSE_BT + select ESP_MAC_ADDR_UNIVERSE_ETH endchoice config ESP32S3_UNIVERSAL_MAC_ADDRESSES int default 2 if ESP32S3_UNIVERSAL_MAC_ADDRESSES_TWO - default 3 if ESP32S3_UNIVERSAL_MAC_ADDRESSES_THREE - - config ESP_MAC_ADDR_UNIVERSE_BT_OFFSET - int - default 2 if ESP32S3_UNIVERSAL_MAC_ADDRESSES_THREE - default 1 if ESP32S3_UNIVERSAL_MAC_ADDRESSES_TWO + default 4 if ESP32S3_UNIVERSAL_MAC_ADDRESSES_FOUR config ESP32S3_ULP_COPROC_ENABLED bool "Enable Ultra Low Power (ULP) Coprocessor" diff --git a/components/esp_hw_support/Kconfig b/components/esp_hw_support/Kconfig index e37fb77ec2..797e27c314 100644 --- a/components/esp_hw_support/Kconfig +++ b/components/esp_hw_support/Kconfig @@ -9,12 +9,6 @@ menu "Hardware Settings" config ESP_MAC_ADDR_UNIVERSE_BT bool - config ESP_MAC_ADDR_UNIVERSE_BT_OFFSET - int - default 2 if ESP32_UNIVERSAL_MAC_ADDRESSES_FOUR - default 1 if ESP32_UNIVERSAL_MAC_ADDRESSES_TWO - default 1 - config ESP_MAC_ADDR_UNIVERSE_ETH bool endmenu diff --git a/components/esp_hw_support/mac_addr.c b/components/esp_hw_support/mac_addr.c index 89a5110c16..81540b1129 100644 --- a/components/esp_hw_support/mac_addr.c +++ b/components/esp_hw_support/mac_addr.c @@ -20,6 +20,14 @@ /* esp_system.h APIs relating to MAC addresses */ +#if CONFIG_ESP32_UNIVERSAL_MAC_ADDRESSES_FOUR || \ + CONFIG_ESP32S3_UNIVERSAL_MAC_ADDRESSES_FOUR || \ + CONFIG_ESP32C3_UNIVERSAL_MAC_ADDRESSES_FOUR +#define MAC_ADDR_UNIVERSE_BT_OFFSET 2 +#else +#define MAC_ADDR_UNIVERSE_BT_OFFSET 1 +#endif + static const char* TAG = "system_api"; static uint8_t base_mac_addr[6] = { 0 }; @@ -180,7 +188,7 @@ esp_err_t esp_read_mac(uint8_t* mac, esp_mac_type_t type) case ESP_MAC_BT: #if CONFIG_ESP_MAC_ADDR_UNIVERSE_BT memcpy(mac, efuse_mac, 6); - mac[5] += CONFIG_ESP_MAC_ADDR_UNIVERSE_BT_OFFSET; + mac[5] += MAC_ADDR_UNIVERSE_BT_OFFSET; #endif break; case ESP_MAC_ETH: diff --git a/components/esp_system/include/esp_system.h b/components/esp_system/include/esp_system.h index c251b41635..bd9bb1a6c4 100644 --- a/components/esp_system/include/esp_system.h +++ b/components/esp_system/include/esp_system.h @@ -42,6 +42,8 @@ typedef enum { #define UNIVERSAL_MAC_ADDR_NUM CONFIG_ESP32_UNIVERSAL_MAC_ADDRESSES #elif CONFIG_IDF_TARGET_ESP32S2 #define UNIVERSAL_MAC_ADDR_NUM CONFIG_ESP32S2_UNIVERSAL_MAC_ADDRESSES +#elif CONFIG_IDF_TARGET_ESP32S3 +#define UNIVERSAL_MAC_ADDR_NUM CONFIG_ESP32S3_UNIVERSAL_MAC_ADDRESSES #elif CONFIG_IDF_TARGET_ESP32C3 #define UNIVERSAL_MAC_ADDR_NUM CONFIG_ESP32C3_UNIVERSAL_MAC_ADDRESSES #endif diff --git a/examples/cxx/exceptions/example_test.py b/examples/cxx/exceptions/example_test.py index db3fa60f1e..f7f5c3805e 100644 --- a/examples/cxx/exceptions/example_test.py +++ b/examples/cxx/exceptions/example_test.py @@ -3,9 +3,9 @@ from __future__ import print_function import ttfw_idf -@ttfw_idf.idf_example_test(env_tag='Example_GENERIC') +@ttfw_idf.idf_example_test(env_tag='Example_GENERIC', target=['esp32', 'esp32c3']) def test_examples_system_cpp_exceptions(env, extra_data): - dut = env.get_dut('cpp_exceptions_example', 'examples/cxx/exceptions', dut_class=ttfw_idf.ESP32DUT) + dut = env.get_dut('cpp_exceptions_example', 'examples/cxx/exceptions') # start test dut.start_app() lines = ['app_main starting', diff --git a/examples/cxx/pthread/example_test.py b/examples/cxx/pthread/example_test.py index 82999fdc7a..759beae31e 100644 --- a/examples/cxx/pthread/example_test.py +++ b/examples/cxx/pthread/example_test.py @@ -5,7 +5,7 @@ import re import ttfw_idf -@ttfw_idf.idf_example_test(env_tag='Example_GENERIC') +@ttfw_idf.idf_example_test(env_tag='Example_GENERIC', target=['esp32', 'esp32c3']) def test_examples_cpp_pthread(env, extra_data): dut = env.get_dut('cpp_pthread', 'examples/cxx/pthread') diff --git a/examples/cxx/rtti/example_test.py b/examples/cxx/rtti/example_test.py index bcf64efd51..80aab78c00 100644 --- a/examples/cxx/rtti/example_test.py +++ b/examples/cxx/rtti/example_test.py @@ -3,9 +3,9 @@ from __future__ import print_function import ttfw_idf -@ttfw_idf.idf_example_test(env_tag='Example_GENERIC') +@ttfw_idf.idf_example_test(env_tag='Example_GENERIC', target=['esp32', 'esp32c3']) def test_cpp_rtti_example(env, extra_data): - dut = env.get_dut('cpp_rtti', 'examples/cxx/rtti', dut_class=ttfw_idf.ESP32DUT) + dut = env.get_dut('cpp_rtti', 'examples/cxx/rtti') dut.start_app() dut.expect('Type name of std::cout is: std::ostream') diff --git a/examples/get-started/blink/example_test.py b/examples/get-started/blink/example_test.py index 505ad58fe9..4cce22f1a6 100644 --- a/examples/get-started/blink/example_test.py +++ b/examples/get-started/blink/example_test.py @@ -27,9 +27,9 @@ def verify_elf_sha256_embedding(dut): raise ValueError('ELF file SHA256 mismatch') -@ttfw_idf.idf_example_test(env_tag='Example_GENERIC') +@ttfw_idf.idf_example_test(env_tag='Example_GENERIC', target=['esp32', 'esp32c3']) def test_examples_blink(env, extra_data): - dut = env.get_dut('blink', 'examples/get-started/blink', dut_class=ttfw_idf.ESP32DUT) + dut = env.get_dut('blink', 'examples/get-started/blink') binary_file = os.path.join(dut.app.binary_path, 'blink.bin') bin_size = os.path.getsize(binary_file) ttfw_idf.log_performance('blink_bin_size', '{}KB'.format(bin_size // 1024)) diff --git a/examples/get-started/hello_world/example_test.py b/examples/get-started/hello_world/example_test.py index 00c3358075..9901d5c1ca 100644 --- a/examples/get-started/hello_world/example_test.py +++ b/examples/get-started/hello_world/example_test.py @@ -5,7 +5,7 @@ from __future__ import division, print_function, unicode_literals import ttfw_idf -@ttfw_idf.idf_example_test(env_tag='Example_GENERIC', target=['esp32', 'esp32s2'], ci_target=['esp32']) +@ttfw_idf.idf_example_test(env_tag='Example_GENERIC', target=['esp32', 'esp32s2', 'esp32c3'], ci_target=['esp32']) def test_examples_hello_world(env, extra_data): app_name = 'hello_world' dut = env.get_dut(app_name, 'examples/get-started/hello_world') diff --git a/examples/protocols/asio/ssl_client_server/example_test.py b/examples/protocols/asio/ssl_client_server/example_test.py index 975adb8503..e819380e3b 100644 --- a/examples/protocols/asio/ssl_client_server/example_test.py +++ b/examples/protocols/asio/ssl_client_server/example_test.py @@ -3,7 +3,7 @@ from __future__ import unicode_literals import ttfw_idf -@ttfw_idf.idf_example_test(env_tag='Example_GENERIC') +@ttfw_idf.idf_example_test(env_tag='Example_GENERIC', target=['esp32', 'esp32c3']) def test_examples_asio_ssl(env, extra_data): dut = env.get_dut('asio_ssl_client_server', 'examples/protocols/asio/ssl_client_server') diff --git a/examples/storage/nvs_rw_blob/README.md b/examples/storage/nvs_rw_blob/README.md index 620edd85e8..62cf36c45d 100644 --- a/examples/storage/nvs_rw_blob/README.md +++ b/examples/storage/nvs_rw_blob/README.md @@ -2,22 +2,22 @@ (See the README.md file in the upper level 'examples' directory for more information about examples.) -This example demonstrates how to read and write a single integer value and a blob (binary large object) using NVS to preserve them between ESP32 module restarts. +This example demonstrates how to read and write a single integer value and a blob (binary large object) using NVS to preserve them between ESP module restarts. - * value - tracks number of ESP32 module soft and hard restarts. - * blob - contains a table with module run times. The table is read from NVS to dynamically allocated RAM. New run time is added to the table on each manually triggered soft restart and written back to NVS. Triggering is done by pulling down GPIO0. + * value - tracks number of soft and hard restarts. + * blob - contains a table with module run times. The table is read from NVS to dynamically allocated RAM. New run time is added to the table on each manually triggered soft restart and written back to NVS. Triggering is done by pulling down the boot mode pin (GPIO0 on ESP32 and ESP32-S2, GPIO9 on ESP32-C3). -Example also shows how to implement diagnostics if read / write operation was successful. +Example also shows how to implement diagnostics if read / write operation was successful. Detailed functional description of NVS and API is provided in [documentation](https://docs.espressif.com/projects/esp-idf/en/latest/api-reference/storage/nvs_flash.html). -If not done already, consider checking simpler example *storage/nvs_rw_value*, that has been used as a starting point for preparing this one. +If not done already, consider checking simpler example *storage/nvs_rw_value*, that has been used as a starting point for preparing this one. ## How to use example ### Hardware required -This example can be run on most common development boards which have an active button connected to GPIO0. On most boards, this button is labeled as "Boot". When pressed, the button connects GPIO0 to ground. +This example can be run on most common development boards which have an active button connected to boot mode pin. On most boards, this button is labeled as "Boot". When pressed, the button connects boot mode pin to ground. ### Build and flash diff --git a/examples/storage/nvs_rw_blob/main/nvs_blob_example_main.c b/examples/storage/nvs_rw_blob/main/nvs_blob_example_main.c index 4860b412a9..9e44c5618d 100644 --- a/examples/storage/nvs_rw_blob/main/nvs_blob_example_main.c +++ b/examples/storage/nvs_rw_blob/main/nvs_blob_example_main.c @@ -19,6 +19,12 @@ #define STORAGE_NAMESPACE "storage" +#if CONFIG_IDF_TARGET_ESP32C3 +#define BOOT_MODE_PIN GPIO_NUM_9 +#else +#define BOOT_MODE_PIN GPIO_NUM_0 +#endif //CONFIG_IDF_TARGET_ESP32C3 + /* Save the number of module restarts in NVS by first reading and then incrementing the number that has been saved previously. @@ -167,16 +173,16 @@ void app_main(void) err = save_restart_counter(); if (err != ESP_OK) printf("Error (%s) saving restart counter to NVS!\n", esp_err_to_name(err)); - gpio_reset_pin(GPIO_NUM_0); - gpio_set_direction(GPIO_NUM_0, GPIO_MODE_INPUT); + gpio_reset_pin(BOOT_MODE_PIN); + gpio_set_direction(BOOT_MODE_PIN, GPIO_MODE_INPUT); /* Read the status of GPIO0. If GPIO0 is LOW for longer than 1000 ms, then save module's run time and restart it */ while (1) { - if (gpio_get_level(GPIO_NUM_0) == 0) { + if (gpio_get_level(BOOT_MODE_PIN) == 0) { vTaskDelay(1000 / portTICK_PERIOD_MS); - if(gpio_get_level(GPIO_NUM_0) == 0) { + if(gpio_get_level(BOOT_MODE_PIN) == 0) { err = save_run_time(); if (err != ESP_OK) printf("Error (%s) saving run time blob to NVS!\n", esp_err_to_name(err)); printf("Restarting...\n"); diff --git a/examples/storage/nvs_rw_blob/nvs_rw_blob_example_test.py b/examples/storage/nvs_rw_blob/nvs_rw_blob_example_test.py index 74e6f541be..b715a781ce 100644 --- a/examples/storage/nvs_rw_blob/nvs_rw_blob_example_test.py +++ b/examples/storage/nvs_rw_blob/nvs_rw_blob_example_test.py @@ -6,7 +6,7 @@ import ttfw_idf from tiny_test_fw import Utility -@ttfw_idf.idf_example_test(env_tag='Example_GENERIC') +@ttfw_idf.idf_example_test(env_tag='Example_GENERIC', target=['esp32', 'esp32c3']) def test_examples_nvs_rw_blob(env, extra_data): dut = env.get_dut('nvs_rw_blob', 'examples/storage/nvs_rw_blob') @@ -24,7 +24,7 @@ def test_examples_nvs_rw_blob(env, extra_data): for i in range(1, 10): time.sleep(random.uniform(0.1, 2)) # in order to randomize the runtimes stored in NVS try: - # Pulling GPIO0 low using DTR + # Pulling pin low using DTR dut.port_inst.setDTR(True) dut.expect('Restarting...', timeout=5) # the application waits for a second finally: diff --git a/examples/storage/nvs_rw_value/nvs_rw_value_example_test.py b/examples/storage/nvs_rw_value/nvs_rw_value_example_test.py index 25af89ebfe..096908292e 100644 --- a/examples/storage/nvs_rw_value/nvs_rw_value_example_test.py +++ b/examples/storage/nvs_rw_value/nvs_rw_value_example_test.py @@ -8,7 +8,7 @@ except ImportError: from itertools import zip_longest -@ttfw_idf.idf_example_test(env_tag='Example_GENERIC') +@ttfw_idf.idf_example_test(env_tag='Example_GENERIC', target=['esp32', 'esp32c3']) def test_examples_nvs_rw_value(env, extra_data): dut = env.get_dut('nvs_rw_value', 'examples/storage/nvs_rw_value') diff --git a/examples/storage/nvs_rw_value_cxx/nvs_rw_value_cxx_example_test.py b/examples/storage/nvs_rw_value_cxx/nvs_rw_value_cxx_example_test.py index 7cdb10d513..3b3e243297 100644 --- a/examples/storage/nvs_rw_value_cxx/nvs_rw_value_cxx_example_test.py +++ b/examples/storage/nvs_rw_value_cxx/nvs_rw_value_cxx_example_test.py @@ -8,7 +8,7 @@ except ImportError: from itertools import zip_longest -@ttfw_idf.idf_example_test(env_tag='Example_GENERIC') +@ttfw_idf.idf_example_test(env_tag='Example_GENERIC', target=['esp32', 'esp32c3']) def test_examples_nvs_rw_value_cxx(env, extra_data): dut = env.get_dut('nvs_rw_value_cxx', 'examples/storage/nvs_rw_value_cxx') diff --git a/examples/storage/partition_api/partition_find/partition_find_example_test.py b/examples/storage/partition_api/partition_find/partition_find_example_test.py index eb1abb67b4..7e6b0ca5d9 100644 --- a/examples/storage/partition_api/partition_find/partition_find_example_test.py +++ b/examples/storage/partition_api/partition_find/partition_find_example_test.py @@ -1,7 +1,7 @@ import ttfw_idf -@ttfw_idf.idf_example_test(env_tag='Example_GENERIC') +@ttfw_idf.idf_example_test(env_tag='Example_GENERIC', target=['esp32', 'esp32c3']) def test_examples_partition_find(env, extra_data): dut = env.get_dut('partition_find', 'examples/storage/partition_api/partition_find') diff --git a/examples/storage/partition_api/partition_mmap/partition_mmap_example_test.py b/examples/storage/partition_api/partition_mmap/partition_mmap_example_test.py index c9a5a73375..8521907752 100644 --- a/examples/storage/partition_api/partition_mmap/partition_mmap_example_test.py +++ b/examples/storage/partition_api/partition_mmap/partition_mmap_example_test.py @@ -3,7 +3,7 @@ import re import ttfw_idf -@ttfw_idf.idf_example_test(env_tag='Example_GENERIC') +@ttfw_idf.idf_example_test(env_tag='Example_GENERIC', target=['esp32', 'esp32c3']) def test_examples_partition_mmap(env, extra_data): dut = env.get_dut('partition_mmap', 'examples/storage/partition_api/partition_mmap') diff --git a/examples/storage/partition_api/partition_ops/partition_ops_example_test.py b/examples/storage/partition_api/partition_ops/partition_ops_example_test.py index 8520311d7b..debadfc1d4 100644 --- a/examples/storage/partition_api/partition_ops/partition_ops_example_test.py +++ b/examples/storage/partition_api/partition_ops/partition_ops_example_test.py @@ -1,7 +1,7 @@ import ttfw_idf -@ttfw_idf.idf_example_test(env_tag='Example_GENERIC') +@ttfw_idf.idf_example_test(env_tag='Example_GENERIC', target=['esp32', 'esp32c3']) def test_examples_partition_ops(env, extra_data): dut = env.get_dut('partition_ops', 'examples/storage/partition_api/partition_ops') diff --git a/examples/storage/parttool/example_test.py b/examples/storage/parttool/example_test.py index 2caa34a1f4..358383f837 100644 --- a/examples/storage/parttool/example_test.py +++ b/examples/storage/parttool/example_test.py @@ -7,9 +7,9 @@ import sys import ttfw_idf -@ttfw_idf.idf_example_test(env_tag='Example_GENERIC') +@ttfw_idf.idf_example_test(env_tag='Example_GENERIC', target=['esp32', 'esp32c3']) def test_examples_parttool(env, extra_data): - dut = env.get_dut('parttool', 'examples/storage/parttool', dut_class=ttfw_idf.ESP32DUT) + dut = env.get_dut('parttool', 'examples/storage/parttool') dut.start_app(False) # Verify factory firmware diff --git a/examples/storage/spiffs/spiffs_example_test.py b/examples/storage/spiffs/spiffs_example_test.py index fa70e1fddb..4151f93c0f 100644 --- a/examples/storage/spiffs/spiffs_example_test.py +++ b/examples/storage/spiffs/spiffs_example_test.py @@ -3,7 +3,7 @@ import re import ttfw_idf -@ttfw_idf.idf_example_test(env_tag='Example_GENERIC') +@ttfw_idf.idf_example_test(env_tag='Example_GENERIC', target=['esp32', 'esp32c3']) def test_examples_spiffs(env, extra_data): dut = env.get_dut('spiffs', 'examples/storage/spiffs') diff --git a/examples/storage/spiffsgen/example_test.py b/examples/storage/spiffsgen/example_test.py index c5dd9db917..400706e7dc 100644 --- a/examples/storage/spiffsgen/example_test.py +++ b/examples/storage/spiffsgen/example_test.py @@ -6,10 +6,10 @@ import os import ttfw_idf -@ttfw_idf.idf_example_test(env_tag='Example_GENERIC') +@ttfw_idf.idf_example_test(env_tag='Example_GENERIC', target=['esp32', 'esp32c3']) def test_examples_spiffsgen(env, extra_data): # Test with default build configurations - dut = env.get_dut('spiffsgen', 'examples/storage/spiffsgen', dut_class=ttfw_idf.ESP32DUT) + dut = env.get_dut('spiffsgen', 'examples/storage/spiffsgen') dut.start_app() base_dir = os.path.join(os.path.dirname(os.path.abspath(__file__)), 'spiffs_image') diff --git a/examples/storage/wear_levelling/wear_levelling_example_test.py b/examples/storage/wear_levelling/wear_levelling_example_test.py index 395a78cc8c..f8cae1b9a0 100644 --- a/examples/storage/wear_levelling/wear_levelling_example_test.py +++ b/examples/storage/wear_levelling/wear_levelling_example_test.py @@ -3,7 +3,7 @@ import re import ttfw_idf -@ttfw_idf.idf_example_test(env_tag='Example_GENERIC') +@ttfw_idf.idf_example_test(env_tag='Example_GENERIC', target=['esp32', 'esp32c3']) def test_examples_wear_levelling(env, extra_data): dut = env.get_dut('wear_levelling', 'examples/storage/wear_levelling') diff --git a/examples/system/base_mac_address/example_test.py b/examples/system/base_mac_address/example_test.py index cf0a340dc2..ad53e58fda 100644 --- a/examples/system/base_mac_address/example_test.py +++ b/examples/system/base_mac_address/example_test.py @@ -6,7 +6,7 @@ import ttfw_idf from tiny_test_fw import Utility -@ttfw_idf.idf_example_test(env_tag='Example_GENERIC') +@ttfw_idf.idf_example_test(env_tag='Example_GENERIC', target=['esp32', 'esp32c3']) def test_examples_base_mac_address(env, extra_data): dut = env.get_dut('base_mac_address', 'examples/system/base_mac_address') diff --git a/examples/system/console/example_test.py b/examples/system/console/example_test.py index 2a56824b2c..4bcd8a0d99 100644 --- a/examples/system/console/example_test.py +++ b/examples/system/console/example_test.py @@ -3,7 +3,7 @@ from __future__ import print_function import ttfw_idf -@ttfw_idf.idf_example_test(env_tag='Example_GENERIC') +@ttfw_idf.idf_example_test(env_tag='Example_GENERIC', target=['esp32', 'esp32c3']) def test_examples_system_console(env, extra_data): dut = env.get_dut('console_example', 'examples/system/console', app_config_name='history') print('Using binary path: {}'.format(dut.app.binary_path)) diff --git a/examples/system/deep_sleep/example_test.py b/examples/system/deep_sleep/example_test.py index 035290e65e..e89a8ca0bc 100644 --- a/examples/system/deep_sleep/example_test.py +++ b/examples/system/deep_sleep/example_test.py @@ -4,14 +4,16 @@ import re import ttfw_idf +touch_wake_up_support = ['esp32'] -@ttfw_idf.idf_example_test(env_tag='Example_GENERIC') + +@ttfw_idf.idf_example_test(env_tag='Example_GENERIC', target=['esp32', 'esp32c3']) def test_examples_deep_sleep(env, extra_data): dut = env.get_dut('deep_sleep', 'examples/system/deep_sleep') dut.start_app() - def expect_enable_deep_sleep(): + def expect_enable_deep_sleep_touch(): dut.expect_all('Enabling timer wakeup, 20s', re.compile(r'Touch pad #8 average: \d+, wakeup threshold set to \d+.'), re.compile(r'Touch pad #9 average: \d+, wakeup threshold set to \d+.'), @@ -19,6 +21,16 @@ def test_examples_deep_sleep(env, extra_data): 'Entering deep sleep', timeout=10) + def expect_enable_deep_sleep_no_touch(): + dut.expect_all('Enabling timer wakeup, 20s', + 'Entering deep sleep', + timeout=10) + + if dut.TARGET in touch_wake_up_support: + expect_enable_deep_sleep = expect_enable_deep_sleep_touch + else: + expect_enable_deep_sleep = expect_enable_deep_sleep_no_touch + dut.expect('Not a deep sleep reset', timeout=30) expect_enable_deep_sleep() diff --git a/examples/system/efuse/example_test.py b/examples/system/efuse/example_test.py index 5379dfd060..082ed35135 100644 --- a/examples/system/efuse/example_test.py +++ b/examples/system/efuse/example_test.py @@ -5,7 +5,7 @@ import re import ttfw_idf -@ttfw_idf.idf_example_test(env_tag='Example_GENERIC') +@ttfw_idf.idf_example_test(env_tag='Example_GENERIC', target=['esp32', 'esp32c3']) def test_examples_efuse(env, extra_data): dut = env.get_dut('efuse', 'examples/system/efuse') diff --git a/examples/system/esp_event/default_event_loop/example_test.py b/examples/system/esp_event/default_event_loop/example_test.py index 78f9377533..4060071741 100644 --- a/examples/system/esp_event/default_event_loop/example_test.py +++ b/examples/system/esp_event/default_event_loop/example_test.py @@ -69,8 +69,8 @@ def _test_iteration_events(dut): dut.expect(TASK_ITERATION_HANDLING.format(iteration)) dut.expect('TASK_EVENTS:TASK_ITERATION_EVENT: all_event_handler') elif iteration == TASK_UNREGISTRATION_LIMIT: - dut.expect('TASK_EVENTS:TASK_ITERATION_EVENT: unregistering task_iteration_handler') - dut.expect('TASK_EVENTS:TASK_ITERATION_EVENT: all_event_handler') + dut.expect_all('TASK_EVENTS:TASK_ITERATION_EVENT: unregistering task_iteration_handler', + 'TASK_EVENTS:TASK_ITERATION_EVENT: all_event_handler') print('Unregistered handler at iteration {} out of {}'.format(iteration, TASK_ITERATION_LIMIT)) else: dut.expect('TASK_EVENTS:TASK_ITERATION_EVENT: all_event_handler') @@ -81,7 +81,7 @@ def _test_iteration_events(dut): print('Deleted task event source') -@ttfw_idf.idf_example_test(env_tag='Example_GENERIC') +@ttfw_idf.idf_example_test(env_tag='Example_GENERIC', target=['esp32']) def test_default_event_loop_example(env, extra_data): dut = env.get_dut('default_event_loop', 'examples/system/esp_event/default_event_loop') diff --git a/examples/system/esp_event/user_event_loops/example_test.py b/examples/system/esp_event/user_event_loops/example_test.py index 82664f9cf8..53853b8edf 100644 --- a/examples/system/esp_event/user_event_loops/example_test.py +++ b/examples/system/esp_event/user_event_loops/example_test.py @@ -8,9 +8,9 @@ TASK_ITERATION_POSTING = 'posting TASK_EVENTS:TASK_ITERATION_EVENT to {}, iterat TASK_ITERATION_HANDLING = 'handling TASK_EVENTS:TASK_ITERATION_EVENT from {}, iteration {}' -@ttfw_idf.idf_example_test(env_tag='Example_GENERIC') +@ttfw_idf.idf_example_test(env_tag='Example_GENERIC', target=['esp32', 'esp32c3']) def test_user_event_loops_example(env, extra_data): - dut = env.get_dut('user_event_loops', 'examples/system/esp_event/user_event_loops', dut_class=ttfw_idf.ESP32DUT) + dut = env.get_dut('user_event_loops', 'examples/system/esp_event/user_event_loops') dut.start_app() diff --git a/examples/system/esp_timer/README.md b/examples/system/esp_timer/README.md index 1814c75f25..0be910fb23 100644 --- a/examples/system/esp_timer/README.md +++ b/examples/system/esp_timer/README.md @@ -1,7 +1,7 @@ -| Supported Targets | ESP32 | -| ----------------- | ----- | +| Supported Targets | ESP32 | ESP32-S2 | +| ----------------- | ----- | -------- | -# High Resolution Timer Example (`esp_timer`) +# High Resolution Timer Example (`esp_timer`) (See the README.md file in the upper level 'examples' directory for more information about examples.) @@ -15,7 +15,7 @@ The `esp_timer` API also provides the `esp_timer_get_time()` function which retu ### Hardware Required -This example should be able to run on any commonly available ESP32 development board. +This example should be able to run on any commonly available ESP development board. ### Configure the project @@ -127,7 +127,7 @@ I (5265) example: Periodic timer called, time since boot: 5002476 us The one-shot timer runs and changes the period of the periodic timer. Now the periodic timer runs with a period of 1 second: -``` +``` I (5265) example: One-shot timer called, time since boot: 5002586 us I (5265) example: Restarted periodic timer with 1s period, time since boot: 5005475 us I (6265) example: Periodic timer called, time since boot: 6005492 us @@ -144,7 +144,7 @@ I (10265) example: Periodic timer called, time since boot: 10005492 us ### 5. Continuation through light sleep To illustrate that timekeeping continues correctly after light sleep, the example enters light sleep for 0.5 seconds. This sleep does not impact timer period, and the timer is executed 1 second after the previous iteration. Note that the timers can not execute during light sleep, since the CPU is not running at that time. Such timers would execute immediately after light sleep, and then continue running with their normal period. - + ``` I (10275) example: Entering light sleep for 0.5s, time since boot: 10011559 us I (10275) example: Woke up from light sleep, time since boot: 10512007 us diff --git a/examples/system/esp_timer/example_test.py b/examples/system/esp_timer/example_test.py index d8cd0f4ccf..60b8ee6471 100644 --- a/examples/system/esp_timer/example_test.py +++ b/examples/system/esp_timer/example_test.py @@ -26,9 +26,9 @@ LIGHT_SLEEP_TIME = 500000 ONE_SHOT_TIMER_PERIOD = 5000000 -@ttfw_idf.idf_example_test(env_tag='Example_GENERIC') +@ttfw_idf.idf_example_test(env_tag='Example_GENERIC', target=['esp32']) def test_examples_system_esp_timer(env, extra_data): - dut = env.get_dut('esp_timer_example', 'examples/system/esp_timer', dut_class=ttfw_idf.ESP32DUT) + dut = env.get_dut('esp_timer_example', 'examples/system/esp_timer') # start test dut.start_app() groups = dut.expect(STARTING_TIMERS_REGEX, timeout=30) diff --git a/examples/system/freertos/real_time_stats/example_test.py b/examples/system/freertos/real_time_stats/example_test.py index d5528ea452..2b66a6ec42 100644 --- a/examples/system/freertos/real_time_stats/example_test.py +++ b/examples/system/freertos/real_time_stats/example_test.py @@ -6,9 +6,9 @@ STATS_TASK_ITERS = 3 STATS_TASK_EXPECT = 'Real time stats obtained' -@ttfw_idf.idf_example_test(env_tag='Example_GENERIC') +@ttfw_idf.idf_example_test(env_tag='Example_GENERIC', target=['esp32', 'esp32c3']) def test_real_time_stats_example(env, extra_data): - dut = env.get_dut('real_time_stats', 'examples/system/freertos/real_time_stats', dut_class=ttfw_idf.ESP32DUT) + dut = env.get_dut('real_time_stats', 'examples/system/freertos/real_time_stats') dut.start_app() for iteration in range(0, STATS_TASK_ITERS): diff --git a/examples/system/light_sleep/README.md b/examples/system/light_sleep/README.md index c9212067c6..6f59910891 100644 --- a/examples/system/light_sleep/README.md +++ b/examples/system/light_sleep/README.md @@ -1,3 +1,5 @@ +| Supported Targets | ESP32 | ESP32-S2 | +| ----------------- | ----- | -------- | # Light Sleep Example (See the README.md file in the upper level 'examples' directory for more information about examples.) diff --git a/examples/system/light_sleep/example_test.py b/examples/system/light_sleep/example_test.py index a67b81d9af..225ad499d1 100644 --- a/examples/system/light_sleep/example_test.py +++ b/examples/system/light_sleep/example_test.py @@ -12,9 +12,9 @@ WAITING_FOR_GPIO_STR = 'Waiting for GPIO0 to go high...' WAKEUP_INTERVAL_MS = 2000 -@ttfw_idf.idf_example_test(env_tag='Example_GENERIC') +@ttfw_idf.idf_example_test(env_tag='Example_GENERIC', target=['esp32']) def test_examples_system_light_sleep(env, extra_data): - dut = env.get_dut('light_sleep_example', 'examples/system/light_sleep', dut_class=ttfw_idf.ESP32DUT) + dut = env.get_dut('light_sleep_example', 'examples/system/light_sleep') dut.start_app() # Ensure DTR and RTS are de-asserted for proper control of GPIO0 diff --git a/examples/system/perfmon/example_test.py b/examples/system/perfmon/example_test.py index 0ad3e827d4..ead2a520b8 100644 --- a/examples/system/perfmon/example_test.py +++ b/examples/system/perfmon/example_test.py @@ -3,7 +3,7 @@ from __future__ import unicode_literals import ttfw_idf -@ttfw_idf.idf_example_test(env_tag='Example_GENERIC') +@ttfw_idf.idf_example_test(env_tag='Example_GENERIC', target=['esp32']) def test_examples_perfmon(env, extra_data): dut = env.get_dut('perfmon', 'examples/system/perfmon') diff --git a/examples/system/select/example_test.py b/examples/system/select/example_test.py index d95d3300a8..1feff1e6c8 100644 --- a/examples/system/select/example_test.py +++ b/examples/system/select/example_test.py @@ -18,7 +18,7 @@ def get_uart_msgs(i): 'uart_select_example: {} bytes were received through UART1: {}'.format(len(msg), msg)] -@ttfw_idf.idf_example_test(env_tag='Example_GENERIC') +@ttfw_idf.idf_example_test(env_tag='Example_GENERIC', target=['esp32', 'esp32c3']) def test_examples_select(env, extra_data): dut = env.get_dut('select', 'examples/system/select') diff --git a/examples/system/task_watchdog/example_test.py b/examples/system/task_watchdog/example_test.py index ba908e6e6f..58e4d75fd0 100644 --- a/examples/system/task_watchdog/example_test.py +++ b/examples/system/task_watchdog/example_test.py @@ -3,7 +3,7 @@ from __future__ import unicode_literals import ttfw_idf -@ttfw_idf.idf_example_test(env_tag='Example_GENERIC') +@ttfw_idf.idf_example_test(env_tag='Example_GENERIC', target=['esp32', 'esp32c3']) def test_examples_task_watchdog(env, extra_data): dut = env.get_dut('task_watchdog', 'examples/system/task_watchdog') diff --git a/examples/system/task_watchdog/main/task_watchdog_example_main.c b/examples/system/task_watchdog/main/task_watchdog_example_main.c index 89bce16f00..c1b25691b2 100644 --- a/examples/system/task_watchdog/main/task_watchdog_example_main.c +++ b/examples/system/task_watchdog/main/task_watchdog_example_main.c @@ -52,7 +52,7 @@ void app_main(void) #ifndef CONFIG_ESP_TASK_WDT_CHECK_IDLE_TASK_CPU0 esp_task_wdt_add(xTaskGetIdleTaskHandleForCPU(0)); #endif -#ifndef CONFIG_ESP_TASK_WDT_CHECK_IDLE_TASK_CPU1 +#if CONFIG_ESP_TASK_WDT_CHECK_IDLE_TASK_CPU1 && !CONFIG_FREERTOS_UNICORE esp_task_wdt_add(xTaskGetIdleTaskHandleForCPU(1)); #endif diff --git a/examples/system/ulp/example_test.py b/examples/system/ulp/example_test.py index 7d4c84ebec..1e3afe0b46 100644 --- a/examples/system/ulp/example_test.py +++ b/examples/system/ulp/example_test.py @@ -7,7 +7,7 @@ import ttfw_idf from tiny_test_fw import Utility -@ttfw_idf.idf_example_test(env_tag='Example_GENERIC') +@ttfw_idf.idf_example_test(env_tag='Example_GENERIC', target=['esp32']) def test_examples_ulp(env, extra_data): dut = env.get_dut('ulp', 'examples/system/ulp') diff --git a/examples/system/ulp_adc/example_test.py b/examples/system/ulp_adc/example_test.py index 0331823638..d0b07d51ba 100644 --- a/examples/system/ulp_adc/example_test.py +++ b/examples/system/ulp_adc/example_test.py @@ -6,7 +6,7 @@ import ttfw_idf from tiny_test_fw import Utility -@ttfw_idf.idf_example_test(env_tag='Example_GENERIC') +@ttfw_idf.idf_example_test(env_tag='Example_GENERIC', target=['esp32']) def test_examples_ulp_adc(env, extra_data): dut = env.get_dut('ulp_adc', 'examples/system/ulp_adc') diff --git a/examples/system/unit_test/example_test.py b/examples/system/unit_test/example_test.py index 9fe6cb8d7f..8343e9a1e4 100644 --- a/examples/system/unit_test/example_test.py +++ b/examples/system/unit_test/example_test.py @@ -5,7 +5,7 @@ import re import ttfw_idf -@ttfw_idf.idf_example_test(env_tag='Example_GENERIC') +@ttfw_idf.idf_example_test(env_tag='Example_GENERIC', target=['esp32', 'esp32c3']) def test_examples_unit_test(env, extra_data): dut = env.get_dut('unit_test', 'examples/system/unit_test')