From 879b5d4401b501939c461a8e5c24c124d27734c9 Mon Sep 17 00:00:00 2001 From: Armando Date: Thu, 13 Jul 2023 18:31:34 +0800 Subject: [PATCH 1/2] fix(adc): fix adc continuous hal func not in iram when gdma isr iram --- components/esp_adc/linker.lf | 20 ++++++++++++++++++++ components/hal/linker.lf | 20 -------------------- 2 files changed, 20 insertions(+), 20 deletions(-) diff --git a/components/esp_adc/linker.lf b/components/esp_adc/linker.lf index b2e1851e28..755c83f1d6 100644 --- a/components/esp_adc/linker.lf +++ b/components/esp_adc/linker.lf @@ -3,3 +3,23 @@ archive: libesp_adc.a entries: if ADC_ONESHOT_CTRL_FUNC_IN_IRAM = y: adc_oneshot: adc_oneshot_read_isr (noflash) + +[mapping:adc_hal] +archive: libhal.a +entries: + if ADC_ONESHOT_CTRL_FUNC_IN_IRAM = y: + adc_oneshot_hal (noflash) + if COMPILER_OPTIMIZATION_DEBUG = y: + adc_hal_common: get_controller (noflash) + adc_hal_common: adc_hal_set_controller (noflash) + if SOC_ADC_ARBITER_SUPPORTED = y: + adc_hal_common: adc_hal_arbiter_config (noflash) + if SOC_ADC_CALIBRATION_V1_SUPPORTED = y: + adc_hal_common: adc_hal_set_calibration_param (noflash) + adc_hal_common: adc_hal_calibration_init (noflash) + if ADC_CONTINUOUS_ISR_IRAM_SAFE = y || GDMA_ISR_IRAM_SAFE = y: + adc_hal: adc_hal_get_reading_result (noflash) + if IDF_TARGET_ESP32 = y || IDF_TARGET_ESP32S2 = y: + adc_hal: adc_hal_check_event (noflash) + adc_hal: adc_hal_digi_clr_intr (noflash) + adc_hal: adc_hal_get_desc_addr (noflash) diff --git a/components/hal/linker.lf b/components/hal/linker.lf index adb824b320..26367cd1e9 100644 --- a/components/hal/linker.lf +++ b/components/hal/linker.lf @@ -36,23 +36,3 @@ entries: gpio_hal: gpio_hal_intr_disable (noflash) if LCD_RGB_ISR_IRAM_SAFE = y: lcd_hal: lcd_hal_cal_pclk_freq (noflash) - if ADC_ONESHOT_CTRL_FUNC_IN_IRAM = y: - adc_oneshot_hal (noflash) - if COMPILER_OPTIMIZATION_DEFAULT = y: - adc_hal_common: get_controller (noflash) - adc_hal_common: adc_hal_set_controller (noflash) - if SOC_ADC_ARBITER_SUPPORTED = y: - adc_hal_common: adc_hal_arbiter_config (noflash) - if SOC_ADC_CALIBRATION_V1_SUPPORTED = y: - adc_hal_common: adc_hal_set_calibration_param (noflash) - adc_hal_common: adc_hal_calibration_init (noflash) - if ADC_CONTINUOUS_ISR_IRAM_SAFE = y: - adc_hal: adc_hal_get_reading_result (noflash) - adc_hal: adc_hal_digi_start (noflash) - if COMPILER_OPTIMIZATION_DEFAULT = y: - adc_hal: adc_hal_digi_dma_link_descriptors (noflash) - adc_hal: adc_hal_digi_stop (noflash) - if IDF_TARGET_ESP32 = y || IDF_TARGET_ESP32S2 = y: - adc_hal: adc_hal_check_event (noflash) - adc_hal: adc_hal_digi_clr_intr (noflash) - adc_hal: adc_hal_get_desc_addr (noflash) From 8b6957a99c9aa0dc2c263c029b9a8dbe974d9471 Mon Sep 17 00:00:00 2001 From: Armando Date: Wed, 5 Jul 2023 11:01:41 +0800 Subject: [PATCH 2/2] test(adc): continuous driver iram test with gdma iram safe option only --- components/esp_adc/.build-test-rules.yml | 1 + .../test_apps/adc/main/test_adc_driver_iram.c | 4 ++-- components/esp_adc/test_apps/adc/pytest_adc.py | 12 ++++++++++++ .../test_apps/adc/sdkconfig.ci.gdma_iram_safe | 7 +++++++ 4 files changed, 22 insertions(+), 2 deletions(-) create mode 100644 components/esp_adc/test_apps/adc/sdkconfig.ci.gdma_iram_safe diff --git a/components/esp_adc/.build-test-rules.yml b/components/esp_adc/.build-test-rules.yml index 389eceee9d..2a7e4f4184 100644 --- a/components/esp_adc/.build-test-rules.yml +++ b/components/esp_adc/.build-test-rules.yml @@ -3,3 +3,4 @@ components/esp_adc/test_apps/adc: disable: - if: SOC_ADC_SUPPORTED != 1 + - if: CONFIG_NAME == "gdma_iram_safe" and IDF_TARGET in ["esp32", "esp32s2", "esp32c2"] diff --git a/components/esp_adc/test_apps/adc/main/test_adc_driver_iram.c b/components/esp_adc/test_apps/adc/main/test_adc_driver_iram.c index a258a5b743..1e811df9bf 100644 --- a/components/esp_adc/test_apps/adc/main/test_adc_driver_iram.c +++ b/components/esp_adc/test_apps/adc/main/test_adc_driver_iram.c @@ -144,7 +144,7 @@ TEST_CASE("ADC oneshot fast work with ISR and Flash", "[adc_oneshot]") #endif //#if CONFIG_ADC_ONESHOT_CTRL_FUNC_IN_IRAM && CONFIG_GPTIMER_ISR_IRAM_SAFE -#if CONFIG_ADC_CONTINUOUS_ISR_IRAM_SAFE +#if CONFIG_ADC_CONTINUOUS_ISR_IRAM_SAFE || CONFIG_GDMA_ISR_IRAM_SAFE #include "esp_adc/adc_continuous.h" /*--------------------------------------------------------------- ADC continuous work with cache safe ISR @@ -252,7 +252,7 @@ TEST_CASE("ADC continuous work with ISR and Flash", "[adc_oneshot]") TEST_ESP_OK(adc_continuous_deinit(handle)); } -#endif //#if CONFIG_ADC_CONTINUOUS_ISR_IRAM_SAFE +#endif //#if CONFIG_ADC_CONTINUOUS_ISR_IRAM_SAFE || CONFIG_GDMA_ISR_IRAM_SAFE static void IRAM_ATTR NOINLINE_ATTR s_test_cache_disable_period_us(test_adc_iram_ctx_t *ctx, uint32_t period_us) { diff --git a/components/esp_adc/test_apps/adc/pytest_adc.py b/components/esp_adc/test_apps/adc/pytest_adc.py index 17cd79c432..fa7c737a4d 100644 --- a/components/esp_adc/test_apps/adc/pytest_adc.py +++ b/components/esp_adc/test_apps/adc/pytest_adc.py @@ -35,3 +35,15 @@ def test_adc(dut: Dut) -> None: ) def test_adc_esp32c2_xtal_26mhz(dut: Dut) -> None: dut.run_all_single_board_cases(timeout=120) + + +@pytest.mark.esp32s3 +@pytest.mark.esp32c3 +@pytest.mark.esp32c6 +@pytest.mark.esp32h2 +@pytest.mark.adc +@pytest.mark.parametrize('config', [ + 'gdma_iram_safe', +], indirect=True) +def test_adc_gdma_iram(dut: Dut) -> None: + dut.run_all_single_board_cases(timeout=120) diff --git a/components/esp_adc/test_apps/adc/sdkconfig.ci.gdma_iram_safe b/components/esp_adc/test_apps/adc/sdkconfig.ci.gdma_iram_safe new file mode 100644 index 0000000000..67db32cae0 --- /dev/null +++ b/components/esp_adc/test_apps/adc/sdkconfig.ci.gdma_iram_safe @@ -0,0 +1,7 @@ +CONFIG_COMPILER_DUMP_RTL_FILES=y +CONFIG_GDMA_ISR_IRAM_SAFE=y +CONFIG_COMPILER_OPTIMIZATION_SIZE=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