From 1b85ad508140d52089e3f7d214caf781471e5679 Mon Sep 17 00:00:00 2001 From: armando Date: Wed, 11 Mar 2026 10:40:57 +0800 Subject: [PATCH 1/2] change(mem): deprecated tcm and added scp memory utils --- components/app_trace/port/riscv/port_jtag.c | 2 +- .../include/bootloader_memory_utils.h | 26 +++++++++++----- .../bootloader_support/src/esp_image_format.c | 4 +-- components/esp_common/include/esp_attr.h | 19 +++++++----- components/esp_common/soc.lf | 12 ++++---- components/esp_driver_dma/src/dma2d.c | 4 +-- components/esp_hw_support/esp_memory_utils.c | 4 +-- .../esp_hw_support/include/esp_memory_utils.h | 30 +++++++++++++------ .../lowpower/port/esp32p4/sleep_cpu.c | 26 ++++++++-------- .../lowpower/port/esp32p4/sleep_cpu_asm.S | 4 +-- .../port/esp32p4/cpu_region_protect.c | 14 ++++----- .../esp_hw_support/port/esp32p4/pmu_init.c | 10 +++---- .../esp_hw_support/port/esp32p4/pmu_sleep.c | 6 ++-- .../esp_hw_support/port/esp32p4/rtc_clk.c | 8 ++--- .../esp_hw_support/port/esp32s31/rtc_clk.c | 0 components/esp_system/app.lf | 16 +++++----- components/esp_system/ld/esp32p4/memory.ld.in | 4 +-- .../esp_system/ld/esp32p4/sections.ld.in | 26 ++++++++-------- .../esp_system/ld/esp32p4/sections.rev3.ld.in | 26 ++++++++-------- components/esp_system/ld/ld.scp.sections | 15 ++++++++++ .../hal/esp32p4/include/hal/lp_clkrst_ll.h | 4 +-- components/heap/include/esp_heap_caps.h | 3 +- components/heap/port/esp32p4/memory_layout.c | 14 ++++----- .../esp32p4/include/soc/Kconfig.soc_caps.in | 2 +- components/soc/esp32p4/include/soc/soc.h | 4 +-- components/soc/esp32p4/include/soc/soc_caps.h | 2 +- docs/en/api-guides/memory-types.rst | 2 +- docs/en/security/esp32p4_log.inc | 2 +- docs/zh_CN/api-guides/memory-types.rst | 2 +- docs/zh_CN/security/esp32p4_log.inc | 2 +- 30 files changed, 169 insertions(+), 124 deletions(-) create mode 100644 components/esp_hw_support/port/esp32s31/rtc_clk.c create mode 100644 components/esp_system/ld/ld.scp.sections diff --git a/components/app_trace/port/riscv/port_jtag.c b/components/app_trace/port/riscv/port_jtag.c index 03b72826949..2cf7884a31d 100644 --- a/components/app_trace/port/riscv/port_jtag.c +++ b/components/app_trace/port/riscv/port_jtag.c @@ -44,7 +44,7 @@ typedef struct { const static char *TAG = "esp_apptrace"; #if SOC_CACHE_INTERNAL_MEM_VIA_L1CACHE -#define APPTRACE_DRAM_ATTR TCM_DRAM_ATTR +#define APPTRACE_DRAM_ATTR SPM_DRAM_ATTR #else #define APPTRACE_DRAM_ATTR #endif diff --git a/components/bootloader_support/include/bootloader_memory_utils.h b/components/bootloader_support/include/bootloader_memory_utils.h index 0e0f048fffe..2f9a86e533b 100644 --- a/components/bootloader_support/include/bootloader_memory_utils.h +++ b/components/bootloader_support/include/bootloader_memory_utils.h @@ -1,5 +1,5 @@ /* - * SPDX-FileCopyrightText: 2010-2025 Espressif Systems (Shanghai) CO LTD + * SPDX-FileCopyrightText: 2010-2026 Espressif Systems (Shanghai) CO LTD * * SPDX-License-Identifier: Apache-2.0 */ @@ -197,19 +197,31 @@ inline static void * esp_ptr_diram_iram_to_dram(const void *p) { #endif } -#if SOC_MEM_TCM_SUPPORTED +#if SOC_MEM_SCP_SUPPORTED /** - * @brief Check if the pointer is in TCM + * @brief Check if the pointer is in TCM (SCP) * * @param p pointer * - * @return true: is in TCM; false: not in TCM + * @return true: is in TCM (SCP); false: not in TCM (SCP) */ -__attribute__((always_inline)) + __attribute__((always_inline, deprecated("esp_ptr_in_tcm is deprecated, please use esp_ptr_in_scp instead"))) inline static bool esp_ptr_in_tcm(const void *p) { - return ((intptr_t)p >= SOC_TCM_LOW && (intptr_t)p < SOC_TCM_HIGH); + return ((intptr_t)p >= SOC_SCP_LOW && (intptr_t)p < SOC_SCP_HIGH); } -#endif //#if SOC_MEM_TCM_SUPPORTED + +/** + * @brief Check if the pointer is in SCP + * + * @param p pointer + * + * @return true: is in SCP; false: not in SCP + */ + __attribute__((always_inline)) + inline static bool esp_ptr_in_scp(const void *p) { + return ((intptr_t)p >= SOC_SCP_LOW && (intptr_t)p < SOC_SCP_HIGH); + } +#endif //#if SOC_MEM_SCP_SUPPORTED /** End of the common section that has to be in sync with esp_memory_utils.h **/ diff --git a/components/bootloader_support/src/esp_image_format.c b/components/bootloader_support/src/esp_image_format.c index e898d6f328f..76368fb9512 100644 --- a/components/bootloader_support/src/esp_image_format.c +++ b/components/bootloader_support/src/esp_image_format.c @@ -524,8 +524,8 @@ static bool verify_load_addresses(int segment_index, intptr_t load_addr, intptr_ } #endif -#if SOC_MEM_TCM_SUPPORTED - else if (esp_ptr_in_tcm(load_addr_p) && esp_ptr_in_tcm(load_inclusive_end_p)) { +#if SOC_MEM_SCP_SUPPORTED + else if (esp_ptr_in_scp(load_addr_p) && esp_ptr_in_scp(load_inclusive_end_p)) { return true; } #endif diff --git a/components/esp_common/include/esp_attr.h b/components/esp_common/include/esp_attr.h index 267ed590154..0c8c761c48d 100644 --- a/components/esp_common/include/esp_attr.h +++ b/components/esp_common/include/esp_attr.h @@ -1,6 +1,6 @@ /* - * SPDX-FileCopyrightText: 2015-2025 Espressif Systems (Shanghai) CO LTD + * SPDX-FileCopyrightText: 2015-2026 Espressif Systems (Shanghai) CO LTD * * SPDX-License-Identifier: Apache-2.0 */ @@ -29,14 +29,19 @@ extern "C" { // Forces data into DRAM instead of flash #define DRAM_ATTR _SECTION_ATTR_IMPL(".dram1", __COUNTER__) -// Places code into TCM instead of flash -#define TCM_IRAM_ATTR _SECTION_ATTR_IMPL(".tcm.text", __COUNTER__) +// Places code into SCP instead of flash +#define SPM_IRAM_ATTR _SECTION_ATTR_IMPL(".scp.text", __COUNTER__) -// Forces code into TCM instead of flash -#define FORCE_TCM_IRAM_ATTR _SECTION_FORCE_ATTR_IMPL(".tcm.text", __COUNTER__) +// Forces code into SCP instead of flash +#define FORCE_SPM_IRAM_ATTR _SECTION_FORCE_ATTR_IMPL(".scp.text", __COUNTER__) -// Forces data into TCM instead of L2MEM -#define TCM_DRAM_ATTR _SECTION_ATTR_IMPL(".tcm.data", __COUNTER__) +// Forces data into SCP instead of L2MEM +#define SPM_DRAM_ATTR _SECTION_ATTR_IMPL(".scp.data", __COUNTER__) + +// Deprecated macros for TCM (SCP) +#define TCM_IRAM_ATTR _SECTION_ATTR_IMPL(".scp.text", __COUNTER__) _Pragma ("GCC warning \"'TCM_IRAM_ATTR' macro is deprecated, please use `SPM_IRAM_ATTR`\"") +#define FORCE_TCM_IRAM_ATTR _SECTION_FORCE_ATTR_IMPL(".scp.text", __COUNTER__) _Pragma ("GCC warning \"'FORCE_TCM_IRAM_ATTR' macro is deprecated, please use `FORCE_SPM_IRAM_ATTR`\"") +#define TCM_DRAM_ATTR _SECTION_ATTR_IMPL(".scp.data", __COUNTER__) _Pragma ("GCC warning \"'TCM_DRAM_ATTR' macro is deprecated, please use `SPM_DRAM_ATTR`\"") // Forces data to be removed from the final binary but keeps it in the ELF file #define NOLOAD_ATTR _SECTION_ATTR_IMPL(".noload_keep_in_elf", __COUNTER__) diff --git a/components/esp_common/soc.lf b/components/esp_common/soc.lf index 99f81a2a74f..78df6d163dd 100644 --- a/components/esp_common/soc.lf +++ b/components/esp_common/soc.lf @@ -42,14 +42,14 @@ entries: entries: .ext_ram.bss+ -[sections:tcm_text] +[sections:scp_text] entries: - .tcm.text+ + .scp.text+ -[sections:tcm_data] +[sections:scp_data] entries: - .tcm.data+ + .scp.data+ -[sections:tcm_bss] +[sections:scp_bss] entries: - .tcm.bss+ + .scp.bss+ diff --git a/components/esp_driver_dma/src/dma2d.c b/components/esp_driver_dma/src/dma2d.c index 748dc00ca0b..fa59c2fd4b6 100644 --- a/components/esp_driver_dma/src/dma2d.c +++ b/components/esp_driver_dma/src/dma2d.c @@ -711,8 +711,8 @@ esp_err_t dma2d_set_desc_addr(dma2d_channel_handle_t dma2d_chan, intptr_t desc_b { esp_err_t ret = ESP_OK; ESP_GOTO_ON_FALSE_ISR(dma2d_chan && desc_base_addr, ESP_ERR_INVALID_ARG, err, TAG, "invalid argument"); - // 2D-DMA descriptor addr needs 8-byte alignment and not in TCM (addr not in TCM is IDF restriction) - ESP_GOTO_ON_FALSE_ISR((desc_base_addr & 0x7) == 0 && !esp_ptr_in_tcm((void *)desc_base_addr), ESP_ERR_INVALID_ARG, err, TAG, "invalid argument"); + // 2D-DMA descriptor addr needs 8-byte alignment and not in SCP (addr not in SCP is IDF restriction) + ESP_GOTO_ON_FALSE_ISR((desc_base_addr & 0x7) == 0 && !esp_ptr_in_scp((void *)desc_base_addr), ESP_ERR_INVALID_ARG, err, TAG, "invalid argument"); dma2d_group_t *group = dma2d_chan->group; int channel_id = dma2d_chan->channel_id; diff --git a/components/esp_hw_support/esp_memory_utils.c b/components/esp_hw_support/esp_memory_utils.c index a2539da92e7..010da2b5ac4 100644 --- a/components/esp_hw_support/esp_memory_utils.c +++ b/components/esp_hw_support/esp_memory_utils.c @@ -52,8 +52,8 @@ bool esp_ptr_byte_accessible(const void *p) intptr_t ip = (intptr_t) p; bool r; r = (ip >= SOC_BYTE_ACCESSIBLE_LOW && ip < SOC_BYTE_ACCESSIBLE_HIGH); -#if SOC_MEM_TCM_SUPPORTED - r |= esp_ptr_in_tcm(p); +#if SOC_MEM_SCP_SUPPORTED + r |= esp_ptr_in_scp(p); #endif #if CONFIG_ESP_SYSTEM_ALLOW_RTC_FAST_MEM_AS_HEAP /* For ESP32 case, RTC fast memory is accessible to PRO cpu only and hence diff --git a/components/esp_hw_support/include/esp_memory_utils.h b/components/esp_hw_support/include/esp_memory_utils.h index 0379c76a843..8c2784a71de 100644 --- a/components/esp_hw_support/include/esp_memory_utils.h +++ b/components/esp_hw_support/include/esp_memory_utils.h @@ -1,5 +1,5 @@ /* - * SPDX-FileCopyrightText: 2010-2025 Espressif Systems (Shanghai) CO LTD + * SPDX-FileCopyrightText: 2010-2026 Espressif Systems (Shanghai) CO LTD * * SPDX-License-Identifier: Apache-2.0 */ @@ -196,19 +196,31 @@ inline static void * esp_ptr_diram_iram_to_dram(const void *p) { #endif } -#if SOC_MEM_TCM_SUPPORTED +#if SOC_MEM_SCP_SUPPORTED /** - * @brief Check if the pointer is in TCM + * @brief Check if the pointer is in TCM (SCP) * * @param p pointer * - * @return true: is in TCM; false: not in TCM + * @return true: is in TCM (SCP); false: not in TCM (SCP) */ -__attribute__((always_inline)) + __attribute__((always_inline, deprecated("esp_ptr_in_tcm is deprecated, please use esp_ptr_in_scp instead"))) inline static bool esp_ptr_in_tcm(const void *p) { - return ((intptr_t)p >= SOC_TCM_LOW && (intptr_t)p < SOC_TCM_HIGH); + return ((intptr_t)p >= SOC_SCP_LOW && (intptr_t)p < SOC_SCP_HIGH); } -#endif //#if SOC_MEM_TCM_SUPPORTED + +/** + * @brief Check if the pointer is in SCP + * + * @param p pointer + * + * @return true: is in SCP; false: not in SCP + */ + __attribute__((always_inline)) + inline static bool esp_ptr_in_scp(const void *p) { + return ((intptr_t)p >= SOC_SCP_LOW && (intptr_t)p < SOC_SCP_HIGH); + } +#endif //#if SOC_MEM_SCP_SUPPORTED /** End of common functions to be kept in sync with bootloader_memory_utils.h **/ /** Add app-specific functions below **/ @@ -278,8 +290,8 @@ inline static bool esp_ptr_internal(const void *p) { bool r; r = ((intptr_t)p >= SOC_MEM_INTERNAL_LOW && (intptr_t)p < SOC_MEM_INTERNAL_HIGH); -#if SOC_MEM_TCM_SUPPORTED - r |= esp_ptr_in_tcm(p); +#if SOC_MEM_SCP_SUPPORTED + r |= esp_ptr_in_scp(p); #endif #if SOC_RTC_SLOW_MEM_SUPPORTED diff --git a/components/esp_hw_support/lowpower/port/esp32p4/sleep_cpu.c b/components/esp_hw_support/lowpower/port/esp32p4/sleep_cpu.c index eaabbcb4199..8cb351b50d1 100644 --- a/components/esp_hw_support/lowpower/port/esp32p4/sleep_cpu.c +++ b/components/esp_hw_support/lowpower/port/esp32p4/sleep_cpu.c @@ -1,5 +1,5 @@ /* - * SPDX-FileCopyrightText: 2023-2025 Espressif Systems (Shanghai) CO LTD + * SPDX-FileCopyrightText: 2023-2026 Espressif Systems (Shanghai) CO LTD * * SPDX-License-Identifier: Apache-2.0 */ @@ -40,13 +40,13 @@ #if CONFIG_PM_ESP_SLEEP_POWER_DOWN_CPU && !CONFIG_FREERTOS_UNICORE -static TCM_DRAM_ATTR smp_retention_state_t s_smp_retention_state[portNUM_PROCESSORS]; +static SPM_DRAM_ATTR smp_retention_state_t s_smp_retention_state[portNUM_PROCESSORS]; #endif ESP_LOG_ATTR_TAG(TAG, "sleep"); -static TCM_DRAM_ATTR __attribute__((unused)) sleep_cpu_retention_t s_cpu_retention; +static SPM_DRAM_ATTR __attribute__((unused)) sleep_cpu_retention_t s_cpu_retention; extern RvCoreCriticalSleepFrame *rv_core_critical_regs_frame[portNUM_PROCESSORS]; @@ -60,7 +60,7 @@ FORCE_INLINE_ATTR void restore_mstatus(uint32_t mstatus_val) RV_WRITE_CSR(mstatus, mstatus_val); } -static TCM_IRAM_ATTR RvCoreNonCriticalSleepFrame * rv_core_noncritical_regs_save(void) +static SPM_IRAM_ATTR RvCoreNonCriticalSleepFrame * rv_core_noncritical_regs_save(void) { RvCoreNonCriticalSleepFrame *frame = s_cpu_retention.retent.non_critical_frame[esp_cpu_get_core_id()]; @@ -129,7 +129,7 @@ static TCM_IRAM_ATTR RvCoreNonCriticalSleepFrame * rv_core_noncritical_regs_save return frame; } -static TCM_IRAM_ATTR void rv_core_noncritical_regs_restore(void) +static SPM_IRAM_ATTR void rv_core_noncritical_regs_restore(void) { RvCoreNonCriticalSleepFrame *frame = s_cpu_retention.retent.non_critical_frame[esp_cpu_get_core_id()]; @@ -196,7 +196,7 @@ static TCM_IRAM_ATTR void rv_core_noncritical_regs_restore(void) RV_WRITE_CSR(mcycle, frame->mcycle); } -static TCM_IRAM_ATTR void cpu_domain_dev_regs_save(cpu_domain_dev_sleep_frame_t *frame) +static SPM_IRAM_ATTR void cpu_domain_dev_regs_save(cpu_domain_dev_sleep_frame_t *frame) { assert(frame); cpu_domain_dev_regs_region_t *region = frame->region; @@ -210,7 +210,7 @@ static TCM_IRAM_ATTR void cpu_domain_dev_regs_save(cpu_domain_dev_sleep_frame_t } } -static TCM_IRAM_ATTR void cpu_domain_dev_regs_restore(cpu_domain_dev_sleep_frame_t *frame) +static SPM_IRAM_ATTR void cpu_domain_dev_regs_restore(cpu_domain_dev_sleep_frame_t *frame) { assert(frame); cpu_domain_dev_regs_region_t *region = frame->region; @@ -225,12 +225,12 @@ static TCM_IRAM_ATTR void cpu_domain_dev_regs_restore(cpu_domain_dev_sleep_frame } #if CONFIG_PM_CHECK_SLEEP_RETENTION_FRAME -static TCM_IRAM_ATTR void update_retention_frame_crc(uint32_t *frame_ptr, uint32_t frame_check_size, uint32_t *frame_crc_ptr) +static SPM_IRAM_ATTR void update_retention_frame_crc(uint32_t *frame_ptr, uint32_t frame_check_size, uint32_t *frame_crc_ptr) { *(frame_crc_ptr) = esp_rom_crc32_le(0, (void *)frame_ptr, frame_check_size); } -static TCM_IRAM_ATTR void validate_retention_frame_crc(uint32_t *frame_ptr, uint32_t frame_check_size, uint32_t *frame_crc_ptr) +static SPM_IRAM_ATTR void validate_retention_frame_crc(uint32_t *frame_ptr, uint32_t frame_check_size, uint32_t *frame_crc_ptr) { if(*(frame_crc_ptr) != esp_rom_crc32_le(0, (void *)(frame_ptr), frame_check_size)){ // resume uarts @@ -252,7 +252,7 @@ extern RvCoreCriticalSleepFrame * rv_core_critical_regs_save(void); extern RvCoreCriticalSleepFrame * rv_core_critical_regs_restore(void); typedef uint32_t (* sleep_cpu_entry_cb_t)(uint32_t, uint32_t, uint32_t, bool); -static TCM_IRAM_ATTR esp_err_t do_cpu_retention(sleep_cpu_entry_cb_t goto_sleep, +static SPM_IRAM_ATTR esp_err_t do_cpu_retention(sleep_cpu_entry_cb_t goto_sleep, uint32_t wakeup_opt, uint32_t reject_opt, uint32_t lslp_mem_inf_fpu, bool dslp) { uint8_t core_id = esp_cpu_get_core_id(); @@ -291,7 +291,7 @@ static TCM_IRAM_ATTR esp_err_t do_cpu_retention(sleep_cpu_entry_cb_t goto_sleep, return pmu_sleep_finish(dslp); } -esp_err_t TCM_IRAM_ATTR esp_sleep_cpu_retention(uint32_t (*goto_sleep)(uint32_t, uint32_t, uint32_t, bool), +esp_err_t SPM_IRAM_ATTR esp_sleep_cpu_retention(uint32_t (*goto_sleep)(uint32_t, uint32_t, uint32_t, bool), uint32_t wakeup_opt, uint32_t reject_opt, uint32_t lslp_mem_inf_fpu, bool dslp) { esp_sleep_execute_event_callbacks(SLEEP_EVENT_SW_CPU_TO_MEM_START, (void *)0); @@ -374,7 +374,7 @@ esp_err_t sleep_cpu_configure(bool light_sleep_enable) #if !CONFIG_FREERTOS_UNICORE #if CONFIG_PM_ESP_SLEEP_POWER_DOWN_CPU -static TCM_IRAM_ATTR void smp_core_do_retention(void) +static SPM_IRAM_ATTR void smp_core_do_retention(void) { uint8_t core_id = esp_cpu_get_core_id(); @@ -438,7 +438,7 @@ static TCM_IRAM_ATTR void smp_core_do_retention(void) } -TCM_IRAM_ATTR void esp_sleep_cpu_skip_retention(void) { +SPM_IRAM_ATTR void esp_sleep_cpu_skip_retention(void) { atomic_store(&s_smp_retention_state[esp_cpu_get_core_id()], SMP_SKIP_RETENTION); } #endif diff --git a/components/esp_hw_support/lowpower/port/esp32p4/sleep_cpu_asm.S b/components/esp_hw_support/lowpower/port/esp32p4/sleep_cpu_asm.S index 9018ba9c258..a2c9c9831c7 100644 --- a/components/esp_hw_support/lowpower/port/esp32p4/sleep_cpu_asm.S +++ b/components/esp_hw_support/lowpower/port/esp32p4/sleep_cpu_asm.S @@ -14,7 +14,7 @@ #define MTVT (0x307) #define MINTTHRESH (0x347) - .section .tcm.data,"aw" + .section .scp.data,"aw" .global rv_core_critical_regs_frame .type rv_core_critical_regs_frame,@object .align 4 @@ -33,7 +33,7 @@ rv_core_critical_regs_frame: -------------------------------------------------------------------------------- */ - .section .tcm.text,"ax" + .section .scp.text,"ax" .global rv_core_critical_regs_save .type rv_core_critical_regs_save,@function .align 4 diff --git a/components/esp_hw_support/port/esp32p4/cpu_region_protect.c b/components/esp_hw_support/port/esp32p4/cpu_region_protect.c index 1d7e804a4d8..17db36f416c 100644 --- a/components/esp_hw_support/port/esp32p4/cpu_region_protect.c +++ b/components/esp_hw_support/port/esp32p4/cpu_region_protect.c @@ -1,5 +1,5 @@ /* - * SPDX-FileCopyrightText: 2023-2025 Espressif Systems (Shanghai) CO LTD + * SPDX-FileCopyrightText: 2023-2026 Espressif Systems (Shanghai) CO LTD * * SPDX-License-Identifier: Apache-2.0 */ @@ -50,12 +50,12 @@ static void esp_cpu_configure_invalid_regions(void) // 0. Gap at bottom of address space PMA_RESET_AND_ENTRY_SET_NAPOT(0, 0, SOC_CPU_SUBSYSTEM_LOW, PMA_NAPOT | PMA_NONE); - // 1. Gap between CPU subsystem region & HP TCM + // 1. Gap between CPU subsystem region & HP SCP PMA_RESET_AND_ENTRY_SET_TOR(1, SOC_CPU_SUBSYSTEM_HIGH, PMA_NONE); - PMA_RESET_AND_ENTRY_SET_TOR(2, SOC_TCM_LOW, PMA_TOR | PMA_NONE); + PMA_RESET_AND_ENTRY_SET_TOR(2, SOC_SCP_LOW, PMA_TOR | PMA_NONE); - // 2. Gap between HP TCM and CPU Peripherals - PMA_RESET_AND_ENTRY_SET_TOR(3, SOC_TCM_HIGH, PMA_NONE); + // 2. Gap between HP SCP and CPU Peripherals + PMA_RESET_AND_ENTRY_SET_TOR(3, SOC_SCP_HIGH, PMA_NONE); PMA_RESET_AND_ENTRY_SET_TOR(4, CPU_PERIPH_LOW, PMA_TOR | PMA_NONE); // 3. Gap between CPU Peripherals and I_Cache @@ -106,8 +106,8 @@ static void esp_cpu_configure_region_protection_rev_v3(void) PMP_RESET_AND_ENTRY_SET(0, pmpaddr0, PMP_NAPOT | RW); _Static_assert(SOC_CPU_SUBSYSTEM_LOW < SOC_CPU_SUBSYSTEM_HIGH, "Invalid CPU subsystem region"); - // 2. HP-CPU TCM - // The default memory permissions are RWX and TCM should be RWX, so we can skip configuring it + // 2. HP-CPU SCP + // The default memory permissions are RWX and SCP should be RWX, so we can skip configuring it // 3. CPU Peripherals const uint32_t pmpaddr1 = PMPADDR_NAPOT(CPU_PERIPH_LOW, CPU_PERIPH_HIGH); diff --git a/components/esp_hw_support/port/esp32p4/pmu_init.c b/components/esp_hw_support/port/esp32p4/pmu_init.c index e9ab441ccfc..ad4dedd21db 100644 --- a/components/esp_hw_support/port/esp32p4/pmu_init.c +++ b/components/esp_hw_support/port/esp32p4/pmu_init.c @@ -1,5 +1,5 @@ /* - * SPDX-FileCopyrightText: 2023-2025 Espressif Systems (Shanghai) CO LTD + * SPDX-FileCopyrightText: 2023-2026 Espressif Systems (Shanghai) CO LTD * * SPDX-License-Identifier: Apache-2.0 */ @@ -39,13 +39,13 @@ typedef struct { const pmu_lp_system_analog_param_t *analog; } pmu_lp_system_param_t; -pmu_context_t * __attribute__((weak)) TCM_IRAM_ATTR PMU_instance(void) +pmu_context_t * __attribute__((weak)) SPM_IRAM_ATTR PMU_instance(void) { /* It should be explicitly defined in the internal RAM, because this * instance will be used in pmu_sleep.c */ - static TCM_DRAM_ATTR pmu_hal_context_t pmu_hal = { .dev = &PMU }; - static TCM_DRAM_ATTR pmu_sleep_machine_constant_t pmu_mc = PMU_SLEEP_MC_DEFAULT(); - static TCM_DRAM_ATTR pmu_context_t pmu_context = { .hal = &pmu_hal, .mc = (void *)&pmu_mc }; + static SPM_DRAM_ATTR pmu_hal_context_t pmu_hal = { .dev = &PMU }; + static SPM_DRAM_ATTR pmu_sleep_machine_constant_t pmu_mc = PMU_SLEEP_MC_DEFAULT(); + static SPM_DRAM_ATTR pmu_context_t pmu_context = { .hal = &pmu_hal, .mc = (void *)&pmu_mc }; return &pmu_context; } diff --git a/components/esp_hw_support/port/esp32p4/pmu_sleep.c b/components/esp_hw_support/port/esp32p4/pmu_sleep.c index 78a06374d99..069e7395121 100644 --- a/components/esp_hw_support/port/esp32p4/pmu_sleep.c +++ b/components/esp_hw_support/port/esp32p4/pmu_sleep.c @@ -384,10 +384,10 @@ FORCE_INLINE_ATTR void pmu_sleep_cache_sync_items(uint32_t gid, uint32_t type, u ; } -static TCM_DRAM_ATTR uint32_t s_mpll_freq_mhz_before_sleep = 0; +static SPM_DRAM_ATTR uint32_t s_mpll_freq_mhz_before_sleep = 0; __attribute__((optimize("-O2"))) -TCM_IRAM_ATTR uint32_t pmu_sleep_start(uint32_t wakeup_opt, uint32_t reject_opt, uint32_t lslp_mem_inf_fpu, bool dslp) +SPM_IRAM_ATTR uint32_t pmu_sleep_start(uint32_t wakeup_opt, uint32_t reject_opt, uint32_t lslp_mem_inf_fpu, bool dslp) { lp_aon_hal_inform_wakeup_type(dslp); @@ -470,7 +470,7 @@ TCM_IRAM_ATTR uint32_t pmu_sleep_start(uint32_t wakeup_opt, uint32_t reject_opt, return pmu_sleep_finish(dslp); } -TCM_IRAM_ATTR bool pmu_sleep_finish(bool dslp) +SPM_IRAM_ATTR bool pmu_sleep_finish(bool dslp) { if (dslp) { pmu_ll_hp_set_dcm_vset(&PMU, PMU_MODE_HP_ACTIVE, HP_CALI_ACTIVE_DCM_VSET_DEFAULT); diff --git a/components/esp_hw_support/port/esp32p4/rtc_clk.c b/components/esp_hw_support/port/esp32p4/rtc_clk.c index 1f7dd0ca609..1373bbdcec2 100644 --- a/components/esp_hw_support/port/esp32p4/rtc_clk.c +++ b/components/esp_hw_support/port/esp32p4/rtc_clk.c @@ -31,7 +31,7 @@ ESP_HW_LOG_ATTR_TAG(TAG, "rtc_clk"); static int s_cur_cpll_freq = 0; // MPLL frequency option, 400MHz. Zero if MPLL is not enabled. -static TCM_DRAM_ATTR uint32_t s_cur_mpll_freq = 0; +static SPM_DRAM_ATTR uint32_t s_cur_mpll_freq = 0; void rtc_clk_32k_enable(bool enable) { @@ -643,13 +643,13 @@ bool rtc_dig_8m_enabled(void) } //------------------------------------MPLL-------------------------------------// -TCM_IRAM_ATTR void rtc_clk_mpll_disable(void) +SPM_IRAM_ATTR void rtc_clk_mpll_disable(void) { clk_ll_mpll_disable(); s_cur_mpll_freq = 0; } -TCM_IRAM_ATTR void rtc_clk_mpll_enable(void) +SPM_IRAM_ATTR void rtc_clk_mpll_enable(void) { clk_ll_mpll_enable(); } @@ -678,7 +678,7 @@ void rtc_clk_mpll_configure(uint32_t xtal_freq, uint32_t mpll_freq, bool thread_ s_cur_mpll_freq = mpll_freq; } -TCM_IRAM_ATTR uint32_t rtc_clk_mpll_get_freq(void) +SPM_IRAM_ATTR uint32_t rtc_clk_mpll_get_freq(void) { return s_cur_mpll_freq; } diff --git a/components/esp_hw_support/port/esp32s31/rtc_clk.c b/components/esp_hw_support/port/esp32s31/rtc_clk.c new file mode 100644 index 00000000000..e69de29bb2d diff --git a/components/esp_system/app.lf b/components/esp_system/app.lf index d9f6b73e446..85929ae2b7a 100644 --- a/components/esp_system/app.lf +++ b/components/esp_system/app.lf @@ -22,8 +22,8 @@ entries: rtc_data -> rtc_data rtc_rodata -> rtc_data rtc_bss -> rtc_bss - tcm_text -> tcm_text - tcm_data -> tcm_data + scp_text -> scp_text + scp_data -> scp_data [scheme:rtc] entries: @@ -46,13 +46,13 @@ entries: entries: text -> iram0_text -[scheme:tcm] +[scheme:scp] entries: - text -> tcm_text - data -> tcm_data - rodata -> tcm_data - bss -> tcm_bss - common -> tcm_bss + text -> scp_text + data -> scp_data + rodata -> scp_data + bss -> scp_bss + common -> scp_bss [mapping:default] archive: * diff --git a/components/esp_system/ld/esp32p4/memory.ld.in b/components/esp_system/ld/esp32p4/memory.ld.in index 698d6dac409..c7a52fe7882 100644 --- a/components/esp_system/ld/esp32p4/memory.ld.in +++ b/components/esp_system/ld/esp32p4/memory.ld.in @@ -46,8 +46,8 @@ MEMORY * of the various regions. The 'data access port' dram/drom regions map to the same iram/irom regions but * are connected to the data port of the CPU and eg allow byte-wise access. */ - /* TCM */ - tcm_idram_seg (RX) : org = 0x30100000, len = 0x2000 + /* SCP */ + scp_idram_seg (RX) : org = 0x30100000, len = 0x2000 #if CONFIG_APP_BUILD_USE_FLASH_SECTIONS #if CONFIG_SPIRAM_FETCH_INSTRUCTIONS diff --git a/components/esp_system/ld/esp32p4/sections.ld.in b/components/esp_system/ld/esp32p4/sections.ld.in index 40197e4147a..9e3d745be79 100644 --- a/components/esp_system/ld/esp32p4/sections.ld.in +++ b/components/esp_system/ld/esp32p4/sections.ld.in @@ -157,26 +157,26 @@ SECTIONS ASSERT((_rtc_fast_length <= LENGTH(rtc_data_seg)), "RTC_FAST segment data does not fit.") - .tcm.text : + .scp.text : { - /* Code marked as running out of TCM */ - _tcm_text_start = ABSOLUTE(.); + /* Code marked as running out of SCP */ + _scp_text_start = ABSOLUTE(.); - arrays[tcm_text] - mapping[tcm_text] + arrays[scp_text] + mapping[scp_text] - _tcm_text_end = ABSOLUTE(.); - } > tcm_idram_seg + _scp_text_end = ABSOLUTE(.); + } > scp_idram_seg - .tcm.data : + .scp.data : { - _tcm_data_start = ABSOLUTE(.); + _scp_data_start = ABSOLUTE(.); - arrays[tcm_data] - mapping[tcm_data] + arrays[scp_data] + mapping[scp_data] - _tcm_data_end = ABSOLUTE(.); - } > tcm_idram_seg + _scp_data_end = ABSOLUTE(.); + } > scp_idram_seg .iram0.text : { diff --git a/components/esp_system/ld/esp32p4/sections.rev3.ld.in b/components/esp_system/ld/esp32p4/sections.rev3.ld.in index 137e638c22b..9342bd915dc 100644 --- a/components/esp_system/ld/esp32p4/sections.rev3.ld.in +++ b/components/esp_system/ld/esp32p4/sections.rev3.ld.in @@ -166,26 +166,26 @@ SECTIONS ASSERT((_rtc_fast_length <= LENGTH(rtc_data_seg)), "RTC_FAST segment data does not fit.") - .tcm.text : + .scp.text : { - /* Code marked as running out of TCM */ - _tcm_text_start = ABSOLUTE(.); + /* Code marked as running out of SCP */ + _scp_text_start = ABSOLUTE(.); - arrays[tcm_text] - mapping[tcm_text] + arrays[scp_text] + mapping[scp_text] - _tcm_text_end = ABSOLUTE(.); - } > tcm_idram_seg + _scp_text_end = ABSOLUTE(.); + } > scp_idram_seg - .tcm.data : + .scp.data : { - _tcm_data_start = ABSOLUTE(.); + _scp_data_start = ABSOLUTE(.); - arrays[tcm_data] - mapping[tcm_data] + arrays[scp_data] + mapping[scp_data] - _tcm_data_end = ABSOLUTE(.); - } > tcm_idram_seg + _scp_data_end = ABSOLUTE(.); + } > scp_idram_seg .iram0.text : { diff --git a/components/esp_system/ld/ld.scp.sections b/components/esp_system/ld/ld.scp.sections new file mode 100644 index 00000000000..c300bdc9f74 --- /dev/null +++ b/components/esp_system/ld/ld.scp.sections @@ -0,0 +1,15 @@ +#include "ld.common" + .scp.text : + { + /* Code marked as running out of scp */ + _scp_text_start = ABSOLUTE(.); + SECTION_MAPPINGS(scp_text) + _scp_text_end = ABSOLUTE(.); + } > scp_idram_seg + + .scp.data : + { + _scp_data_start = ABSOLUTE(.); + SECTION_MAPPINGS(scp_data) + _scp_data_end = ABSOLUTE(.); + } > scp_idram_seg diff --git a/components/hal/esp32p4/include/hal/lp_clkrst_ll.h b/components/hal/esp32p4/include/hal/lp_clkrst_ll.h index 68f4b424f2c..01810bd632b 100644 --- a/components/hal/esp32p4/include/hal/lp_clkrst_ll.h +++ b/components/hal/esp32p4/include/hal/lp_clkrst_ll.h @@ -21,8 +21,8 @@ extern "C" { /** * Select CPU reset vector * @param boot_from_lp_ram - * true: boot from LP TCM RAM: 0x50108000 - * false: boot from HP TCM ROM: 0x4FC00000 + * true: boot from LP SCP RAM: 0x50108000 + * false: boot from HP SCP ROM: 0x4FC00000 */ __attribute__((always_inline)) static inline void lp_clkrst_ll_boot_from_lp_ram(bool boot_from_lp_ram) diff --git a/components/heap/include/esp_heap_caps.h b/components/heap/include/esp_heap_caps.h index d060ed6a571..e6abd31ae8c 100644 --- a/components/heap/include/esp_heap_caps.h +++ b/components/heap/include/esp_heap_caps.h @@ -44,7 +44,8 @@ extern "C" { #define MALLOC_CAP_IRAM_8BIT (1<<13) ///< Memory must be in IRAM and allow unaligned access #define MALLOC_CAP_RETENTION (1<<14) ///< Memory must be able to accessed by retention DMA #define MALLOC_CAP_RTCRAM (1<<15) ///< Memory must be in RTC fast memory -#define MALLOC_CAP_TCM (1<<16) ///< Memory must be in TCM memory +#define MALLOC_CAP_SCP (1<<16) ///< Memory must be in SCP memory +#define MALLOC_CAP_TCM MALLOC_CAP_SCP _Pragma ("GCC warning \"'MALLOC_CAP_TCM' macro is deprecated, please use `MALLOC_CAP_SCP`\"") #define MALLOC_CAP_DMA_DESC_AHB (1<<17) ///< Memory must be capable of containing AHB DMA descriptors #define MALLOC_CAP_DMA_DESC_AXI (1<<18) ///< Memory must be capable of containing AXI DMA descriptors #define MALLOC_CAP_CACHE_ALIGNED (1<<19) ///< Memory must be aligned to the cache line size of any intermediate caches diff --git a/components/heap/port/esp32p4/memory_layout.c b/components/heap/port/esp32p4/memory_layout.c index d26238bc975..3635de2d5cc 100644 --- a/components/heap/port/esp32p4/memory_layout.c +++ b/components/heap/port/esp32p4/memory_layout.c @@ -1,5 +1,5 @@ /* - * SPDX-FileCopyrightText: 2023-2025 Espressif Systems (Shanghai) CO LTD + * SPDX-FileCopyrightText: 2023-2026 Espressif Systems (Shanghai) CO LTD * * SPDX-License-Identifier: Apache-2.0 */ @@ -36,7 +36,7 @@ enum { */ SOC_MEMORY_TYPE_RETENT_MEM = 1, SOC_MEMORY_TYPE_SPIRAM = 2, - SOC_MEMORY_TYPE_TCM = 3, + SOC_MEMORY_TYPE_SCP = 3, SOC_MEMORY_TYPE_RTCRAM = 4, SOC_MEMORY_TYPE_NUM, }; @@ -53,7 +53,7 @@ enum { #endif // The memory used for SIMD instructions requires the bus of its memory regions be able to transfer the data in 128-bit -// TCM and RTCRAM memory regions cannot satisfy 128-bit data access +// SCP and RTCRAM memory regions cannot satisfy 128-bit data access /** * Defined the attributes and allocation priority of each memory on the chip, @@ -66,7 +66,7 @@ const soc_memory_type_desc_t soc_memory_types[SOC_MEMORY_TYPE_NUM] = { [SOC_MEMORY_TYPE_RETENT_MEM] = { "RETENT_RAM", { MALLOC_L2MEM_BASE_CAPS | MALLOC_CAP_RETENTION | MALLOC_CAP_SIMD, 0, 0 }}, [SOC_MEMORY_TYPE_L2MEM] = { "RAM", { MALLOC_L2MEM_BASE_CAPS | MALLOC_CAP_SIMD, 0, 0 }}, [SOC_MEMORY_TYPE_SPIRAM] = { "SPIRAM", { MALLOC_CAP_SPIRAM, 0, ESP32P4_MEM_COMMON_CAPS | MALLOC_CAP_SIMD }}, - [SOC_MEMORY_TYPE_TCM] = { "TCM", { MALLOC_CAP_TCM, ESP32P4_MEM_COMMON_CAPS | MALLOC_CAP_INTERNAL, 0 }}, + [SOC_MEMORY_TYPE_SCP] = { "SCP", { MALLOC_CAP_SCP, ESP32P4_MEM_COMMON_CAPS | MALLOC_CAP_INTERNAL, 0 }}, [SOC_MEMORY_TYPE_RTCRAM] = { "RTCRAM", { MALLOC_CAP_RTCRAM, 0, MALLOC_RTCRAM_BASE_CAPS}}, }; @@ -112,7 +112,7 @@ const soc_memory_region_t soc_memory_regions[] = { #ifdef CONFIG_ESP_SYSTEM_ALLOW_RTC_FAST_MEM_AS_HEAP { 0x50108000, APP_USABLE_LP_RAM_SIZE, SOC_MEMORY_TYPE_RTCRAM, 0, false}, //LPRAM #endif - { 0x30100000, 0x2000, SOC_MEMORY_TYPE_TCM, 0, false}, + { 0x30100000, 0x2000, SOC_MEMORY_TYPE_SCP, 0, false}, }; const size_t soc_memory_region_count = sizeof(soc_memory_regions) / sizeof(soc_memory_region_t); @@ -125,7 +125,7 @@ extern int _data_start, _heap_start, _iram_start, _iram_end, _rtc_force_slow_end extern int _rtc_p4_rev3_mspi_workaround_start, _rtc_p4_rev3_mspi_workaround_end; #endif #endif -extern int _tcm_text_start, _tcm_data_end; +extern int _scp_text_start, _scp_data_end; extern int _rtc_reserved_start, _rtc_reserved_end; extern int _rtc_ulp_memory_start; @@ -146,7 +146,7 @@ SOC_RESERVE_MEMORY_REGION((intptr_t)&_data_start, (intptr_t)&_heap_start, dram_d // Target has a shared D/IRAM virtual address, no need to calculate I_D_OFFSET like previous chips SOC_RESERVE_MEMORY_REGION((intptr_t)&_iram_start, (intptr_t)&_iram_end, iram_code); -SOC_RESERVE_MEMORY_REGION((intptr_t)&_tcm_text_start, (intptr_t)&_tcm_data_end, tcm_code_data); +SOC_RESERVE_MEMORY_REGION((intptr_t)&_scp_text_start, (intptr_t)&_scp_data_end, scp_code_data); #ifdef CONFIG_SPIRAM SOC_RESERVE_MEMORY_REGION( SOC_EXTRAM_LOW, SOC_EXTRAM_HIGH, extram_region); diff --git a/components/soc/esp32p4/include/soc/Kconfig.soc_caps.in b/components/soc/esp32p4/include/soc/Kconfig.soc_caps.in index 80dd93d7653..250730082a4 100644 --- a/components/soc/esp32p4/include/soc/Kconfig.soc_caps.in +++ b/components/soc/esp32p4/include/soc/Kconfig.soc_caps.in @@ -1899,7 +1899,7 @@ config SOC_TEMPERATURE_SENSOR_SUPPORT_SLEEP_RETENTION bool default y -config SOC_MEM_TCM_SUPPORTED +config SOC_MEM_SCP_SUPPORTED bool default y diff --git a/components/soc/esp32p4/include/soc/soc.h b/components/soc/esp32p4/include/soc/soc.h index f6d21eaf0b5..fd2877cb807 100644 --- a/components/soc/esp32p4/include/soc/soc.h +++ b/components/soc/esp32p4/include/soc/soc.h @@ -156,8 +156,8 @@ #define SOC_IROM_MASK_HIGH 0x4fc20000 #define SOC_DROM_MASK_LOW 0x4fc00000 #define SOC_DROM_MASK_HIGH 0x4fc20000 -#define SOC_TCM_LOW 0x30100000 -#define SOC_TCM_HIGH 0x30102000 +#define SOC_SCP_LOW 0x30100000 +#define SOC_SCP_HIGH 0x30102000 #define SOC_IRAM_LOW 0x4ff00000 #define SOC_IRAM_HIGH 0x4ffc0000 #define SOC_DRAM_LOW 0x4ff00000 diff --git a/components/soc/esp32p4/include/soc/soc_caps.h b/components/soc/esp32p4/include/soc/soc_caps.h index f65ede2724e..ce1faa500f9 100644 --- a/components/soc/esp32p4/include/soc/soc_caps.h +++ b/components/soc/esp32p4/include/soc/soc_caps.h @@ -727,7 +727,7 @@ #define SOC_TEMPERATURE_SENSOR_SUPPORT_SLEEP_RETENTION (1) /*-------------------------- Memory CAPS --------------------------*/ -#define SOC_MEM_TCM_SUPPORTED (1) +#define SOC_MEM_SCP_SUPPORTED (1) #define SOC_ASYNCHRONOUS_BUS_ERROR_MODE (1) /*--------------------------- EMAC --------------------------------*/ #define SOC_EMAC_IEEE1588V2_SUPPORTED (1) /*!< EMAC Supports IEEE1588v2 time stamping */ diff --git a/docs/en/api-guides/memory-types.rst b/docs/en/api-guides/memory-types.rst index 87455bea14b..10e1cfab342 100644 --- a/docs/en/api-guides/memory-types.rst +++ b/docs/en/api-guides/memory-types.rst @@ -187,7 +187,7 @@ The ``DRAM_ATTR`` attribute can be used to force constants from DROM into the :r Remaining RTC FAST memory is added to the heap unless the option :ref:`CONFIG_ESP_SYSTEM_ALLOW_RTC_FAST_MEM_AS_HEAP` is disabled. This memory can be used interchangeably with :ref:`DRAM`, but is slightly slower to access. -.. only:: SOC_MEM_TCM_SUPPORTED +.. only:: SOC_MEM_SCP_SUPPORTED SPM (Scratchpad Memory) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ diff --git a/docs/en/security/esp32p4_log.inc b/docs/en/security/esp32p4_log.inc index ae977774011..8df6f986989 100644 --- a/docs/en/security/esp32p4_log.inc +++ b/docs/en/security/esp32p4_log.inc @@ -127,7 +127,7 @@ I (310) heap_init: At 4FF3AFC0 len 00004BE4 (18 KiB): RAM I (316) heap_init: At 4FF40000 len 00060000 (384 KiB): RAM I (323) heap_init: At 50108000 len 00007FE8 (31 KiB): RTCRAM - I (329) heap_init: At 30100044 len 00001FBC (7 KiB): TCM + I (329) heap_init: At 30100044 len 00001FBC (7 KiB): SCP I (336) spi_flash: detected chip: generic I (340) spi_flash: flash io: dio W (344) spi_flash: Detected size(4096k) larger than the size in the binary image header(2048k). Using the size in the binary image header. diff --git a/docs/zh_CN/api-guides/memory-types.rst b/docs/zh_CN/api-guides/memory-types.rst index fcb5e8b1c56..7546958d156 100644 --- a/docs/zh_CN/api-guides/memory-types.rst +++ b/docs/zh_CN/api-guides/memory-types.rst @@ -187,7 +187,7 @@ DROM(数据存储在 flash 中) 除非禁用 :ref:`CONFIG_ESP_SYSTEM_ALLOW_RTC_FAST_MEM_AS_HEAP` 选项,否则剩余的 RTC FAST memory 会被添加到堆中。该部分内存可以和 :ref:`DRAM` 互换使用,但是访问速度稍慢一点。 -.. only:: SOC_MEM_TCM_SUPPORTED +.. only:: SOC_MEM_SCP_SUPPORTED SPM(暂存内存) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ diff --git a/docs/zh_CN/security/esp32p4_log.inc b/docs/zh_CN/security/esp32p4_log.inc index ae977774011..8df6f986989 100644 --- a/docs/zh_CN/security/esp32p4_log.inc +++ b/docs/zh_CN/security/esp32p4_log.inc @@ -127,7 +127,7 @@ I (310) heap_init: At 4FF3AFC0 len 00004BE4 (18 KiB): RAM I (316) heap_init: At 4FF40000 len 00060000 (384 KiB): RAM I (323) heap_init: At 50108000 len 00007FE8 (31 KiB): RTCRAM - I (329) heap_init: At 30100044 len 00001FBC (7 KiB): TCM + I (329) heap_init: At 30100044 len 00001FBC (7 KiB): SCP I (336) spi_flash: detected chip: generic I (340) spi_flash: flash io: dio W (344) spi_flash: Detected size(4096k) larger than the size in the binary image header(2048k). Using the size in the binary image header. From 45ec3b962bac8fe9491c08800b8efcc4f78a15c7 Mon Sep 17 00:00:00 2001 From: armando Date: Mon, 16 Mar 2026 17:37:36 +0800 Subject: [PATCH 2/2] fix(spm): rename scp (scratchpad) to spm (scratchpad memory) --- .../include/bootloader_memory_utils.h | 20 +++++++------- .../bootloader_support/src/esp_image_format.c | 4 +-- components/esp_common/include/esp_attr.h | 20 +++++++------- components/esp_common/soc.lf | 12 ++++----- components/esp_driver_dma/src/dma2d.c | 4 +-- components/esp_hw_support/esp_memory_utils.c | 4 +-- .../esp_hw_support/include/esp_memory_utils.h | 24 ++++++++--------- .../lowpower/port/esp32p4/sleep_cpu_asm.S | 4 +-- .../port/esp32p4/cpu_region_protect.c | 12 ++++----- components/esp_system/app.lf | 16 ++++++------ components/esp_system/ld/esp32p4/memory.ld.in | 4 +-- .../esp_system/ld/esp32p4/sections.ld.in | 26 +++++++++---------- .../esp_system/ld/esp32p4/sections.rev3.ld.in | 26 +++++++++---------- components/esp_system/ld/ld.scp.sections | 15 ----------- components/esp_system/ld/ld.spm.sections | 15 +++++++++++ .../hal/esp32p4/include/hal/lp_clkrst_ll.h | 4 +-- components/heap/include/esp_heap_caps.h | 4 +-- components/heap/port/esp32p4/memory_layout.c | 12 ++++----- .../esp32p4/include/soc/Kconfig.soc_caps.in | 2 +- components/soc/esp32p4/include/soc/soc.h | 4 +-- components/soc/esp32p4/include/soc/soc_caps.h | 2 +- docs/en/api-guides/memory-types.rst | 2 +- docs/en/security/esp32p4_log.inc | 2 +- docs/zh_CN/api-guides/memory-types.rst | 2 +- docs/zh_CN/security/esp32p4_log.inc | 2 +- 25 files changed, 121 insertions(+), 121 deletions(-) delete mode 100644 components/esp_system/ld/ld.scp.sections create mode 100644 components/esp_system/ld/ld.spm.sections diff --git a/components/bootloader_support/include/bootloader_memory_utils.h b/components/bootloader_support/include/bootloader_memory_utils.h index 2f9a86e533b..d9f1f59f481 100644 --- a/components/bootloader_support/include/bootloader_memory_utils.h +++ b/components/bootloader_support/include/bootloader_memory_utils.h @@ -197,31 +197,31 @@ inline static void * esp_ptr_diram_iram_to_dram(const void *p) { #endif } -#if SOC_MEM_SCP_SUPPORTED +#if SOC_MEM_SPM_SUPPORTED /** - * @brief Check if the pointer is in TCM (SCP) + * @brief Check if the pointer is in TCM (SPM) * * @param p pointer * - * @return true: is in TCM (SCP); false: not in TCM (SCP) + * @return true: is in TCM (SPM); false: not in TCM (SPM) */ - __attribute__((always_inline, deprecated("esp_ptr_in_tcm is deprecated, please use esp_ptr_in_scp instead"))) + __attribute__((always_inline, deprecated("esp_ptr_in_tcm is deprecated, please use esp_ptr_in_spm instead"))) inline static bool esp_ptr_in_tcm(const void *p) { - return ((intptr_t)p >= SOC_SCP_LOW && (intptr_t)p < SOC_SCP_HIGH); + return ((intptr_t)p >= SOC_SPM_LOW && (intptr_t)p < SOC_SPM_HIGH); } /** - * @brief Check if the pointer is in SCP + * @brief Check if the pointer is in SPM * * @param p pointer * - * @return true: is in SCP; false: not in SCP + * @return true: is in SPM; false: not in SPM */ __attribute__((always_inline)) - inline static bool esp_ptr_in_scp(const void *p) { - return ((intptr_t)p >= SOC_SCP_LOW && (intptr_t)p < SOC_SCP_HIGH); + inline static bool esp_ptr_in_spm(const void *p) { + return ((intptr_t)p >= SOC_SPM_LOW && (intptr_t)p < SOC_SPM_HIGH); } -#endif //#if SOC_MEM_SCP_SUPPORTED +#endif //#if SOC_MEM_SPM_SUPPORTED /** End of the common section that has to be in sync with esp_memory_utils.h **/ diff --git a/components/bootloader_support/src/esp_image_format.c b/components/bootloader_support/src/esp_image_format.c index 76368fb9512..2a0c078c7cc 100644 --- a/components/bootloader_support/src/esp_image_format.c +++ b/components/bootloader_support/src/esp_image_format.c @@ -524,8 +524,8 @@ static bool verify_load_addresses(int segment_index, intptr_t load_addr, intptr_ } #endif -#if SOC_MEM_SCP_SUPPORTED - else if (esp_ptr_in_scp(load_addr_p) && esp_ptr_in_scp(load_inclusive_end_p)) { +#if SOC_MEM_SPM_SUPPORTED + else if (esp_ptr_in_spm(load_addr_p) && esp_ptr_in_spm(load_inclusive_end_p)) { return true; } #endif diff --git a/components/esp_common/include/esp_attr.h b/components/esp_common/include/esp_attr.h index 0c8c761c48d..89b234b2368 100644 --- a/components/esp_common/include/esp_attr.h +++ b/components/esp_common/include/esp_attr.h @@ -29,19 +29,19 @@ extern "C" { // Forces data into DRAM instead of flash #define DRAM_ATTR _SECTION_ATTR_IMPL(".dram1", __COUNTER__) -// Places code into SCP instead of flash -#define SPM_IRAM_ATTR _SECTION_ATTR_IMPL(".scp.text", __COUNTER__) +// Places code into SPM instead of flash +#define SPM_IRAM_ATTR _SECTION_ATTR_IMPL(".spm.text", __COUNTER__) -// Forces code into SCP instead of flash -#define FORCE_SPM_IRAM_ATTR _SECTION_FORCE_ATTR_IMPL(".scp.text", __COUNTER__) +// Forces code into SPM instead of flash +#define FORCE_SPM_IRAM_ATTR _SECTION_FORCE_ATTR_IMPL(".spm.text", __COUNTER__) -// Forces data into SCP instead of L2MEM -#define SPM_DRAM_ATTR _SECTION_ATTR_IMPL(".scp.data", __COUNTER__) +// Forces data into SPM instead of L2MEM +#define SPM_DRAM_ATTR _SECTION_ATTR_IMPL(".spm.data", __COUNTER__) -// Deprecated macros for TCM (SCP) -#define TCM_IRAM_ATTR _SECTION_ATTR_IMPL(".scp.text", __COUNTER__) _Pragma ("GCC warning \"'TCM_IRAM_ATTR' macro is deprecated, please use `SPM_IRAM_ATTR`\"") -#define FORCE_TCM_IRAM_ATTR _SECTION_FORCE_ATTR_IMPL(".scp.text", __COUNTER__) _Pragma ("GCC warning \"'FORCE_TCM_IRAM_ATTR' macro is deprecated, please use `FORCE_SPM_IRAM_ATTR`\"") -#define TCM_DRAM_ATTR _SECTION_ATTR_IMPL(".scp.data", __COUNTER__) _Pragma ("GCC warning \"'TCM_DRAM_ATTR' macro is deprecated, please use `SPM_DRAM_ATTR`\"") +// Deprecated macros for TCM (SPM) +#define TCM_IRAM_ATTR _SECTION_ATTR_IMPL(".spm.text", __COUNTER__) _Pragma ("GCC warning \"'TCM_IRAM_ATTR' macro is deprecated, please use `SPM_IRAM_ATTR`\"") +#define FORCE_TCM_IRAM_ATTR _SECTION_FORCE_ATTR_IMPL(".spm.text", __COUNTER__) _Pragma ("GCC warning \"'FORCE_TCM_IRAM_ATTR' macro is deprecated, please use `FORCE_SPM_IRAM_ATTR`\"") +#define TCM_DRAM_ATTR _SECTION_ATTR_IMPL(".spm.data", __COUNTER__) _Pragma ("GCC warning \"'TCM_DRAM_ATTR' macro is deprecated, please use `SPM_DRAM_ATTR`\"") // Forces data to be removed from the final binary but keeps it in the ELF file #define NOLOAD_ATTR _SECTION_ATTR_IMPL(".noload_keep_in_elf", __COUNTER__) diff --git a/components/esp_common/soc.lf b/components/esp_common/soc.lf index 78df6d163dd..f98c631669b 100644 --- a/components/esp_common/soc.lf +++ b/components/esp_common/soc.lf @@ -42,14 +42,14 @@ entries: entries: .ext_ram.bss+ -[sections:scp_text] +[sections:spm_text] entries: - .scp.text+ + .spm.text+ -[sections:scp_data] +[sections:spm_data] entries: - .scp.data+ + .spm.data+ -[sections:scp_bss] +[sections:spm_bss] entries: - .scp.bss+ + .spm.bss+ diff --git a/components/esp_driver_dma/src/dma2d.c b/components/esp_driver_dma/src/dma2d.c index fa59c2fd4b6..bcb4d470f61 100644 --- a/components/esp_driver_dma/src/dma2d.c +++ b/components/esp_driver_dma/src/dma2d.c @@ -711,8 +711,8 @@ esp_err_t dma2d_set_desc_addr(dma2d_channel_handle_t dma2d_chan, intptr_t desc_b { esp_err_t ret = ESP_OK; ESP_GOTO_ON_FALSE_ISR(dma2d_chan && desc_base_addr, ESP_ERR_INVALID_ARG, err, TAG, "invalid argument"); - // 2D-DMA descriptor addr needs 8-byte alignment and not in SCP (addr not in SCP is IDF restriction) - ESP_GOTO_ON_FALSE_ISR((desc_base_addr & 0x7) == 0 && !esp_ptr_in_scp((void *)desc_base_addr), ESP_ERR_INVALID_ARG, err, TAG, "invalid argument"); + // 2D-DMA descriptor addr needs 8-byte alignment and not in SPM (addr not in SPM is IDF restriction) + ESP_GOTO_ON_FALSE_ISR((desc_base_addr & 0x7) == 0 && !esp_ptr_in_spm((void *)desc_base_addr), ESP_ERR_INVALID_ARG, err, TAG, "invalid argument"); dma2d_group_t *group = dma2d_chan->group; int channel_id = dma2d_chan->channel_id; diff --git a/components/esp_hw_support/esp_memory_utils.c b/components/esp_hw_support/esp_memory_utils.c index 010da2b5ac4..fd79ef09ce9 100644 --- a/components/esp_hw_support/esp_memory_utils.c +++ b/components/esp_hw_support/esp_memory_utils.c @@ -52,8 +52,8 @@ bool esp_ptr_byte_accessible(const void *p) intptr_t ip = (intptr_t) p; bool r; r = (ip >= SOC_BYTE_ACCESSIBLE_LOW && ip < SOC_BYTE_ACCESSIBLE_HIGH); -#if SOC_MEM_SCP_SUPPORTED - r |= esp_ptr_in_scp(p); +#if SOC_MEM_SPM_SUPPORTED + r |= esp_ptr_in_spm(p); #endif #if CONFIG_ESP_SYSTEM_ALLOW_RTC_FAST_MEM_AS_HEAP /* For ESP32 case, RTC fast memory is accessible to PRO cpu only and hence diff --git a/components/esp_hw_support/include/esp_memory_utils.h b/components/esp_hw_support/include/esp_memory_utils.h index 8c2784a71de..22aa4c6e6be 100644 --- a/components/esp_hw_support/include/esp_memory_utils.h +++ b/components/esp_hw_support/include/esp_memory_utils.h @@ -196,31 +196,31 @@ inline static void * esp_ptr_diram_iram_to_dram(const void *p) { #endif } -#if SOC_MEM_SCP_SUPPORTED +#if SOC_MEM_SPM_SUPPORTED /** - * @brief Check if the pointer is in TCM (SCP) + * @brief Check if the pointer is in TCM (SPM) * * @param p pointer * - * @return true: is in TCM (SCP); false: not in TCM (SCP) + * @return true: is in TCM (SPM); false: not in TCM (SPM) */ - __attribute__((always_inline, deprecated("esp_ptr_in_tcm is deprecated, please use esp_ptr_in_scp instead"))) + __attribute__((always_inline, deprecated("esp_ptr_in_tcm is deprecated, please use esp_ptr_in_spm instead"))) inline static bool esp_ptr_in_tcm(const void *p) { - return ((intptr_t)p >= SOC_SCP_LOW && (intptr_t)p < SOC_SCP_HIGH); + return ((intptr_t)p >= SOC_SPM_LOW && (intptr_t)p < SOC_SPM_HIGH); } /** - * @brief Check if the pointer is in SCP + * @brief Check if the pointer is in SPM * * @param p pointer * - * @return true: is in SCP; false: not in SCP + * @return true: is in SPM; false: not in SPM */ __attribute__((always_inline)) - inline static bool esp_ptr_in_scp(const void *p) { - return ((intptr_t)p >= SOC_SCP_LOW && (intptr_t)p < SOC_SCP_HIGH); + inline static bool esp_ptr_in_spm(const void *p) { + return ((intptr_t)p >= SOC_SPM_LOW && (intptr_t)p < SOC_SPM_HIGH); } -#endif //#if SOC_MEM_SCP_SUPPORTED +#endif //#if SOC_MEM_SPM_SUPPORTED /** End of common functions to be kept in sync with bootloader_memory_utils.h **/ /** Add app-specific functions below **/ @@ -290,8 +290,8 @@ inline static bool esp_ptr_internal(const void *p) { bool r; r = ((intptr_t)p >= SOC_MEM_INTERNAL_LOW && (intptr_t)p < SOC_MEM_INTERNAL_HIGH); -#if SOC_MEM_SCP_SUPPORTED - r |= esp_ptr_in_scp(p); +#if SOC_MEM_SPM_SUPPORTED + r |= esp_ptr_in_spm(p); #endif #if SOC_RTC_SLOW_MEM_SUPPORTED diff --git a/components/esp_hw_support/lowpower/port/esp32p4/sleep_cpu_asm.S b/components/esp_hw_support/lowpower/port/esp32p4/sleep_cpu_asm.S index a2c9c9831c7..63d3759a80f 100644 --- a/components/esp_hw_support/lowpower/port/esp32p4/sleep_cpu_asm.S +++ b/components/esp_hw_support/lowpower/port/esp32p4/sleep_cpu_asm.S @@ -14,7 +14,7 @@ #define MTVT (0x307) #define MINTTHRESH (0x347) - .section .scp.data,"aw" + .section .spm.data,"aw" .global rv_core_critical_regs_frame .type rv_core_critical_regs_frame,@object .align 4 @@ -33,7 +33,7 @@ rv_core_critical_regs_frame: -------------------------------------------------------------------------------- */ - .section .scp.text,"ax" + .section .spm.text,"ax" .global rv_core_critical_regs_save .type rv_core_critical_regs_save,@function .align 4 diff --git a/components/esp_hw_support/port/esp32p4/cpu_region_protect.c b/components/esp_hw_support/port/esp32p4/cpu_region_protect.c index 17db36f416c..ffafdbc821e 100644 --- a/components/esp_hw_support/port/esp32p4/cpu_region_protect.c +++ b/components/esp_hw_support/port/esp32p4/cpu_region_protect.c @@ -50,12 +50,12 @@ static void esp_cpu_configure_invalid_regions(void) // 0. Gap at bottom of address space PMA_RESET_AND_ENTRY_SET_NAPOT(0, 0, SOC_CPU_SUBSYSTEM_LOW, PMA_NAPOT | PMA_NONE); - // 1. Gap between CPU subsystem region & HP SCP + // 1. Gap between CPU subsystem region & HP SPM PMA_RESET_AND_ENTRY_SET_TOR(1, SOC_CPU_SUBSYSTEM_HIGH, PMA_NONE); - PMA_RESET_AND_ENTRY_SET_TOR(2, SOC_SCP_LOW, PMA_TOR | PMA_NONE); + PMA_RESET_AND_ENTRY_SET_TOR(2, SOC_SPM_LOW, PMA_TOR | PMA_NONE); - // 2. Gap between HP SCP and CPU Peripherals - PMA_RESET_AND_ENTRY_SET_TOR(3, SOC_SCP_HIGH, PMA_NONE); + // 2. Gap between HP SPM and CPU Peripherals + PMA_RESET_AND_ENTRY_SET_TOR(3, SOC_SPM_HIGH, PMA_NONE); PMA_RESET_AND_ENTRY_SET_TOR(4, CPU_PERIPH_LOW, PMA_TOR | PMA_NONE); // 3. Gap between CPU Peripherals and I_Cache @@ -106,8 +106,8 @@ static void esp_cpu_configure_region_protection_rev_v3(void) PMP_RESET_AND_ENTRY_SET(0, pmpaddr0, PMP_NAPOT | RW); _Static_assert(SOC_CPU_SUBSYSTEM_LOW < SOC_CPU_SUBSYSTEM_HIGH, "Invalid CPU subsystem region"); - // 2. HP-CPU SCP - // The default memory permissions are RWX and SCP should be RWX, so we can skip configuring it + // 2. HP-CPU SPM + // The default memory permissions are RWX and SPM should be RWX, so we can skip configuring it // 3. CPU Peripherals const uint32_t pmpaddr1 = PMPADDR_NAPOT(CPU_PERIPH_LOW, CPU_PERIPH_HIGH); diff --git a/components/esp_system/app.lf b/components/esp_system/app.lf index 85929ae2b7a..728957b221a 100644 --- a/components/esp_system/app.lf +++ b/components/esp_system/app.lf @@ -22,8 +22,8 @@ entries: rtc_data -> rtc_data rtc_rodata -> rtc_data rtc_bss -> rtc_bss - scp_text -> scp_text - scp_data -> scp_data + spm_text -> spm_text + spm_data -> spm_data [scheme:rtc] entries: @@ -46,13 +46,13 @@ entries: entries: text -> iram0_text -[scheme:scp] +[scheme:spm] entries: - text -> scp_text - data -> scp_data - rodata -> scp_data - bss -> scp_bss - common -> scp_bss + text -> spm_text + data -> spm_data + rodata -> spm_data + bss -> spm_bss + common -> spm_bss [mapping:default] archive: * diff --git a/components/esp_system/ld/esp32p4/memory.ld.in b/components/esp_system/ld/esp32p4/memory.ld.in index c7a52fe7882..212270b3499 100644 --- a/components/esp_system/ld/esp32p4/memory.ld.in +++ b/components/esp_system/ld/esp32p4/memory.ld.in @@ -46,8 +46,8 @@ MEMORY * of the various regions. The 'data access port' dram/drom regions map to the same iram/irom regions but * are connected to the data port of the CPU and eg allow byte-wise access. */ - /* SCP */ - scp_idram_seg (RX) : org = 0x30100000, len = 0x2000 + /* SPM */ + spm_idram_seg (RX) : org = 0x30100000, len = 0x2000 #if CONFIG_APP_BUILD_USE_FLASH_SECTIONS #if CONFIG_SPIRAM_FETCH_INSTRUCTIONS diff --git a/components/esp_system/ld/esp32p4/sections.ld.in b/components/esp_system/ld/esp32p4/sections.ld.in index 9e3d745be79..fb59d8397b4 100644 --- a/components/esp_system/ld/esp32p4/sections.ld.in +++ b/components/esp_system/ld/esp32p4/sections.ld.in @@ -157,26 +157,26 @@ SECTIONS ASSERT((_rtc_fast_length <= LENGTH(rtc_data_seg)), "RTC_FAST segment data does not fit.") - .scp.text : + .spm.text : { - /* Code marked as running out of SCP */ - _scp_text_start = ABSOLUTE(.); + /* Code marked as running out of SPM */ + _spm_text_start = ABSOLUTE(.); - arrays[scp_text] - mapping[scp_text] + arrays[spm_text] + mapping[spm_text] - _scp_text_end = ABSOLUTE(.); - } > scp_idram_seg + _spm_text_end = ABSOLUTE(.); + } > spm_idram_seg - .scp.data : + .spm.data : { - _scp_data_start = ABSOLUTE(.); + _spm_data_start = ABSOLUTE(.); - arrays[scp_data] - mapping[scp_data] + arrays[spm_data] + mapping[spm_data] - _scp_data_end = ABSOLUTE(.); - } > scp_idram_seg + _spm_data_end = ABSOLUTE(.); + } > spm_idram_seg .iram0.text : { diff --git a/components/esp_system/ld/esp32p4/sections.rev3.ld.in b/components/esp_system/ld/esp32p4/sections.rev3.ld.in index 9342bd915dc..8dd54f47225 100644 --- a/components/esp_system/ld/esp32p4/sections.rev3.ld.in +++ b/components/esp_system/ld/esp32p4/sections.rev3.ld.in @@ -166,26 +166,26 @@ SECTIONS ASSERT((_rtc_fast_length <= LENGTH(rtc_data_seg)), "RTC_FAST segment data does not fit.") - .scp.text : + .spm.text : { - /* Code marked as running out of SCP */ - _scp_text_start = ABSOLUTE(.); + /* Code marked as running out of SPM */ + _spm_text_start = ABSOLUTE(.); - arrays[scp_text] - mapping[scp_text] + arrays[spm_text] + mapping[spm_text] - _scp_text_end = ABSOLUTE(.); - } > scp_idram_seg + _spm_text_end = ABSOLUTE(.); + } > spm_idram_seg - .scp.data : + .spm.data : { - _scp_data_start = ABSOLUTE(.); + _spm_data_start = ABSOLUTE(.); - arrays[scp_data] - mapping[scp_data] + arrays[spm_data] + mapping[spm_data] - _scp_data_end = ABSOLUTE(.); - } > scp_idram_seg + _spm_data_end = ABSOLUTE(.); + } > spm_idram_seg .iram0.text : { diff --git a/components/esp_system/ld/ld.scp.sections b/components/esp_system/ld/ld.scp.sections deleted file mode 100644 index c300bdc9f74..00000000000 --- a/components/esp_system/ld/ld.scp.sections +++ /dev/null @@ -1,15 +0,0 @@ -#include "ld.common" - .scp.text : - { - /* Code marked as running out of scp */ - _scp_text_start = ABSOLUTE(.); - SECTION_MAPPINGS(scp_text) - _scp_text_end = ABSOLUTE(.); - } > scp_idram_seg - - .scp.data : - { - _scp_data_start = ABSOLUTE(.); - SECTION_MAPPINGS(scp_data) - _scp_data_end = ABSOLUTE(.); - } > scp_idram_seg diff --git a/components/esp_system/ld/ld.spm.sections b/components/esp_system/ld/ld.spm.sections new file mode 100644 index 00000000000..d8a90900ed2 --- /dev/null +++ b/components/esp_system/ld/ld.spm.sections @@ -0,0 +1,15 @@ +#include "ld.common" + .spm.text : + { + /* Code marked as running out of spm */ + _spm_text_start = ABSOLUTE(.); + SECTION_MAPPINGS(spm_text) + _spm_text_end = ABSOLUTE(.); + } > spm_idram_seg + + .spm.data : + { + _spm_data_start = ABSOLUTE(.); + SECTION_MAPPINGS(spm_data) + _spm_data_end = ABSOLUTE(.); + } > spm_idram_seg diff --git a/components/hal/esp32p4/include/hal/lp_clkrst_ll.h b/components/hal/esp32p4/include/hal/lp_clkrst_ll.h index 01810bd632b..b9dc1a4f000 100644 --- a/components/hal/esp32p4/include/hal/lp_clkrst_ll.h +++ b/components/hal/esp32p4/include/hal/lp_clkrst_ll.h @@ -21,8 +21,8 @@ extern "C" { /** * Select CPU reset vector * @param boot_from_lp_ram - * true: boot from LP SCP RAM: 0x50108000 - * false: boot from HP SCP ROM: 0x4FC00000 + * true: boot from LP SPM RAM: 0x50108000 + * false: boot from HP SPM ROM: 0x4FC00000 */ __attribute__((always_inline)) static inline void lp_clkrst_ll_boot_from_lp_ram(bool boot_from_lp_ram) diff --git a/components/heap/include/esp_heap_caps.h b/components/heap/include/esp_heap_caps.h index e6abd31ae8c..08e87426446 100644 --- a/components/heap/include/esp_heap_caps.h +++ b/components/heap/include/esp_heap_caps.h @@ -44,8 +44,8 @@ extern "C" { #define MALLOC_CAP_IRAM_8BIT (1<<13) ///< Memory must be in IRAM and allow unaligned access #define MALLOC_CAP_RETENTION (1<<14) ///< Memory must be able to accessed by retention DMA #define MALLOC_CAP_RTCRAM (1<<15) ///< Memory must be in RTC fast memory -#define MALLOC_CAP_SCP (1<<16) ///< Memory must be in SCP memory -#define MALLOC_CAP_TCM MALLOC_CAP_SCP _Pragma ("GCC warning \"'MALLOC_CAP_TCM' macro is deprecated, please use `MALLOC_CAP_SCP`\"") +#define MALLOC_CAP_SPM (1<<16) ///< Memory must be in SPM memory +#define MALLOC_CAP_TCM MALLOC_CAP_SPM _Pragma ("GCC warning \"'MALLOC_CAP_TCM' macro is deprecated, please use `MALLOC_CAP_SPM`\"") #define MALLOC_CAP_DMA_DESC_AHB (1<<17) ///< Memory must be capable of containing AHB DMA descriptors #define MALLOC_CAP_DMA_DESC_AXI (1<<18) ///< Memory must be capable of containing AXI DMA descriptors #define MALLOC_CAP_CACHE_ALIGNED (1<<19) ///< Memory must be aligned to the cache line size of any intermediate caches diff --git a/components/heap/port/esp32p4/memory_layout.c b/components/heap/port/esp32p4/memory_layout.c index 3635de2d5cc..d05ffc51096 100644 --- a/components/heap/port/esp32p4/memory_layout.c +++ b/components/heap/port/esp32p4/memory_layout.c @@ -36,7 +36,7 @@ enum { */ SOC_MEMORY_TYPE_RETENT_MEM = 1, SOC_MEMORY_TYPE_SPIRAM = 2, - SOC_MEMORY_TYPE_SCP = 3, + SOC_MEMORY_TYPE_SPM = 3, SOC_MEMORY_TYPE_RTCRAM = 4, SOC_MEMORY_TYPE_NUM, }; @@ -53,7 +53,7 @@ enum { #endif // The memory used for SIMD instructions requires the bus of its memory regions be able to transfer the data in 128-bit -// SCP and RTCRAM memory regions cannot satisfy 128-bit data access +// SPM and RTCRAM memory regions cannot satisfy 128-bit data access /** * Defined the attributes and allocation priority of each memory on the chip, @@ -66,7 +66,7 @@ const soc_memory_type_desc_t soc_memory_types[SOC_MEMORY_TYPE_NUM] = { [SOC_MEMORY_TYPE_RETENT_MEM] = { "RETENT_RAM", { MALLOC_L2MEM_BASE_CAPS | MALLOC_CAP_RETENTION | MALLOC_CAP_SIMD, 0, 0 }}, [SOC_MEMORY_TYPE_L2MEM] = { "RAM", { MALLOC_L2MEM_BASE_CAPS | MALLOC_CAP_SIMD, 0, 0 }}, [SOC_MEMORY_TYPE_SPIRAM] = { "SPIRAM", { MALLOC_CAP_SPIRAM, 0, ESP32P4_MEM_COMMON_CAPS | MALLOC_CAP_SIMD }}, - [SOC_MEMORY_TYPE_SCP] = { "SCP", { MALLOC_CAP_SCP, ESP32P4_MEM_COMMON_CAPS | MALLOC_CAP_INTERNAL, 0 }}, + [SOC_MEMORY_TYPE_SPM] = { "SPM", { MALLOC_CAP_SPM, ESP32P4_MEM_COMMON_CAPS | MALLOC_CAP_INTERNAL, 0 }}, [SOC_MEMORY_TYPE_RTCRAM] = { "RTCRAM", { MALLOC_CAP_RTCRAM, 0, MALLOC_RTCRAM_BASE_CAPS}}, }; @@ -112,7 +112,7 @@ const soc_memory_region_t soc_memory_regions[] = { #ifdef CONFIG_ESP_SYSTEM_ALLOW_RTC_FAST_MEM_AS_HEAP { 0x50108000, APP_USABLE_LP_RAM_SIZE, SOC_MEMORY_TYPE_RTCRAM, 0, false}, //LPRAM #endif - { 0x30100000, 0x2000, SOC_MEMORY_TYPE_SCP, 0, false}, + { 0x30100000, 0x2000, SOC_MEMORY_TYPE_SPM, 0, false}, }; const size_t soc_memory_region_count = sizeof(soc_memory_regions) / sizeof(soc_memory_region_t); @@ -125,7 +125,7 @@ extern int _data_start, _heap_start, _iram_start, _iram_end, _rtc_force_slow_end extern int _rtc_p4_rev3_mspi_workaround_start, _rtc_p4_rev3_mspi_workaround_end; #endif #endif -extern int _scp_text_start, _scp_data_end; +extern int _spm_text_start, _spm_data_end; extern int _rtc_reserved_start, _rtc_reserved_end; extern int _rtc_ulp_memory_start; @@ -146,7 +146,7 @@ SOC_RESERVE_MEMORY_REGION((intptr_t)&_data_start, (intptr_t)&_heap_start, dram_d // Target has a shared D/IRAM virtual address, no need to calculate I_D_OFFSET like previous chips SOC_RESERVE_MEMORY_REGION((intptr_t)&_iram_start, (intptr_t)&_iram_end, iram_code); -SOC_RESERVE_MEMORY_REGION((intptr_t)&_scp_text_start, (intptr_t)&_scp_data_end, scp_code_data); +SOC_RESERVE_MEMORY_REGION((intptr_t)&_spm_text_start, (intptr_t)&_spm_data_end, spm_code_data); #ifdef CONFIG_SPIRAM SOC_RESERVE_MEMORY_REGION( SOC_EXTRAM_LOW, SOC_EXTRAM_HIGH, extram_region); diff --git a/components/soc/esp32p4/include/soc/Kconfig.soc_caps.in b/components/soc/esp32p4/include/soc/Kconfig.soc_caps.in index 250730082a4..a6632761058 100644 --- a/components/soc/esp32p4/include/soc/Kconfig.soc_caps.in +++ b/components/soc/esp32p4/include/soc/Kconfig.soc_caps.in @@ -1899,7 +1899,7 @@ config SOC_TEMPERATURE_SENSOR_SUPPORT_SLEEP_RETENTION bool default y -config SOC_MEM_SCP_SUPPORTED +config SOC_MEM_SPM_SUPPORTED bool default y diff --git a/components/soc/esp32p4/include/soc/soc.h b/components/soc/esp32p4/include/soc/soc.h index fd2877cb807..42195616ce3 100644 --- a/components/soc/esp32p4/include/soc/soc.h +++ b/components/soc/esp32p4/include/soc/soc.h @@ -156,8 +156,8 @@ #define SOC_IROM_MASK_HIGH 0x4fc20000 #define SOC_DROM_MASK_LOW 0x4fc00000 #define SOC_DROM_MASK_HIGH 0x4fc20000 -#define SOC_SCP_LOW 0x30100000 -#define SOC_SCP_HIGH 0x30102000 +#define SOC_SPM_LOW 0x30100000 +#define SOC_SPM_HIGH 0x30102000 #define SOC_IRAM_LOW 0x4ff00000 #define SOC_IRAM_HIGH 0x4ffc0000 #define SOC_DRAM_LOW 0x4ff00000 diff --git a/components/soc/esp32p4/include/soc/soc_caps.h b/components/soc/esp32p4/include/soc/soc_caps.h index ce1faa500f9..c32904ca018 100644 --- a/components/soc/esp32p4/include/soc/soc_caps.h +++ b/components/soc/esp32p4/include/soc/soc_caps.h @@ -727,7 +727,7 @@ #define SOC_TEMPERATURE_SENSOR_SUPPORT_SLEEP_RETENTION (1) /*-------------------------- Memory CAPS --------------------------*/ -#define SOC_MEM_SCP_SUPPORTED (1) +#define SOC_MEM_SPM_SUPPORTED (1) #define SOC_ASYNCHRONOUS_BUS_ERROR_MODE (1) /*--------------------------- EMAC --------------------------------*/ #define SOC_EMAC_IEEE1588V2_SUPPORTED (1) /*!< EMAC Supports IEEE1588v2 time stamping */ diff --git a/docs/en/api-guides/memory-types.rst b/docs/en/api-guides/memory-types.rst index 10e1cfab342..844c33c479e 100644 --- a/docs/en/api-guides/memory-types.rst +++ b/docs/en/api-guides/memory-types.rst @@ -187,7 +187,7 @@ The ``DRAM_ATTR`` attribute can be used to force constants from DROM into the :r Remaining RTC FAST memory is added to the heap unless the option :ref:`CONFIG_ESP_SYSTEM_ALLOW_RTC_FAST_MEM_AS_HEAP` is disabled. This memory can be used interchangeably with :ref:`DRAM`, but is slightly slower to access. -.. only:: SOC_MEM_SCP_SUPPORTED +.. only:: SOC_MEM_SPM_SUPPORTED SPM (Scratchpad Memory) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ diff --git a/docs/en/security/esp32p4_log.inc b/docs/en/security/esp32p4_log.inc index 8df6f986989..d88e2870813 100644 --- a/docs/en/security/esp32p4_log.inc +++ b/docs/en/security/esp32p4_log.inc @@ -127,7 +127,7 @@ I (310) heap_init: At 4FF3AFC0 len 00004BE4 (18 KiB): RAM I (316) heap_init: At 4FF40000 len 00060000 (384 KiB): RAM I (323) heap_init: At 50108000 len 00007FE8 (31 KiB): RTCRAM - I (329) heap_init: At 30100044 len 00001FBC (7 KiB): SCP + I (329) heap_init: At 30100044 len 00001FBC (7 KiB): SPM I (336) spi_flash: detected chip: generic I (340) spi_flash: flash io: dio W (344) spi_flash: Detected size(4096k) larger than the size in the binary image header(2048k). Using the size in the binary image header. diff --git a/docs/zh_CN/api-guides/memory-types.rst b/docs/zh_CN/api-guides/memory-types.rst index 7546958d156..26ef3b1c4b1 100644 --- a/docs/zh_CN/api-guides/memory-types.rst +++ b/docs/zh_CN/api-guides/memory-types.rst @@ -187,7 +187,7 @@ DROM(数据存储在 flash 中) 除非禁用 :ref:`CONFIG_ESP_SYSTEM_ALLOW_RTC_FAST_MEM_AS_HEAP` 选项,否则剩余的 RTC FAST memory 会被添加到堆中。该部分内存可以和 :ref:`DRAM` 互换使用,但是访问速度稍慢一点。 -.. only:: SOC_MEM_SCP_SUPPORTED +.. only:: SOC_MEM_SPM_SUPPORTED SPM(暂存内存) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ diff --git a/docs/zh_CN/security/esp32p4_log.inc b/docs/zh_CN/security/esp32p4_log.inc index 8df6f986989..d88e2870813 100644 --- a/docs/zh_CN/security/esp32p4_log.inc +++ b/docs/zh_CN/security/esp32p4_log.inc @@ -127,7 +127,7 @@ I (310) heap_init: At 4FF3AFC0 len 00004BE4 (18 KiB): RAM I (316) heap_init: At 4FF40000 len 00060000 (384 KiB): RAM I (323) heap_init: At 50108000 len 00007FE8 (31 KiB): RTCRAM - I (329) heap_init: At 30100044 len 00001FBC (7 KiB): SCP + I (329) heap_init: At 30100044 len 00001FBC (7 KiB): SPM I (336) spi_flash: detected chip: generic I (340) spi_flash: flash io: dio W (344) spi_flash: Detected size(4096k) larger than the size in the binary image header(2048k). Using the size in the binary image header.