you may or may not be able to set the following to turn it off. I would have to specifically check the MicroPython code to see if it is able to be done.
CONFIG_ESP_ERR_TO_NAME_LOOKUP=n
Here is a list of the options which can impact performance and binary size for the ESP32 line of MCU’s…
I do also recommend going through the config options for MicroPython to turn on and off features you will not use. Due to MicroPython being a runtime language there are a lit of things that get linked to in the ESP-IDF that you might not use. Things like the RMT or the Touch GPIOs. Everything that gets called from MicroPython’s C code gets compiled into the binary even if it goes unused so the author of MicroPython has coded in the ability to turn those things off and that can lead to a large savings in code. an example is if you are not going to use any crypto stuff. then you don’t need to compile that portion of MicroPython and that can lead to a really large savings in binary size.
To see what you can turn on and off check in themicropython/ports/esp32/mpconfigport.h file. There is a long list of options that can be turned on and off. There are also more MicroPython options that get specific to the moard you are using. so check the micropython/ports/esp32/boards/***/mpconfigboard.h file where *** is the BOARD you are using.
Also turn off ALL widgets you are not using in the lv_config.h file.
It is typical to see 2.5mb of flash use when compiling MicroPython with LVGL and leaving most things turned on in LVGL and leaving MicroPython and the ESP-IDF at their defaults.
A good summary; this is essentially a classic case of a “default build” adding too much unnecessary bloat.
I’d also add that on the ESP32, optimization almost always comes down to three things:
a rigorous audit of ESP-IDF / MicroPython features, as they do indeed have many unnecessary subsystems being pulled in transitively.
disabling everything unused at the board configuration level, not just the general mpconfigport.h.
and, separately, careful handling of LVGL, as it can grow significantly if you leave the default widgets and drivers in place.
From experience, the biggest gains usually come from disabling crypto/network modules and unused peripherals (RMT, BLE, touch, etc.). Sometimes this can actually save megabytes, as you mentioned.
In general, expect an increase of 1 MB with “LVGL” on “MicroPython”. The “<200 KB” size is usually for a minimal native LVGL build. MicroPython firmware also includes LVGL bindings, runtime overhead and ESP-IDF components.
Since you have already trimmed fonts and widgets, I would look into trimming “MicroPython” modules and “ESP-IDF” features next. Often the greatest flash savings can be had by disabling unused peripherals, crypto, logging, BLE, and other optional components rather than any further LVGL tweaks. It is a very common thing to see the firmware size grow a lot after enabling LVGL on ESP32-C3.