Skip to content

Commit 2ac0fc1

Browse files
committed
change(heap): Update soc_memory_regions on esp32c5
The array of memory regions is simplyfied by using the macro defined in soc.h (for beta3 and mp respectively).
1 parent 79b7e2c commit 2ac0fc1

File tree

1 file changed

+8
-15
lines changed

1 file changed

+8
-15
lines changed

components/heap/port/esp32c5/memory_layout.c

Lines changed: 8 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -45,11 +45,11 @@ enum {
4545
/**
4646
* Defined the attributes and allocation priority of each memory on the chip,
4747
* The heap allocator will traverse all types of memory types in column High Priority Matching and match the specified caps at first,
48-
* if no memory caps matched or the allocation is failed, it will go to columns Medium Priorty Matching and Low Priority Matching
48+
* if no memory caps matched or the allocation is failed, it will go to columns Medium Priority Matching and Low Priority Matching
4949
* in turn to continue matching.
5050
*/
5151
const soc_memory_type_desc_t soc_memory_types[SOC_MEMORY_TYPE_NUM] = {
52-
/* Mem Type Name High Priority Matching Medium Priorty Matching Low Priority Matching */
52+
/* Mem Type Name High Priority Matching Medium Priority Matching Low Priority Matching */
5353
[SOC_MEMORY_TYPE_RAM] = { "RAM", { ESP32C5_MEM_COMMON_CAPS | MALLOC_CAP_DMA, 0, 0 }},
5454
[SOC_MEMORY_TYPE_RTCRAM] = { "RTCRAM", { MALLOC_CAP_RTCRAM, ESP32C5_MEM_COMMON_CAPS, 0 }},
5555
#if CONFIG_IDF_TARGET_ESP32C5_MP_VERSION
@@ -70,23 +70,16 @@ const size_t soc_memory_type_count = sizeof(soc_memory_types) / sizeof(soc_memor
7070
/**
7171
* Register the shared buffer area of the last memory block into the heap during heap initialization
7272
*/
73-
#define APP_USABLE_DRAM_END (SOC_ROM_STACK_START - SOC_ROM_STACK_SIZE)
73+
#define APP_USABLE_DRAM_END (SOC_ROM_STACK_START - SOC_ROM_STACK_SIZE)
7474

7575
const soc_memory_region_t soc_memory_regions[] = {
7676
#if CONFIG_SPIRAM && CONFIG_IDF_TARGET_ESP32C5_MP_VERSION
77-
{ SOC_EXTRAM_DATA_LOW, (SOC_EXTRAM_DATA_HIGH - SOC_EXTRAM_DATA_LOW),SOC_MEMORY_TYPE_SPIRAM, 0}, //SPI SRAM, if available
77+
{ SOC_EXTRAM_DATA_LOW, (SOC_EXTRAM_DATA_HIGH - SOC_EXTRAM_DATA_LOW), SOC_MEMORY_TYPE_SPIRAM, 0, false}, //SPI SRAM, if available
7878
#endif
79-
{ 0x40800000, 0x20000, SOC_MEMORY_TYPE_RAM, 0x40800000, false}, //D/IRAM level0, can be used as trace memory
80-
{ 0x40820000, 0x20000, SOC_MEMORY_TYPE_RAM, 0x40820000, false}, //D/IRAM level1, can be used as trace memory
81-
#if CONFIG_IDF_TARGET_ESP32C5_BETA3_VERSION
82-
{ 0x40840000, 0x20000, SOC_MEMORY_TYPE_RAM, 0x40840000, false}, //D/IRAM level2, can be used as trace memory
83-
{ 0x40860000, (APP_USABLE_DRAM_END-0x40860000), SOC_MEMORY_TYPE_RAM, 0x40860000, false}, //D/IRAM level3, can be used as trace memory
84-
#elif CONFIG_IDF_TARGET_ESP32C5_MP_VERSION
85-
{ 0x40840000, (APP_USABLE_DRAM_END-0x40840000), SOC_MEMORY_TYPE_RAM, 0x40840000, false}, //D/IRAM level3, can be used as trace memory
86-
#endif
87-
{ APP_USABLE_DRAM_END, (SOC_DIRAM_DRAM_HIGH-APP_USABLE_DRAM_END), SOC_MEMORY_TYPE_RAM, APP_USABLE_DRAM_END, true}, //D/IRAM level3, can be used as trace memory (ROM reserved area)
79+
{ SOC_DIRAM_DRAM_LOW, (APP_USABLE_DRAM_END - SOC_DIRAM_DRAM_LOW), SOC_MEMORY_TYPE_RAM, SOC_DIRAM_IRAM_LOW, false}, //D/IRAM, can be used as trace memory
80+
{ APP_USABLE_DRAM_END, (SOC_DIRAM_DRAM_HIGH - APP_USABLE_DRAM_END), SOC_MEMORY_TYPE_RAM, APP_USABLE_DRAM_END, true}, //D/IRAM, can be used as trace memory (ROM reserved area)
8881
#ifdef CONFIG_ESP_SYSTEM_ALLOW_RTC_FAST_MEM_AS_HEAP
89-
{ 0x50000000, 0x4000, SOC_MEMORY_TYPE_RTCRAM, 0, false}, //LPRAM
82+
{ SOC_RTC_DATA_LOW, (SOC_RTC_DATA_HIGH - SOC_RTC_DATA_LOW), SOC_MEMORY_TYPE_RTCRAM, 0, false}, //LPRAM
9083
#endif
9184
};
9285

@@ -118,5 +111,5 @@ SOC_RESERVE_MEMORY_REGION((intptr_t)&_rtc_reserved_start, (intptr_t)&_rtc_reserv
118111
#ifdef CONFIG_SPIRAM
119112
/* Reserve the whole possible SPIRAM region here, spiram.c will add some or all of this
120113
* memory to heap depending on the actual SPIRAM chip size. */
121-
SOC_RESERVE_MEMORY_REGION(SOC_DROM_LOW, SOC_DROM_HIGH, extram_data_region);
114+
SOC_RESERVE_MEMORY_REGION(SOC_EXTRAM_DATA_LOW, SOC_EXTRAM_DATA_HIGH, extram_data_region);
122115
#endif

0 commit comments

Comments
 (0)