2023-09-29 04:10 PM
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
2023-09-29 04:55 PM
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.
2023-09-29 05:53 PM
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?
The pattern above continues on down through line 270 of the IOC file.
Thank you for any help or guidance anyone can provide here.
2023-10-04 09:53 AM
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.
2023-10-05 07:27 PM
That seems like the way to go.