feat(ulp): support placing ULP app in HP-RAM

This commit is contained in:
Marius Vikhammer
2026-04-29 09:47:33 +08:00
parent e17f46e240
commit 261bd160aa
31 changed files with 698 additions and 34 deletions
@@ -0,0 +1,22 @@
/*
* SPDX-FileCopyrightText: 2026 Espressif Systems (Shanghai) CO LTD
*
* SPDX-License-Identifier: Apache-2.0
*/
/* ESP32-P4 target-specific HP memory definitions shared between HP app and LP Core linker scripts */
#if CONFIG_ESP32P4_SELECTS_REV_LESS_V3
#define SRAM_MAIN_END 0x4FF2CBD0 /* 2nd stage bootloader iram_loader_seg start address (rev < 3) */
#else
#define SRAM_MAIN_END 0x4FFAEFC0 /* 2nd stage bootloader iram_loader_seg start address (rev3+) */
#endif
#if CONFIG_ULP_COPROC_RUN_FROM_HP_MEM
#define ULP_HP_MEM_SIZE CONFIG_ULP_COPROC_RESERVE_HP_MEM_BYTES
/* Align down to 64-byte cache line boundary */
#define ULP_HP_MEM_START ((SRAM_MAIN_END - ULP_HP_MEM_SIZE) & ~(64 - 1))
/* Align down to 64-byte cache line boundary so that ULP_HP_MEM_END - ULP_HP_MEM_START
* is always a multiple of the cache line size, satisfying esp_cache_msync alignment */
#define ULP_HP_MEM_END (SRAM_MAIN_END & ~(64 - 1))
#endif
@@ -14,14 +14,23 @@
#include "sdkconfig.h"
#include "ld.common"
#include "ld.hp_mem_defs"
#if !CONFIG_ESP32P4_SELECTS_REV_LESS_V3
#define SRAM_START 0x4FF00000 + CONFIG_CACHE_L2_CACHE_SIZE
#if CONFIG_ULP_COPROC_RUN_FROM_HP_MEM
#define SRAM_END ULP_HP_MEM_START
#else
#define SRAM_END 0x4FFAEFC0 /* 2nd stage bootloader iram_loader_seg start address */
#endif
#define SRAM_SIZE SRAM_END - SRAM_START
#else
#define SRAM_LOW_START 0x4FF00000
#if CONFIG_ULP_COPROC_RUN_FROM_HP_MEM
#define SRAM_LOW_END ULP_HP_MEM_START
#else
#define SRAM_LOW_END 0x4FF2CBD0 /* 2nd stage bootloader iram_loader_seg start address */
#endif
#define SRAM_LOW_SIZE SRAM_LOW_END - SRAM_LOW_START
/* If the cache size is less than 512KB, then there is a region of RAM
@@ -209,3 +218,8 @@ REGION_ALIAS("rtc_reserved_seg", lp_reserved_seg );
#endif //#if CONFIG_SPIRAM_XIP_FROM_PSRAM
ALIGN_VECTOR_TABLE = 0x40;
#if CONFIG_ULP_COPROC_RUN_FROM_HP_MEM
_ulp_hp_mem_resv_start = ULP_HP_MEM_START;
_ulp_hp_mem_resv_end = ULP_HP_MEM_END;
#endif