ccompilationembeddedmsp430mspgcc

MSP430F5529 | MSPGCC Building/Compiling manually | Cannot execute Simple Program


i have just started to work with the MSP430F5529. I have downloaded the msp430-gcc compiler and tried to compile the folowing short program:

#include <msp430f5529.h>

int main(void)
{
    WDTCTL = WDTPW | WDTHOLD;

    P1DIR = BIT0;
    P1OUT = 0x00;
    P1REN = 0x00;
    while(1)
    {
        P1OUT = BIT0;
    };
    return 0;
}

I have compiled it via: C:\ProgrammingTools\ti\msp430-gcc\bin\msp430-elf-gcc.exe -Wall main.c -IC:\ProgrammingTools\ti\msp430-gcc\include\ -o MSP430.out

I have flashed it onto the board with the MSPFlasher 1.3.20, it did not show any errors, but the LED did not turn on. I have also tried to verify and flash it with the UniFlash Tool (V8.1.1.41.46). Ther verification was successful, but the result of flashing was the same, the LED did not do anything. Has anyone had the same problem?


Solution

  • It seems that you have to link the correct linker script.

    The correct way of building would have been:

    C:\ProgrammingTools\ti\msp430-gcc\bin\msp430-elf-gcc.exe -I C:\ProgrammingTools\ti\msp430-gcc\include -L C:\ProgrammingTools\ti\msp430-gcc\include -mmcu=msp430f5529 -O2 -g main.c -o MSP430.out
    

    It is also described in the MSP430 GCC Toolcahin User Guide in section 4.6.2 Building Manually with gcc.