cancel
Showing results for 
Search instead for 
Did you mean: 

Can you change the location of generated files in CubeMX?

RC_Embedded
Associate II

For a given project directory, is it possible to specify the folders in which files are generated into? For example, gpio.c is generated in PROJECT_DIRECTORY/Src and I would like to change it to another location (PROJECT_DIRECTORY/Src/MCU).

The closest thing I've found to doing this is modifying the extSettings file, but it looks like that is only for changing the location in the an IDE like the workspace in IAR. If using extSettings is the correct way, the documentation is very sparse and there are very few examples that I could find online.

Thank you for the help.

4 REPLIES 4
dbgarasiya
Senior II

yes you can

RC_Embedded
Associate II

Edit: Can't delete, moved reply to above

Could you elaborate please? Is it done through the extSettings file or possibly the .mxproject file?

For extSettings, I've tried following the example given in the documentation and am trying to move gpio.c from Src to Src/MCU and have tried both absolute and paths relative to the project directory. This is what I've tried (note: not all at the same time):

[Groups]
C:\Path\To\Project\Src\MCU=C:\Path\To\Project\Src\gpio.c
Src\MCU=Src\gpio.c
Src\MCU=C:\Path\To\Project\Src\gpio.c

I know that the .extSettings file is working properly because I am also using it to enable a couple HALModules in [Others].

In .mxproject I've tried something similar:

[PreviousGenFiles]
SrcTestPath=C:/Path/To/Project/Src/MCU
SrcTestFiles=gpio.c;

yellowtomato
Associate II

@RC_Embedded​  Did you find a solution? @dbgarasiya​ can you elaborate your answer?