Skip to main content
Associate
Aug 29, 2024 3:02 PM UTC
Solved

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

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?

This topic has been closed for replies.
Pavel A.
Pavel A.Best answer
Aug 30, 2024 8:58 PM UTC

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].

 

 

8 replies

Pavel A.
Aug 29, 2024 3:33 PM UTC

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

gariAuthor
Associate
Aug 30, 2024 4:52 PM UTC

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?

 

AScha.3
Super User
Aug 30, 2024 6:13 PM UTC

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 on " Best Answer ".
gariAuthor
Associate
Aug 30, 2024 7:36 PM UTC

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.

Pavel A.
Pavel A.Best answer
Aug 30, 2024 8:58 PM UTC

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].

 

 

gariAuthor
Associate
Aug 30, 2024 11:17 PM UTC

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.
Aug 31, 2024 11:50 PM UTC

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