Jump to content
Sign in to follow this  
Apaseo

mspgcc setup to compile using command line on Windows

Recommended Posts

Hello,

I am trying to set up my computer so that I can compile my code with mspgcc using the command line.

I downloaed mspgcc from: http://sourceforge.net/projects/mspgcc/files/Windows/mingw32/

 

Extracted it into mspgcc folder at C:/

 

Then I added to path.

 

Now, when I tried to use it, it tells me (and I see) that there is no make.exe

but there is msp430-gcc.exe, when I run this it tells me:

msp430-gcc fatal error: no input files

 

Does anyone have any idea or comments about this.

All is welcomed.

I prefer to work with the command line,

Thanks

Share this post


Link to post
Share on other sites

Now, when I tried to use it, it tells me (and I see) that there is no make.exe

but there is msp430-gcc.exe, when I run this it tells me:

msp430-gcc fatal error: no input files

 

 

How did you use it? Via a makefile? So it failed and you try just type "C:>msp430-gcc"? You do need parameters though.

 

I would say if you are serious w/ doing command line, install cygwin and you will have all utilities available (make, binutils, etc). And the install just take 10 minutes.

 

I think I am using the same mspgcc built, plus I had cygwin installed, plus I built mspdebug from source under cygwin.

 

chrisc@5A:~ > which make
/usr/bin/make
chrisc@5A:~ > which msp430-gcc
/cygdrive/c/mspgcc-20120406-p20120502/bin/msp430-gcc
chrisc@5A:~ > which mspdebug
/usr/local/bin/mspdebug
chrisc@5A:~ >

Share this post


Link to post
Share on other sites

Im going to post what I have and how I have used it:

I went to: http://sourceforge.net/apps/mediawiki/mspgcc/index.php?title=MSPGCC_Wiki

And downloaded the latest windows version here:http://sourceforge.net/projects/mspgcc/files/Windows/mingw32/

 

After downloading I extracted to my C:/mspgcc

After extracting I added the path: C:\mspgcc\bin to my paths

 

now to test if I had the files working I opened a command window (cmd)

and typed 

msp430-gcc
:msp430-gcc: fatal error: no input files
compilation terminated.
-->This means that path and files are there  :smile:
 
Now to test if it would actually compile anything I downloaded this examples:
 
Put them on a folder and navigate to the folder on the console, then typed: 
msp430-gcc hello_world.c
And got back:
c:\test>msp430-gcc hello_world.c
c:/mspgcc/bin/../lib/gcc/msp430/4.6.3/../../../../msp430/bin/ld.exe: cannot open
 linker script file memory.x: No such file or directory
collect2: ld returned 1 exit status

And that is where I'm stuck.

 

This is from cygwin:

Mypc ~
$ which mymake
/usr/bin/mymake

Mypc ~
$ which msp430-gcc
/cygdrive/c/mspgcc/bin/msp430-gcc

I would like to get the command line compiling working, because I don't like CCS and would prefer to do my text editing on gVim or Sublime.

Thanks

Share this post


Link to post
Share on other sites

You need to specify the target device via -mmcu, also you should add the -o to specify the output file name, or else you would get a.out (as in all gcc one liners)

The memory model is different for each device and the linker need those information.

 

 

msp430-gcc -mmcu=msp430g2553 hello.c -o hello.elf
You can then use mspdebug or msp430flasher (from TI) to flash the firmware into your launchpad.
 

Share this post


Link to post
Share on other sites

 

You need to specify the target device via -mmcu, also you should add the -o to specify the output file name, or else you would get a.out (as in all gcc one liners)

The memory model is different for each device and the linker need those information.

 

 

msp430-gcc -mmcu=msp430g2553 hello.c -o hello.elf
You can then use mspdebug or msp430flasher (from TI) to flash the firmware into your launchpad.
 

 

I do think I got it.

I was able to get a .elf file

 

Now I will try the flasher stuff, I will report back when I get something.

Thanks

Share this post


Link to post
Share on other sites

 

How did you use it? Via a makefile? So it failed and you try just type "C:>msp430-gcc"? You do need parameters though.

 

I would say if you are serious w/ doing command line, install cygwin and you will have all utilities available (make, binutils, etc). And the install just take 10 minutes.

 

I think I am using the same mspgcc built, plus I had cygwin installed, plus I built mspdebug from source under cygwin.

 

chrisc@5A:~ > which make
/usr/bin/make
chrisc@5A:~ > which msp430-gcc
/cygdrive/c/mspgcc-20120406-p20120502/bin/msp430-gcc
chrisc@5A:~ > which mspdebug
/usr/local/bin/mspdebug
chrisc@5A:~ >

 

Thanks for all the help.

 

Now I seem to be having some problems with installing mspdebug .

 

When I try to build it from source I get some errors.

Just to make sure my cygwin is fine, do you have dev tools installed? Are there other packages that may be needed or some that you might recommend?

 

And if you could please give me some tips or comments on how to build mspdebug from source.

Thank You

Share this post


Link to post
Share on other sites

I don't remember the details, I always have c/c++ development installed w/ cygwin.

 

You definitely need libusb, or libusb development.

 

I just rebuild it and check the -l (libraries) that is needed, you should search for related packages that provides them. I.e. libusb, libreadline?, libws2_32? don't know what it was.

I would usually look at compile / link errors and go from there. If you are stucked, show us the compile error here.

 

gcc -s  -o mspdebug.exe util/btree.o util/expr.o util/list.o util/sockets.o util/sport.o util/usbutil.o util/util.o util/vector.o util/output.o util/output_util.o util/opdb.o util/prog.o util/stab.o util/dis.o util/gdb_proto.o util/dynload.o drivers/device.o drivers/bsl.o drivers/fet.o drivers/fet_error.o drivers/fet_db.o drivers/flash_bsl.o drivers/gdbc.o drivers/olimex.o drivers/rf2500.o drivers/sim.o drivers/uif.o drivers/ti3410.o drivers/tilib.o drivers/olimex_iso.o formats/binfile.o formats/coff.o formats/elf32.o formats/ihex.o formats/symmap.o formats/srec.o formats/titext.o simio/simio.o simio/simio_tracer.o simio/simio_timer.o simio/simio_wdt.o simio/simio_hwmult.o simio/simio_gpio.o ui/gdb.o ui/rtools.o ui/sym.o ui/devcmd.o ui/reader.o ui/cmddb.o ui/stdcmd.o ui/aliasdb.o ui/main.o -lusb -lreadline -lws2_32

Share this post


Link to post
Share on other sites

Just figured it out, I needed some libraries, and it compiled without errors, I was also able to test it.

 

Thanks for the help.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

×