From: Peter B. <pa...@pe...> - 2011-01-30 18:04:13
|
I don't think too many people have been using C++ for msp430, which is a shame because I think a subset of the language is extremely suitable for embedded programming. Beefing up C++ support is a goal of mine. In this case, the problem is that the header files fail to declare the register declarations as externs, and the default behavior in C++ is different from that of C. Ben Ransford submitted a patch that included a fix for this (see SF ticket 3114711 in the mspgcc4 bug tracker). I'm testing a variant of that today. The initial trials suggest it fixes the problem you're seeing. Assuming all goes well, there will be a new mspgcc4 release later today which should work for you. This will also add support for a few new MCUs that people have requested (not the G2xx2s just yet, sorry). Peter On Sun, Jan 30, 2011 at 9:48 AM, James Joyce <jj0...@ya...> wrote: > > > > > Hello, > > I've been trying to compile code using msp430-g++ or msp430-c++. However, > I'm > getting errors and I'm not sure how to proceed. Could you point me in the > right > direction? I haven't found any information on using C++ for either MSPGCC > or > MSPGCC4. > > Thank you > > My error is shown below: > > > /opt/msp430-gcc-4.4.5/lib/gcc/msp430/4.4.5/../../../../msp430/include/msp430x22x4.h:473: > error: uninitialized const ‘P1IN’ > > /opt/msp430-gcc-4.4.5/lib/gcc/msp430/4.4.5/../../../../msp430/include/msp430x22x4.h:490: > error: uninitialized const ‘P2IN’ > > /opt/msp430-gcc-4.4.5/lib/gcc/msp430/4.4.5/../../../../msp430/include/msp430x22x4.h:513: > error: uninitialized const ‘P3IN’ > > /opt/msp430-gcc-4.4.5/lib/gcc/msp430/4.4.5/../../../../msp430/include/msp430x22x4.h:524: > error: uninitialized const ‘P4IN’ > > /opt/msp430-gcc-4.4.5/lib/gcc/msp430/4.4.5/../../../../msp430/include/msp430x22x4.h:540: > error: uninitialized const ‘TAIV’ > > /opt/msp430-gcc-4.4.5/lib/gcc/msp430/4.4.5/../../../../msp430/include/msp430x22x4.h:642: > error: uninitialized const ‘TBIV’ > > /opt/msp430-gcc-4.4.5/lib/gcc/msp430/4.4.5/../../../../msp430/include/msp430x22x4.h:736: > error: uninitialized const ‘UCA0RXBUF’ > > /opt/msp430-gcc-4.4.5/lib/gcc/msp430/4.4.5/../../../../msp430/include/msp430x22x4.h:761: > error: uninitialized const ‘UCB0RXBUF’ > > /opt/msp430-gcc-4.4.5/lib/gcc/msp430/4.4.5/../../../../msp430/include/msp430x22x4.h:989: > error: uninitialized const ‘CALDCO_16MHZ’ > > /opt/msp430-gcc-4.4.5/lib/gcc/msp430/4.4.5/../../../../msp430/include/msp430x22x4.h:991: > error: uninitialized const ‘CALBC1_16MHZ’ > > /opt/msp430-gcc-4.4.5/lib/gcc/msp430/4.4.5/../../../../msp430/include/msp430x22x4.h:993: > error: uninitialized const ‘CALDCO_12MHZ’ > > /opt/msp430-gcc-4.4.5/lib/gcc/msp430/4.4.5/../../../../msp430/include/msp430x22x4.h:995: > error: uninitialized const ‘CALBC1_12MHZ’ > > /opt/msp430-gcc-4.4.5/lib/gcc/msp430/4.4.5/../../../../msp430/include/msp430x22x4.h:997: > error: uninitialized const ‘CALDCO_8MHZ’ > > /opt/msp430-gcc-4.4.5/lib/gcc/msp430/4.4.5/../../../../msp430/include/msp430x22x4.h:999: > error: uninitialized const ‘CALBC1_8MHZ’ > > /opt/msp430-gcc-4.4.5/lib/gcc/msp430/4.4.5/../../../../msp430/include/msp430x22x4.h:1001: > error: uninitialized const ‘CALDCO_1MHZ’ > > /opt/msp430-gcc-4.4.5/lib/gcc/msp430/4.4.5/../../../../msp430/include/msp430x22x4.h:1003: > error: uninitialized const ‘CALBC1_1MHZ’ > > > > My code is in fact all C for now: > > #include "msp430x22x4.h" > > volatile unsigned int i; // volatile to prevent optimization > > int main(void) > { > WDTCTL = WDTPW + WDTHOLD; // Stop watchdog timer > P1DIR |= 0x01; // Set P1.0 to output direction > > for (;;) > { > P1OUT ^= 0x01; // Toggle P1.0 using exclusive-OR > i = 10000; // Delay > do (i--); > while (i != 0); > } > return 1; > } > > > > > ------------------------------------------------------------------------------ > Special Offer-- Download ArcSight Logger for FREE (a $49 USD value)! > Finally, a world-class log management solution at an even better > price-free! > Download using promo code Free_Logger_4_Dev2Dev. Offer expires > February 28th, so secure your free ArcSight Logger TODAY! > http://p.sf.net/sfu/arcsight-sfd2d > _______________________________________________ > Mspgcc-users mailing list > Msp...@li... > https://lists.sourceforge.net/lists/listinfo/mspgcc-users > > |