Electronics & Programming

develissimo

Open Source electronics development and programming

  • You are not logged in.
  • Root
  • » MSPGCC
  • » [Mspgcc-users] C++ with MSPGCC/MSPGCC4 [RSS Feed]

#1 Jan. 30, 2011 15:50:35

James J.
Registered: 2009-11-02
Reputation: +  0  -
Profile   Send e-mail  

[Mspgcc-users] C++ with MSPGCC/MSPGCC4


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;
}
Mspgcc-users mailing list
Mspgcc-users@lists.sourceforge.nethttps://lists.sourceforge.net/lists/listinfo/mspgcc-users

Offline

#2 Jan. 30, 2011 17:30:51

Baruch S.
Registered: 2009-11-02
Reputation: +  0  -
Profile   Send e-mail  

[Mspgcc-users] C++ with MSPGCC/MSPGCC4


Hi James,

On Sun, Jan 30, 2011 at 07:48:00AM -0800, James Joyce wrote:
> 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’



> My code is in fact all C for now:
>
> #include "msp430x22x4.h"

Shouldn't this be
#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;
> }

--
~. .~ Tk Open Systems
=}------------------------------------------------ooO--U--Ooo------------{=
- bar***@*kos.co.il - tel: +972.2.679.5364,http://www.tkos.co.il-


Mspgcc-users mailing list
Mspgcc-users@lists.sourceforge.nethttps://lists.sourceforge.net/lists/listinfo/mspgcc-users

Offline

#3 Jan. 30, 2011 18:05:39

Peter B.
Registered: 2009-11-02
Reputation: +  0  -
Profile   Send e-mail  

[Mspgcc-users] C++ with MSPGCC/MSPGCC4


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 <jj031***@*ahoo.com> 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;
> }
>
>
>
>
>
> Mspgcc-users mailing list
> Mspgcc-us***@*ists.sourceforge.net
>https://lists.sourceforge.net/lists/listinfo/mspgcc-users>
>
Mspgcc-users mailing list
Mspgcc-users@lists.sourceforge.nethttps://lists.sourceforge.net/lists/listinfo/mspgcc-users

Offline

  • Root
  • » MSPGCC
  • » [Mspgcc-users] C++ with MSPGCC/MSPGCC4 [RSS Feed]

Board footer

Moderator control

Enjoy the 21st of August
PoweredBy

The Forums are managed by develissimo stuff members, if you find any issues or misplaced content please help us to fix it. Thank you! Tell us via Contact Options
Leave a Message
Welcome to Develissimo Live Support