Jump to content

Compiling and downloading via the command prompt

Recommended Posts

I ended up installing a Lubuntu partition on my laptop and decided that I'd like to figure out how to program my MSP430.  After trying for some time to get Eclipse working, I decided that it would probably be simpler (and slightly more tech-savvy) to do everything via Makefiles and the command prompt.  Anybody else here doing the same thing?

Link to post
Share on other sites

I am using Linux Mint. For starter projects command line environment is more agile.

On windows side, I install cygwin for a similar build environment.


If you are new to msp430, I suggest you download the code examples to start with, http://processors.wiki.ti.com/index.php/MSP430G2_LaunchPad

it pretty much covers all the various device features in one-file example projects. It is very handy to cut&paste from these examples.


I don't even use makefiles as most of my projects are one-file big.


I use the following script to compile. It will just take my last c file edited and compile it + flash. Every quick to play around.


if [ -z $PRG ]; then
LAST_FILE=`ls -tr *.c | tail -1`
PRG=`basename $LAST_FILE .c`


CFLAGS="-Os -Wall -ffunction-sections -fdata-sections -fno-inline-small-functions -Wl,-Map=$PRG.map,--cref -Wl,--relax -Wl,--gc-sections"
rm *.elf
rm *.hex

echo "$GCCBIN/msp430-gcc $CFLAGS -I$GCCBIN/../msp430/include -mmcu=$MMCU -o $PRG.elf $PRG.c"
$GCCBIN/msp430-gcc $CFLAGS -I$GCCBIN/../msp430/include -mmcu=$MMCU -o $PRG.elf $PRG.c 

if [ $? -ne 0 ]; then

$GCCBIN/msp430-objdump -DS $PRG.elf > $PRG.lst
$GCCBIN/msp430-strip $PRG.elf
$GCCBIN/msp430-size --totals $PRG.elf
$GCCBIN/msp430-objcopy -O ihex $PRG.elf $PRG.hex

# mspdebug rf2500 "prog $PRG.elf"
Link to post
Share on other sites

i use nano,gedit and mspdebug with 

mspdebug rf2500 'prog main.elf'

in a script under /usr/bin/

Thanks!  For whatever reason I've never tried using only single quotemarks, and I could download/run the program if I entered that line right into the cmd prompt.  But I could never get the "prog main.elf" line to work in any of my scripts.  Cripes, syntax is a pain....

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...