My quickie guide for setting up mspgcc for ez430-cc2500

Mostly for my own reference for the next time I have to set it up on a new machine, but may help others on their first time install. Valid as of Feb. or so this year.

Software ‘shopping’ list (all free/OSS tools)
Set up the toolchain (mspgcc). There seem to be several important tools
missing from the mspgcc distro as of this writing, including ‘make’ and
msp430-insight (graphical debugger) that the docs claim are included
with the package. So the complete shopping list is:

mspgcc-win32:
http://downloads.sourceforge.net/mspgcc/mspgcc-20081230.exe?use_mirror=voxel
NOTE: This binary IIRC was not linked on Sourceforge’s downloads page at the time; there was only an older build and this link had to be fished from semi-private newsgroup postings. If there is a newer binary available, download that one.

MinGW/msys (provides ‘make’ and some utilities) :
http://downloads.sourceforge.net/mingw/MinGW-5.1.4.exe?use_mirror=voxel
If it gives you the options of installing minGW and msys, say YES to both.

CoreUtils (provides unix-like ‘rm’ tool required by make) :
http://gnuwin32.sourceforge.net/packages/coreutils.htm

Skipping the debugger for now until I figure out how to use it myself ;-) Seems to work occasionally under win32, but it’s flaky.

Required Knowledge Assuming you already know C and have the appropriate chip documentation/datasheets.
Have a quick read-through of the mspgcc FAQ and manual. Both are
reasonably short for what they are.
FAQ: http://mspgcc.sourceforge.net/faq/t2.html
Manual: http://mspgcc.sourceforge.net/manual/

The manual contains a lot of advanced stuff you can skip at first, or
skip entirely. This includes (at minimum) the stuff about customizing
the startup/end procedures, stack, the entire ABI section, inline
assembly, and stuff about building mspgcc (the package you get is
already built).

Get familiar with ‘make’. Outside of kinky application-specific tools
like the Microchip assembler/compiler and ‘IAR Kickstart’, the rest of
the free world uses make to automate compiling, linking,
installing/running and packaging their code. Go into the mspgcc
‘examples’ folder and find the blinking LEDs example (e.g.
E:\mspgcc\examples\leds). Open up the file called Makefile in Wordpad
and have a look inside. This is the master script that will smartly
handle all your compiling, programming the chip, and avoid you rewriting
lots of code whenever you change chips. The contents will probably look
like gibberish, there are only a few parts that are important for our
purposes. The make tool installed by mingw32 is named ‘mingw32-make’.

How make works is you specify one or more ‘targets’, i.e. things make
can do. Running make with no target specified compiles your program.
Some other targets are ‘mingw32-make clean’ (delete your old build and
any scratch files), or ‘mingw32-make download’ (compiles your program,
downloads it to the chip and runs it). All the necessary commands to
handle each target are in the Makefile.

Since the top half of the ez430 kit is essentially the USB Sy-Bi-Wire programmer, you have to change the download command to:

msp430-jtag –spy-bi-wire -lpt=USBFET -e leds.elf

I.e. in the Makefile you’d find and change the download section to:

download-jtag: all
msp430-jtag –spy-bi-wire -lpt=USBFET -e ${NAME}.elf

As long as you have the Makefile open, now is a good time to find the
CPU= line and change it to match the msp430 variant you are actually
using. In the case of the eZ430 board:
CPU = msp430x2274

Now when you #include the base generic as you will for most any
mspgcc project, it will automatically switch in the correct headers and
peripheral support for that specific CPU.

6 Responses to “My quickie guide for setting up mspgcc for ez430-cc2500”

  1. Jason says:

    Your writeup seems great (I stumbled upon it while realizing I needed make as well. After installing everything though, neither cygwin, nor the standard DOS prompt understands me saying “make”, am I missing another step?? THanks.

  2. jeff says:

    THANK YOU for the msp430-jtag syntax. I appreciate what the mspgcc team is doing but I wish their msp430-downloader utility would support spy-bi-wire.

    I’ll be looking into the GDB proxy now. Unfortunately, none of the three “msp430” options it provides can connect to my USB key, ie it’s lacking the –lpt=USBFET option.

    Or have you already found a solution to this?

    JASON: It’s because MinGW installs mingw32-make.exe instead of make. You could just copy the file and rename it to make.exe while keeping it in the same folder (normally under linux I’d say “ln” it)

  3. jeff says:

    Sorry for the double post: found it!

    first of all create the file gdb.ini in the bin folder and add
    set remoteaddresssize 64
    set remotetimeout 999999
    target remote localhost:2000

    then run the following command:

    msp430-gdbproxy msp430 –spy-bi-wire USBFET

    And you can now use GDB at port 2000.

  4. Jason says:

    Sorry, I didn’t see the response until now, installing MSYS seemed to fix the issue for me, so I am golden. What are you using to debug the code? That is my next step!
    Thanks for the great site!

  5. Tim says:

    @Jason et al: under Windoze, if you install software such as ‘make’ after opening a CMD prompt, only the stuff available before you opened it will show up. Under Win32, the installers for most programs such as make intended to be used from anywhere will add themselves to your PATH= system variable, so that Windows can find them without explicitly specifying their location every time. If this does not happen, try closing and opening a new command prompt (Start -> run “cmd”) to see if it exists now… if not, you will need to explicitly add them to Windows’ path.

    if ‘make’ (or ‘mingw32-make’, etc. still is not found even though they have been installed, you need to add the path to them into the Windows PATH= system environment variable. To do this, open Start -> Settings -> Control Panel -> System -> Advanced tab, click on “environment variables”, and in the “system variables” window, find the ‘Path’ variable. It contains a long list of paths where important programs are located, such as e.g. C:\Windows\System32 (etc.) separated by semicolons;… to enable mingw32-make to work from any location, add its path to this list. Eg. change the ‘Path’ variable so that it reads ‘C:\Windows\system32;C:\important\crap\;…(more crap)…;C:\mingw\ (or wherever it is located). After you have added its path, close and re-open any command prompts and it should work. Same goes for any other important programs or script interpreters, e.g. perl, python, etc….

  6. Bruce says:

    THANK YOU for the msp430-jtag syntax. I appreciate what the mspgcc team is doing but I wish their msp430-downloader utility would support spy-bi-wire.

    I’ll be looking into the GDB proxy now. Unfortunately, none of the three “msp430” options it provides can connect to my USB key, ie it’s lacking the –lpt=USBFET option.

    Or have you already found a solution to this?

    JASON: It’s because MinGW installs mingw32-make.exe instead of make. You could just copy the file and rename it to make.exe while keeping it in the same folder (normally under linux I’d say “ln” it)

Leave a Reply