Skip to main content
Armandas
Associate II
August 4, 2022
Solved

Support relative paths in IOC file

  • August 4, 2022
  • 6 replies
  • 3285 views

I fully appreciate that CubeMX is geared towards hobbyists and demo projects.

But let's imagine for a second that someone is trying to use this software professionally.

I have created a template to generate some custom code with CubeMX and it works as expected. However, in the IOC file my settings are stored as shown below:

ProjectManager.TemplateDestinationPath=C\:\\path\\to\\my\\project\\cubemx\\my_project_name
ProjectManager.TemplateSourcePath=C\:\\path\\to\\my\\project\\tools\\cubemx-templates

Now imagine someone else is working on this project. Maybe they have checked out the code to a different directory, or maybe they are using Linux. The IOC file is broken for them. If they fix it on their side and commit it, it will be broken for me.

Please add support for setting these paths relative to the IOC file itself, so that multiple people can work on the project.

By the way, I tried editing the file manually and setting a relative path, but then the file is no longer generated.

I am using CubeMX version 6.6.1

Best answer by Ghofrane GSOURI

Hello @Armandas 

First let me thank you for posting.

Your suggestion is raised to dev team for review.

Internal ticket number:  158696(This is an internal tracking number and is not accessible or usable by customers).

I will keep you posted with updates.

Thx

Ghofrane

6 replies

victagayun
Senior III
August 4, 2022

I am using Win10, it seems to work for me.

I generally upload the ioc file which is located at the root folder name in my workspace and the Core\Src files (keeping the folder structure) to github (assuming I did not edit Core\Inc files to be uploaded).

When I use another win10 machine, I download the project folder and save it to my workspace.

I import specifying the ioc.

From there I just flash it to the MCU.

Armandas
ArmandasAuthor
Associate II
August 4, 2022

Do you use custom templates? If not, then there are no paths in the IOC and no problem.

Pavel A.
Super User
August 4, 2022

What if you change the paths to relative in the ioc file manually?

Armandas
ArmandasAuthor
Associate II
August 4, 2022

I tried the following, but then the file is not generated anymore...

ProjectManager.TemplateDestinationPath=my_project_name
ProjectManager.TemplateSourcePath=..\\tools\\cubemx-templates

lospaul
Associate
March 23, 2023

We are facing the same problem and tried the same steps to solve it - without success.

This is really a pain in a distributed project with people checking out the projects in their workspace. It makes the template feature nearly unusable.

Has anybody found a solution in the meanwhile?

ToddB1
Explorer
August 1, 2023

I'm having the same issue. I haven't been able to resolve this for the MX tool, but in the generated IDE project it's possible to hand modify the .cproject file to use relative paths. This way my IDE project will build with the correct files. Unfortunately, any time I modify my IOC project in the STM32CubeMX, I have to repeat this process.

It would be very helpful if ST modified this application to allow relative paths, similar to setting the $project_loc in the IDE.

Pavel A.
Super User
August 1, 2023

@ToddB1 Paths in .cproject are a different issue, not related to .ioc and templates. Please start a new thread.

ToddB1
Explorer
August 1, 2023

Same root cause. I need STM32CubeMX to have relative paths to solve my problem. Until then I will use the workaround I described.

Ghofrane GSOURI
Ghofrane GSOURIBest answer
Technical Moderator
August 3, 2023

Hello @Armandas 

First let me thank you for posting.

Your suggestion is raised to dev team for review.

Internal ticket number:  158696(This is an internal tracking number and is not accessible or usable by customers).

I will keep you posted with updates.

Thx

Ghofrane

To give better visibility on the answered topics, please click on Accept as Solution on the reply which solved your issue or answered your question.
cvanbeek
Associate III
June 20, 2025

Hi @Ghofrane GSOURI is there an update on the internal ST ticket?  I was also hoping to use relative paths for template files, and it does not seem to be working in STM32CubeMX version 6.14.1.

Thanks,

Cory