diff --git a/docs/FAQ.md b/docs/FAQ.md index b27a7a7b5f..f78c101563 100644 --- a/docs/FAQ.md +++ b/docs/FAQ.md @@ -109,3 +109,37 @@ https://www.stm32duino.com/viewtopic.php?f=62&t=1000 Refers to this [warning](Upload-methods.md#bmp-black-magic-probe) +#### Builds are very slow + +Compiling a sketch involves the core, the HAL and the libraries, which is thousands of small files and many short-lived +compiler processes. On Windows, real-time antivirus scanning (e.g. Microsoft Defender, Microsoft Defender for Endpoint) +scans each of them, which can multiply the build time. + +Excluding the build-related folders from real-time scanning usually gives the biggest improvement. +Only exclude folders you trust. + +Folders to exclude (replace `` with your user name): + +| Path | Content | +|------|---------| +| `C:\Users\\AppData\Local\Arduino15` | Cores, HAL, toolchain (`arm-none-eabi-gcc`), tools and libraries installed by the Boards/Library Manager | +| `C:\Users\\AppData\Local\arduino` | Arduino IDE 2 / `arduino-cli` cache and build folders | +| `C:\Users\\AppData\Local\Programs\Arduino IDE` | Arduino IDE 2 installation, including `arduino-cli.exe` | +| `C:\Users\\AppData\Local\Temp\.arduinoIDE-*` | Arduino IDE 2 temporary files | +| `C:\Users\\Documents\Arduino` | Default sketchbook location (use your own if you changed it in the IDE *Preferences*) | + +The temporary build folder location can be checked by enabling *Show verbose output during compilation* in the IDE +*Preferences*: look for the `--build-path` value in the output. + +If your policy allows process exclusions, also add `arm-none-eabi-gcc.exe`, `arm-none-eabi-g++.exe`, `cc1.exe`, +`cc1plus.exe`, `as.exe`, `ld.exe`, `collect2.exe`, `busybox.exe` and `arduino-cli.exe`. + +On a managed computer, exclusions are usually defined by your IT department. Give them the list above. + +Other things that help: + +* Keep the build folder on an SSD and do not clean it between builds: changing the board menu options (e.g. optimization, + USB support) invalidates the cached core and forces a full recompilation. +* Use a short sketch path. +* Use *Warnings: None* and keep the verbose output disabled. + diff --git a/system/extras/prebuild.sh b/system/extras/prebuild.sh index 95faf81ce2..3b8c38ecf4 100755 --- a/system/extras/prebuild.sh +++ b/system/extras/prebuild.sh @@ -24,16 +24,7 @@ fi UNAME_OS="$(uname -s)" case "${UNAME_OS}" in Windows*) - i=1 - prefix="" - while [ "$i" -le "${#BOARD_PLATFORM_PATH}" ]; do - c=$(printf '%s' "$BOARD_PLATFORM_PATH" | cut -c $i) - prefix=${prefix}${c} - if [ "${c}" = "\\" ]; then - prefix=${prefix}"\\" - fi - i="$((i + 1))" - done + prefix=$(printf '%s' "$BOARD_PLATFORM_PATH" | sed 's/\\/\\\\/g') ;; *) prefix=${BOARD_PLATFORM_PATH}