Minimum ESP32-S2 build for testing

atlaste
Posts: 6
Joined: Thu Jun 22, 2023 1:42 pm

Minimum ESP32-S2 build for testing

Postby atlaste » Tue Apr 30, 2024 10:01 am

Hi,

I've been attempting to make a minimum build configuration for the ESP32-S2 so we can just test a single device. Basically what I'm trying to do is get UART up and running and some driver (say, SPI) and then remove everything else from the build so that I can iterate development more quickly.

So the goals are:

(1) As little compilation as possible
(2) As little flashing as possible.

I have no need for TLS, WIFI, WPS, etc, etc. Freertos is pretty much a requirement because of the GDB stub. I need UART. And other than that, I don't need anything...

So far my ventures have been without much success... I use components "driver freertos esp_hw_support esp_rom esp_timer" in my cmakelists. When I build with IDF.PY, it will then just explode into:

Components: app_trace app_update bootloader bootloader_support bt cmock console cxx driver efuse esp-tls esp_adc esp_app_format esp_coex esp_common esp_eth esp_event esp_gdbstub esp_hid esp_http_client esp_http_server esp_https_ota esp_https_server esp_hw_support esp_lcd esp_local_ctrl esp_mm esp_netif esp_netif_stack esp_partition esp_phy esp_pm esp_psram esp_ringbuf esp_rom esp_system esp_timer esp_wifi espcoredump esptool_py fatfs freertos hal heap http_parser idf_test ieee802154 json log lwip mbedtls mqtt newlib nvs_flash openthread partition_table perfmon protobuf-c protocomm pthread sdmmc soc spi_flash spiffs src tcp_transport touch_element ulp unity usb vfs wear_levelling wifi_provisioning wpa_supplicant xtensa

Where is all this coming from? I didn't ask for these?

Anyways it then continues on and terminates with an error:

C:/Espressif/frameworks/esp-idf-v5.1.1/components/mbedtls/mbedtls/include/mbedtls/check_config.h:77:2: error: #error "MBEDTLS_CTR_DRBG_C defined, but not all prerequisites"
77 | #error "MBEDTLS_CTR_DRBG_C defined, but not all prerequisites"
| ^~~~~
C:/Espressif/frameworks/esp-idf-v5.1.1/components/mbedtls/mbedtls/include/mbedtls/check_config.h:86:2: error: #error "MBEDTLS_CMAC_C defined, but not all prerequisites"
86 | #error "MBEDTLS_CMAC_C defined, but not all prerequisites"
| ^~~~~

Apparently AES is needed. Fine, so I'll add them to menuconfig and end up with:

1565 | #error "Please enable at least one IP stack (either IPv4 or IPv6 or both)"
| ^~~~~

What happens next is that WiFi provisioning will fail:

In file included from C:/Espressif/frameworks/esp-idf-v5.1.1/components/wifi_provisioning/src/wifi_provisioning_priv.h:12,
from C:/Espressif/frameworks/esp-idf-v5.1.1/components/wifi_provisioning/src/manager.c:26:
C:/Espressif/frameworks/esp-idf-v5.1.1/components/wifi_provisioning/include/wifi_provisioning/manager.h:214:1: error: empty enum is invalid
214 | } wifi_prov_security_t;
| ^
C:/Espressif/frameworks/esp-idf-v5.1.1/components/wifi_provisioning/include/wifi_provisioning/manager.h:331:44: error: unknown type name 'wifi_prov_security_t'; did you mean 'wifi_prov_scheme_t'?
331 | esp_err_t wifi_prov_mgr_start_provisioning(wifi_prov_security_t security, const void *wifi_prov_sec_params, const char *service_name, const char *service_key);
| ^~~~~~~~~~~~~~~~~~~~
| wifi_prov_scheme_t
C:/Espressif/frameworks/esp-idf-v5.1.1/components/wifi_provisioning/src/manager.c:1489:44: error: unknown type name 'wifi_prov_security_t'; did you mean 'wifi_prov_scan_ctx_t'?
1489 | esp_err_t wifi_prov_mgr_start_provisioning(wifi_prov_security_t security, const void *wifi_prov_sec_params,
| ^~~~~~~~~~~~~~~~~~~~
| wifi_prov_scan_ctx_t

... and so on and so forth...

Keep in mind: I need none of these features, and they only add to the build time. How can I just disable the lot?

Cheers,
Stefan.

ESP_Sprite
Posts: 9769
Joined: Thu Nov 26, 2015 4:08 am

Re: Minimum ESP32-S2 build for testing

Postby ESP_Sprite » Tue Apr 30, 2024 1:20 pm

Generally, the answer is 'you don't'. The components that are not needed are compiled the first time, but if you do not use them, they aren't linked into the binary and won't add to the size of the binary. After the first compile, only the changed files and whatever it depends on are changed, so the components that aren't needed won't add to your compile time.

MicroController
Posts: 1738
Joined: Mon Oct 17, 2022 7:38 pm
Location: Europe, Germany

Re: Minimum ESP32-S2 build for testing

Postby MicroController » Tue Apr 30, 2024 1:26 pm

atlaste wrote:
Tue Apr 30, 2024 10:01 am
I need UART. And other than that, I don't need anything...
Take one of the UART example projects then add the functionality you need to that. That's as slim as it gets in ESP-IDF.
On the upside, the linker will remove most to all code not actually used by the application when creating the final binary.

Who is online

Users browsing this forum: No registered users and 87 guests