I had changed a library file, and i wondered, why after a MX config generation it did not work anymore.
CubeMX replaced all the files!!! Lucky i had some backup. Why would you replace library files, that were already copied? Please see my picture for a future upgrade:
Rule #1 - NEVER trust CubeMX (or ANY code generator) to not screw up your code. The stakes are just too high no matter how good the code generator is (please no CubeMX flames here).
Yeah - CubeMX re-generates all files in the Drivers tree. The best way to handle this is use version control (git, svn, etc.). Make sure your version control repo is "clean" (i.e. all changes checked in) before you allow CubeMX to re-gen code.
I've got a large handful of changes to the various HAL files and non-HAL CubeMX generated files. These changes are not between the "USER" comment sections, so CubeMX over-writes them. After ever re-gen, I have to restore those changes from the GIT repo. But that is a simple 1-step process (after committing the changes I wanted from the re-gen).
Yes, adding option "Do not touch (delete, rewrite) library files" can be helpful for re-generation, if the user has changed any library files and wants to keep them.
The other option "only once" IMHO won't be helpful. Less value vs. effort to implement.
Note that if user choses the option to "add files as references", and changes the library or middlewares files in the "repository", these changes will stay after re-generation. Cube won't re-download and compare the libraries.
"The other option "only once" IMHO won't be helpful. Less value vs. effort to implement."
I think other people would not care about your opinion when it comes to create some nice system. Give people choices! The implementation wouldnt be much effort...