cancel
Showing results for 
Search instead for 
Did you mean: 

How to Specify the Build Directory for an STM32 Project in CubeIDE

gari
Associate II

I am using STM32 Project with CubeIDE.

When I select "Automatically generate Makefile" in the project properties, it seems that I cannot change the build location.

Is there a way to specify the output directory for the build artifacts?

1 ACCEPTED SOLUTION

Accepted Solutions
Pavel A.
Evangelist III

These debug config screens are not related to build directory. Edit the makefile, find any definitions/macros that can be changed in make command line or environment.

Choosing makefile as the project type usually means that developer is comfortable with makefiles [and is smarter than IDE & mouse clicking folks].

 

 

View solution in original post

8 REPLIES 8
Pavel A.
Evangelist III

Not in the CubeMX GUI - but you can do this by tweaking the generated makefile in the post-build command.

gari
Associate II

Thank you for your response.
Is there a way to change the build directory by modifying the settings in CubeIDE or the project configuration, without directly editing the Makefile?

 

Just make/edit a new debug or run configuration and set it to....what you want:

AScha3_0-1725041624139.png

 

If you feel a post has answered your question, please click "Accept as Solution".

Thank you for the information.
How exactly should I set this up?
Aren't the build configurations and run configurations meant for setting up how the build artifacts are debugged or run?
I am specifically looking to designate an output directory for the build artifacts.

For example, I would like to create a build directory under the project root, and within that, have separate release and debug directories for the output. In the future, I also plan to create separate directories under build for unit test build artifacts.

Come on... read the manuals and the how-to-use ...

then right click and create a new configuration...as you like, set it. Thats it. Try...

 

If you feel a post has answered your question, please click "Accept as Solution".
Pavel A.
Evangelist III

These debug config screens are not related to build directory. Edit the makefile, find any definitions/macros that can be changed in make command line or environment.

Choosing makefile as the project type usually means that developer is comfortable with makefiles [and is smarter than IDE & mouse clicking folks].

 

 

gari
Associate II

Thank you.
I usually use CMake, so I'm not very familiar with Makefile, but I'll give it a try and read through it.

 

Pavel A.
Evangelist III

Newer CubeMX versions can produce Cmake project as well. There's no reason to suffer.