cancel
Showing results for 
Search instead for 
Did you mean: 

How to cleanly merge STCubeGenerated.ioc file in a team environment using Git/SVN etc?

aahsan
Associate III

I was wondering if multiple team members are modifying this file,

what is the clean way to do a merge this file using Git? I am pretty sure STM Community is using CubeMX and there should be a way to update this file by multiple people and merge the changes without messing up the project.

Any suggestions/comments are welcome.

Thanks 

4 REPLIES 4
TDK
Guru

It's a regular text file and should be compatible with the standard method of merging different commits.

You're going to have issues if people making incompatible changes, but that's the case with any other file. You'll need to reconcile those changes before pushing to the repo.

If you feel a post has answered your question, please click "Accept as Solution".

The problem with merging changes to the ioc file generated by the CubeMX configuration tool is not as simple as merging two text-based source files with localized conflicts. 

The issue is that CubeMX uses some sort of MCU pin enumeration scheme to associate IDs to physical pins in the ioc file. When a change is made on one branch, it may associate a new physical MCU pin with an existing enumeration index, sliding all other enumerations in sequence after it down and completely changing the mapping of MCU pin enumerations to physical pin names in the map. I'm unsure of the repercussions of this, but it seems very impactful.

See the attached screenshot of a small excerpt from a Bitbucket pull request showing the issue I'm describing. In this case, CubeMX was used to change the configuration of 3 or 4 pins associated with a single SPI port on an MCU with hundreds of pins. This resulted in hundreds of lines of changes mostly associated with reassociating most of the physical MCU pins with a different enumerated MCU pin ID.

If changes like this occur on separate branches it will create conflicts throughout the bulk of the file when merging. How do you simply and accurately resolve such a sweeping merge conflict in an ioc file?

ioc file merge request.png

The pattern above continues on down through line 270 of the IOC file.

Thank you for any help or guidance anyone can provide here.

For this reason (pointed out by @abarmeyer ) all CubeMX changes must be serialized - like an RTOS mutex controlling write access to the ioc file.  Only one person is allowed to change it at a time, and all other users MUST merge that change before they make any other changes.

aahsan
Associate III

That seems like the way to go.