cancel
Showing results for 
Search instead for 
Did you mean: 

CubeMX does not reload correctly the ioc file if modifed offline

Manuel Ferrero
Associate III

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)

 

1 ACCEPTED SOLUTION

Accepted Solutions

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

View solution in original post

10 REPLIES 10
Andrew Neil
Evangelist III

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.

Pavel A.
Evangelist III

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

 

AScha.3
Chief III

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

If you feel a post has answered your question, please click "Accept as Solution".

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

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

Pavel, look closely at the OP.  He edited the generated code.  He then expected the change to appear in his .ioc.

I'm still laughing (at the OP)...  :face_with_tears_of_joy:

> I'm still laughing (at the OP)

Har har har

Welcome back, @Manuel Ferrero 

Is your question now answered?

Techn
Senior III

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

If you feel a post has answered your question, please click "Accept as Solution".