Arduino IDE compiles every time and is slow

Hi,

I'm using Arduino IDE 1.8 for Windows. My code in the .ino file has some dependencies and imports .h/.cpp files. Every time I want to upload the code to any board, the IDE recompiles everything, even if I didn't change anything in the code.
The problem is not so much with the compiling but with the fact that it takes too long every time.
Moreover, I installed some espressif libraries (for the ESP32 chip) and I compiled from shell but, after the first time which was slower, it was always very fast, as if it wasn't recompiling the whole project every time but only the files with changes.

Any insight would be appreciated
Thank you

If you expect compilation to object modules that will later be linked, you need a tool chain with support for that. In other words, a standard C/C++ make environment. It's possible that the Espressif compiler handles this somehow.

This question is not in the right sub forum, please ask a moderator to move it.

Your topic was MOVED to its current forum category which is more appropriate than the original as it has nothing to do with Installation and Troubleshooting of the IDE

If your only problem is the re-compile preceding download, then simply copy the object file (hex or bin file depending on which processor youre using), and use the appropriate upload tool to simply re-upload without re-compiling. The location of the object file and the exact command line to use will be near the end of the console output if you turn on verbose output.

Hi @raff5184. The Arduino IDE is designed to cache the core and libraries. So after the first compilation you should find that the already compiled files are reused. If you enable verbose output during compilation in the IDE preferences, you will see information about that in the compilation output. It will have a format something like this (differing in the paths and libraries shown):

Compiling libraries...
Compiling library "WiFi"
Using previously compiled file: C:\Users\per\AppData\Local\Temp\arduino_build_75761\libraries\WiFi\WiFiGeneric.cpp.o
Using previously compiled file: C:\Users\per\AppData\Local\Temp\arduino_build_75761\libraries\WiFi\WiFiServer.cpp.o
Using previously compiled file: C:\Users\per\AppData\Local\Temp\arduino_build_75761\libraries\WiFi\WiFiSTA.cpp.o
Using previously compiled file: C:\Users\per\AppData\Local\Temp\arduino_build_75761\libraries\WiFi\WiFiMulti.cpp.o
Using previously compiled file: C:\Users\per\AppData\Local\Temp\arduino_build_75761\libraries\WiFi\WiFiScan.cpp.o
Using previously compiled file: C:\Users\per\AppData\Local\Temp\arduino_build_75761\libraries\WiFi\WiFi.cpp.o
Using previously compiled file: C:\Users\per\AppData\Local\Temp\arduino_build_75761\libraries\WiFi\WiFiAP.cpp.o
Using previously compiled file: C:\Users\per\AppData\Local\Temp\arduino_build_75761\libraries\WiFi\WiFiClient.cpp.o
Using previously compiled file: C:\Users\per\AppData\Local\Temp\arduino_build_75761\libraries\WiFi\WiFiUdp.cpp.o
Compiling core...
Using precompiled core: C:\Users\per\AppData\Local\Temp\arduino_cache_755866\core\core_450a9c097c7caeb11bddd3f9a5c9eeb9.a

The core and libraries are only recompiled if they have been modified or if you exit the IDE (it cleans up the temporary folder of the cache on exit).

The sketch code is recompiled every time. However, if you think about it, caching this compilation doesn't really make sense because we would typically only compile after we have modified that code.

If you check your output and find that the cached files are not being used, I recommend checking whether you are using an outdated version of the ESP32 boards platform. The platform must be correctly configured in order to enable the IDE caching and I believe the older versions of that platform were not.

You can check the installed version by doing this:

  1. Select Tools > Board > Boards Manager from the Arduino IDE menus.
  2. Wait for the updates to finish.
  3. Scroll down through the list of boards platforms until you see "esp32 by Espressif Systems".

The version will be shown there. For example, here you can see I have version 2.0.5 installed:

2.0.5 is the latest version. Something to note if you have an older version is Espressif changed the URL used in the Arduino IDE's "Additional Boards Manager URLs" and no longer maintain the old one. This is a common cause of people using outdated versions. You can learn the latest URL to put in your preferences from checking the official installation instructions:

https://docs.espressif.com/projects/arduino-esp32/en/latest/installing.html#installing-using-arduino-ide


Another thing you might try is using Arduino IDE 2.x. Unlike Arduino IDE 1.x, Arduino IDE 2.x does not clear the core compilation cache temporary folder on exit, so you only need to compile the core once and then after that it will always be used until your operating system does a clean up of the temporary folders (which Windows does not ever do automatically from what I can tell). This results in a significant speed up in compilation time for the first compilation of the session compared to Arduino IDE 1.x.

Just curious, what kinda time we talking here?

I don't doubt that faster would be better. And it is annoying to be held up for an amount of time you can't do much of anything else with. Sometimes way slower us better - time for a smoke or lunch. :expressionless:

I do a mini-meditation or look out the window and think of getting back to not this.

a7

I have disabled my virus protection for IDE. That made a big difference... (from 5 minutes to 2)...

Programmers today are spoiled! Most clearly never had to deal with software development in the old days of 8032/8080/8085/Z80 and 8086 computers, and EEPROM memory, where a single compile on a large project could take as much as a couple of hours, and programming and plugging in the dozen or more EEPROMs could take another 20 minutes. Ah, the good old days... :frowning:

2 Likes

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