From de0a8c6185f5564dd0fad00c6e0ab74ef5b004fa Mon Sep 17 00:00:00 2001 From: "J. Nick Koston" Date: Sun, 28 Sep 2025 23:23:04 -0500 Subject: [PATCH 1/2] [esp32] Document disable_libc_locks_in_iram option --- content/components/esp32.md | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/content/components/esp32.md b/content/components/esp32.md index 9682a4b453..f08f262832 100644 --- a/content/components/esp32.md +++ b/content/components/esp32.md @@ -164,6 +164,10 @@ LWIP (Lightweight IP) behavior. Some options improve performance while others sa - **enable_lwip_check_thread_safety** (*Optional*, boolean): Enable LWIP thread safety checks to detect incorrect usage of the TCP/IP stack from multiple threads. This helps catch thread safety issues when core locking is enabled. Defaults to `true`. +- **disable_libc_locks_in_iram** (*Optional*, boolean): Disable placing libc lock functions in IRAM. This saves approximately + 1.6KB of IRAM by placing these functions in flash memory instead. This is safe for ESPHome since no IRAM interrupt service + routines (ISRs that run while cache is disabled) use libc lock APIs. Defaults to `true` (IRAM placement disabled to save RAM). + Some options can be disabled to save flash memory without affecting typical ESPHome functionality. The performance options (defaulting to `true` ) improve socket operation performance but can be disabled if you need better multi-threaded scalability (which is uncommon since ESPHome uses an event loop). @@ -182,6 +186,7 @@ esp32: enable_lwip_check_thread_safety: true # Thread safety validation # Memory saving options + disable_libc_locks_in_iram: true # Enabled by default, saves 1.6KB IRAM enable_lwip_dhcp_server: false # Disabled by default, only needed for AP mode enable_lwip_mdns_queries: false # Enabled by default, can disable if not using .local hostnames enable_lwip_bridge_interface: false # Disabled by default From 269587ec6a71c8ac275a46a1ffa03280d6b15a15 Mon Sep 17 00:00:00 2001 From: Keith Burzinski Date: Wed, 15 Oct 2025 14:17:39 -0500 Subject: [PATCH 2/2] Update RAM savings values --- content/components/esp32.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/content/components/esp32.md b/content/components/esp32.md index afeef71cc0..fdd84803bb 100644 --- a/content/components/esp32.md +++ b/content/components/esp32.md @@ -172,7 +172,7 @@ LWIP (Lightweight IP) behavior. Some options improve performance while others sa the TCP/IP stack from multiple threads. This helps catch thread safety issues when core locking is enabled. Defaults to `true`. - **disable_libc_locks_in_iram** (*Optional*, boolean): Disable placing libc lock functions in IRAM. This saves approximately - 1.6KB of IRAM by placing these functions in flash memory instead. This is safe for ESPHome since no IRAM interrupt service + 1.3 KB of IRAM by placing these functions in flash memory instead. This is safe for ESPHome since no IRAM interrupt service routines (ISRs that run while cache is disabled) use libc lock APIs. Defaults to `true` (IRAM placement disabled to save RAM). Some options can be disabled to save flash memory without affecting typical ESPHome functionality. The performance @@ -193,7 +193,7 @@ esp32: enable_lwip_check_thread_safety: true # Thread safety validation # Memory saving options - disable_libc_locks_in_iram: true # Enabled by default, saves 1.6KB IRAM + disable_libc_locks_in_iram: true # Enabled by default, saves 1.3 KB IRAM enable_lwip_dhcp_server: false # Disabled by default, only needed for AP mode enable_lwip_mdns_queries: false # Enabled by default, can disable if not using .local hostnames enable_lwip_bridge_interface: false # Disabled by default