Skip to end of metadata
Go to start of metadata

You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 54 Next »

We thank Chris Snyder for his contribution on setting up this environment.

mspgcc can be used as the development environment for the following platforms:

  • GINA
  • GINA-Basestation
  • TelosB

gcc is the ubiquitous open-source C compiler. mspgcc is its extension to support the TI MSP430 micro-controller.

 

Build Environments

The mspgcc toolchain supports both the SCons/command line environment and Eclipse.

  • Command line – See the sections below on mspgcc versions and installation.
  • Eclipse – See these separate pages:

Versions

We use the following versions in the OpenWSN team:

toolversion
msp430-gccmsp430-gcc (GCC) 4.6.3 20120301 (mspgcc LTS 20120406 patched to 20120502)
msp430-arGNU ar (GNU Binutils) 2.21.1 (mspgcc LTS 20120406 patched to 20120502)
msp430-ranlibGNU ranlib (GNU Binutils) 2.21.1 (mspgcc LTS 20120406 patched to 20120502)

Installing

 Linux...

The following steps were tested on Ubuntu 12.04LTS 64bit.

  1. Install gcc-msp430. Use one of the following choices:
    1. [recommended] install the latest version of gcc-msp430 from source by following this tutorial.
    2. Use the version available in the sources of your distribution. At the time of writing, this is 1.5.3. While this version works, you will need to change interrupt declaration in the source code (i.e. in board.c) since #pragmas directives are not supported.
  2. Install mspdebug for uploading via the msp-fet430uif. Use one of the following choices:
    1. [recommended] manual installation and compilation [download]
    2. There are packages Debian/Ubuntu and Fedora available:

      apt-get install mspdebug
  3. Copy the following firmware files into /lib/firmware.
    1. download the following firmware files [file1] [file2]
    2. place them into /lib/firmware.
 Windows...
  1. Install the mspgcc packages for mingw. mingw is a "minimalist GNU for Windows", i.e. it contains the build tools you typically find in a Linux distribution, but runs on Windows.
    1. Download the latest version from http://sourceforge.net/projects/mspgcc/files/Windows/mingw32/. At the time of writing, mspgcc-20120406-p20120911.zip.
    2. Unzip somewhere on your computer. We recommend C:\mspgcc\mspgcc-20120406-p20120911.
  2. Add the bin/ directory to your PATH. Use one of the following:
    1. To add it temporarily, open a command prompt and type:

      C:\Users\Thomas>set PATH=%PATH%;C:\mspgcc\mspgcc-20120406-p20120911\bin\
    2. To add it permanently:
      1. Type Ctrl+Windows.
      2. Click on Advanced System Settings > Environment Variables.
      3. In User Variables for <you>, select PATH and click Edit.
      4. At the end of the Variable Value text field, append;C:\mspgcc\mspgcc-20120406-p20120911\bin\.

To test that the installation was successfully, invoke the msp430-gcc program with the --version switch to have it print its version:

C:\Users\Thomas>msp430-gcc --version
msp430-gcc (GCC) 4.6.3 20120301 (mspgcc LTS 20120406 patched to 20120502)
Copyright (C) 2011 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

Building

The OpenWSN project uses SCons as its build environment. Refer to the Installation instructions for SCons.

For example, to build the 01bsp_bsp_timer project for the TelosB platform, using mspgcc, and loading the resulting binary on a TelosB connecting to COM30 of your computer, type:

scons board=telosb toolchain=mspgcc bootload=COM30 bsp_bsp_timer

Tips and Tricks

The MSP-FET430uif firmware

Your MSP-FET430 UIF can come with different versions of the firmware. If you connect your FET debugger to the USB port and appears as a /dev/ttyUSBx devices then most probably you have version 2 of the firmware. If contrarily it appears as a /dev/ttyACMx your device is on version 3 of the firmware.

MSP-FET Firmware V2

With version 2 of the firmware things are pretty easy.

  • Connect it to the USB port. It should appear as a /dev/ttyUSBx device.
  • Edit the ./firmware/openos/projects/<YOUR_PLATFORM>/SConscript.env. and make sure that the mspdebug is called with -j uif option
