PlatformIO Community

ESP32 insane compile times everytime

Hello. I have seen numerous posts about problems with compile times in platformio. Every time I change one line of code, it recompiles the whole program which takes 2-3 minutes. Same behaviour explained here:

Has there been any updates regarding this issue? Any workarounds available?

Which line of code is changed, and what platformio.ini are you using?

My platformio :

; PlatformIO Project Configuration File


;   Build options: build flags, source filter, extra scripting

;   Upload options: custom port, speed and extra flags

;   Library options: dependencies, extra library storages


; Please visit documentation for the other options and examples



platform = espressif32

framework = espidf

monitor_speed = 115200


board = esp32dev

board_build.partitions = partitions_two_ota.csv # required for OTA


#board = esp-wrover-kit


#board = lolin32

And all I have changed is added one printf statement to my custom library function

Is that library function in lib/<library name> or did you add it in components/<component-name>?

I have not created components folder. I have simply created my own custom .c file under src/ folder and then I modify my CMakeLists.txt and add all my .c files

idf_component_register(SRCS "main.c" "test.c" "https_OTA.c BLE_uart.c"

                    INCLUDE_DIRS "")

I see. I recreated the project based on the hello-world project with src/main.c and src/test.c, initially


#include <stdio.h>
#include "freertos/FreeRTOS.h"
#include "freertos/task.h"
#include "driver/gpio.h"
#include "sdkconfig.h"

extern void some_test();

void app_main()
    printf("Hello world!\n");

and src\test.c

#include <stdio.h>
void some_test() {
   printf("Test 1\n");

The first compilation is complete (as expected). If I then modify src\test.c to

#include <stdio.h>
void some_test() {
   printf("Test 1\n");
   printf("Test 2\n");

and build again

Reading CMake configuration...
LDF: Library Dependency Finder ->
LDF Modes: Finder ~ chain, Compatibility ~ soft
Found 0 compatible libraries
Scanning dependencies...
No dependencies
Building in release mode
Compiling .pio\build\esp32dev\src\test.o
Linking .pio\build\esp32dev\firmware.elf
Retrieving maximum program size .pio\build\esp32dev\firmware.elf
Checking size .pio\build\esp32dev\firmware.elf
Advanced Memory Usage is available via "PlatformIO Home > Project Inspect"
RAM:   [          ]   3.8% (used 12588 bytes from 327680 bytes)
Flash: [==        ]  15.2% (used 159413 bytes from 1048576 bytes)
Building .pio\build\esp32dev\firmware.bin v3.1
Merged 1 ELF section
========================= [SUCCESS] Took 18.84 seconds =========================

Only test.o is recompiled and the firmware is relinked.

So, I can’t reproduce your problem.

Make sure your PlatformIO core is of the latest version, as well as your Espressif32 platform. In a CLI, execute

pio upgrade --dev
pio platform update espressif32

It’s somewhat dependent on the speed of your computer but this is my experience too. From what I see it compiles all the libraries (Including ESP32 Core) every time. I believe with the ESP32 having things like WiFi, Bluetooth, SD Card etc that it just takes longer than other Arduino’s that don’t have those. Also, I think the Arduino IDE only uses one core of your processor.


Install vscode; Install platformio-vscode-ide; Create new project (I’m using esp8266 and esp32); Click ‘build’ or … ESP32 insane compile times everytime .


We can’t reproduce that unless you show the project you’re having problems with. What compilation times are you getting? Are you talking about unnecessary recompilations for minor code-only changes or the general compilation time? Is that with Arduino as framewokr?