From 4f2fd431f8fb764c0bd6b384d2f42122433c9bcd Mon Sep 17 00:00:00 2001 From: Marius Vikhammer Date: Wed, 12 Mar 2025 10:52:07 +0800 Subject: [PATCH 1/2] fix(heap): fixed HEAP_PLACE_FUNCTION_INTO_FLASH disabled if heap impl in ROM --- components/heap/Kconfig | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/components/heap/Kconfig b/components/heap/Kconfig index 8de0f77519..20f9e62174 100644 --- a/components/heap/Kconfig +++ b/components/heap/Kconfig @@ -127,5 +127,6 @@ menu "Heap memory debugging" Enable this flag to save up RAM space by placing the heap component in the flash memory Note that it is only safe to enable this configuration if no functions from esp_heap_caps.h - or esp_heap_trace.h are called from ISR. + or esp_heap_trace.h are called from IRAM ISR which runs when cache is disabled. + endmenu From c86f9d2868c80ee099b6a7ebd2b8b01b6e03be8b Mon Sep 17 00:00:00 2001 From: Marius Vikhammer Date: Wed, 12 Mar 2025 11:16:38 +0800 Subject: [PATCH 2/2] fix(newlib): fixed newlib malloc wrappers IRAM/flash placement If HEAP_PLACE_FUNCTION_INTO_FLASH = y then we should also place the newlib wrappers for the heap in to flash. --- components/newlib/newlib.lf | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/components/newlib/newlib.lf b/components/newlib/newlib.lf index d92c04fb0f..8d685e9ec4 100644 --- a/components/newlib/newlib.lf +++ b/components/newlib/newlib.lf @@ -1,7 +1,8 @@ [mapping:newlib] archive: libnewlib.a entries: - heap (noflash) + if HEAP_PLACE_FUNCTION_INTO_FLASH = n: + heap (noflash) abort (noflash) assert (noflash) stdatomic (noflash)