diff --git a/components/esp_hw_support/linker.lf b/components/esp_hw_support/linker.lf index f6d5847180..39c09b7d65 100644 --- a/components/esp_hw_support/linker.lf +++ b/components/esp_hw_support/linker.lf @@ -41,7 +41,13 @@ entries: if IDF_TARGET_ESP32 = y || IDF_TARGET_ESP32S2 = y: rtc_wdt (noflash_text) if PERIPH_CTRL_FUNC_IN_IRAM = y: - periph_ctrl: periph_module_reset (noflash) + periph_ctrl:periph_module_reset (noflash) + periph_ctrl:periph_rcc_enter (noflash) + periph_ctrl:periph_rcc_exit (noflash) + periph_ctrl:periph_rcc_acquire_enter (noflash) + periph_ctrl:periph_rcc_acquire_exit (noflash) + periph_ctrl:periph_rcc_release_enter (noflash) + periph_ctrl:periph_rcc_release_exit (noflash) if PERIPH_CTRL_FUNC_IN_IRAM = y && ESP_WIFI_ENABLED = y: periph_ctrl: wifi_module_enable (noflash) periph_ctrl: wifi_module_disable (noflash) diff --git a/components/esp_hw_support/periph_ctrl.c b/components/esp_hw_support/periph_ctrl.c index 29152555d9..3aeacc32fc 100644 --- a/components/esp_hw_support/periph_ctrl.c +++ b/components/esp_hw_support/periph_ctrl.c @@ -21,35 +21,35 @@ static portMUX_TYPE periph_spinlock = portMUX_INITIALIZER_UNLOCKED; static uint8_t ref_counts[PERIPH_MODULE_MAX] = {0}; -IRAM_ATTR void periph_rcc_enter(void) +void periph_rcc_enter(void) { portENTER_CRITICAL_SAFE(&periph_spinlock); } -IRAM_ATTR void periph_rcc_exit(void) +void periph_rcc_exit(void) { portEXIT_CRITICAL_SAFE(&periph_spinlock); } -IRAM_ATTR uint8_t periph_rcc_acquire_enter(periph_module_t periph) +uint8_t periph_rcc_acquire_enter(periph_module_t periph) { periph_rcc_enter(); return ref_counts[periph]; } -IRAM_ATTR void periph_rcc_acquire_exit(periph_module_t periph, uint8_t ref_count) +void periph_rcc_acquire_exit(periph_module_t periph, uint8_t ref_count) { ref_counts[periph] = ++ref_count; periph_rcc_exit(); } -IRAM_ATTR uint8_t periph_rcc_release_enter(periph_module_t periph) +uint8_t periph_rcc_release_enter(periph_module_t periph) { periph_rcc_enter(); return ref_counts[periph] - 1; } -IRAM_ATTR void periph_rcc_release_exit(periph_module_t periph, uint8_t ref_count) +void periph_rcc_release_exit(periph_module_t periph, uint8_t ref_count) { ref_counts[periph] = ref_count; periph_rcc_exit();