|
| 1 | +# This is a collection of sdkconfig settings that frees RAM at runtime, |
| 2 | +# at the expense of performance. |
| 3 | +# |
| 4 | +# Not all options will work on all SoC families, but adding this sdkconfig |
| 5 | +# set to a board should increase the free memory. |
| 6 | +# |
| 7 | +# - Many options free IRAM, which on most ESP32 families leads to |
| 8 | +# free DRAM at runtime (original ESP32 and S2 may not). |
| 9 | +# - The other options reduce runtime DRAM usage from the heap. |
| 10 | +# |
| 11 | +# IMPORTANT: If you enable these config settings on a custom build then you may |
| 12 | +# encounter bugs or crashes. If you choose to open a MicroPython bug report then |
| 13 | +# please mention these config settings! |
| 14 | + |
| 15 | +# Place functions in flash whenever possible to free IRAM |
| 16 | +CONFIG_RINGBUF_PLACE_FUNCTIONS_INTO_FLASH=y |
| 17 | +CONFIG_FREERTOS_PLACE_FUNCTIONS_INTO_FLASH=y |
| 18 | +CONFIG_HEAP_PLACE_FUNCTION_INTO_FLASH=y |
| 19 | + |
| 20 | +# Use the SPI flash functions in ROM (when available). This may limit flash chip |
| 21 | +# support and cause issues with some flash chips. Each SoC family has different |
| 22 | +# set of chip support baked into ROM. |
| 23 | +CONFIG_SPI_FLASH_ROM_IMPL=y |
| 24 | + |
| 25 | +# Run the Bluetooth controller from flash not IRAM |
| 26 | +CONFIG_BT_CTRL_RUN_IN_FLASH_ONLY=y |
| 27 | + |
| 28 | +# lwIP adjustments to limit runtime memory usage (at expense of performance, and/or |
| 29 | +# a reduction in number of active connections). |
| 30 | +CONFIG_LWIP_TCPIP_RECVMBOX_SIZE=16 |
| 31 | +CONFIG_LWIP_MAX_SOCKETS=6 |
| 32 | +CONFIG_LWIP_MAX_ACTIVE_TCP=8 |
| 33 | + |
| 34 | +# These lwIP values are recommended to scale relative to the Wi-Fi buffer numbers |
| 35 | +CONFIG_LWIP_TCP_WND_DEFAULT=3072 |
| 36 | +CONFIG_LWIP_TCP_SND_BUF_DEFAULT=3072 |
| 37 | + |
| 38 | +# Wi-Fi adjustments to reduce peak runtime memory usage, at expense of peak |
| 39 | +# performance |
| 40 | +CONFIG_ESP_WIFI_STATIC_RX_BUFFER_NUM=8 |
| 41 | +CONFIG_ESP_WIFI_DYNAMIC_RX_BUFFER_NUM=12 |
| 42 | +CONFIG_ESP_WIFI_DYNAMIC_TX_BUFFER_NUM=12 |
| 43 | +CONFIG_ESP_WIFI_RX_MGMT_BUF_NUM_DEF=2 |
| 44 | +CONFIG_ESP_WIFI_RX_BA_WIN=12 |
0 commit comments