While the given information in this document is believed to be correct, the authors assume no responsibility whatsoever for any damage to hardware and/or software, or any loss of data resulting from the procedures outlined in this document.


--------- Begin ---------


Step 1:

Install FTDI driver for OS X from the following link.

Install wget from the following link.


Step 2:

If it’s not present, create the /opt folder at the system level and work on it.

Login to the TinyOS CVS in /opt:


cvs -d:pserver:anonymous@tinyos.cvs.sourceforge.net:/cvsroot/tinyos login


Download the MSPGCC package (Gcc Toolchain for MSP430, for documentation see the link):


cvs -z3 -d:pserver:anonymous@tinyos.cvs.sourceforge.net:/cvsroot/tinyos co tinyos-1.x/tools/src/mspgcc


Step 3:

Copy the attached file serverOSX.patch in /opt/tinyos-1.x/tools/src/mspgcc.

On the console type the following commands:


cd /opt/tinyos-1.x/tools/src/mspgcc

patch build-mspgcc serverOSX.patch

sudo gcc_select 3.3

export CXX=gcc-3.3

export GCC=gcc-3.3

export CC=gcc-3.3

sudo ./build-mspgcc install


Step 4:

Download the MSPGCC-PYBSL package in /opt:


cvs -z3 -d:pserver:anonymous@tinyos.cvs.sourceforge.net:/cvsroot/tinyos co tinyos-1.x/tools/src/mspgcc-pybsl


and execute on the terminal:


sudo ln -s /opt/tinyos-1.x/tools/src/mspgcc-pybsl/bsl.py /opt/msp430/bin/msp430-bsl


Step 5:

Add to the ~/.bashrc file the following lines:


export MOTEPOS=`ls /dev/tty.usbserial-*`

chmod 666 $MOTEPOS

export PATH=$PATH:/opt/msp430/bin:/opt/contiki-2.x/platform/sky


Step 6:

Download the latest Contiki snapshot from the CVS in /opt with:


cvs -d:pserver:anonymous@contiki.cvs.sourceforge.net:/cvsroot/contiki login


cvs -z3 -d:pserver:anonymous@contiki.cvs.sourceforge.net:/cvsroot/contiki co contiki-2.x


Step 7:

Modify the file tunslip.c in /opt/contiki-2.x/tools/tunslip.c:


a)

add #define mac_something 1 at the beginning


b)

FROM:

static const char *siodevs[] = {

"/dev/ttyUSB0", "/dev/ucom0", "/dev/cuaU0"

};

TO:

char * motepos = getenv("MOTEPOS");

motepos=motepos+5;

const char *siodevs[] = {

motepos, "/dev/ucom0", "/dev/cuaU0"

};


c)

FROM:

ssystem("sysctl net.inet.ip.forwarding=0");

TO:

ssystem("sysctl -w net.inet.ip.forwarding=0");


d)

FROM:

ssystem("sysctl net.inet.ip.forwarding=1");

TO:

ssystem("sysctl -w net.inet.ip.forwarding=1");


Step 8:

Modify the file Makefile in /opt/contiki-2.x/platform/sky/Makefile:


FROM:

COMPORT := /dev/ttyUSB0

TO:

COMPORT := $(MOTEPOS)


Step 9:

Execute on the terminal the following commands:


cd /opt/contiki-2.x/platform/sky/

make

make gateway.u


Step 10:

In /opt/contiki-2.x/platform/sky/ create a file called compile:


pico compile


editing it with the following content:


#!/bin/bash

msp430-gcc -mmcu=msp430x1611 -I. -I../../cpu/msp430 -I../../core -I../../apps -Wall -Os -DPROCESS_LOADABLE -c $1.c -o $1.prg

msp430-strip --strip-unneeded -g -x $1.prg

codeprop 172.16.0.1 $1.prg


Assign to the file the right of execution:


chmod +x compile


Step 11:

Download and install the TUNTAP driver for OS X from the following link.


Step 12:

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.


Open a terminal in /opt/contiki-2.x/platform/sky/ and type the following commands:


rm tunslip

make

sudo tunslip 172.16.0.1 255.255.0.0



The output should be like this:


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)


Step 13:

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.


Open another terminal in /opt/contiki-2.x/platform/sky/ and type the following commands:


codeprop 172.16.0.1 loadable_prg.prg

(if you want to use a testing file)


OR


compile <FileName>

(if you have created your own file in /opt/contiki-2.x/platform/sky/)



The output should be like this:


File successfully sent (1116 bytes)

Reply: ok


While in the first console the report should be:


test_process starting

OR

<your program’s output if any>


--------- End ---------

Last Updated: April 2007

If you have any question, please contact the authors:


Ettore Ferranti


Elisa Rondini