cancel
Showing results for 
Search instead for 
Did you mean: 

How to create Windows batch script to build STM32CubeIDE project

James-Shih
Associate II

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!

 

1 ACCEPTED SOLUTION

Accepted Solutions
Semer CHERNI
ST Employee

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.

View solution in original post

2 REPLIES 2
Semer CHERNI
ST Employee

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.

Hi Semer,

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

BR,

James Shih