Skip to main content
sebastian23
Associate
Apr 29, 2015 6:36 PM UTC
Question

CubeMX Code generation removes braces

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
This topic has been closed for replies.

8 replies

childresss
Associate III
Apr 29, 2015 6:46 PM UTC
Posted on April 29, 2015 at 20:46

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

hbarta2
Associate III
May 4, 2015 7:58 PM UTC
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 Technical Moderator
May 5, 2015 9:33 AM UTC
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 "Best Answer" on the reply which solved your issue or answered your question.
AvaTar
Senior III
May 5, 2015 12:24 PM UTC
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
May 5, 2015 3:41 PM UTC
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
Senior III
May 5, 2015 6:11 PM UTC
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
Jun 3, 2015 3:51 PM UTC
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
Jun 4, 2015 11:27 AM UTC
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.