Recompiling on upload without code change

Why IDE 2.0 Recompiling on every upload's, when my code is not changed ?

Like the 8.1.15 and its predecessors, it doesn't store the result of the compilation after upload.
If it did you could end up with huge number of old machine code files on your HD.

So compiling, uploading and then removing the machine code file helps to keep your HD or whatever you use uncluttered.

Tom... :smiley: :+1: :coffee: :australia:

Even though the build process occurs before every upload. The libraries, including the core library, are cached. So you only have a full compilation the first time, or after you have changed board types (because this affects compilation and so the caches are not valid).

The caching system checks if files have been changed since the cache and recompiles any that have, so it automagically does the right thing during library development.

Since most users are only editing the sketch files and not switching to different board types, this caching system means that 99.9% of the time the only file that is compiled on subsequent compilations is the sketch itself. There really isn't a point in caching the sketch because it needs to be recompiled after every change anyway, and if you didn't make a change to the sketch then there is no point in compiling or uploading.

The exception might be if you are deploying a single program to a large number of boards. However, in that case the IDE is not the right tool. You will be better to use a command line tool that will allow automation of the process. For that purpose, you can use the lower level command line tool (e.g., AVRDUDE for the AVR-based boards like the Uno), or go a little higher level and use Arduino CLI:

The arduino-cli upload command uploads the binary produced by the arduino-cli compile command, meaning you can compile once and then upload as many times as you like without recompiling. And of course arduino-cli compile still does caching to avoid unnecessary compilations (Arduino CLI actually handles the build process for the Arduino IDE).

This topic was automatically closed 120 days after the last reply. New replies are no longer allowed.