diff --git a/components/driver/rmt/rmt_tx.c b/components/driver/rmt/rmt_tx.c index 31a53bec3f..5c1136e51e 100644 --- a/components/driver/rmt/rmt_tx.c +++ b/components/driver/rmt/rmt_tx.c @@ -486,6 +486,10 @@ esp_err_t rmt_transmit(rmt_channel_handle_t channel, rmt_encoder_t *encoder, con #if !SOC_RMT_SUPPORT_TX_LOOP_COUNT ESP_RETURN_ON_FALSE(config->loop_count <= 0, ESP_ERR_NOT_SUPPORTED, TAG, "loop count is not supported"); #endif // !SOC_RMT_SUPPORT_TX_LOOP_COUNT +#if CONFIG_RMT_ISR_IRAM_SAFE + // payload is retrieved by the encoder, we should make sure it's still accessible even when the cache is disabled + ESP_RETURN_ON_FALSE(esp_ptr_internal(payload), ESP_ERR_INVALID_ARG, TAG, "payload not in internal RAM"); +#endif rmt_group_t *group = channel->group; rmt_hal_context_t *hal = &group->hal; int channel_id = channel->channel_id; diff --git a/components/driver/test_apps/rmt/main/CMakeLists.txt b/components/driver/test_apps/rmt/main/CMakeLists.txt index 0f606cfe21..018443a52a 100644 --- a/components/driver/test_apps/rmt/main/CMakeLists.txt +++ b/components/driver/test_apps/rmt/main/CMakeLists.txt @@ -9,5 +9,5 @@ if(CONFIG_RMT_ISR_IRAM_SAFE) endif() idf_component_register(SRCS "${srcs}" - PRIV_REQUIRES unity driver esp_timer + PRIV_REQUIRES unity driver esp_timer esp_psram WHOLE_ARCHIVE) diff --git a/components/driver/test_apps/rmt/main/test_util_rmt_encoders.c b/components/driver/test_apps/rmt/main/test_util_rmt_encoders.c index 6c95e5d631..15dde71a30 100644 --- a/components/driver/test_apps/rmt/main/test_util_rmt_encoders.c +++ b/components/driver/test_apps/rmt/main/test_util_rmt_encoders.c @@ -9,6 +9,7 @@ #include "sdkconfig.h" #include "unity.h" #include "driver/rmt_encoder.h" +#include "esp_heap_caps.h" #include "esp_attr.h" typedef struct { @@ -72,7 +73,7 @@ static esp_err_t rmt_led_strip_encoder_reset(rmt_encoder_t *encoder) esp_err_t test_rmt_new_led_strip_encoder(rmt_encoder_handle_t *ret_encoder) { - rmt_led_strip_encoder_t *led_encoder = calloc(1, sizeof(rmt_led_strip_encoder_t)); + rmt_led_strip_encoder_t *led_encoder = heap_caps_calloc(1, sizeof(rmt_led_strip_encoder_t), MALLOC_CAP_INTERNAL | MALLOC_CAP_8BIT); led_encoder->base.encode = rmt_encode_led_strip; led_encoder->base.del = rmt_del_led_strip_encoder; led_encoder->base.reset = rmt_led_strip_encoder_reset; @@ -187,7 +188,7 @@ static esp_err_t rmt_nec_protocol_encoder_reset(rmt_encoder_t *encoder) esp_err_t test_rmt_new_nec_protocol_encoder(rmt_encoder_handle_t *ret_encoder) { - rmt_nec_protocol_encoder_t *nec_encoder = calloc(1, sizeof(rmt_nec_protocol_encoder_t)); + rmt_nec_protocol_encoder_t *nec_encoder = heap_caps_calloc(1, sizeof(rmt_nec_protocol_encoder_t), MALLOC_CAP_INTERNAL | MALLOC_CAP_8BIT); nec_encoder->base.encode = rmt_encode_nec_protocol; nec_encoder->base.del = rmt_del_nec_protocol_encoder; nec_encoder->base.reset = rmt_nec_protocol_encoder_reset; diff --git a/components/driver/test_apps/rmt/pytest_rmt.py b/components/driver/test_apps/rmt/pytest_rmt.py index 1bbb3bace0..95e33cf316 100644 --- a/components/driver/test_apps/rmt/pytest_rmt.py +++ b/components/driver/test_apps/rmt/pytest_rmt.py @@ -1,4 +1,4 @@ -# SPDX-FileCopyrightText: 2021-2022 Espressif Systems (Shanghai) CO LTD +# SPDX-FileCopyrightText: 2021-2023 Espressif Systems (Shanghai) CO LTD # SPDX-License-Identifier: CC0-1.0 import pytest @@ -7,7 +7,6 @@ from pytest_embedded import Dut @pytest.mark.esp32 @pytest.mark.esp32s2 -@pytest.mark.esp32s3 @pytest.mark.esp32c3 @pytest.mark.esp32c6 @pytest.mark.esp32h2 @@ -22,3 +21,17 @@ from pytest_embedded import Dut ) def test_rmt(dut: Dut) -> None: dut.run_all_single_board_cases() + + +@pytest.mark.esp32s3 +@pytest.mark.octal_psram +@pytest.mark.parametrize( + 'config', + [ + 'iram_safe', + 'release', + ], + indirect=True, +) +def test_rmt_psram(dut: Dut) -> None: + dut.run_all_single_board_cases() diff --git a/components/driver/test_apps/rmt/sdkconfig.defaults.esp32s3 b/components/driver/test_apps/rmt/sdkconfig.defaults.esp32s3 new file mode 100644 index 0000000000..24336a0742 --- /dev/null +++ b/components/driver/test_apps/rmt/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 diff --git a/components/esp_hw_support/intr_alloc.c b/components/esp_hw_support/intr_alloc.c index 02d72ccd5d..da8b616ec3 100644 --- a/components/esp_hw_support/intr_alloc.c +++ b/components/esp_hw_support/intr_alloc.c @@ -560,7 +560,7 @@ esp_err_t esp_intr_alloc_intrstatus(int source, int flags, uint32_t intrstatusre //Allocate that int! if (flags & ESP_INTR_FLAG_SHARED) { //Populate vector entry and add to linked list. - shared_vector_desc_t *sh_vec=malloc(sizeof(shared_vector_desc_t)); + shared_vector_desc_t *sh_vec = heap_caps_malloc(sizeof(shared_vector_desc_t), MALLOC_CAP_INTERNAL | MALLOC_CAP_8BIT); if (sh_vec == NULL) { portEXIT_CRITICAL(&spinlock); free(ret); @@ -583,7 +583,7 @@ esp_err_t esp_intr_alloc_intrstatus(int source, int flags, uint32_t intrstatusre vd->flags = VECDESC_FL_NONSHARED; if (handler) { #if CONFIG_APPTRACE_SV_ENABLE - non_shared_isr_arg_t *ns_isr_arg=malloc(sizeof(non_shared_isr_arg_t)); + non_shared_isr_arg_t *ns_isr_arg = heap_caps_malloc(sizeof(non_shared_isr_arg_t), MALLOC_CAP_INTERNAL | MALLOC_CAP_8BIT); if (!ns_isr_arg) { portEXIT_CRITICAL(&spinlock); free(ret);