cancel
Showing results for 
Search instead for 
Did you mean: 

CubeMX Code generation removes braces

sebastian23
Associate II
Posted on April 29, 2015 at 20:36

Hey,

i encountered a problem using the CubeMX Eclipse plugin. When I made some changes to the startup code using the eclipse plugin and generate the Project code, opening braces are removed. Maybe this is a known problem and fixed in the standalone version. Unfortunatly I'm not able to find out which version of CubeMX is integrated in eclipse plugin. Code like this

if
(...)
{
.....
}

is changed to

if
(...)
...
}

Has anybody a workarround? Edit: I'm creating a ''True Studio'' project with CubeMX project settings. Regards, Sebastian #cubemx-braces-problem
8 REPLIES 8
childresss
Associate II
Posted on April 29, 2015 at 20:46

I haven't encountered that using IAR's EWARM without Eclipse.

hbarta2
Associate III
Posted on May 04, 2015 at 21:58

#define OPENBRACE {
if (...)
OPENBRACE
...
}

I wonder if this has been fixed in the latest release.
Amel NASRI
ST Employee
Posted on May 05, 2015 at 11:33

Hello,

The bug was already fixed with CubeMX 4.7.1 (last one available on the web).

Sebastian,

Are you using this version and you still face issue with True Studio?

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

AvaTar
Lead
Posted on May 05, 2015 at 14:24

#define OPENBRACE {

if (...)

OPENBRACE

...

}

I wonder if this has been fixed in the latest release. I admire your inventiveness and your capability to suffer ...
hbarta2
Associate III
Posted on May 05, 2015 at 17:41

I had 10 opening braces that STM32CubeMX would remove whenever I generated code. This was much less suffering than replacing them each time. ;)

AvaTar
Lead
Posted on May 05, 2015 at 20:11

I would not consider a tool that can't even generate syntactically correct code.

However, when it comes to MCUs, I'm fortunately not bound to any company restrictions.

sebastian23
Associate II
Posted on June 03, 2015 at 17:51

Hey,

sorry that i haven't answered for that long period.

Updating the CubeMX Eclipse Plugin solved my problem.

Regards,

Sebastian

hbarta
Associate II
Posted on June 04, 2015 at 13:27

I much prefer syntactically incorrect than subtly wrong. In other cases (such as wrong DMA channel) I purposely injected syntax errors by spreading variable definitions across the ''BEGIN USER CODE'' marker to remind me to fix the ADC channel assignment whenever I regenerated code.