Skip to main content
John Craven
Senior
February 15, 2018
Question

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

  • February 15, 2018
  • 15 replies
  • 2682 views
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!!!

    This topic has been closed for replies.

    15 replies

    henry.dick
    Associate II
    February 16, 2018
    Posted on February 16, 2018 at 02:57

    what you are asking is fairly easy to do: if you don't use cube, you don't have to patch cube.

    seriously, we have fairly limited ways of dealing with a given peripheral. If you can look at the most common tasks you do with a given peripheral, it is not that difficult, certainly much simpler than to constantly patching up code, to write a set of your own routines that deal with that peripheral, either on top of vendor libraries like cube / spl, or directly.

    take a shot at it and you may like it. it certainly simplified my (programming) life greatly.

    John Craven
    Senior
    February 16, 2018
    Posted on February 16, 2018 at 04:43

    I acknowledge that not every user, is using CubeMX or HAL.

    But i don't go out of my way to suggest they switch to Cube or HAL!  To each his own!

    But I have not intention of writing my own libraries for the peripherals!

    I use what the vendor recommends/provides for tools, libraries and docs.

    I build solutions not bricks. If STM can't provide, tools and bricks, my time is wasted and i will move on to a vendor that can give robust tools and libraries (bricks).

    Its definitely far from perfect, but I don't find anything in CubeMX or HAL that is a deal breaker at this point.

    But STM could make issues less annoying, and this is just one way i see them making thing easier while they fix the underlying issues.

    Their tool already manages avoid deleting my user, i am just asking for a simple extension of the that concept, if i mark the file, don't overwrite it, user-code or not.

    Vasile Guta_Ciucur
    Senior
    February 16, 2018
    Posted on February 16, 2018 at 06:21

    You ask for a generator that must learn not to generate... 

    The only valid solution is for them to make the code right and stop breaking things according with their current mood.

    Sometimes It seems that the CubeMX development is some kind of secondary task, as if they are in the middle of a major change and all the man power is massed on the first task. I think here are others that said something similar...

    You get what you get...

    Maybe someday, someone will start his own open-source code generator...

    Andrew Neil
    Super User
    February 16, 2018
    Posted on February 16, 2018 at 17:20

    Sounds like you need a Revision Control System ...

    A complex system that works is invariably found to have evolved from a simple system that worked.A complex system designed from scratch never works and cannot be patched up to make it work.
    David Littell
    Senior II
    February 16, 2018
    Posted on February 16, 2018 at 20:23

    I don't think a revision control system can address the underlying problem, that being the need to merge changes/fixes to the HAL source code that had to be done outside the USER CODE blocks. 

    Andrew Neil
    Super User
    February 16, 2018
    Posted on February 16, 2018 at 20:36

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

    A complex system that works is invariably found to have evolved from a simple system that worked.A complex system designed from scratch never works and cannot be patched up to make it work.
    ali maqsood
    Associate
    February 17, 2018
    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.