Go Down

Topic: C++ What is and isn't implemented in the Arduino IDE (Read 2281 times) previous topic - next topic

tochinet

Quote
It wouldn't have made sense to write a "language reference" page where Arduino specific stuff would've been lost in yet-another-c++-reference.


But it would make sense to extend the reference to other available functions and refine the documentation when useful. For example the Serial.print is used a lot, but not covered in the reference. Same for the String library. And some indications on how the selection of libraries etc. has an impact on the usage of memory would also be great...

Quote
A lot has changed in the C++ world since 2008.


Any pointer that explains the major differences between 2008's avr-gcc 4.3.2 and 2012's 4.7.2 ?

Of course there is gcc.gnu.org, where 4.7.2 changes page says (as an example)
Quote
The AVR port's libgcc has been improved and its multilib structure has been enhanced. As a result, all objects contributing to an application must either be compiled with GCC versions up to 4.6.x or with GCC versions 4.7.0 or later.

Support has been added for the AVR-specific configure option --with-avrlibc=yes in order to arrange for better integration of AVR-Libc. This configure option is supported in avr-gcc 4.7.2 and newer and will only take effect in non-RTEMS configurations. If avr-gcc is configured for RTEMS, the option will be ignored which is the same as specifying --with-avrlibc=no. See PR54461 for more technical details.

Support for AVR-specific built-in functions has been added.

but this is probably Chinese for most Arduino users. And it only covers the _latest_ differences.

Nantonos


For example, on Linux (Fedora) if I install the arduino software via the yum repository, compiler is fairly new (4.6-ish), while if I use the compiler that is supplied with the Arduino 1.0.1 tarball, it is rather old (4.3.2) which is several years old, and 4 major revisions out of date. 


I notice that the Arduino 1.5beta released yesterday also uses avr-gcc-4.3.2 for the AVR architecture, and arm-none-eabi-gcc-4.4.1 for the SAM architecture.

PaulS

Quote
For example the Serial.print is used a lot, but not covered in the reference.

Except here:
http://arduino.cc/en/Reference/Serial
which is linked to on the main page.

Quote
Same for the String library.

Exactly the same:
http://arduino.cc/en/Reference/StringObject
under Data Types, String - object.

Quote
And some indications on how the selection of libraries etc. has an impact on the usage of memory would also be great...

They all use some.  8) OK, that's covered.


tochinet

I definitely need glasses :-(  there are even 2 strings on that page...


odalcet

Hi Dyslexicbloke, I think this can help you:

https://www.sparkfun.com/products/10956

It's a multimeter kit sold by Sparkfun and while it's not Arduino, the processor is the same (ATMega328). The great thing here is the source code. Is included in that site.

Cheers!

Krupski


sprintf being a prime example ...
   I found it quite by accident and then discovered that the Arduino implementation is limited with respect to its standard form.


As far as I know, the only "problem" with sprintf (and sscanf) is that the default library excludes the floating point code in order to save space.

For what I do, I NEED floating point support, so I "patched" my "libc.a" files to remove the "standard" sprintf and sscanf code and replace it with the floating point version.

It does make the resulting sketches about 1.5K larger, but that's never been a problem for me (so far).

In case you are interested, here's a script to automate "fixing" libc.a to support floating point:

Code: [Select]

#!/bin/bash
################################################################################
# fixfp - script to install floating point support into Arduino printf library
#
# For more information, see this post:
# http://arduino.cc/forum/index.php/topic,124809.msg938573.html#msg938573
################################################################################

STATUS=0

## Exit if libc.a isn't here
test -e libc.a
if [ ${?} -ne 0 ]; then {
        echo "File 'libc.a' not found - exiting"
        exit 0
} fi

test -e libc.a.orig
let STATUS+=${?}

test -e vfprintf_flt.o
let STATUS+=${?}

test -e vfscanf_flt.o
let STATUS+=${?}

if [ $STATUS -eq 0 ]; then {
        echo "Floating point patch already performed - exiting"
        exit 0
} else {
        cp libc.a libc.a.orig
        ar -dv libc.a vfprintf_std.o
        ar -dv libc.a vfscanf_std.o
        ar -xv libprintf_flt.a vfprintf_flt.o
        ar -xv libscanf_flt.a vfscanf_flt.o
        ar -rv libc.a vfprintf_flt.o
        ar -rv libc.a vfscanf_flt.o
        echo "Floating point patch installed."
} fi


Hope this helps...
Gentlemen may prefer Blondes, but Real Men prefer Redheads!

Go Up