cancel
Showing results for 
Search instead for 
Did you mean: 

STM32CubeMX 4.7.0 Bug Report - main.c, user code corrupted

petr239955
Associate III
Posted on March 24, 2015 at 00:12

My conditions:

STM32CubeMX 4.7.0 STM32F042F6P6 and STM32F103CT6 STM32CubeMX

removes

bracket

inside

/* USER CODE BEGIN 3 */
/* USER CODE END 3 */

section of main.c.

STM32CubeMX 4.7.0
Code before regeneration:
...
/* Infinite loop */
/* USER CODE BEGIN WHILE */
while (1)
{
/* USER CODE END WHILE */
/* USER CODE BEGIN 3 */
if (1)
{
}
}
/* USER CODE END 3 */
}
Code after regenerations using STM32CubeMX 4.7.0:
...
/* Infinite loop */
/* USER CODE BEGIN WHILE */
while (1)
{
/* USER CODE END WHILE */
/* USER CODE BEGIN 3 */
if (1)
/* <<< missing bracket */
}
}
/* USER CODE END 3 */
}
STM32CubeMX 4.6.0 was correct:
...
/* USER CODE BEGIN 3 */
/* Infinite loop */
while (1)
{
if (1)
{
}
}
/* USER CODE END 3 */
}

#stm32cubemx-main.c-user-code
7 REPLIES 7
joe
Associate III
Posted on March 25, 2015 at 16:37

I'm getting the same problem. Most leading '{' brackets are being removed from User Code in main.c

stm32cube-t
Senior III
Posted on April 07, 2015 at 16:05

Issue is confirmed and will be fixed with next 4.8 version.

Sorry about that.

markb
Associate II
Posted on April 07, 2015 at 19:10

While you are fixing that could you please also stop it needlessly changing the dates in the generated files that haven't altered since they were last changed. It makes source code control much more work than it should be. You do use source code control, don't you?

Posted on April 07, 2015 at 23:04

Hear hear!

joe
Associate III
Posted on April 07, 2015 at 23:22

great point mark.....hate when this happens. If it's avoidable ST please make it so date doesn't update if file doesn't change.

Amel NASRI
ST Employee
Posted on April 08, 2015 at 19:10

If it's avoidable ST please make it so date doesn't update if file doesn't change.

Same request as the one in

https://my.st.com/public/STe2ecommunities/mcu/Lists/STM32Java/Flat.aspx?RootFolder=https://my.st.com/public/STe2ecommunities/mcu/Lists/STM32Java/BUG%20stm32cubemx%20on%20every%20save%20change%20some%20values%20randomly

.

And, yes your feedback will be taken into account :)

-Mayla-

To give better visibility on the answered topics, please click on Accept as Solution on the reply which solved your issue or answered your question.

hbarta2
Associate III
Posted on April 09, 2015 at 14:36

WRT the original issue, I have the following to work:

#define OPENBRACE {

And then replace the opening braces that get deleted with OPENBRACE. It's ugly but it eliminates the need to fix this every time STM32CubeMX regenerates initialization code.

Please add my vote not to gratuitously change the file contents when no other changes are made.

Also add a Big Thanks for whoever provided the STM32CubeMX to run under Linux! Now if I could only get the rest of the tool chain to play along. ;)