Skip to content

Commit a30054b

Browse files
authored
[esp32] Document advanced VFS options for flash optimization (#5507)
1 parent b6dd4f1 commit a30054b

File tree

1 file changed

+23
-1
lines changed

1 file changed

+23
-1
lines changed

content/components/esp32.md

Lines changed: 23 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -175,11 +175,30 @@ LWIP (Lightweight IP) behavior. Some options improve performance while others sa
175175
1.3 KB of IRAM by placing these functions in flash memory instead. This is safe for ESPHome since no IRAM interrupt service
176176
routines (ISRs that run while cache is disabled) use libc lock APIs. Defaults to `true` (IRAM placement disabled to save RAM).
177177

178+
**VFS (Virtual File System) Optimization Options:**
179+
180+
The following options disable unused VFS features to save flash memory:
181+
182+
- **disable_vfs_support_termios** (*Optional*, boolean): Disable VFS support for termios (terminal I/O) functions. ESPHome
183+
doesn't use termios functions on ESP32 (they're only used in the host UART driver for Linux/macOS). Disabling this saves
184+
approximately 1.8 KB of flash. Defaults to `true` (VFS termios disabled to save flash).
185+
186+
- **disable_vfs_support_select** (*Optional*, boolean): Disable VFS support for select() with file descriptors. ESPHome uses
187+
`lwip_select()` for socket operations, which works independently of VFS select support. VFS select is only needed for UART
188+
and eventfd file descriptors. Socket operations continue to work normally with this disabled. Components that require VFS
189+
select (e.g., OpenThread) automatically enable it regardless of this setting. Disabling this saves approximately 2.7 KB of
190+
flash. Defaults to `true` (VFS select disabled to save flash).
191+
192+
- **disable_vfs_support_dir** (*Optional*, boolean): Disable VFS support for directory-related functions (opendir, readdir,
193+
mkdir, rmdir, etc.). ESPHome doesn't use directory operations on ESP32. Components that require directory support (e.g.,
194+
future storage components) automatically enable it regardless of this setting. Disabling this saves approximately 0.5 KB+
195+
of flash. Defaults to `true` (VFS directory support disabled to save flash).
196+
178197
Some options can be disabled to save flash memory without affecting typical ESPHome functionality. The performance
179198
options (defaulting to `true` ) improve socket operation performance but can be disabled if you need better
180199
multi-threaded scalability (which is uncommon since ESPHome uses an event loop).
181200

182-
**Example configuration with advanced LWIP options:**
201+
**Example configuration with advanced LWIP and VFS options:**
183202

184203
```yaml
185204
# Example configuration entry
@@ -194,6 +213,9 @@ esp32:
194213
195214
# Memory saving options
196215
disable_libc_locks_in_iram: true # Enabled by default, saves 1.3 KB IRAM
216+
disable_vfs_support_termios: true # Enabled by default, saves 1.8 KB flash
217+
disable_vfs_support_select: true # Enabled by default, saves 2.7 KB flash (auto-enabled by openthread)
218+
disable_vfs_support_dir: true # Enabled by default, saves 0.5 KB+ flash
197219
enable_lwip_dhcp_server: false # Disabled by default, only needed for AP mode
198220
enable_lwip_mdns_queries: false # Enabled by default, can disable if not using .local hostnames
199221
enable_lwip_bridge_interface: false # Disabled by default

0 commit comments

Comments
 (0)