Skip to main content
Associate III
December 8, 2025
Question

CubeMX code generation from command line

  • December 8, 2025
  • 6 replies
  • 1156 views

I would like to automate code generation of my .ioc file using CubeMX from command line or PowerShell.

AI says its possible with the -q (quiet mode) option but it does not seem to work.

6 replies

Technical Moderator
December 8, 2025

Hello @dvescovi 

Yes, as stated in UM1718 "3.3.2 Running STM32CubeMX in command-line mode" you can run STM32CubeMX in command-line mode without UI:

– On Windows:
cd <STM32CubeMX installation path>
jre\bin\java -jar STM32CubeMX.exe –q <script filename>
– On Linux and macOS:
./STM32CubeMX –q <script filename


 

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.
Andrew Neil
Super User
December 8, 2025

@dvescovi wrote:

AI says its possible with the -q (quiet mode) option but it does not seem to work.


What version are you using?

Please show the command you actually used, and the results you got.

 

How to write your question to maximize your chances to find a solution

A complex system that works is invariably found to have evolved from a simple system that worked.A complex system designed from scratch never works and cannot be patched up to make it work.
dvescoviAuthor
Associate III
December 8, 2025

can you show me what a powershell script would look like if I have CubeMX installed at:

C:\Program Files\STMicroelectronics\STM32Cube\STM32CubeMX

and my .ioc at:

C:\GitHub\STM32\debug\tester\test.ioc

I tried:

# Path to CubeMX executable
$CubeMX = "C:\Program Files\STMicroelectronics\STM32Cube\STM32CubeMX\STM32CubeMX.exe"

# Path to your .ioc project file
$Project = "C:\GitHub\STM32\debug\tester\test.ioc"

# Run CubeMX in quiet mode (-q) to generate code without opening the GUI
Start-Process -FilePath $CubeMX -ArgumentList "-q `"$Project`"" -Wait

but I know that is wrong ...

Show me formatted correctly

Andrew Neil
Super User
December 9, 2025

@dvescovi wrote:

but I know that is wrong ...


So, again, what response do you get when you run that command?

 


@dvescovi wrote:

Show me formatted correctly


Did you try what @Souhaib MAZHOUD already showed you:

 


@Souhaib MAZHOUD wrote:

– On Windows:
cd <STM32CubeMX installation path>
jre\bin\java -jar STM32CubeMX.exe –q <script filename>

If that doesn't work for you, show what result you get.

A complex system that works is invariably found to have evolved from a simple system that worked.A complex system designed from scratch never works and cannot be patched up to make it work.
dvescoviAuthor
Associate III
December 9, 2025

I suggest you actually try it before offering it as a solution.

Here is what I get:

dvescovi_0-1765279585768.png

Dumps a lot of *** ... opens the CubeMX IDE ... which I do not want ... does nothing no code generated!

 

dvescoviAuthor
Associate III
December 9, 2025

replies does not allow me to attach file

 

dvescoviAuthor
Associate III
December 9, 2025

.ioc attached

Andrew Neil
Super User
December 11, 2025
A complex system that works is invariably found to have evolved from a simple system that worked.A complex system designed from scratch never works and cannot be patched up to make it work.