cancel
Showing results for 
Search instead for 
Did you mean: 

File are not modified when using Git with STM32Cube IDE

XB1
Associate II

Hello everyone,

I'm fairly new to Git and I'm trying to use it as my firmware version manager for an existing STM32 project. I set up correctly my project directory to work on my computer and with Bitbucket and everything works fine. I created a new branch before doing some big changes to the project, and I did a checkout towards this branch.

The problem is that when I modify anything inside Cube IDE, the modification doesn't appear inside the "real" file that I find on my computer inside the directory : for example, if I add "//test" into main.c inside Cube IDE, and then I open main.c with VSCode, this line does not appear. I checked several times that the file path is EXACTLY the same (D:/__Git/MyProject/Core/src/main.c), but it does not work at all.

Is it a problem with my setup, with Cube IDE, or with my understanding of Git ? Does anyone have a solution ?

Best Regards.

1 ACCEPTED SOLUTION

Accepted Solutions
KnarfB
Principal III

Sure STM32CubeIDE is not everybody's darling, but it is no evil tool doing harm to your files at will. If you create a new STM32 project with STM32CubeMX or IDE and choose copying all library (driver) source code, you get an ordinary tree of ordinary files which works very well with git. Using that in many projects, for many years. There is even a git plugin for Eclipse/STM32CubeIDE.

Are you sure you saved your file changes before checking? Using a network share may delay updates or irritate the tools with wrong timestamps. Besides of that, I never ran into issues here.

VSCode with stm32-for-vscode extension can be a valid alternative too.

hth

KnarfB

View solution in original post

6 REPLIES 6
Piranha
Chief II

CubeMX is not a code editor. And, if you mean CubeIDE, then that one is an Eclipse with it's notorious broken workspace concept, where projects are located it those workspaces, not in an arbitrary directories.

You're right, I messed up : it's the IDE ; I edited the post.

Is it impossible to work with Git? Do I need to setup like VSCode for Stm32 (if possible) or something like that?

Pavel A.
Evangelist III

You can use git with CubeIDE and any other eclipse. Should work just fine. A git plugin exists for Eclipse, you can install and use it if you prefer so (I use different git front ends outside of any IDE).

Note that Eclipse has a "virtual filesystem" (linked files, directories). To see where the file is actually, open its properties (alt/enter or right click in the project tree pane) then click on Resource on the left side. There you can see the true location of the file.

KnarfB
Principal III

Sure STM32CubeIDE is not everybody's darling, but it is no evil tool doing harm to your files at will. If you create a new STM32 project with STM32CubeMX or IDE and choose copying all library (driver) source code, you get an ordinary tree of ordinary files which works very well with git. Using that in many projects, for many years. There is even a git plugin for Eclipse/STM32CubeIDE.

Are you sure you saved your file changes before checking? Using a network share may delay updates or irritate the tools with wrong timestamps. Besides of that, I never ran into issues here.

VSCode with stm32-for-vscode extension can be a valid alternative too.

hth

KnarfB

XB1
Associate II

I'm sure I saved it because I double checked it. But maybe the project isn't built correctly : for a while, I had a lot of troubles importing it : when I switched the workspace to the parent directory of my project, nothing showed up etc.

Another strange thing is that when I closed the IDE with the change and reopened it, the change was still there, but reloading the project (close project > double click to open project from file explorer in the IDE) made the "//test" disappear.

I'm not a big fan of Cube IDE ; I may try the VSCode extension, thanks for the info ! But I'm still curious to understand why my project seems broken. I must have done something incorrectly.

Thanks for the reply anyway

XB1
Associate II

I may have messed up with files opened in multiple locations or something like that whithout Cube IDE noticing me that he is not able to save the file : I restarted the computer and everything is working fine. I should have begun with that !

Thanks everyone for the nice replies.