Jump to content

Eclipse MSP430-gcc integration

Recommended Posts

I have followed the tutorial on this site for integrating Eclipse with msp430-gcc.


I am running ubuntu 13.04 64 bit. msp430-gcc (GCC) 4.6.3 20120301 (mspgcc LTS 20120406 unpatched)

Eclipse Platform Version: 3.8.1
Compiling manually on a Terminal works:
I have a simple programme to toggle LED on the MSP430 Launchpad Rev 1.5 board.
I compile this on a terminal using 
msp430-gcc -mmcu=msp-430g2553 -o led.elf blinkingled.c 
This gets compiled and I can flash the binary to my board and it works.
When I have this same setup to compile on Eclipse the compilation is in two stages. The first step is creating object files and then the linker kicks in. 
I have included the following Library search path under GCC C Linker --> Libraries in Eclipse
This is as per the tutorial, however this results in 
Building target: led.elf
Invoking: GCC C Linker
msp430-gcc --mmcu=msp430g2553 -Wl,-Map=led.map -L/usr/msp430/lib/ -o "led.elf"  ./led.o   
/usr/lib/gcc/msp430/4.6.3/../../../../msp430/bin/ld: cannot open linker script file memory.x: No such file or directory
collect2: ld returned 1 exit status
make: *** [led.elf] Error 1
For the linker to succeed, as a work around I have given the full path in GCC C Linker --> Libraries in Eclipse
With this linking succeeds and am able to create the led.elf using eclipse.
Can some one throw a light on what is wrong with my setup which is preventing the linker to fail in the first setup?



Problem 2


I have File1.c, File2.c and File2.h all in the same folder.


I am calling a function func1 inside File1.c. File1.c has File2.h in its #include.


func1 is defined in File2.h and implemented in File2.c


I am able to compile this using the following command on a terminal


msp430-gcc -mmcu=msp430g2553 -I/usr/msp430/include -I/usr/include -I"./" File2.c File1.c -o something.elf
this compiles and I am able to flash the firmware on to the board.
When I try to compile the same set of code inside Eclipse
I get 
File2. c gets compiled to File2.0
File1.c compilation fails.
File1.c (.init9+0xc): undefined reference to `func1'
Again this is some configuration in Eclipse which is not set properly which is preventing it to relate to the object files.
Could some one kindly throw some light .
With regards
Link to post
Share on other sites

Another comment:


msp430-gcc -mmcu=msp430g2553 -I/usr/msp430/include -I/usr/include -I"./" File2.c File1.c -o something.elf


None of these -I flags should be necessary.  If you've built the toolchain to be installed in /usr, then /usr/msp430/include (where the MCU-specific headers are located) should be part of the standard include path automatically.  /usr/include should not be used, as it holds headers for your host system (Ubuntu), and none of those will be right for an msp430 application.  ./ is not necessary if you use double-quotes for your #include directives (viz., #include "file.h", as opposed to #include <file.h>) because gcc will automatically search the directory holding the C file for those files.


The only one that's really wrong is /usr/include, but in general you should avoid unnecessary compiler options because it's a source of confusion.

Link to post
Share on other sites

I have installed the Eclipse plugin from XPG mentioned in this forum else where. This has resolved the problem with building using Eclipse. It boils to down to how the Make files are autogenerated. I have left it for another time to figure out the difference between the environment settings of the Plugin Vs standard eclipse

Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Create New...