Merge branch 'feature/c3_example_tests' into 'master'

CI: add Example_GENERIC for C3

Closes IDF-2935

See merge request espressif/esp-idf!12557
This commit is contained in:
Michael (XIAO Xufeng) 2021-03-16 09:43:38 +00:00
commit be30289364
45 changed files with 160 additions and 115 deletions

View File

@ -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"

View File

@ -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))

View File

@ -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

View File

@ -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:

View File

@ -25,41 +25,40 @@ menu "ESP32C3-Specific"
choice ESP32C3_UNIVERSAL_MAC_ADDRESSES
bool "Number of universally administered (by IEEE) MAC address"
default ESP32C3_UNIVERSAL_MAC_ADDRESSES_TWO
default ESP32C3_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 ESP32C3_UNIVERSAL_MAC_ADDRESSES_TWO
bool "Two"
select ESP_MAC_ADDR_UNIVERSE_WIFI_STA
select ESP_MAC_ADDR_UNIVERSE_BT
config ESP32C3_UNIVERSAL_MAC_ADDRESSES_THREE
bool "Three"
config ESP32C3_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 ESP32C3_UNIVERSAL_MAC_ADDRESSES
int
default 2 if ESP32C3_UNIVERSAL_MAC_ADDRESSES_TWO
default 3 if ESP32C3_UNIVERSAL_MAC_ADDRESSES_THREE
config ESP_MAC_ADDR_UNIVERSE_BT_OFFSET
int
default 2 if ESP32C3_UNIVERSAL_MAC_ADDRESSES_THREE
default 1 if ESP32C3_UNIVERSAL_MAC_ADDRESSES_TWO
default 4 if ESP32C3_UNIVERSAL_MAC_ADDRESSES_FOUR
config ESP32C3_DEBUG_OCDAWARE
bool "Make exception and panic handlers JTAG/OCD aware"

View File

@ -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"

View File

@ -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

View File

@ -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:

View File

@ -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

View File

@ -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',

View File

@ -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')

View File

@ -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')

View File

@ -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))

View File

@ -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')

View File

@ -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')

View File

@ -2,10 +2,10 @@
(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.
@ -17,7 +17,7 @@ If not done already, consider checking simpler example *storage/nvs_rw_value*, t
### 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

View File

@ -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");

View File

@ -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:

View File

@ -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')

View File

@ -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')

View File

@ -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')

View File

@ -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')

View File

@ -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')

View File

@ -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

View File

@ -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')

View File

@ -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')

View File

@ -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')

View File

@ -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')

View File

@ -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))

View File

@ -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()

View File

@ -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')

View File

@ -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')

View File

@ -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()

View File

@ -1,5 +1,5 @@
| Supported Targets | ESP32 |
| ----------------- | ----- |
| Supported Targets | ESP32 | ESP32-S2 |
| ----------------- | ----- | -------- |
# High Resolution Timer Example (`esp_timer`)
@ -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

View File

@ -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)

View File

@ -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):

View File

@ -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.)

View File

@ -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

View File

@ -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')

View File

@ -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')

View File

@ -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')

View File

@ -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

View File

@ -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')

View File

@ -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')

View File

@ -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')