This page is to help people getting to grips with the MSP-gcc compiler we will be using.


There are two ways to install MSP-gcc, using a premade binary installer or compiling it yourself. A binary installer is probably the best option if you are having any kind of trouble. The Windows binary installer can be obtained here:


MSP-gcc is not a development environment, nor a graphical application of any kind. It is a command line application. In order to use it, you must first bring up a terminal. On a Windows machine, this is done by going to the start menu, selecting 'run' and typing 'cmd' into the dialogue box and hitting enter.

When you have a terminal, navigate to the location of where msp-gcc is installed and type the following command:

msp430-gcc <filename.c> -mmcu=msp430x1612

With <filename.c> replaced by the name of the C file you wish to compile. If you do have a Windows development environment you wish to use as an editor, it is in some cases possible to instruct the programme to use an alternative compiler. Search the option menus until you find the command used to compile your code and change it from its default to 'msp-gcc'.

//Note: There are several commands which can be added to the end of the compiler command line. A couple of useful commands are "-pedantic" which will enable warnings demanded by strict ISO C and "-Wall" which enables all compiler warnings. Also, "-o" allows you to name the file aswell as specify the file type. For testing purposes with the board, .elf is the most convinent of these //

Use with a .bat file

It is generally far more convenient to compile your code using a ready made .bat file rather than bringing up the command prompt every time. This is especially true if you are constantly making changes to your code as you test it on the board.

Within the directory containing your C files, create a new text file called <filename>.bat (<filename> being the name of the C file you wish to compile). Within it enter the following code.

@echo off

del <filename>.elf

echo ========================================
echo Compiling square.elf with errors enabled
echo ========================================

<mspgccinstall>\bin\msp430-gcc <filename>.c -mmcu=msp430x1612 -o <filename>.elf -Wall


Running this (after replacing <mspgccinstall> and <filename>) will compile your file to a .elf within the current directory. This file can then be transferred to the board.

Create a new .bat file for each new code file you make, changing <filename> appropriately.

Other Platforms

Arch Linux: There is a source package availible on the AUR

Linux and Mac instructions will be available if/when anyone needs them.

Unless otherwise stated, the content of this page is licensed under Creative Commons Attribution-Share Alike 2.5 License.