Skip to main content
Associate II
November 23, 2023
Solved

How to create Windows batch script to build STM32CubeIDE project

Hi,

I created a Windows batch file trying to build STM32CubeIDE project, but somehow it always got the workspace error and please help to clarify, thanks.

Here is my batch script.

 

 

set CUBEIDE_PATH=C:\ST\STM32CubeIDE_1.13.2\STM32CubeIDE

set WORKSPACE=C:\Users\James.Shih\STM32CubeIDE\workspace_1.13.2
set PROJECT=vB+STM32G070
set CONSOLE=-vmargs -Dorg.eclipse.cdt.core.console=org.eclipse.cdt.core.systemConsole
set HEADLESS=--launcher.suppressErrors -nosplash -application org.eclipse.cdt.managedbuilder.core.headlessbuild

%CUBEIDE_PATH%\stm32cubeidec.exe %HEADLESS% -build %PROJECT% %WORKSPACE% %CONSOLE%

 

 
Here is the error logs.

 

!MESSAGE Application error
!STACK 1
java.lang.IllegalStateException: Workspace is already closed or not ready yet. Consider tracking the org.eclipse.core.resources.IWorkspace service (using your favorite technique, e.g. Declarative Services, ServiceTracker, Blueprint, ...) instead of calling the static method here to prevent such issues!

 

This topic has been closed for replies.
Semer CHERNI
Semer CHERNIBest answer
ST Employee
December 4, 2023

Hello @James-Shih 

First let me thank you for posting and I apologize for the late reply :).

Try to use this script it should work :

set CUBEIDE_PATH=C:\ST\STM32CubeIDE_1.14.0\STM32CubeIDE

set WORKSPACE=C:\Users\chernise\STM32CubeIDE\workspace_1.14.0new
set PROJECT=headless_build

cd %CUBEIDE_PATH% 
CALL headless-build.bat -data %WORKSPACE% -cleanBuild %PROJECT%

 

KR,
Semer.

To give better visibility on the answered topics, please click on Accept as Solution on the reply which solved your issue or answered your question.

2 replies

Semer CHERNI
Semer CHERNIBest answer
ST Employee
December 4, 2023

Hello @James-Shih 

First let me thank you for posting and I apologize for the late reply :).

Try to use this script it should work :

set CUBEIDE_PATH=C:\ST\STM32CubeIDE_1.14.0\STM32CubeIDE

set WORKSPACE=C:\Users\chernise\STM32CubeIDE\workspace_1.14.0new
set PROJECT=headless_build

cd %CUBEIDE_PATH% 
CALL headless-build.bat -data %WORKSPACE% -cleanBuild %PROJECT%

 

KR,
Semer.

To give better visibility on the answered topics, please click on Accept as Solution on the reply which solved your issue or answered your question.
Associate II
December 5, 2023

Hi Semer,

Thanks for your help and now my problem is resolved :)

BR,

James Shih