From 0f6adbebed0ecfc9dad4df16165ad1b841797a7d Mon Sep 17 00:00:00 2001 From: armando Date: Tue, 23 Sep 2025 11:21:13 +0800 Subject: [PATCH] change(memory): removed rtc related memory attrs on no-rtc-support chips --- components/esp_common/include/esp_attr.h | 28 +++++++------------ .../release-6.x/6.0/system.rst | 6 ++++ .../release-6.x/6.0/system.rst | 6 ++++ 3 files changed, 22 insertions(+), 18 deletions(-) diff --git a/components/esp_common/include/esp_attr.h b/components/esp_common/include/esp_attr.h index bd122e39c9f..267ed590154 100644 --- a/components/esp_common/include/esp_attr.h +++ b/components/esp_common/include/esp_attr.h @@ -12,6 +12,7 @@ extern "C" { #endif #include "sdkconfig.h" +#include "esp_assert.h" #define ROMFN_ATTR @@ -115,14 +116,15 @@ extern "C" { // Allows to place data into RTC_FAST memory and map it to coredump #define COREDUMP_RTC_FAST_ATTR _SECTION_ATTR_IMPL(".rtc.fast.coredump", __COUNTER__) #else -#define RTC_DATA_ATTR -#define RTC_NOINIT_ATTR -#define RTC_RODATA_ATTR -#define COREDUMP_RTC_DATA_ATTR -#define RTC_SLOW_ATTR -#define RTC_IRAM_ATTR -#define RTC_FAST_ATTR -#define COREDUMP_RTC_FAST_ATTR +// RTC memory is not supported on these chips +#define RTC_DATA_ATTR ESP_STATIC_ASSERT(0, "RTC_DATA_ATTR is not supported on this chip. Use DRAM_ATTR instead.") +#define RTC_NOINIT_ATTR ESP_STATIC_ASSERT(0, "RTC_NOINIT_ATTR is not supported on this chip. Use DRAM_ATTR instead.") +#define RTC_RODATA_ATTR ESP_STATIC_ASSERT(0, "RTC_RODATA_ATTR is not supported on this chip. Use DRAM_ATTR instead.") +#define COREDUMP_RTC_DATA_ATTR ESP_STATIC_ASSERT(0, "COREDUMP_RTC_DATA_ATTR is not supported on this chip. Use COREDUMP_DRAM_ATTR instead.") +#define RTC_SLOW_ATTR ESP_STATIC_ASSERT(0, "RTC_SLOW_ATTR is not supported on this chip. Use DRAM_ATTR instead.") +#define RTC_IRAM_ATTR ESP_STATIC_ASSERT(0, "RTC_IRAM_ATTR is not supported on this chip. Use IRAM_ATTR instead.") +#define RTC_FAST_ATTR ESP_STATIC_ASSERT(0, "RTC_FAST_ATTR is not supported on this chip. Use DRAM_ATTR instead.") +#define COREDUMP_RTC_FAST_ATTR ESP_STATIC_ASSERT(0, "COREDUMP_RTC_FAST_ATTR is not supported on this chip. Use COREDUMP_DRAM_ATTR instead.") #endif #if CONFIG_SPIRAM_ALLOW_BSS_SEG_EXTERNAL_MEMORY @@ -132,16 +134,6 @@ extern "C" { #define EXT_RAM_BSS_ATTR #endif -/** - * Deprecated Macro for putting .bss on PSRAM - */ -#if CONFIG_SPIRAM_ALLOW_BSS_SEG_EXTERNAL_MEMORY -// Forces bss variable into external memory. " -#define EXT_RAM_ATTR _SECTION_ATTR_IMPL(".ext_ram.bss", __COUNTER__) _Pragma ("GCC warning \"'EXT_RAM_ATTR' macro is deprecated, please use `EXT_RAM_BSS_ATTR`\"") -#else -#define EXT_RAM_ATTR _Pragma ("GCC warning \"'EXT_RAM_ATTR' macro is deprecated, please use `EXT_RAM_BSS_ATTR`\"") -#endif - // Forces data into noinit section to avoid initialization after restart. #define __NOINIT_ATTR _SECTION_ATTR_IMPL(".noinit", __COUNTER__) diff --git a/docs/en/migration-guides/release-6.x/6.0/system.rst b/docs/en/migration-guides/release-6.x/6.0/system.rst index 11d1ceba928..f57ef9f92f9 100644 --- a/docs/en/migration-guides/release-6.x/6.0/system.rst +++ b/docs/en/migration-guides/release-6.x/6.0/system.rst @@ -253,3 +253,9 @@ Heap In previous versions of ESP-IDF, the capability MALLOC_CAP_EXEC would be available regardless of the memory protection configuration state. This implied that a call to e.g., :cpp:func:`heap_caps_malloc` with MALLOC_CAP_EXEC would return NULL when CONFIG_ESP_SYSTEM_MEMPROT_FEATURE or CONFIG_ESP_SYSTEM_PMP_IDRAM_SPLIT are enabled. Since ESP-IDF v6.0, the definition of MALLOC_CAP_EXEC is conditional, meaning that if CONFIG_ESP_SYSTEM_MEMPROT is enabled, MALLOC_CAP_EXEC will not be defined. Therefore, using it will generate a compile time error. + +``esp_common`` +-------------- + +- ``EXT_RAM_ATTR`` was deprecated since v5.0, Now it has been removed. Please use the macro ``EXT_RAM_BSS_ATTR`` to put ``.bss`` on PSRAM. +- RTC related memory attributes (``RTC_x_ATTR``) have been removed on those chips without RTC memory. diff --git a/docs/zh_CN/migration-guides/release-6.x/6.0/system.rst b/docs/zh_CN/migration-guides/release-6.x/6.0/system.rst index b8fbc5c79f9..f2864d25945 100644 --- a/docs/zh_CN/migration-guides/release-6.x/6.0/system.rst +++ b/docs/zh_CN/migration-guides/release-6.x/6.0/system.rst @@ -246,3 +246,9 @@ ULP --- LP-Core 在深度睡眠期间遇到异常时,将唤醒主 CPU。此功能默认启用,若不需要此行为,可以通过 :ref:`CONFIG_ULP_TRAP_WAKEUP` Kconfig 配置选项禁用。 + +``esp_common`` +---------------- + +- ``EXT_RAM_ATTR`` 自 v5.0 已弃用,现已移除。请使用 ``EXT_RAM_BSS_ATTR`` 宏将 ``.bss`` 放在 PSRAM 上。 +- RTC 相关内存属性 (``RTC_x_ATTR``) 已从没有 RTC 存储的芯片中移除。