M5Stack Very Slow to compile & Load

I'm used to programming with the Arduino UNO/NANO, but recently switched to using an M5Stack Core2 (AWS). I've got the board files installed and working, but I'm finding that it takes about 2m, & 30sec to compile and load even a small project (Hello World).

If I change to verbose, it's over 4 minutes.

My PC is a desktop:
Processor Intel(R) Core(TM) i5-3570 CPU @ 3.40GHz, 3401 Mhz, 4 Core(s), 4 Logical Processor(s)
Samsung SSD 850 drive (30% capacity)
8GB of memory

At this speed of uploading, debugging will take a LONG time... (I'm not a GREAT programmer)

Is there something that I'm missing, that all of the libraries seem to want to recompile with each load?

Sir Michael

Hi @SirMichael. Which version of Arduino IDE are you using (e.g., "2.0.1")? The version is shown on the window title bar and also in the Help > About dialog.

I've tried both the 1.8.x and the 2.0, very little difference.

How long does it take for you to do an upload cycle to your M5Stack?

Incidentally, I've also tried it on my Lenovo Laptop (though it's not as fast as the desktop).

Sir Michael

I was hoping to get you to tell me a specific IDE version.

There have been many releases in the Arduino 2.0 series. Some of the older ones had a bug (arduino/arduino-ide#68 / arduino/arduino-ide#405 that caused the output to be printed very slowly. That matches the symptom you described:

That output bug was fixed some versions back, so if you are using the latest version 2.0.3 then I would not expect any difference in upload times with or without verbose output enabled.

The time will depend on the sketch you are uploading.

Another thing to note is that Arduino IDE caches the compiled files, so the first compilation of a given sketch for a given board will be much slower than subsequent compilations. Arduino IDE 1.x fully cleans up the compilation cache on exit, so this will apply to every session. Arduino IDE 2.x does not clear the core cache on exit (it is stored in the system temporary folder so the operating system may clean it automatically, but I find Windows does not) so even between sessions you will find the cache speeds compilation up significantly.

The second upload (meaning compilation is using the cache) of the sketch I get from File > New Sketch takes 24 seconds on my moderate spec Windows machine.

Yes, I am running the latest version, 2.0.3. Just downloaded it. I do like some of the features of the new IDE...

I'm aware of when you compile for the first time, that it takes longer, I've observed this in the past and expect that be the case.

I did disable Windows Defender and it didn't make any difference (I've been trying to google the problem a lot). I did add the Arduino.exe to the Defender allowed though...

When doing the compile, the CPU is not maxed out, nor is the Samsung SSD.

I also checked to make sure that the "libraries" directory is on my local drive. I do, from time to time store some of my sketches on my OneDrive (cloud).

I killed a bunch of processes and the CPU is running 35%, SSD is at or near 0%, Memory is 5.5 out of 7.9 GB. That's with the M5Stack disconnected, not loading (I've compiled quite a few times, not the first). Compile Verbose is Off.

Sketch: Hello World, 1st run, 3:50. 2nd run was 43 seconds.

The sketch that I'm working on updating from an UNO to M5Stack (LCD...) with errors.., 1st 3:05, 2nd was 2:34m/s

Is that reasonable??? I'm not sure that I'm that patient!!!

Sir Michael

I have exactly the same problem! Extremely slow compilation of even the most simple sketch (hello, world)! Did you find a solution for it?

Hi @ingerlg. Exceptionally slow compilations are often found to be caused by the "on access" or "realtime" scanning behavior of antivirus software interfering with the compilation, which involves a large number of processes and files. You can try :warning: TEMPORARILY :warning: disabling your antivirus for a single compilation to see if the problem goes away, then turn the antivirus back on.

If the problem doesn't occur with the antivirus off you will need to adjust the settings of your antivirus to put the appropriate file, folder, or process on the "allow list" so it doesn't interfere with compilation.

:warning: Please be cautious about working without an antivirus. This is only about temporarily disabling it for a quick test. If you don't feel comfortable doing that, fine. You can try going straight to configuring the antivirus to not interfere with the Arduino software.

Ditto and I can also confirm it's not just windows.
Fresh load of Ubuntu 22.10.

using an M5Tough.
works but super slow..

helloworld 3 mins on pass one, 1:30 on pass 2..
verbose on compiler..
lots of long lines, probably a library issue..

Logs are here..

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