[Solved] CubeMx, run code generation from command line?
I have a project that uses different MCUs. 99.99% of the code is common for all, so I have different .project, .cproject and .ioc files for each, and use CubeMx to handle the hardware initialization.
Currently, it requires manual building: Close the project, copy and replace the files, open the project, trigger code generation and compile.
Now I'm trying to automate that.
Replacing these files in a script and calling the compiler (headless build) is the easy part.
This compiles correctly when the code was already generated with CubeMX.
org.eclipse.cdt.managedbuilder.core.headlessbuild -import C:\projects\my_project -build my_project/ReleaseHowever, I was unable to automate CubeMX generation
I tried using CubeMx from CubeIDE, and also standalone version, with the same results:
C:\Program Files\STMicroelectronics\STM32Cube\STM32CubeMX\STM32CubeMX.exe
C:\ST\STM32CubeIDE_1.7.0\STM32CubeIDE\plugins\com.st.stm32cube.common.mx_6.3.0.202107141111\STM32CubeMX.jarIf I only run this, it load the config and I can generate the code manually:
java -jar STM32CubeMX.jar my_project.iocIf I try using a script:
java -jar STM32CubeMX.jar -q my_scriptload STM32F103C(8-B)Tx
load config my_project.ioc
project name my_project
project path C:\projects\my_project
project generate
exitI always get "Can't create config Project: error when loading config.xml file"
And this line is shown in the cmd window;
[ERROR] ApiDbMcu:562 - C:\ST\STM32CubeIDE_1.7.0\STM32CubeIDE\plugins\com.st.stm32cube.common.mx_6.3.0.202107141111\\db\//mcu/config.xml doesn't existI've tried a lot of different commands without success. ST example in manual is unclear.
Also the interactive switch (-i) doesn't work, the application launches normally.
Please, how to trigger code generation from command line or using a script?
