diff --git a/components/esp_hw_support/esp_memory_utils.c b/components/esp_hw_support/esp_memory_utils.c index 62627cbcb9..a75a769b52 100644 --- a/components/esp_hw_support/esp_memory_utils.c +++ b/components/esp_hw_support/esp_memory_utils.c @@ -1,5 +1,5 @@ /* - * SPDX-FileCopyrightText: 2010-2022 Espressif Systems (Shanghai) CO LTD + * SPDX-FileCopyrightText: 2010-2025 Espressif Systems (Shanghai) CO LTD * * SPDX-License-Identifier: Apache-2.0 */ @@ -29,6 +29,24 @@ bool esp_ptr_dma_ext_capable(const void *p) #endif //CONFIG_SPIRAM } +bool esp_ptr_executable(const void *p) +{ + intptr_t ip = (intptr_t) p; + return (ip >= SOC_IROM_LOW && ip < SOC_IROM_HIGH) + || (ip >= SOC_IRAM_LOW && ip < SOC_IRAM_HIGH) + || (ip >= SOC_IROM_MASK_LOW && ip < SOC_IROM_MASK_HIGH) +#if SOC_SPIRAM_SUPPORTED && CONFIG_SPIRAM + || esp_ptr_external_ram(p) +#endif +#if defined(SOC_CACHE_APP_LOW) && defined(CONFIG_ESP_SYSTEM_SINGLE_CORE_MODE) + || (ip >= SOC_CACHE_APP_LOW && ip < SOC_CACHE_APP_HIGH) +#endif +#if SOC_RTC_FAST_MEM_SUPPORTED + || (ip >= SOC_RTC_IRAM_LOW && ip < SOC_RTC_IRAM_HIGH) +#endif + ; +} + bool esp_ptr_byte_accessible(const void *p) { intptr_t ip = (intptr_t) p; diff --git a/components/esp_hw_support/include/esp_memory_utils.h b/components/esp_hw_support/include/esp_memory_utils.h index 4b3a5db4ca..08485750af 100644 --- a/components/esp_hw_support/include/esp_memory_utils.h +++ b/components/esp_hw_support/include/esp_memory_utils.h @@ -246,21 +246,7 @@ inline static bool esp_ptr_word_aligned(const void *p) * * @return true: is executable; false: not executable */ -__attribute__((always_inline)) -inline static bool esp_ptr_executable(const void *p) -{ - intptr_t ip = (intptr_t) p; - return (ip >= SOC_IROM_LOW && ip < SOC_IROM_HIGH) - || (ip >= SOC_IRAM_LOW && ip < SOC_IRAM_HIGH) - || (ip >= SOC_IROM_MASK_LOW && ip < SOC_IROM_MASK_HIGH) -#if defined(SOC_CACHE_APP_LOW) && defined(CONFIG_ESP_SYSTEM_SINGLE_CORE_MODE) - || (ip >= SOC_CACHE_APP_LOW && ip < SOC_CACHE_APP_HIGH) -#endif -#if SOC_RTC_FAST_MEM_SUPPORTED - || (ip >= SOC_RTC_IRAM_LOW && ip < SOC_RTC_IRAM_HIGH) -#endif - ; -} +bool esp_ptr_executable(const void *p); /** * @brief Check if the pointer is byte accessible