def uploader(device):

    return Builder(action = 'mspdebug -d {} -j uif "prog $SOURCE"'.format(device),

                   suffix = '.phonyupload',

                   src_suffix = '.ihex')
  • To download the firmware to the mote just type: (this may require root privileges (sudo))
scons project=<gina|telosb|pc>  upload=/dev/ttyUSBx  ./path/to/project/03oos_openwsn/

e.g: scons project=gina  upload=/dev/ttyUSB0  ./firmware/openos/projects/common/03oos_openwsn/

MSP-FET Firmware V3

If you have version 3 of the firmware you have 2 options:

  1. Downgrade your firmware to version 2 as described here.
  2. Setting up your environment to run with version 3 of the firmware.

Setup environment to run with FET v3 Firmware

Needed to say that I had a lot of problems to setup that. I will try to simplify as much as possible the steps to follow so you skip all my problems.

  • Edit the ./firmware/openos/projects/<YOUR_PLATFORM>/SConscript.env. and make sure that the mspdebug is called with tilib option
def uploader(device):

    return Builder(action = 'mspdebug tilib -d {} "prog $SOURCE"'.format(device),

                   suffix = '.phonyupload',

                   src_suffix = '.ihex')


  • Then you need to have the libmsp430.so in your /usr/lib or somewhere else in your path. This lib needs to be compiled from some MSP430 sources that are developed for windows so building it requires certain patience and several other tools. Too simplify your life I compiled them for both 32 bits and 64 bits but it is possible that they don't work on your system.libmsp430.so [32 bit] [64 bit]

  • Place the library (according to your OS version) into /usr/lib/ and execute: (may require sudo). If this works you are done.
scons project=<gina|telosb|pc>  upload=/dev/ttyACMx  ./path/to/project/03oos_openwsn/

e.g: scons project=gina  upload=/dev/ttyACM0  ./firmware/openos/projects/common/03oos_openwsn/

If libmsp430.so library does not work, you will need to compile it manually. To do so you can follow this tutorial and this very helpful post on the TI forums. Besides I try to resume here all the steps.:

  • install gcc-multilib library as you will need some extras from gcc: apt-get install gcc-multilib
  • download the sources of the libmsp430.so library. I've put together the lib sources, a patch to correct errors on the library (only for 64bit version) and the firmware files for the FET. [download]
  • unzip it and apply the patch to the folder. 
  • Then you will need to install libboost-*. Boost is a set of extension libraries for cpp and it is used by the libmsp430 library sources.  download latest version (I used 1.5.2). Unzip it and execute: 
         ./boostrap.sh --prefix=[dir]
         ./b2 link=static cxxflags=-fPIC -d+2 -a
  • once the process finishes you will need to copy the generated libraries into /usb/lib (or somewhere else that it is in your path)
  • After that, come back to the libmsp430 source folder and execute make. When the compilation finishes the libmsp430.so will be in the root of this folder.
  • Copy the libmsp430.so to /usr/lib.
  • to download the firmware to the mote execute: (may require sudo). If this works you are done.
scons project=<gina|telosb|pc>  upload=/dev/ttyACMx  ./path/to/project/03oos_openwsn/

e.g: scons project=gina  upload=/dev/ttyACM0  ./firmware/openos/projects/common/03oos_openwsn/

Known problems

During the process of setting up the environment I've found this problems. Check this section in case you are facing any problem during the install.

 

Problem: When installing msp430-binutils from sources the compiler complaints about makeinfo in the texinfo package.

Solution: Install texinfo from sources:

apt-get install texinfo.

Then edit the Makefile (line 344) and replace

 

MAKEINFO = /path/to/your/msp430-build/binutils-2.21.1/missing makeinfo

by:

MAKEINFO =  makeinfo

 

Problem: GDB does not compile and complaints about ncurses lib.

Solution: Install libcurses5-dev

apt-get install libncurses5-dev

 

Problem: mspdebug does not compile because usb.h and readline.h header are missing

Solution: Install libus-dev and libreadline-dev

apt-get install libusb-dev

apt-get install libreadline libreadline-dev

  • No labels