Chapter 4. API Guides
names for error values (see Error Handling) in error logs, etc. This saves some binary size, but error values
will be printed as integers only.
• Setting CONFIG_ESP_SYSTEM_PANIC to “Silent reboot”will save a small amount of binary size, however
this is only recommended if no one will use UART output to debug the device.
Note: In addition to the many configuration items shown here, there are a number of configuration options where
changing the option from the default will increase binary size. These are not noted here. Where the increase is
significant, this is usually noted in the configuration item help text.
Targeted Optimizations The following binary size optimizations apply to a particular component or a function:
Wi-Fi
• Disabling CONFIG_ESP32_WIFI_ENABLE_WPA3_SAE will save some Wi-Fi binary size if WPA3 support is
not needed. (Note that WPA3 is mandatory for new Wi-Fi device certifications.)
• Disabling CONFIG_ESP_WIFI_SOFTAP_SUPPORT will save some Wi-Fi binary size if soft-AP support is not
needed.
lwIP IPv6
• Setting CONFIG_LWIP_IPV6 to false will reduce the size of the lwIP TCP/IP stack, at the cost of only sup-
porting IPv4.
Note: IPv6 is required by some components such as coap and ASIO port, These components will not be
available if IPV6 is disabled.
Newlib nano formatting By default, ESP-IDF uses newlib “full”formating for I/O (printf, scanf, etc.)
Enabling the config option CONFIG_NEWLIB_NANO_FORMAT will switch newlib to the“nano”formatting mode.
This both smaller in code size and a large part of the implementation is compiled into the ESP32-S2 ROM, so it
doesn’t need to be included in the binary at all.
The exact difference in binary size depends on which features the firmware uses, but 25 KB ~ 50 KB is typical.
Enabling Nano formatting also reduces the stack usage of each function that calls printf() or another string formatting
function, see Reducing Stack Sizes.
“Nano”formatting doesn’t support 64-bit integers, or C99 formatting features. For a full list of restrictions, search
for --enable-newlib-nano-formatted-io in the Newlib README file.
mbedTLS features Under Component Config -> mbedTLS there are multiple mbedTLS features which are enabled
by default but can be disabled if not needed to save code size.
These include:
• CONFIG_MBEDTLS_HAVE_TIME
• CONFIG_MBEDTLS_ECDSA_DETERMINISTIC
• CONFIG_MBEDTLS_SHA512_C
• CONFIG_MBEDTLS_SSL_PROTO_TLS1
• CONFIG_MBEDTLS_SSL_PROTO_TLS1_1
• CONFIG_MBEDTLS_CLIENT_SSL_SESSION_TICKETS
• CONFIG_MBEDTLS_SERVER_SSL_SESSION_TICKETS
• CONFIG_MBEDTLS_SSL_ALPN
• CONFIG_MBEDTLS_CCM_C
• CONFIG_MBEDTLS_GCM_C
Espressif Systems 1450
Submit Document Feedback
Release v4.4