cancel
Showing results for 
Search instead for 
Did you mean: 

Headless build issues with STM32CubeIDE in Windows

LGree.3
Associate II

Hello,

I'm working on a project with STM32CubeIDE. I would like to get a build script going which would use the headless build option. I've looked in User Guide:

https://www.st.com/content/ccc/resource/technical/document/user_manual/group1/f8/a2/48/77/68/e6/4b/74/DM00629856/files/DM00629856.pdf/jcr:content/translations/en.DM00629856.pdf

And it mentions the headless build but when I follow the instructions step by step and set it up exactly as shown in the guide, it does not build anything.

I am running STM32CubeIDE 1.6.1, I set up my workspace in the location on the user guide, I have a project of the same name, I open a command prompt and navigate to the directory where the headless-build.bat file is located, I enter the workspace path with the correct 1.6.1 in place of 1.7.0 and try to build the project I created of the same name (NUCLEO-F401RE). After running the command listed:

headless-build.bat -data C:\Users\Name\STM32CubeIDE\workspace_1.7.0 ‑cleanBuild NUCLEO‑F401RE

replacing the Name and workspace with the correct ones for my path, I see this:

stm32cubeidec.exe --launcher.suppressErrors -nosplash -application org.eclipse.cdt.managedbuilder.core.headlessbuild
 
Usage: PROGRAM -data <workspace> -application org.eclipse.cdt.managedbuilder.core.headlessbuild [ OPTIONS ]
 
 
 
  -data    {/path/to/workspace}
 
  -import   {[uri:/]/path/to/project}
 
  -importAll {[uri:/]/path/to/projectTreeURI} Import all projects under URI
 
  -build   {project_name_reg_ex{/config_reg_ex} | all}
 
  -cleanBuild {project_name_reg_ex{/config_reg_ex} | all}
 
  -markerType Marker types to fail build on {all | cdt | marker_id}
 
  -no-indexer Disable indexer
 
  -printErrorMarkers Print all error markers
 
  -I     {include_path} additional include_path to add to tools
 
  -include  {include_file} additional include_file to pass to tools
 
  -D     {prepoc_define} addition preprocessor defines to pass to the tools
 
  -E     {var=value} replace/add value to environment variable when running all tools
 
  -Ea     {var=value} append value to environment variable when running all tools
 
  -Ep     {var=value} prepend value to environment variable when running all tools
 
  -Er     {var} remove/unset the given environment variable
 
  -T     {toolid} {optionid=value} replace a tool option value in each configuration built
 
  -Ta     {toolid} {optionid=value} append to a tool option value in each configuration built
 
  -Tp     {toolid} {optionid=value} prepend to a tool option value in each configuration built
 
  -Tr     {toolid} {optionid=value} remove a tool option value in each configuration built
 
        Tool option values are parsed as a string, comma separated list of strings or a boolean based on the options type

But when I check the Debug folder on the project, the files have not been updated. I can build the project with the IDE and I see the files updated with that. Closing the IDE and attempting headless build gets me no where. I've tried some different settings, I am able to get it to say "No project matched "NUCLEO-F401RE" and "NUCLEO-F401RE/Debug" using the following commands:

headless-build -project "NUCLEO-F401RE" -data C:\ST\STM32CubeIDE_1.6.1\STM32CubeIDE -build

and

headless-build -project "NUCLEO-F401RE\Debug" -data C:\ST\STM32CubeIDE_1.6.1\STM32CubeIDE -build

I've looked at the .bat file itself and the help. I've tried -import and using the project path, tried import all, tried the headless-build.bat file in my project path, in the workspace, tried the project in the workspace with the .bat etc. etc. etc.

I would prefer to get this working in Windows and/or WSL. Any help would be greatly appreciated. I'm sure it's a workspace or project path issue but I feel as though I've tried everything.

If someone could show me a working very basic example that I could adapt to my project settings that would be great!

1 ACCEPTED SOLUTION

Accepted Solutions
KnarfB
Principal III

If you look at the .bat file you see that it is only a thin wrapper juggling with some parameters. I would not use that, but directly call the undelying .exe:

stm32cubeidec.exe --launcher.suppressErrors -nosplash -application org.eclipse.cdt.managedbuilder.core.headlessbuild -data D:\Users\knarfb\test -cleanBuild HelloWorld/Release

where D:\Users\knarfb\test is the workspace and HelloWorld the project which exists in the workspace.

Works for me, also from any folder when stm32cubeidec.exe is on the PATH. Watch out for non-ASCII chars and other difficulties like umlauts, spaces or special chars in the paths as those regularily cause pain.

hth

KnarfB

View solution in original post

4 REPLIES 4
KnarfB
Principal III

If you look at the .bat file you see that it is only a thin wrapper juggling with some parameters. I would not use that, but directly call the undelying .exe:

stm32cubeidec.exe --launcher.suppressErrors -nosplash -application org.eclipse.cdt.managedbuilder.core.headlessbuild -data D:\Users\knarfb\test -cleanBuild HelloWorld/Release

where D:\Users\knarfb\test is the workspace and HelloWorld the project which exists in the workspace.

Works for me, also from any folder when stm32cubeidec.exe is on the PATH. Watch out for non-ASCII chars and other difficulties like umlauts, spaces or special chars in the paths as those regularily cause pain.

hth

KnarfB

Thank you for the tip! I noticed the .bat file was calling this function. I did a test with a sample project similar to yours and I am able to build it in headless mode!

I'm wondering if you have the documentation for stm32cubeidec.exe? I would like to see all the parameters. I would like to prevent it from printing on the cmd prompt, I would like to import the project from a different directory, change the workspace, etc.

I don't have that information, sorry.

KnarfB

stm32cubeidec.exe is simply a 'console' variant of stm32cubeide.exe. It has all the same parameters as the latter.

In Windows an executable can be either 'console' or 'GUI' and you need a 'console' one for headless terminal environment (well, not exactly so in modern Windows... but creating a console twin for GUI app is a simple way to get the desired behavior) .

For Unix/Linux such a twin is not needed at all.