Reducing Binary Size by Removing Pthread

top_of_the_stack
Posts: 3
Joined: Tue May 14, 2024 10:50 am

Reducing Binary Size by Removing Pthread

Postby top_of_the_stack » Tue Nov 11, 2025 4:35 pm

Hiyaa,

My binary size is getting a little large!

When I check the components, the 3 with the largest footprint are Wifi, Ble and pthread.

I print all the components that I use at the end of my CMakeLists.txt.

Code: Select all

Components: app_update bootloader bootloader_support bt cxx driver efuse esp-modbus esp-tls esp_adc esp_app_format esp_bootloader_format esp_coex esp_common esp_eth esp_event esp_http_client esp_http_server esp_hw_support 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 espressif__esp_modem esptool_py freertos hal hardware-test heap http_parser json load-balancing log lwip main mbedtls mqtt newlib nvs_flash partition_table port pthread sentinel soc spi_flash spiffs tcp_transport vfs wpa_supplicant xtensa
I'm not sure why I need pthread? I use the freeRTOS functions directly. Could I remove pthread completely, and how would I do this?

Code: Select all

{
    "libpthread.a": {
        ".dram0.bss": 12,
        ".dram0.data": 16,
        ".flash.rodata": 246482,
        ".flash.text": 969,
        "flash_total": 247467,
        "ram_st_total": 28
    },
    "libbt.a": {
        ".dram0.data": 180,
        ".ext_ram.bss": 605,
        ".flash.rodata": 15454,
        ".flash.text": 211110,
        ".iram0.text": 489,
        "flash_total": 227233,
        "ram_st_total": 1274
    },
    "libnet80211.a": {
        ".dram0.data": 863,
        ".ext_ram.bss": 8141,
        ".flash.rodata": 13183,
        ".flash.rodata_noload": 11651,
        ".flash.text": 124625,
        "flash_total": 138671,
        "ram_st_total": 9004
    },

User avatar
thefury
Posts: 38
Joined: Thu Sep 05, 2019 5:25 pm

Re: Reducing Binary Size by Removing Pthread

Postby thefury » Sun Nov 23, 2025 6:00 pm

That may be a red herring. See the note at the end of this section about merging constants: https://docs.espressif.com/projects/esp ... components

So it's prolly not actually that large

Who is online

Users browsing this forum: Google [Bot], PerplexityBot, PetalBot and 11 guests