Skip to main content
Graduate II
July 5, 2024
Solved

CubeMX does not reload correctly the ioc file if modifed offline

  • July 5, 2024
  • 4 replies
  • 2544 views

I have a project with its ioc, the setup of the peripherals are ok.

Now I want to edit a file while cubeide is closed and have the change reloaded when I reopen the ioc.

Let say that I set the baudrate of UART5 to 115200: in some file I'll have the UART5 init and in that function I'll have a line of code to set the baudrate to 115200:

huart5.Init.BaudRate = 115200;

I was expecting that if I close the cubeide, change the code to:

huart5.Init.BaudRate = 57600;

and then reopen cubemx it would load the new setting, but it seems that it does not.

Am I wrong to expect that behaviour or there is something going on here?

STM32CubeIDE
Version: 1.16.0
Build: 21983_20240628_1741 (UTC)

 

    This topic has been closed for replies.
    Best answer by Andrew Neil

    @Pavel A. wrote:

    Yes this should 'work' as expected. 


    That depends on what you're expecting!

    I think @Manuel Ferrero is expecting that changes made to the generated C source should be reflected in the .ioc file.

    That expectation will not be met.

    4 replies

    Super User
    July 5, 2024

    The C code is generated from the .ioc file - not the other way around.

    There's no mechanism to "back port" changes from the C code to the .ioc file.

     

    EDIT:

    If you edit a .c or .h file outside CubeIDE, then the edits to those files should show up in the IDE's source file editor.

    But they won't be reflected back into the .ioc file.

    Super User
    July 5, 2024

    Yes this should 'work' as expected. Does it show any error message?

     

    Super User
    July 5, 2024

    @Pavel A. wrote:

    Yes this should 'work' as expected. 


    That depends on what you're expecting!

    I think @Manuel Ferrero is expecting that changes made to the generated C source should be reflected in the .ioc file.

    That expectation will not be met.

    Super User
    July 5, 2024

    @Andrew Neil but the OP clearly wrote: "and then reopen cubemx". So it is not about generated code. Or wait... it was actually CubeIDE? Confused.

    Super User
    July 5, 2024

    >Am I wrong to expect that behaviour

    Yes.

    CubeMx is a code generator , not more.

    So you can edit (also while IDE open, or in IDE) any setting in your main , to test something or...so.

    But if you "generate code" , it will generate code to the settings in Cube , whatever they are.

    Your changes in code - away. Except in the "user areas" , this will stay and be there again.

    Graduate II
    September 26, 2024

    You can edit ioc offline.  Then open it in MX and press generate code, the changes will be reflected in the c code. 

    Super User
    September 26, 2024

    But that wasn't the question.

    The question was about editing the .c file, and that change being reflected back into the .ioc file.