From bb2fd6101359be7d6641de71ee3aba411367ceff Mon Sep 17 00:00:00 2001 From: armando Date: Thu, 9 Apr 2026 16:04:37 +0800 Subject: [PATCH] fix(xip): fixed xip example --- examples/system/.build-test-rules.yml | 4 ---- .../main/xip_from_psram_example_main.c | 4 ++-- .../xip_from_psram/pytest_xip_from_psram.py | 23 ++++++++++++++++++- 3 files changed, 24 insertions(+), 7 deletions(-) diff --git a/examples/system/.build-test-rules.yml b/examples/system/.build-test-rules.yml index ae9a81b828..2539468823 100644 --- a/examples/system/.build-test-rules.yml +++ b/examples/system/.build-test-rules.yml @@ -305,7 +305,3 @@ examples/system/xip_from_psram: disable: - if: IDF_TARGET == "esp32" reason: target esp32 doesn't support this feature. - disable_test: - - if: IDF_TARGET == "esp32s31" - temporary: true - reason: cannot pass # TODO: IDF-15526 diff --git a/examples/system/xip_from_psram/main/xip_from_psram_example_main.c b/examples/system/xip_from_psram/main/xip_from_psram_example_main.c index c66b91c6e3..129a46ca2c 100644 --- a/examples/system/xip_from_psram/main/xip_from_psram_example_main.c +++ b/examples/system/xip_from_psram/main/xip_from_psram_example_main.c @@ -14,7 +14,7 @@ #include "esp_flash.h" #include "esp_timer.h" -#if CONFIG_IDF_TARGET_ESP32C5 || CONFIG_IDF_TARGET_ESP32C61 +#if CONFIG_IDF_TARGET_ESP32C5 || CONFIG_IDF_TARGET_ESP32C61 || CONFIG_IDF_TARGET_ESP32S31 #define EXAMPLE_TIMER_ALERT_TIME (1 * 3 * 1000) #else #define EXAMPLE_TIMER_ALERT_TIME (1 * 10 * 1000) @@ -64,7 +64,7 @@ void app_main(void) static IRAM_ATTR void NOINLINE_ATTR oneshot_timer_callback(void* arg) { - bool in_psram = (bool*) arg; + bool in_psram = *(bool*) arg; time_cb_start = esp_timer_get_time(); if (in_psram == true) { cb_in_psram(); diff --git a/examples/system/xip_from_psram/pytest_xip_from_psram.py b/examples/system/xip_from_psram/pytest_xip_from_psram.py index e63392dac7..e673db4af0 100644 --- a/examples/system/xip_from_psram/pytest_xip_from_psram.py +++ b/examples/system/xip_from_psram/pytest_xip_from_psram.py @@ -1,4 +1,4 @@ -# SPDX-FileCopyrightText: 2022-2025 Espressif Systems (Shanghai) CO LTD +# SPDX-FileCopyrightText: 2022-2026 Espressif Systems (Shanghai) CO LTD # SPDX-License-Identifier: CC0-1.0 import pytest from pytest_embedded.dut import Dut @@ -27,6 +27,27 @@ def test_xip_from_psram_example_generic(dut: Dut) -> None: assert float(response_time) <= 12 +@pytest.mark.generic +@pytest.mark.parametrize( + 'config', + [ + 'generic', + ], + indirect=True, +) +@idf_parametrize('target', ['esp32s31'], indirect=['target']) +def test_xip_from_psram_example_s31(dut: Dut) -> None: + dut.expect_exact('found partition') + + res = dut.expect(r'callback\(in PSRAM\) response time: (\d{1,3}) us') + response_time = res.group(1).decode('utf8') + assert float(response_time) <= 5 + + res = dut.expect(r'callback\(in IRAM\) response time: (\d{1,3}) us') + response_time = res.group(1).decode('utf8') + assert float(response_time) <= 5 + + @pytest.mark.MSPI_F4R8 @pytest.mark.parametrize( 'config',