Skip to content

Instantly share code, notes, and snippets.

@GaryLee
Last active July 4, 2025 10:26
Show Gist options
  • Save GaryLee/25101eccd50be9997e08cf21c39567bc to your computer and use it in GitHub Desktop.
Save GaryLee/25101eccd50be9997e08cf21c39567bc to your computer and use it in GitHub Desktop.
Build STM32CubeIDE project from command line.
@ECHO OFF
@REM By check the headless-build.bat which come along with STM32CubeIDE.
@REM we can invoke the build process without invoking the GUI.
@REM Set PATH for STM32CubeIDE.
SET "CUBEIDE_PATH=C:\ST\STM32CubeIDE_1.14.0\STM32CubeIDE"
SET OLD_PATH=%PATH%
SET PATH=%CUBEIDE_PATH%;%PATH%
@REM Use stm32cubeidec.exe to build the project in specified workspace.
@REM To select the build configuration, add "/<config>" after project name.
@REM For example, to build Debug configuration only, set PROJECT to "Your_project_name_here/Debug"
SET "WORKSPACE=Your_workspace_path_here"
SET "PROJECT=Your_project_name_here"
SET HEADLESS=--launcher.suppressErrors -nosplash -application org.eclipse.cdt.managedbuilder.core.headlessbuild
stm32cubeidec.exe %HEADLESS% -build %PROJECT% -data "%WORKSPACE%"
SET PATH=%OLD_PATH%
ECHO ON
@TDERL
Copy link

TDERL commented Jul 4, 2025

Change -build %PROJECT% to -build %PROJECT%/Debug

Yes, thank you :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment