How To: Install a Development Environment for the Tmote Sky and the Contiki OS for Linux.

Preface:

OS — Fedora Core 3 for the Intel i686 (non-Hyper Threading)

Required Components.

Read and Write access to the USB port where your tmote is connected, typically /dev/ttyUSB*.  

The quickest and easiest thing to do is just to change the permissions to allow everyone rw access.  This can be done as follows:

[root]# chmod 666 /dev/ttyUSB0

Unfortunately, the permissions are reset every time the computer is rebooted or the tmote is disconnected.  A better solution is to add your user name to the Group which also has rw access to the USB ports (on my machine that group is uucp) but it is easily found out by doing the following:

[root]# ls -l /dev/ttyUSB0
crw-rw----  1 root uucp 188, 0 Nov 26 12:27 /dev/ttyUSB0

Then you'll always have rw access to whatever USB port is used.  Note: You will probably have to login again for the change to take place.

MSPGCC Tool Chain.  

This is the bit that is going to complile, link, load, assemble, etc. your Contiki program for the msp430 CPU of your Tmote.  The source and documentation are contained at the following link:

http://mspgcc.sourceforge.net/tools.html

Various binaries are also available.  I used the following:

msp430tools-base-0.1-20050607.i386.rpm
msp430tools-binutils-2.16-20050607.i386.rpm
msp430tools-gcc-3.2.3-20050607.i386.rpm
msp430tools-gdb-6.0-20050609.i386.rpm
msp430tools-gdb-proxy-6.0-20050609.i386.rpm
msp430tools-jtag-lib-20031101cvs-20050610.i386.rpm
msp430tools-libc-20050308cvs-20050608.i386.rpm
msp430tools-python-tools-1.0-1.noarch.rpm

available from: http://www.sics.se/~bg/telos/linux-bin/

One would normally install the above as follows:

[root]# rpm -ivh msp430tools-*.rpm

These tools will be and are normally stored in /opt/msp430/bin.  I believe that a lot of the code expects for these tools to be located here.  If you choose another directory then take this into account.  Along these lines you should make sure that your PATH  now points to /opt/msp430/bin as well.

Note:  msp430-bsl which came with one of the above binaries did not work with the tmote.  Msp430-bsl is the boot strap loader and is responsible for actully uploading the compiled kernel to the tmote via the USB interface.  I am currently using the following version 1.39-telos-7, which I obtained from the tinyos tools distribution.

Contiki Operating System.

Available from:  http://www.sics.se/~bg/telos/.

Install by first untarring it somewhere where you have write permission.  The following command should do fine.

[user]# tar xfvz contiki-2.x-snap3.tar.gz

Then change to the following directory and compile the source code.

[user]# cd contiki-2.x/platform/sky/
[user]# make

You can then upload the kernel (generic.ihex) to your tmote by issuing the following command.

[user]# make generic.u

Permission to run tunslip.

Tunslip, which is compiled and found in the contiki-2.x/platform/sky directory is the program which allows your computer to use the tmote sky connected to your USB port as a network device.  This is what will allow you to talk to your tmote and/or tmote network.  By default it requires root privileges to run.  You can always just start up the tunslip program as root.  I chose to use 'sudo' so that I can run it under my own user name.  It is run as follows:

[user]$ tunslip 172.16.0.1 255.255.0.0
slip started on ``/dev/ttyUSB0''
opened device ``/dev/tun0''
ifconfig tun0 inet `hostname` up
route add -net 172.16.0.0 netmask 255.255.0.0 dev tun0
ifconfig tun0

tun0      Link encap:UNSPEC  HWaddr 00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00
          inet addr:10.1.1.12  P-t-P:10.1.1.12  Mask:255.255.255.255
          UP POINTOPOINT RUNNING NOARP MULTICAST  MTU:1500  Metric:1
          RX packets:0 errors:0 dropped:0 overruns:0 frame:0
          TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:500
          RX bytes:0 (0.0 b)  TX bytes:0 (0.0 b)

Tunslip can be started with an & at the end to run it in the background.  However, I like to run it in its own console as all 'printf' information is then diplayed there.

Codeprop.

Codeprop is the program which uploads program modules to a tmote running the Contiki kernel and then starts them.  It uses tunslip to deliver them via ip and can subsequently also upload via the wireless interface of the tmotes.  For example, if you wanted to upload the sample program to your tmote you would do as follows:

[user]# codeprop 172.16.0.1 loadable_prg.prg
File successfully sent (1116 bytes)
Reply: ok

The console (if you were running it) would then report:

test_process starting