Skip to main content
RC_Embedded
Associate
February 17, 2020
Question

Can you change the location of generated files in CubeMX?

  • February 17, 2020
  • 3 replies
  • 1572 views

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.

This topic has been closed for replies.

3 replies

dbgarasiya
Senior
February 18, 2020

yes you can

RC_Embedded
Associate
February 18, 2020

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;

RC_Embedded
Associate
February 18, 2020

Edit: Can't delete, moved reply to above

yellowtomato
Associate II
March 5, 2021

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