Before logging an issue, please update to the latest release of Visual Micro from the Downloads Page.

When Logging a Support Issue in the Forum, please ensure you have also:-

  • Enabled vMicro > Compiler > Show Build Properties
  • Re-Compile your program with these settings enabled
 
Save the new Output to a Text File and....
  • Click the Reply button and attach as .txt file OR
  • Click here to Email us with the file attached, and a link to your post
Support requests without the output above may be impossible to answer, so please help us to help you
 
Page Index Toggle Pages: 1 Send TopicPrint
Hot Topic (More than 8 Replies) IDE: C99 struct initializers: OK for Teensy3, error for Teensy2 (Read 9893 times)
stevech
Member
***
Offline


Posts: 147
Location: So. Calif. US
Joined: Jun 16th, 2013
IDE: C99 struct initializers: OK for Teensy3, error for Teensy2
Apr 17th, 2014 at 12:41am
Print Post  
A GCC param is wrong somewhere, for the Teensy2 (Atmel AVR)  target case. Compiles OK (C99 compatible) for Teensy3. Something differs in the C99 options for the two targets.

Code
Select All
struct foo_t
{
    int me;
};
struct foo_t  thing =
{
    .me = 123;  // C99 standard's named initializer
};
 

« Last Edit: Apr 17th, 2014 at 12:42am by stevech »  
Back to top
 
IP Logged
 
Tim@Visual Micro
Administrator
*****
Offline


Posts: 12137
Location: United Kingdom
Joined: Apr 10th, 2010
Re: IDE: C99 struct initializers: OK for Teensy3, error for Teensy2
Reply #1 - Apr 17th, 2014 at 12:13pm
Print Post  
Hi stevech,

Does the same code fail in the Teensy/Arduino IDE?

Thanks
  
Back to top
IP Logged
 
stevech
Member
***
Offline


Posts: 147
Location: So. Calif. US
Joined: Jun 16th, 2013
Re: IDE: C99 struct initializers: OK for Teensy3, error for Teensy2
Reply #2 - Apr 17th, 2014 at 3:06pm
Print Post  
I'll check. It may be that VM's arguments passed to GCC such as -std=  differ for Teensy 2 than Teensy 3, where the latter is correct.
  
Back to top
 
IP Logged
 
Tim@Visual Micro
Administrator
*****
Offline


Posts: 12137
Location: United Kingdom
Joined: Apr 10th, 2010
Re: IDE: C99 struct initializers: OK for Teensy3, error for Teensy2
Reply #3 - Apr 17th, 2014 at 3:30pm
Print Post  
The arguments are defined by the teensy config so you should see the same result in both Ide's

Thanks
  
Back to top
IP Logged
 
stevech
Member
***
Offline


Posts: 147
Location: So. Calif. US
Joined: Jun 16th, 2013
Re: IDE: C99 struct initializers: OK for Teensy3, error for Teensy2
Reply #4 - Apr 17th, 2014 at 3:39pm
Print Post  
In the Arduino IDE, when teensy 2 is chosen, the struct initializer by name per the C99 standard does not work. It does work when the teensy 3 is chosen (different command line). Same issue in VM. Of course, different versions of GCC are used for Teensy 2 and Teensy 3. The the choice of target core type has nothing to do with supporting struct init per C99.

I noted, in the GCC command line args, that Teensy 2 uses -std=c++0x  whereas Teensy 3 uses -std=gnu++0x. I don't know if that's relevant.
  
Back to top
 
IP Logged
 
Tim@Visual Micro
Administrator
*****
Offline


Posts: 12137
Location: United Kingdom
Joined: Apr 10th, 2010
Re: IDE: C99 struct initializers: OK for Teensy3, error for Teensy2
Reply #5 - Apr 17th, 2014 at 3:45pm
Print Post  
Great. thanks for the update and best of luck with your projects.
  
Back to top
IP Logged
 
stevech
Member
***
Offline


Posts: 147
Location: So. Calif. US
Joined: Jun 16th, 2013
Re: IDE: C99 struct initializers: OK for Teensy3, error for Teensy2
Reply #6 - Apr 17th, 2014 at 3:52pm
Print Post  
How does VM define the GCC command line it uses?
  
Back to top
 
IP Logged
 
Tim@Visual Micro
Administrator
*****
Offline


Posts: 12137
Location: United Kingdom
Joined: Apr 10th, 2010
Re: IDE: C99 struct initializers: OK for Teensy3, error for Teensy2
Reply #7 - Apr 17th, 2014 at 3:55pm
Print Post  
It reads it from the teensy config files.
  
Back to top
IP Logged
 
stevech
Member
***
Offline


Posts: 147
Location: So. Calif. US
Joined: Jun 16th, 2013
Re: IDE: C99 struct initializers: OK for Teensy3, error for Teensy2
Reply #8 - Apr 17th, 2014 at 4:05pm
Print Post  
ah, that's why your comment implied "not a VM problem!"
  
Back to top
 
IP Logged
 
Tim@Visual Micro
Administrator
*****
Offline


Posts: 12137
Location: United Kingdom
Joined: Apr 10th, 2010
Re: IDE: C99 struct initializers: OK for Teensy3, error for Teensy2
Reply #9 - Apr 17th, 2014 at 5:00pm
Print Post  
Yes sorry wasn't clear. The Teensy system does use the older arduino 1.0 format which is relatively hard coded compared to the 1.5 format. One day when someone has time we should re-do the Teensy boards.txt files so they are 1.5 compatible it's a better system.

However teensy defines a number of additional properties in boards.txt which allow overrides of the build process. It's too big a topic to support discussion but obvious when you look at boards.txt
  
Back to top
IP Logged
 
stevech
Member
***
Offline


Posts: 147
Location: So. Calif. US
Joined: Jun 16th, 2013
Re: IDE: C99 struct initializers: OK for Teensy3, error for Teensy2
Reply #10 - Apr 17th, 2014 at 5:30pm
Print Post  
Teensy is still on Arduino 1.0.5, as I read, because Arduino has yet to finalize a new library management methodology and implementation of such.
« Last Edit: Apr 17th, 2014 at 5:30pm by stevech »  
Back to top
 
IP Logged
 
Tim@Visual Micro
Administrator
*****
Offline


Posts: 12137
Location: United Kingdom
Joined: Apr 10th, 2010
Re: IDE: C99 struct initializers: OK for Teensy3, error for Teensy2
Reply #11 - Apr 17th, 2014 at 5:41pm
Print Post  
It's all finalized now and anyway 1.5 has been extended to also compile pre-1.5 libraries so there is no longer any reason not to jump to 1.5

  
Back to top
IP Logged
 
Tim@Visual Micro
Administrator
*****
Offline


Posts: 12137
Location: United Kingdom
Joined: Apr 10th, 2010
Re: IDE: C99 struct initializers: OK for Teensy3, error for Teensy2
Reply #12 - Apr 18th, 2014 at 12:06am
Print Post  
Sorry, I didn't explain that very well. 1.0.x is fine and I am in no position to comment on the default install of Teensy. It probably makes sense to stick with 1.0.

What I meant was that 1.5 is actually just a matter of making up the config files which we might find time to look at in a few months just for a bit of fun. The Visual Micro config supports adding another Teensy entry to the apps list with a different specification (Teensy 1.5). The underlying core can stay the same so the compiled program code remains the same. It's a job for someone who knows arduino and teensy config files.
  
Back to top
IP Logged
 
Page Index Toggle Pages: 1
Send TopicPrint