cancel
Showing results for 
Search instead for 
Did you mean: 

CubeMX Feature Request: PLEASE DON'T MAKE ME PATCH THIS AGAIN */

John Craven
Senior
Posted on February 15, 2018 at 16:02

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!!!

15 REPLIES 15
Posted on February 16, 2018 at 20:36

No, but it should facilitate the identification and (re-)application of the 'patches' ... ?

Posted on February 16, 2018 at 21:30

0690X00000609hDQAQ.png

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!!!!

ali maqsood
Associate
Posted on February 17, 2018 at 18:14

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.

Posted on February 17, 2018 at 17:45

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...

Posted on February 17, 2018 at 17:47

Because you have to patch them anyway, I see you have too much work to do when you generate separate files

Posted on February 22, 2018 at 10:15

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'.