Search code examples
cgcclinkerundefined-referencemsp430

MSP430 (msp430-gcc) linker undefined reference to


I'm trying to compile my MSP430 project using the Linux msp430-gcc compiler.

When I try to compile it using the CCS IDE it works just fine, but when I try to compile it using the msp430-gcc commandline tool, I get linker errors about functions like calloc and __no_operation.

The beginning of my source file looks like this:

#include <stdio.h>
#include <stdlib.h>

I compile the program using the following command:

msp430-gcc -mmcu=msp430g2553 -o test.out source_file.c

So it looks like I include the stdio.h and stdlib.h just fine, but I still get linker errors about functions like calloc. I also tried using arguments like -lc, but that doesn't seem to help. I read that both stdio and stdlib get included automatically by the compiler so I guess there is no need to use additional arguments for these files.

Does anyone have any idea how I could fix this?

Thanks.


Solution

  • mspgcc was a fork of gcc; by now, it's horribly outdated.

    Nowadays, MSP430 development happens in gcc itself. You could compile the latest version of gcc yourself, or hope that your distribution has a MSP430 cross compiler, or get it from TI.