Arduino IDE 2.3.2 & RUI-3 compiles extreamly slow

I have recently started working with the RAK ecosystem and am currently experimenting with the RAK4631-R core module. While running basic examples from the RAK WisBlock RUI, such as the “Arduino_Led_Breathing” example, I have observed that the compilation time can extend up to two minutes. For more advanced examples, the compilation time is even longer, often doubling the initial time.

This significant delay hinders the development process and is consistently observed during every compilation, not just the initial one.

Could you please provide any recommendations to address this issue? Additionally, could this performance issue be related to the version of the Arduino IDE being used?

Thank you for your assistance.

One of weird things with Arduino way of compiling code is that it always compiles everything, whether the file was changed or not. This leads to long compilation times, even if you changed only one file or no file at all.

What you can try is to use Visual Studio Code with Arduino Extension which is my preference and it has some advantages, as I show in my RUI3 Best Practices.
With VSC + Arduino Extension you will see for example lines like

Using previously compiled file: D:\Projects\RUI3\RUI3-RAK12500-RAK1904-GNSS\build\core\external\STM32CubeWL\Utilities\trace\adv_trace\stm32_adv_trace.c.o

which means these files are not compiled anymore, but cached versions are used.

Another solution is to use ArduinoCLI from command line.
With the option --build-cache-path, the compilation is only including changed files and reuses cached unchanged files from the last build (same as Visual Studio Code with Arduino Extension).

How I use it:

arduino-cli.exe  compile -b rak_rui:stm32:WisDuoRAK3172EvaluationBoard --build-property compiler.cpp.extra_flags="-DMY_DEBUG=1  -DAUTO_DR=1" --output-dir .\RUI3-Modular\flash-files --build-path .\RUI3-Modular\build --build-cache-path .\RUI3-Modular\cache --no-color --verbose --library .\RUI3-Modular\libraries .\RUI3-Modular\RUI3-Modular.ino

First build is still taking a long time, but following builds are much faster.

1 Like

Thank you Beegee for the support!!

I’ve tried VS code as well but again, I have to say that the verification process is extreamly slow… In Arduino.json I’ve included the output directory to avoid rebuilding files:

Even for a simple sketch like the one shown below, the verification process takes between 90 seconds and 5 minutes. I do not believe this should be the case. Am I doing something wrong? Have other community members reported this issue?

void setup(){
    Serial.begin(115200);
}

void loop(){
    Serial.println("Test");
    delay(1000);
}

For your reference, with other boards I do not have this issue. For example with Arduino UNO the compilation and upload executes in miliseconds

I am using VScode v1.91.1. I do not believe this is the cause of the issue, but I am mentioning

Do you have any other suggestions?

Also this simple sketch uses 53% of memory?? Hard to believe that… I have read that the built-in firmware on the RAK4631-R remains even after flashing with a custom firmware based on RUI3. Is this true? Could this be the reason for the 53% memory usage?

My largest code builds in around 1.5 minutes on a fresh build and around 40 seconds on a second build.
Same VSC version 1.91.1

Windows 11 Home
11th Gen Intel Core i7 @ 1.4Ghz
16GB RAM

For the code size, the RUI3 API is quite large, by default it includes the LoRa drivers (P2P), the complete LoRaWAN stack for 11 LoRa WAN regions and the BLE drivers for UART and OTA DFU.
So a large amount of memory is going into this.

You can reduce by changing the supported LoRaWAN regions, or, if you use LoRa P2P, disable the LoRaWAN support complete in the Arduino Board Configuration:

Thank you a lot Bernd,

It appears that the issue was caused by the IntelliSense and parsing processes, both of which were loading very slowly. I disabled all the extensions, which resolved the problem. The next step is to identify which specific extension is causing the issue. Currently, the build time is consistent at approximately 40 seconds. Additionally, I disabled some features from the RUI API, which resulted in a 10% reduction in memory usage.