Build compiles all source files into object files

When I do a build all source files get compiled, every time I build. Even if the source files have not changed.
What can i do to have it so only changed source files get built.

Edit: It seems if I make changes to my sourse and hit upload it doesnt compile everything. If I hit build it rebuilds everything. Is this how it is supposed to work ?

If you make any changes to the platformio.ini file… that will trigger the next build to be a full rebuild. Otherwise, normally only changed files will be compiled (after there has been a successful full build, of course!). This is the same regardless of if this is a build or an upload task.


So do I first build, then upload ? Because I confirmed that my changes to source are making it to the board by only uploading (without building first). I am not touching my ini file and when I build, everything gets re-compiled which takes a long time. BTW, I am switching from Windows to linux and platformio is helping me do that because the IDE’s I use for arduino and STM are windows only.

edit: I went back and tested again. So this time it is not rebuilding everything. Maybe I am losing my mind.
Thanks for your help.

1 Like