Skip to content

Commit 6a2e21d

Browse files
yamtxiaoxiang781216
authored andcommitted
esp32: Fix a heap corruption bug with SPIRAM
Don't add SPIRAM ("HEAP2") to both of kernel/user heaps. Sync with the corresponding logic in esp32s3.
1 parent b28f87e commit 6a2e21d

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

arch/xtensa/src/esp32/esp32_allocateheap.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -210,7 +210,7 @@ void xtensa_add_region(void)
210210
availregions = 2;
211211
#endif
212212

213-
#ifdef CONFIG_ESP32_SPIRAM_COMMON_HEAP
213+
#if defined(CONFIG_ESP32_SPIRAM_COMMON_HEAP) && !defined(MM_USER_HEAP_EXTRAM)
214214
availregions++;
215215
#endif
216216

@@ -242,7 +242,7 @@ void xtensa_add_region(void)
242242
MM_ADDREGION(start, size);
243243
#endif
244244

245-
#ifdef CONFIG_ESP32_SPIRAM_COMMON_HEAP
245+
#if defined(CONFIG_ESP32_SPIRAM_COMMON_HEAP) && !defined(MM_USER_HEAP_EXTRAM)
246246
#ifdef CONFIG_XTENSA_EXTMEM_BSS
247247
start = (void *)(_ebss_extmem);
248248
size = CONFIG_HEAP2_SIZE - (size_t)(_ebss_extmem - _sbss_extmem);

0 commit comments

Comments
 (0)