Hi,
I'm new to MSP programming and ran into this very same issue. I found out
that compiling with
msp430-g++ ....cpp -c -o ....o
msp430-gcc ....o -o ....bin
works well. However, it does not optimize as much as I'd like it to.
Reading the gcc man page, it seem that it determines language based on the
file extension, so we can use msp430-gcc with a .cpp file and it will
recognize it as C++. Since I couldn't get -flto to work (but didn't bother
much), I compile with:
msp430-gcc -Os -Wall -g -mmcu=msp430g2553 -std=c++0x -fwhole-program
-I../../PeripheralTemplateLibrary/include/ ....cpp -o ....bin
(There are some flags in the mails above that I still have to check!)
MSPGCC ships with a standard C library that can be of use. In order to use
it this way, you must enclose your includes in an extern "C" block like:
extern "C" {
#include <stdlib.h>
}
and it works well.
Also, I strongly recommend using the Peripheral Template Library. It works
quite well, makes code an order of magnitude simpler and, if you read the
sources, it provides good examples and helps making sense of all those
register names :)
João Reis
On Tue, Jun 11, 2013 at 12:02 PM, Peter Bigot <big...@acm.org> wrote:
> I believe (without checking) that since mspgcc doesn't support C++
> exceptions the default is -fno-exceptions. I suspect rtti is also off by
> default, but I don't have the vague reminiscence of having made sure of
> that.
>
>
> On Tue, Jun 11, 2013 at 4:39 AM, Paul Sokolovsky <pmis...@gmail.com>
> wrote:
>
> > Hello,
> >
> > On Mon, 10 Jun 2013 17:23:00 -0700
> > Thomas Taranowski <t...@baringforge.com> wrote:
> >
> > > Thanks for the comment Paul. What are you using for your compiler
> > > flags? I'm having a couple issues with mine.
> > >
> > > I'm currently using the following:
> > > -ffunction-sections -fdata-sections -DGCC_MSP430 -Wall -fno-exceptions
> > > -fno-rtti -fno-enforce-eh-specs -nodefaultlibs
> >
> > Well, I'm using:
> >
> > msp430-g++ -I../include/ -mmcu=msp430g2553 -O1 -g -Wreturn-type
> > -ffunction-sections -fdata-sections -DHW_CONFIG=\"hw_config_msp430.hpp\"
> > -fno-exceptions -c blink.cpp -o bin-msp430/blink.o
> > msp430-gcc -mmcu=msp430g2553 -Wl,--gc-sections
> > -Wl,-Map=bin-msp430/blink.map,--cref bin-msp430/blink.o -o
> > bin-msp430/blink
> >
> > (I was shocked to see that Energia doesn't pass -fno-exceptions, but I
> > myself don't pass -fno-rtti, that needs to be fixed).
> >
> > >
> > > This works well in with -O2 specified (release build), but fails with
> > > memset undefined when running my -O0 debug build. Presumably the
> > > optimized version is using the built-in library. Also, I can't seem
> > > to get printf back in by adding -lgcc -lc.to the linker flags, as I
> > > think these get ignored after specifying the -nodefaultlibs argument.
> > > I really want something to just disable the libstdc++ include.
> > > Thomas Taranowski | 425-442-9209 | skype: thomas.taranowski |
> > > baringforge.com
> > >
> >
> > --
> > Best regards,
> > Paul mailto:pmis...@gmail.com
> >
> >
> >
> ------------------------------------------------------------------------------
> > This SF.net email is sponsored by Windows:
> >
> > Build for Windows Store.
> >
> > http://p.sf.net/sfu/windows-dev2dev
> > _______________________________________________
> > Mspgcc-users mailing list
> > Mspgcc-users@lists.sourceforge.net
> > https://lists.sourceforge.net/lists/listinfo/mspgcc-users
> >
>
>
> ------------------------------------------------------------------------------
> This SF.net email is sponsored by Windows:
>
> Build for Windows Store.
>
> http://p.sf.net/sfu/windows-dev2dev
> _______________________________________________
> Mspgcc-users mailing list
> Mspgcc-users@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/mspgcc-users
>
>
------------------------------------------------------------------------------
This SF.net email is sponsored by Windows:
Build for Windows Store.
http://p.sf.net/sfu/windows-dev2dev
_______________________________________________
Mspgcc-users mailing list
Mspgcc-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/mspgcc-users