test(system): add system test-case for flash auto-suspend

This commit is contained in:
Marius Vikhammer
2025-03-14 14:34:00 +08:00
parent ff3126fa09
commit e52ea52792
8 changed files with 62 additions and 0 deletions

View File

@@ -0,0 +1,15 @@
# Options that will enable common IRAM usage reduction option. These options should be safe to use with most setups
CONFIG_FREERTOS_PLACE_FUNCTIONS_INTO_FLASH=y
CONFIG_RINGBUF_PLACE_FUNCTIONS_INTO_FLASH=y
CONFIG_HEAP_PLACE_FUNCTION_INTO_FLASH=y
CONFIG_LIBC_LOCKS_PLACE_IN_IRAM=n
CONFIG_HAL_ASSERTION_SILENT=y
CONFIG_COMPILER_OPTIMIZATION_ASSERTIONS_SILENT=y
CONFIG_COMPILER_OPTIMIZATION_SIZE=y
# Options that will enable IRAM reduction option that are not necessarily safe for all use-cases
CONFIG_RINGBUF_PLACE_ISR_FUNCTIONS_INTO_FLASH=y
# Options that will enable IRAM reduction option that are only usable together with flash auto-suspend
CONFIG_SPI_FLASH_AUTO_SUSPEND=y
CONFIG_LIBC_MISC_IN_IRAM=n

View File

@@ -30,6 +30,15 @@ tools/test_apps/system/eh_frame:
tools/test_apps/system/esp_intr_dump:
tools/test_apps/system/flash_auto_suspend_iram_reduction:
disable:
- if: IDF_TARGET == "esp32" or IDF_TARGET == "esp32s2
reason: Targets do not support auto-suspend
disable_test:
- if: IDF_TARGET != "esp32c3"
temporary: true
reason: lack of runners
tools/test_apps/system/g0_components:
enable:
- if: INCLUDE_DEFAULT == 1 or IDF_TARGET in ["esp32c5", "esp32c61", "esp32h21", "esp32h4"] # preview targets

View File

@@ -0,0 +1,9 @@
# The following five 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.16)
include($ENV{IDF_PATH}/tools/cmake/project.cmake)
list(PREPEND SDKCONFIG_DEFAULTS "$ENV{IDF_PATH}/tools/test_apps/configs/sdkconfig.flash_auto_suspend_iram_reduction")
project(flash_auto_suspend_iram_reduction)

View File

@@ -0,0 +1,2 @@
| Supported Targets | ESP32-C2 | ESP32-C3 | ESP32-C5 | ESP32-C6 | ESP32-C61 | ESP32-H2 | ESP32-H21 | ESP32-P4 | ESP32-S2 | ESP32-S3 |
| ----------------- | -------- | -------- | -------- | -------- | --------- | -------- | --------- | -------- | -------- | -------- |

View File

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

View File

@@ -0,0 +1,11 @@
/*
* SPDX-FileCopyrightText: 2025 Espressif Systems (Shanghai) CO LTD
*
* SPDX-License-Identifier: Unlicense OR CC0-1.0
*/
#include <stdio.h>
void app_main(void)
{
printf("Hello World!\n");
}

View File

@@ -0,0 +1,12 @@
# SPDX-FileCopyrightText: 2025 Espressif Systems (Shanghai) CO LTD
# SPDX-License-Identifier: CC0-1.0
import pytest
from pytest_embedded import Dut
from pytest_embedded_idf.utils import idf_parametrize
@pytest.mark.flash_suspend
@idf_parametrize('config', ['defaults'], indirect=['config'])
@idf_parametrize('target', ['esp32c3'], indirect=['target'])
def test_flash_auto_suspend_minimize_iram_usage(dut: Dut) -> None:
dut.expect_exact('Hello World!', timeout=30)

View File

@@ -0,0 +1,2 @@
# Now the runners are massively using xmc-c chips, to be removed when xmc-d goes massive production.
CONFIG_SPI_FLASH_FORCE_ENABLE_XMC_C_SUSPEND=y