2018-02-15 07:02 AM
I can't remember the last time i could use a complete set of project files generated by CubeMX without having to patch something in the project that isn't user code.
I am kind of tired maintaining backups of the patched files, or a live 'MODs list' of things to repatch when i won't to go back to CubeMX and change a setting or add a peripheral etc.
I would like to see some method of marking individual files as do not overwrite on Cube project regeneration.
I tried just marking the files as READ ONLY. but CubeMX just ignores this and overwrites them anyways. This would be the simplest, just respect the Readonly settings!!!
If you want to do it the hard way, then after initial generation, you would left me mark as protected from overwrite, either by perpherial/middleware, or by individual file.
Alternatively, add a comment section at the beginning of every file, that can be altered by the user, to mark it as 'leave me alone'! CubeMX is smart enough to not overwrite my code between 'USER CODE BEGIN' and 'USER CODE END'. I am sure it could just leave the whole file alone if some comment were added to the top of the '/* !!! PLEASE DON'T MAKE ME PATCH THIS AGAIN !!! */'
Its one thing to have to deal with all the issues is HAL and the many workarounds and to find them and fix it once. Its whole different level of annoyance to have to so the same thing over and over!!! STM please while your improving CubeMX and HAL/LL, please don't make me hate it due to useless repetition!!!
2018-02-16 12:36 PM
No, but it should facilitate the identification and (re-)application of the 'patches' ... ?
2018-02-16 01:30 PM
I can have Cube backup the files its going to overwrite.
It can recognized my code sections within a generated file, update the whole file and leave my code in new file.
It can figure out that i have removed a peripheral and delete the old files.
Is really too much to ask it not overwrite a file i mark as readonly in the OS after i add a workaround outside of user code sections?
Simple checkbox, check file protection before overwrite, if its READONLY leave it alone.
It shouldnt overwrite READONLY files in the first place!!!!
2018-02-17 09:14 AM
I found a problem in 'HAL_RCC_ClockConfig' function from 'STM32Cube_FW_F1_V1.6.0' firmware library
which I have to correct every time I generate code in CubeMX. It was so annoying. So, as a workaround I corrected function definition in firmware library itself as it is used by CubeMX to generate code. Now everytime CubeMX generates code with my changes in it. You should patch your changes in CubeMX firmware library itself. The location of firmware library can be found in CubeMX project settings.
2018-02-17 09:45 AM
I make comments about the modifications I need to do after a re-generation, in the USER CODE 4 area... those are specific to the application. Until no needed anymore...
2018-02-17 09:47 AM
Because you have to patch them anyway, I see you have too much work to do when you generate separate files
2018-02-22 02:15 AM
Using a version control system is sound advice. You check in/commit the originally-generated files, then with your changes/patches (use comments to mark them so that they are easy to find) and now when you regenerating the code you immediately see all changes and can accept (not your modified code) or reject (your modified code) them. Either by-file or line-by-line.
Granted, it still is always manual work, but that way you also don't miss actual improvements and bug-fixes in the code generator itself which is what you would do if you declared whole files as 'never touch again'.