2024-04-23 09:40 AM - edited 2024-04-25 06:30 AM
I have a .cmd script to do headless builds on Windows 11:
@Echo off
echo incrementally building...
set PROJECT_DIR=%cd%\..
set PROJECT_NAME=MY_PROJECT_NAME
set BUILD_TYPE=Debug
set workspace_folder=%temp%\%PROJECT_NAME%_workspace
mkdir %workspace_folder%
C:\ST\STM32CubeIDE_1.11.2\STM32CubeIDE\headless-build.bat -data %workspace_folder% -import %PROJECT_DIR% -build %PROJECT_NAME%/%BUILD_TYPE%
exit /b %ERRORLEVEL%
It builds perfectly:
13:31:22 Build Finished. 0 errors, 0 warnings. (took 3s.227ms)
After this the command prompt sometimes hangs for about 20 seconds. But not always.
First build after switching between TouchGFX, command prompt or STM32CubeIDE freezes 20 seconds (in TouchGFX or command prompt), subsequent builds don't freeze until I switch again. This is not a big deal as it's only the first build, but I still like to have it fixed. I tried many things:
I've attached a simple project that replicates the issue. The project is simpler and the delay is only 5 seconds after build after switching. I've removed the Middlewares folder or else the archive would be 256MiB. It's just a project generated from TouchGFX for the STM32H735G-DK with slight modifications
Solved! Go to Solution.
2024-04-24 02:02 AM - edited 2024-05-06 03:29 AM
I've solved it! It's a bug or a missing feature in STM32CubeIDE\headless-build.bat.
The culprit is the indexer which runs after the build (silently, except when running it verbose). The indexer is not needed for a headless build in my opinion. (I found it in an example here: https://stackoverflow.com/a/76571159/15307950)
By adding the parameter -no-indexer to headless-build.bat the problem goes away.
off
echo incrementally building...
set PROJECT_DIR=%cd%\..
set PROJECT_NAME=MY_PROJECT_NAME
set BUILD_TYPE=Debug
set workspace_folder=%temp%\%PROJECT_NAME%_workspace
mkdir %workspace_folder%
C:\ST\STM32CubeIDE_1.11.2\STM32CubeIDE\headless-build.bat -no-indexer -data %workspace_folder% -import %PROJECT_DIR% -build %PROJECT_NAME%/%BUILD_TYPE%
exit /b %ERRORLEVEL%
Or modifying STM32CubeIDE\headless-build.bat to:
OFF
set basedir=%~dp0
"%basedir%"stm32cubeidec.exe --launcher.suppressErrors -nosplash -application org.eclipse.cdt.managedbuilder.core.headlessbuild -no-indexer %*
I'd like to hear from the ST team if they are going to fix this bug.
2024-04-24 02:02 AM - edited 2024-05-06 03:29 AM
I've solved it! It's a bug or a missing feature in STM32CubeIDE\headless-build.bat.
The culprit is the indexer which runs after the build (silently, except when running it verbose). The indexer is not needed for a headless build in my opinion. (I found it in an example here: https://stackoverflow.com/a/76571159/15307950)
By adding the parameter -no-indexer to headless-build.bat the problem goes away.
off
echo incrementally building...
set PROJECT_DIR=%cd%\..
set PROJECT_NAME=MY_PROJECT_NAME
set BUILD_TYPE=Debug
set workspace_folder=%temp%\%PROJECT_NAME%_workspace
mkdir %workspace_folder%
C:\ST\STM32CubeIDE_1.11.2\STM32CubeIDE\headless-build.bat -no-indexer -data %workspace_folder% -import %PROJECT_DIR% -build %PROJECT_NAME%/%BUILD_TYPE%
exit /b %ERRORLEVEL%
Or modifying STM32CubeIDE\headless-build.bat to:
OFF
set basedir=%~dp0
"%basedir%"stm32cubeidec.exe --launcher.suppressErrors -nosplash -application org.eclipse.cdt.managedbuilder.core.headlessbuild -no-indexer %*
I'd like to hear from the ST team if they are going to fix this bug.