From ff3126fa092f7647ef029477482f73a4fc7ad45f Mon Sep 17 00:00:00 2001 From: Marius Vikhammer Date: Fri, 14 Mar 2025 10:41:51 +0800 Subject: [PATCH] feat(newlib): added option for placing functions in flash if flash-auto-suspend --- components/newlib/Kconfig | 4 ++++ components/newlib/src/newlib.lf | 11 ++++++----- 2 files changed, 10 insertions(+), 5 deletions(-) diff --git a/components/newlib/Kconfig b/components/newlib/Kconfig index 221ef36a94..9cbfd8ec4b 100644 --- a/components/newlib/Kconfig +++ b/components/newlib/Kconfig @@ -11,6 +11,10 @@ menu "LibC" depends on !IDF_TOOLCHAIN_CLANG && IDF_EXPERIMENTAL_FEATURES endchoice + config LIBC_MISC_IN_IRAM + bool "Place misc libc functions (abort/assert/stdatomics) in IRAM" if SPI_FLASH_AUTO_SUSPEND + default y + config LIBC_LOCKS_PLACE_IN_IRAM bool "Place lock API in IRAM" default y diff --git a/components/newlib/src/newlib.lf b/components/newlib/src/newlib.lf index 1e2782ac7d..7ca47a0b9b 100644 --- a/components/newlib/src/newlib.lf +++ b/components/newlib/src/newlib.lf @@ -1,10 +1,11 @@ [mapping:newlib] archive: libnewlib.a entries: - if HEAP_PLACE_FUNCTION_INTO_FLASH = n: - heap (noflash) - abort (noflash) - assert (noflash) - stdatomic (noflash) + if LIBC_MISC_IN_IRAM = y: + if HEAP_PLACE_FUNCTION_INTO_FLASH = n: + heap (noflash) + abort (noflash) + assert (noflash) + stdatomic (noflash) if STDATOMIC_S32C1I_SPIRAM_WORKAROUND = y: stdatomic_s32c1i (noflash)