2

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.

Olliek
  • 124
  • 2
  • 11
  • Which version are you using? What about `-minrt`? – CL. May 24 '16 at 08:22
  • @CL. You mean the msp430-gcc version? That's 4.6.3 20120301 (mspgcc LTS 20120406 unpatched). I tried the -minrt argument, but it tells me it's an unrecognized option. – Olliek May 24 '16 at 08:25
  • `msp430_gcc` should use its toolchain includes and libs. – LPs May 24 '16 at 08:48

1 Answers1

3

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.

CL.
  • 173,858
  • 17
  • 217
  • 259
  • 2
    Thanks, I downloaded the .run pre-compiled one from TI's website. I now use the msp430-elf-gcc executable to compile my sources and that seems to work perfectly fine! I did however have to manually direct the compiler to the MSP include files now (eg. msp430g2553.h). Same goes for the msp430g2553 linker files (msp430g2553.ld and msp430g2553_symbols.ld). – Olliek May 26 '16 at 12:32