From 8af9bb624e7d1fd555e1f2a69fc9d94f8c84d29f Mon Sep 17 00:00:00 2001 From: morris Date: Wed, 30 Apr 2025 10:40:29 +0800 Subject: [PATCH] test(uhci): enable the psram test in CI --- components/esp_driver_uart/Kconfig | 1 + components/esp_driver_uart/linker.lf | 5 +---- components/esp_driver_uart/src/uhci.c | 2 +- .../test_apps/.build-test-rules.yml | 1 - .../test_apps/uhci/main/test_uhci.c | 4 ++-- .../test_apps/uhci/pytest_uhci.py | 17 +++++++++++++++-- .../test_apps/uhci/sdkconfig.ci.cache_safe | 1 - .../test_apps/uhci/sdkconfig.ci.psram | 1 - .../test_apps/uhci/sdkconfig.defaults.esp32c5 | 3 +++ .../test_apps/uhci/sdkconfig.defaults.esp32s3 | 4 ++++ 10 files changed, 27 insertions(+), 12 deletions(-) delete mode 100644 components/esp_driver_uart/test_apps/uhci/sdkconfig.ci.psram create mode 100644 components/esp_driver_uart/test_apps/uhci/sdkconfig.defaults.esp32c5 create mode 100644 components/esp_driver_uart/test_apps/uhci/sdkconfig.defaults.esp32s3 diff --git a/components/esp_driver_uart/Kconfig b/components/esp_driver_uart/Kconfig index fea6dcfaa2..3e1d4ab9ba 100644 --- a/components/esp_driver_uart/Kconfig +++ b/components/esp_driver_uart/Kconfig @@ -16,6 +16,7 @@ menu "ESP-Driver:UHCI Configurations" config UHCI_ISR_HANDLER_IN_IRAM bool "Place UHCI ISR function into IRAM" default n + select GDMA_CTRL_FUNC_IN_IRAM if SOC_GDMA_SUPPORTED help If this option is not selected, UHCI interrupt will be disabled for a long time and may cause data lost when doing spi flash operation. diff --git a/components/esp_driver_uart/linker.lf b/components/esp_driver_uart/linker.lf index ab18e75b35..747b770f36 100644 --- a/components/esp_driver_uart/linker.lf +++ b/components/esp_driver_uart/linker.lf @@ -18,13 +18,10 @@ entries: uhci: uhci_gdma_tx_callback_eof (noflash) uhci: uhci_do_transmit (noflash) -[mapping:uhci_driver_gdma] +[mapping:uhci_driver_gdma_link] archive: libesp_hw_support.a entries: if UHCI_ISR_HANDLER_IN_IRAM = y: gdma_link: gdma_link_count_buffer_size_till_eof (noflash) gdma_link: gdma_link_mount_buffers (noflash) gdma_link: gdma_link_get_head_addr (noflash) - gdma: gdma_start (noflash) - gdma: gdma_stop (noflash) - gdma: gdma_reset (noflash) diff --git a/components/esp_driver_uart/src/uhci.c b/components/esp_driver_uart/src/uhci.c index 7ee7fdc4b5..c15dfa824e 100644 --- a/components/esp_driver_uart/src/uhci.c +++ b/components/esp_driver_uart/src/uhci.c @@ -539,7 +539,7 @@ esp_err_t uhci_register_event_callbacks(uhci_controller_handle_t uhci_ctrl, cons { ESP_RETURN_ON_FALSE(uhci_ctrl && cbs, ESP_ERR_INVALID_ARG, TAG, "invalid argument"); -#if CONFIG_UHCI_ISR_CACHE_SAFE +#if CONFIG_UHCI_ISR_HANDLER_IN_IRAM if (cbs->on_rx_trans_event) { ESP_RETURN_ON_FALSE(esp_ptr_in_iram(cbs->on_rx_trans_event), ESP_ERR_INVALID_ARG, TAG, "on_rx_trans_event callback not in IRAM"); } diff --git a/components/esp_driver_uart/test_apps/.build-test-rules.yml b/components/esp_driver_uart/test_apps/.build-test-rules.yml index 02f215e5c3..6675de71ca 100644 --- a/components/esp_driver_uart/test_apps/.build-test-rules.yml +++ b/components/esp_driver_uart/test_apps/.build-test-rules.yml @@ -32,6 +32,5 @@ components/esp_driver_uart/test_apps/uart_vfs: components/esp_driver_uart/test_apps/uhci: disable: - if: SOC_UHCI_SUPPORTED != 1 - - if: CONFIG_NAME == "psram" and SOC_AHB_GDMA_SUPPORT_PSRAM != 1 depends_components: - esp_driver_uart diff --git a/components/esp_driver_uart/test_apps/uhci/main/test_uhci.c b/components/esp_driver_uart/test_apps/uhci/main/test_uhci.c index a9cb04a6bf..5ffdef4944 100644 --- a/components/esp_driver_uart/test_apps/uhci/main/test_uhci.c +++ b/components/esp_driver_uart/test_apps/uhci/main/test_uhci.c @@ -121,7 +121,7 @@ static void uhci_receive_test(void *arg) uhci_controller_handle_t uhci_ctrl = ((uhci_controller_handle_t *)arg)[0]; SemaphoreHandle_t exit_sema = ((SemaphoreHandle_t *)arg)[1]; - uhci_context_t *ctx = calloc(1, sizeof(uhci_context_t)); + uhci_context_t *ctx = heap_caps_calloc(1, sizeof(uhci_context_t), MALLOC_CAP_INTERNAL | MALLOC_CAP_8BIT); assert(ctx); ctx->uhci_queue = xQueueCreate(15, sizeof(uhci_event_t)); assert(ctx->uhci_queue); @@ -252,7 +252,7 @@ static void uhci_receive_test_in_psram(void *arg) uhci_controller_handle_t uhci_ctrl = ((uhci_controller_handle_t *)arg)[0]; SemaphoreHandle_t exit_sema = ((SemaphoreHandle_t *)arg)[1]; - uhci_context_t *ctx = calloc(1, sizeof(uhci_context_t)); + uhci_context_t *ctx = heap_caps_calloc(1, sizeof(uhci_context_t), MALLOC_CAP_INTERNAL | MALLOC_CAP_8BIT); assert(ctx); ctx->uhci_queue = xQueueCreate(15, sizeof(uhci_event_t)); assert(ctx->uhci_queue); diff --git a/components/esp_driver_uart/test_apps/uhci/pytest_uhci.py b/components/esp_driver_uart/test_apps/uhci/pytest_uhci.py index 70d0b963ce..41bf30e1df 100644 --- a/components/esp_driver_uart/test_apps/uhci/pytest_uhci.py +++ b/components/esp_driver_uart/test_apps/uhci/pytest_uhci.py @@ -3,7 +3,6 @@ import pytest from pytest_embedded import Dut from pytest_embedded_idf.utils import idf_parametrize -from pytest_embedded_idf.utils import soc_filtered_targets @pytest.mark.generic @@ -15,6 +14,20 @@ from pytest_embedded_idf.utils import soc_filtered_targets ], indirect=True, ) -@idf_parametrize('target', soc_filtered_targets('SOC_UHCI_SUPPORTED == 1'), indirect=['target']) +@idf_parametrize('target', ['esp32c3', 'esp32c5', 'esp32c6', 'esp32h2', 'esp32p4'], indirect=['target']) def test_uhci(dut: Dut) -> None: dut.run_all_single_board_cases() + + +@pytest.mark.octal_psram +@pytest.mark.parametrize( + 'config', + [ + 'cache_safe', + 'release', + ], + indirect=True, +) +@idf_parametrize('target', ['esp32s3'], indirect=['target']) +def test_uhci_psram_s3(dut: Dut) -> None: + dut.run_all_single_board_cases() diff --git a/components/esp_driver_uart/test_apps/uhci/sdkconfig.ci.cache_safe b/components/esp_driver_uart/test_apps/uhci/sdkconfig.ci.cache_safe index 0f206ba78c..0d1c27286b 100644 --- a/components/esp_driver_uart/test_apps/uhci/sdkconfig.ci.cache_safe +++ b/components/esp_driver_uart/test_apps/uhci/sdkconfig.ci.cache_safe @@ -6,6 +6,5 @@ CONFIG_COMPILER_OPTIMIZATION_NONE=y CONFIG_FREERTOS_PLACE_FUNCTIONS_INTO_FLASH=y # silent the error check, as the error string are stored in rodata, causing RTL check failure CONFIG_COMPILER_OPTIMIZATION_CHECKS_SILENT=y -CONFIG_COMPILER_OPTIMIZATION_ASSERTIONS_SILENT=y CONFIG_HAL_ASSERTION_SILENT=y CONFIG_COMPILER_OPTIMIZATION_ASSERTIONS_DISABLE=y diff --git a/components/esp_driver_uart/test_apps/uhci/sdkconfig.ci.psram b/components/esp_driver_uart/test_apps/uhci/sdkconfig.ci.psram deleted file mode 100644 index cc641ea603..0000000000 --- a/components/esp_driver_uart/test_apps/uhci/sdkconfig.ci.psram +++ /dev/null @@ -1 +0,0 @@ -CONFIG_SPIRAM=y diff --git a/components/esp_driver_uart/test_apps/uhci/sdkconfig.defaults.esp32c5 b/components/esp_driver_uart/test_apps/uhci/sdkconfig.defaults.esp32c5 new file mode 100644 index 0000000000..cf58113524 --- /dev/null +++ b/components/esp_driver_uart/test_apps/uhci/sdkconfig.defaults.esp32c5 @@ -0,0 +1,3 @@ +CONFIG_SPIRAM=y +CONFIG_SPIRAM_SPEED_40M=y +CONFIG_SPIRAM_MALLOC_ALWAYSINTERNAL=0 diff --git a/components/esp_driver_uart/test_apps/uhci/sdkconfig.defaults.esp32s3 b/components/esp_driver_uart/test_apps/uhci/sdkconfig.defaults.esp32s3 new file mode 100644 index 0000000000..24336a0742 --- /dev/null +++ b/components/esp_driver_uart/test_apps/uhci/sdkconfig.defaults.esp32s3 @@ -0,0 +1,4 @@ +CONFIG_SPIRAM=y +CONFIG_SPIRAM_MODE_OCT=y +CONFIG_SPIRAM_SPEED_80M=y +CONFIG_SPIRAM_MALLOC_ALWAYSINTERNAL=0