Speed up compilation

Apologies if my question seems naïve (it is my first question on this forum), but I am relatively new to the nuts and bolts of compiling c++ code (I have just switched to platformio from arduino ide). When I build a project for the first time I understand that I am going to need to compile all of the libraries for my system (either esp8266 or esp32-s) together with my source and then link them together to make the final executable. However, once this initial compilation is done I don’t see why all of these libraries need compiling again? I notice if I change my platform.ini file that everything will build again (even if I am just changing the baud rate or upload speed). Is it possible to specify options/flags to prevent this behaviour or am I misunderstanding the compilation process? I am working with VS code on linux (ubuntu x64).

Thank you in advance,


No, you got it correctly, some option changes should not require to recompile but it’s probably easier for platformio developers and safer for platformio users way it is.

I can give you a counter-example where it does have an affect – the value for the upload speed is transported to the code via a define and can then change behavior for different values. Like e.g. in How could the main.cpp read the parameters at platformio.ini? - #3 by maxgerhardt. Instead of doing extensive and complicated research on which option exactly can influence which part of the buildprocess, the solution of rebuild on configuration change is actually quite good for correctness.

1 Like