Addition of -std=gnu++11 and -std=gnu11 compile flags

Post here first, or if you can't find a relevant section!
User avatar
BennehBoy
Posts: 420
Joined: Thu Jan 05, 2017 8:21 pm
Location: Yorkshire
Contact:

Re: Addition of -std=gnu++11 and -std=gnu11 compile flags

Post by BennehBoy » Sun Mar 05, 2017 9:34 pm

OK, so when I put it in the correct place -> http://www.stm32duino.com/viewtopic.php?p=20627#p20627

This makes quite a difference:

Before - 84136 Program, 7904 Dynamic
After - 76772 Program, 5856 Dynamic

With the added benefit of my project still working :D
-------------------------------------
https://github.com/BennehBoy

User avatar
RogerClark
Posts: 6711
Joined: Mon Apr 27, 2015 10:36 am
Location: Melbourne, Australia
Contact:

Re: Addition of -std=gnu++11 and -std=gnu11 compile flags

Post by RogerClark » Sun Mar 05, 2017 11:26 pm

BennehBoy wrote:OK, so when I put it in the correct place -> http://www.stm32duino.com/viewtopic.php?p=20627#p20627

This makes quite a difference:

Before - 84136 Program, 7904 Dynamic
After - 76772 Program, 5856 Dynamic

With the added benefit of my project still working :D
Thanks for testing ;-)

victor_pv
Posts: 1607
Joined: Mon Apr 27, 2015 12:12 pm

Re: Addition of -std=gnu++11 and -std=gnu11 compile flags

Post by victor_pv » Tue Mar 07, 2017 2:44 am

I just tested the -std=gnu++11 and -std=gnu11 compile flags, made no difference in code size, and the bin just runs normally.

stevestrong
Posts: 1514
Joined: Mon Oct 19, 2015 12:06 am
Location: Munich, Germany

Re: Addition of -std=gnu++11 and -std=gnu11 compile flags

Post by stevestrong » Tue Mar 07, 2017 12:01 pm

Have you also tested the linker option "--specs=nano.specs" ? This should do the size trick.
danieleff wrote:This is the same as viewtopic.php?f=14&t=1502 , and basically the usage of new/malloc in code.

Could you try something: put this

Code: Select all

 --specs=nano.specs
at the very end of line in Documents\Arduino\hardware\Arduino_STM32\STM32F1\platform.txt on the line that starts with "recipe.c.combine.pattern=...."
Adding it to this line: https://github.com/rogerclarkmelbourne/ ... rm.txt#L90

User avatar
Rick Kimball
Posts: 992
Joined: Tue Apr 28, 2015 1:26 am
Location: Eastern NC, US
Contact:

Re: Addition of -std=gnu++11 and -std=gnu11 compile flags

Post by Rick Kimball » Wed Mar 08, 2017 3:22 pm

I like nano.specs .. however most here are probably going to be surprised that printf functions that use %f will silently display nothing .. Just wanted people to be aware and not freak out. If you are using the arduino stream methods, floats print fine. However, it seems many people like the printf style approach. Me, I prefer streaming style that uses compile time formatting.
-rick

victor_pv
Posts: 1607
Joined: Mon Apr 27, 2015 12:12 pm

Re: Addition of -std=gnu++11 and -std=gnu11 compile flags

Post by victor_pv » Wed Mar 08, 2017 5:13 pm

stevestrong wrote:Have you also tested the linker option "--specs=nano.specs" ? This should do the size trick.
danieleff wrote:This is the same as viewtopic.php?f=14&t=1502 , and basically the usage of new/malloc in code.

Could you try something: put this

Code: Select all

 --specs=nano.specs
at the very end of line in Documents\Arduino\hardware\Arduino_STM32\STM32F1\platform.txt on the line that starts with "recipe.c.combine.pattern=...."
Adding it to this line: https://github.com/rogerclarkmelbourne/ ... rm.txt#L90
I have used the nano specs successfully before, but in this case I am only using the C11 flags, to be able to know if something breaks.

User avatar
RogerClark
Posts: 6711
Joined: Mon Apr 27, 2015 10:36 am
Location: Melbourne, Australia
Contact:

Re: Addition of -std=gnu++11 and -std=gnu11 compile flags

Post by RogerClark » Wed Mar 08, 2017 9:12 pm

I thought there were already problems with printing floating point even with the current configs

I dont know printf %f works on AVR either

User avatar
RogerClark
Posts: 6711
Joined: Mon Apr 27, 2015 10:36 am
Location: Melbourne, Australia
Contact:

Re: Addition of -std=gnu++11 and -std=gnu11 compile flags

Post by RogerClark » Sat Mar 11, 2017 6:29 am

Guys

I think adding these files will not cause any problems, as a lot of people have tested them with no ill effects

There has also been a discussion about keeping the Master / Head of the repo the "cutting edge" and having separate branches for the stable versions
I'm OK with this, but I think rather than branches, that we can use the GitHub "releases" system, which I think just tags a specific commit as a "release"

The only thing I'm not sure about is what we call the current release version before I make these changes.

I don't think we can use a version numbering system because if we called the current version 1.0 it would imply that its functionality complete / with all the current Arduino API; and its not.

We could use V 0.9 etc, but I think its been suggested before, that we use something like "Stable_$DATE" where $DATE is in the format YYYYMMDD

e.g. Stable_20170310

I think this is likely to be our best option at the moment, but I'm open to other suggestions

edogaldo
Posts: 255
Joined: Fri Jun 03, 2016 8:19 am

Re: Addition of -std=gnu++11 and -std=gnu11 compile flags

Post by edogaldo » Fri May 12, 2017 4:12 pm

Dears, I was playing with the compiler/linker options (latest Maple F1 core) and it happened to me that appending "--specs=nano.specs" to the linker, of course reduced a bit the sketch size but also broke the automatic board reset on a blue pill: since that addition I had to manually reset the board in order to complete the upload..
Removing the option restored the automatic board reset feature.
Couldn't test on other boards..

Best, E.

ps: compiler version: arm-none-eabi-gcc\4.8.3-2014q1

User avatar
RogerClark
Posts: 6711
Joined: Mon Apr 27, 2015 10:36 am
Location: Melbourne, Australia
Contact:

Re: Addition of -std=gnu++11 and -std=gnu11 compile flags

Post by RogerClark » Fri May 26, 2017 6:08 am

Those compiler flags have now been added for the F1 and F4 repos

See

https://github.com/rogerclarkmelbourne/ ... 75b95126d8


Re: nano-specs

I think more testing would need to be done before I included nano-spec in the compile arguments, as it sounds like it potentially causes some serious issues

Post Reply