Hi, I cannot compile TI's MSP430F21x2 examples with mspgcc. It gives me following error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘void’
* Ubuntu 10.04 * I downloaded mspgcc4 binary from: http://sourceforge.net/projects/mspgcc4/files/GCC-4.4.2-GDB-7.0-20091124/20091124-msp430-gcc-4.4.2-gdb-7.0-insight-6.8.7z * I unpacked it and copied to /opt dir * Then I added following line to .bashrc file: export PATH="$PATH:/opt/msp430-gcc-4.4.2/bin" Actually I'm not sure if I'm using right mspgcc because I have also mspgcc-tinyos in my machine (http://docs.tinyos.net/index.php/Installing_TinyOS_2.1) maybe that might cause problems. Source main.c: //****************************************************************************** // MSP430F20x1 Demo - Comp_A, Output Reference Voltages on P1.1 // // Description: Output Comparator_A reference levels on P1.1. Program will // cycle through the on-chip comparator_A reference voltages with output on // P1.1. Normal mode is LPM0, TA0_ISR will interrupt LPM0. // ACLK = n/a, MCLK = SMCLK = default DCO // // MSP430F20x1 // ----------------- // /|\| XIN|- // | | | // --|RST XOUT|- // | | // | P1.1/CA1|--> Vref // | | // // M. Buccini / L. Westlund // Texas Instruments Inc. // December 2005 // Built with CCE Version: 3.2.0 and IAR Embedded Workbench Version: 3.40A //****************************************************************************** #include <msp430x20x1.h> void delay(void); // Software delay void main (void) { WDTCTL = WDTPW + WDTHOLD; // Stop WDT CACTL2 = P2CA4; // CA1/P1.1 = +comp CCTL0 = CCIE; // CCR0 interrupt enabled TACTL = TASSEL_2 + ID_3 + MC_2; // SMCLK/8, cont-mode _EINT(); // enable interrupts while (1) // Loop { CACTL1 = 0x00; // No reference voltage _BIS_SR(LPM0_bits); // Enter LPM0 CACTL1 = CAREF0 + CAON; // 0.25*Vcc, Comp. on _BIS_SR(LPM0_bits); // Enter LPM0 CACTL1 = CAREF1 + CAON; // 0.5*Vcc, Comp. on _BIS_SR(LPM0_bits); // Enter LPM0 CACTL1 = CAREF1 + CAREF0 + CAON; // 0.55V, Comp. on _BIS_SR(LPM0_bits); // Enter LPM0 } } // Timer A0 interrupt service routine #pragma vector=TIMERA0_VECTOR __interrupt void Timer_A (void) { _BIC_SR_IRQ(LPM0_bits); // Clear LPM0 bits from 0(SR) } makefile # makfile configuration NAME = leds OBJECTS = main.o CPU = msp430x2012 CFLAGS = -mmcu=${CPU} -O2 -Wall -g #switch the compiler (for the internal make rules) CC = msp430-gcc-4.4.2 .PHONY: all FORCE clean download download-jtag download-bsl dist #all should be the first target. it's built when make is run without args all: ${NAME}.elf ${NAME}.a43 ${NAME}.lst #confgigure the next line if you want to use the serial download download: download-jtag #download: download-bsl #additional rules for files ${NAME}.elf: ${OBJECTS} ${CC} -mmcu=${CPU} -o $@ ${OBJECTS} ${NAME}.a43: ${NAME}.elf msp430-objcopy -O ihex $^ $@ ${NAME}.lst: ${NAME}.elf msp430-objdump -dSt $^ >$@ download-jtag: all msp430-jtag -e ${NAME}.elf download-bsl: all msp430-bsl -e ${NAME}.elf clean: rm -f ${NAME}.elf ${NAME}.a43 ${NAME}.lst ${OBJECTS} #backup archive dist: tar czf dist.tgz *.c *.h *.txt makefile #dummy target as dependecy if something has to be build everytime FORCE: #project dependencies main.o: main.c If I'm changing CC = msp430-gcc-4.4.2 to CC=msp430-gcc then i got following error: msp430-gcc -mmcu=msp430x2012 -O2 -Wall -g -c -o main.o main.c main.c:32: warning: return type of `main' is not `int' main.c:53: warning: ignoring #pragma vector main.c:54: syntax error before "void" main.c: In function `Timer_A': main.c:56: warning: concatenation of string literals with __FUNCTION__ is deprecated make: *** [main.o] Error 1 Do I have to change orginal TI example code to get it compile? Is makefile OK? Is there something wrong with my mspgcc installation? Andres