Difference between revisions of "Xubuntu 10.04, SVN T2.1, Step by step"

From TinyOS Wiki
Jump to: navigation, search
(New page: How to set up the development environment for MamMark. Assumptions: These notes are written assuming Ubuntu 8.04. Previously development was done on 7.04 but these notes are written expl...)
 
(nuke hinrg as being a debian repository backup. point at stanford.)
 
(12 intermediate revisions by 2 users not shown)
Line 1: Line 1:
How to set up the development environment for MamMark.
+
1) OS Install.
 
 
Assumptions: These notes are written assuming Ubuntu 8.04.  Previously
 
development was done on 7.04 but these notes are written explicitly for
 
8.04.
 
 
 
1) [OS Install]
 
  
 
Install the OS, Ubuntu (Xubuntu uses less resources) on the box.  Recommended is
 
Install the OS, Ubuntu (Xubuntu uses less resources) on the box.  Recommended is
Xubuntu 8.04 (LTS).
+
Xubuntu 10.04 (LTS). A simple install is fine and will take less timeCurrent
 
+
ISO install images can be found at [http://www.xubuntu.org/getubuntu#lucid 10.04 ISO].
  install the following:
 
      subversion cvs build-essentials stow automake autoconf autobook libtool
 
 
 
2) [MamMark tree checkout]
 
 
 
  check out the MamMark source tree.  (denote top level as <mm_t2_base>)
 
 
 
  a) Current hosting site is zoo.cse.ucsc.edu.  <repo_site>
 
  b) cd <mm_t2_base>.
 
  c) svn co svn://<repo_site>/mammark_tinyos2/t2_mm3
 
 
 
  This will create the source tree as <mm_t2_base>/t2_mm3.
 
 
 
  Various configuration files used to construct a full build environment are located
 
  in <mm_t2_base>/t2_mm3/Added_Bits.
 
 
 
3) [TinyOS 2.x tree checkout]
 
 
 
  Check out the current TinyOS 2.x tree.  We use the head of the T2 development
 
  tree which is a little dangerous so pay attention to what comes in with an update.
 
 
 
  a) cd <mm_t2_base>
 
  b) mkdir t2 (I use t2_<date_stamp> and then ln -s t2_<date_stamp> t2_cur)
 
  c) cd t2
 
  d) cvs -z3 -d:pserver:anonymous@tinyos.cvs.sourceforge.net:/cvsroot/tinyos co -P tinyos-2.x
 
 
 
  e) Apply mm3 specific patches to the main T2 core...
 
 
 
      .) cd <mm_t2_base>/t2_cur/tinyos-2.x
 
      .) for i in ../../t2_mm3/Added_Bits/*.patch; do \
 
            patch -p0 < $i; done
 
 
 
5) [TI USB Jtag driver fix]
 
 
 
  Initial Ubuntu 8.04 has a version of the ti_usb_3410_5052 driver (used to
 
  talk to the MSP430 jtag pod) that is slightly modified from the standard
 
  linux kernel available at kernel.org.  The standard kernel's version of the
 
  ti serial driver works so we will just reintall that.
 
 
 
  a) Expand t2_mm3/Added_Bits/mspfet_driver.zip(This will create the directory
 
      mspfet_driver).
 
  b) mspfet_driver/readme.txt has more information.  Read them.  It is good.
 
  c) make
 
  d) temporarily install the new driver.
 
 
 
      a) execute the file mspfet_driver/reload and plug the pod in.
 
 
 
      b) check /var/log/messages for the following messages.  Should be towards the end.
 
        The key thing to look for is "converter now attached to ttyUSB0" or some such.
 
 
 
/build/buildd/linux-2.6.24/drivers/usb/serial/usb-serial.c: USB Serial support registered for TI USB 3410 1 port adapter
 
/build/buildd/linux-2.6.24/drivers/usb/serial/usb-serial.c: USB Serial support registered for TI USB 5052 2 port adapter
 
usbcore: registered new interface driver ti_usb_3410_5052
 
/home/cire/Desktop/mspfet_driver/ti_usb_3410_5052.c: TI USB 3410/5052 Serial Driver v0.9
 
usb 1-2: new full speed USB device using ohci_hcd and address 2
 
usb 1-2: configuration #1 chosen from 1 choice
 
ti_usb_3410_5052 1-2:1.0: TI USB 3410 1 port adapter converter detected
 
usb 1-2: reset full speed USB device using ohci_hcd and address 2
 
usb 1-2: device firmware changed
 
ti_usb_3410_5052: probe of 1-2:1.0 failed with error -5
 
usb 1-2: USB disconnect, address 2
 
usb 1-2: new full speed USB device using ohci_hcd and address 3
 
usb 1-2: configuration #1 chosen from 2 choices
 
ti_usb_3410_5052 1-2:1.0: TI USB 3410 1 port adapter converter detected
 
ti_usb_3410_5052: probe of 1-2:1.0 failed with error -5
 
ti_usb_3410_5052 1-2:2.0: TI USB 3410 1 port adapter converter detected
 
usb 1-2: TI USB 3410 1 port adapter converter now attached to ttyUSB0
 
 
 
      b) run "lsusb" which should look something like the following:
 
 
 
m-tag (19): lsusb
 
Bus 003 Device 001: ID 0000:0000
 
Bus 002 Device 001: ID 0000:0000
 
Bus 001 Device 005: ID 0451:f430 Texas Instruments, Inc. MSP-FET430UIF JTAG Tool
 
Bus 001 Device 001: ID 0000:0000
 
m-tag (20):
 
  
 +
When the install is complete, boot the system, and use apt-get, synaptic or other package
 +
manager to make sure the following packages are installed:
  
  d) Make our new version of the ti serial driver permanent.
 
      1st make a back up of the originally installed driver
 
      (/lib/modules/<kernel version>/kernel/drivers/usb/serial/ti_usb_3410_5052.ko)
 
  
      ie:
+
  autobook  autoconf  automake  build-essentials
      modprobe -r ti_usb_3410_5052
+
  libc6-dev  libtool  openssh-client  openssh-server
      cd /lib/modules/2.6.24-19-generic/kernel/drivers/usb/serial
+
  subversion  stow
      cp ti_usb_3410_5052.ko ti_usb_3410_5052.ko_old
+
 
      cp <mm_t2_base>/t2_mm3/Added_Bits/mspfet_driver/ti_usb_3410_5052.ko .
+
  git-core git-doc gitk gitmagic
      modprobe ti_usb_3410_5052
 
  
  
  NOTE: It is possible for the correct driver to get replaced if the system is
+
  sudo -s
  updated.  This occurs when any kernel packages are updated.  When this occurs
+
  apt-get install autobook autoconf automake build-essentials
  the permanent copy must be done again.
+
  apt-get install libc6-dev libtool openssh-client openssh-server
 +
  apt-get install subversion stow
 +
  apt-get install git-core git-doc gitk gitmagic
  
6) [USB Jtag, /dev/ttyUSBn config 2, permissions fix]
 
  
  We also want to install a udev rule that will correctly enable configuration 2
+
2) Install TinyOS toolset (msp430, avr)
  of the jtag pod (this makes it work). We also modify the permission rule so that
 
  group user can access the jtag pod.  Files exist in the msp430fet_driver directory.
 
  
  a) Install the 40-ti-usb-3410-5052.rules into /etc/udev/rules.d.
+
We want the tinyos toolset for the msp430 (telosb) and the avr (micaz, mica2).
 +
Debian packages are available from Stanford.
  
      cp 40-ti-usb-3410-5052.rules /etc/udev/rules.d
+
Modify the repository list using Applications->System->Software_Sources to include:
      mkdir -p /etc/udev/scripts
 
      cp msp430_init /etc/udev/scripts
 
  
  b) make the following change in /etc/udev/rules.d/40-permissions.rules
+
  http://tinyos.stanford.edu/tinyos/dists/ubuntu lucid main      <- if using Stanford
  
  change:
+
or
  
      SUBSYSTEM=="tty", GROUP="dialout"
+
  echo "deb http://tinyos.stanford.edu/tinyos/dists/ubuntu lucid main" >> /etc/sources.list
  
  to:
 
  
      SUBSYSTEM=="tty", GROUP="users", MODE="0660"
+
Install the following packages:
  
 +
  avr-binutils-tinyos  avrdude-tinyos  avr-gcc-tinyos  avr-libc-tinyos 
 +
  avr-tinyos  avr-tinyos-base  deputy-tinyos  msp430-binutils-tinyos
 +
  msp430-gcc-tinyos  msp430-libc-tinyos  msp430-tinyos  msp430-tinyos-base
 +
  nesc  tinyos  tinyos-2.1  tinyos-base  tinyos-required  tinyos-tools
  
  Make sure that any users that will be using the device are in group "users".
 
  
 +
  sudo -s
 +
  apt-get update
 +
  apt-get install avr-binutils-tinyos  avrdude-tinyos  avr-gcc-tinyos  avr-libc-tinyos
 +
  apt-get install avr-tinyos  avr-tinyos-base  deputy-tinyos  msp430-binutils-tinyos
 +
  apt-get install msp430-gcc-tinyos  msp430-libc-tinyos  msp430-tinyos  msp430-tinyos-base
 +
  apt-get install nesc  tinyos  tinyos-2.1  tinyos-base  tinyos-required  tinyos-tools
  
7) [Install TinyOS toolset (msp430)]
 
  
  Install the tinyos toolset.  We use the msp430 tool chain.  Debian packages are
+
3) TinyOS 2.x tree checkout
  available from Stanford.
 
  
  Modify the repository source to include:
+
Check out the current TinyOS 2.x tree.  We use the head of the T2 development
 +
tree hosted at Google Code.  This is a bit dangerous so pay attention to what comes
 +
in with an update.
  
    http://tinyos.stanford.edu/tinyos/dists/ubuntu/ hardy main
+
<t2_base> refers to the root of the T2 tree.  For example: /home/joe/t2_base or
 +
/home/joe/w  (for working).
  
  Install the following packages:
 
  
    deputy-tinyos
+
  a) cd <t2_base>
  msp430-binutils-tinyos
+
  b) mkdir <t2_cur> (one suggestion is to use t2_<date_stamp> and then ln -s t2_<date_stamp> t2_cur)
  msp430-gcc-tinyos
+
  c) cd t2_cur
  msp430-libc-tinyos
+
  d) svn checkout http://tinyos-main.googlecode.com/svn/trunk/ tinyos-2.x
  msp430-tinyos
 
  msp430-tinyos-base
 
  nesc
 
  tinyos
 
  tinyos-2.1
 
  tinyos-base
 
  tinyos-required
 
  tinyos-tools
 
  tinyos-optional (but doesn't work) (for gdb and msp430-jtag)
 
  
  
8) [Install gdb and msp430-jtag from temporary location]
+
This will pull the current SVN T2 source tree into /home/joe/t2_cur/tinyos-2.x.
  
  *** These need to be put into a hardy debian package, they will be ***
 
  *** included in the tinyos-optional (msp430 flavor)                ***
 
  
  a) cd <mm_t2_base>.  (remember to be enabled, sudo)
+
4) Modify PATH and LD_LIBRARY_PATH
  b) cd t2_mm3/Added_Bits/tools
 
  c) make install
 
  
  This should install into /opt/msp430/bin gdb.430 (the msp430-gdb debugger),
+
Make sure your PATH and LD_LIBRARY_PATH include /opt/msp430 and
  msp430-jtag and some other tools.  Appropriate libraries are installed into
+
/usr/msp430 as appropriate.
  /opt/msp430/lib.
 
 
 
 
 
9) [Modify PATH and LD_LIBRARY_PATH]
 
 
 
  Make sure your PATH and LD_LIBRARY_PATH include /opt/msp430 and
 
  /usr/msp430 as appropriate.
 
  
 
   M1="/opt/msp430"
 
   M1="/opt/msp430"
Line 180: Line 82:
 
   export LD_LIBRARY_PATH="$LD_LIBRARY_PATH:$M1/lib:$M2/lib:/usr/local/lib"
 
   export LD_LIBRARY_PATH="$LD_LIBRARY_PATH:$M1/lib:$M2/lib:/usr/local/lib"
  
10) [Set up build environment settings]
 
  
    The following environment variables must be set to build.
+
5) Set up build environment settings
 +
 
 +
The following environment variables must be set to build.
  
 
     TOSROOT
 
     TOSROOT
Line 190: Line 93:
 
     TOSMAKE_PATH
 
     TOSMAKE_PATH
  
     for example:  note: <mm_t2_base> := ~/mm_t2
+
     for example:  note: <t2_base> := ~/t2_base
 +
 
 +
  #!/bin/sh
 +
 
 +
  MOTECOM="serial@/dev/ttyS0:telosb"
 +
 
 +
  TOSROOT=~/t2_base/t2_cur/tinyos-2.x
 +
  TOSDIR=$TOSROOT/tos
 +
 
 +
  M1="/opt/msp430"
 +
  M2="/usr/msp430"
 +
  PATH="$PATH:$M1/bin:$M2/bin"
 +
  LD_LIBRARY_PATH="$LD_LIBRARY_PATH:$M1/lib:$M2/lib:/usr/local/lib"
 +
 
 +
  MAN_PATH="$MAN_PATH:$M1/man:$M2/man"
 +
 
 +
  MAKERULES=$TOSROOT/support/make/Makerules
 +
  CLASSPATH=.:$TOSROOT/support/sdk/java/tinyos.jar
 +
 
 +
  PYTHONPATH=$TOSROOT/support/sdk/python:$PYTHONPATH
 +
  PYTHONPATH=$M1/lib:$M1/bin:$M2/lib:$M2/bin:$PYTHONPATH
 +
  PYTHONPATH=$M1/lib/python2.3/site-packages:$PYTHONPATH
 +
  PYTHONPATH=$M2/lib/python2.3/site-packages:$PYTHONPATH
 +
 
 +
  #LIBMSPGCC_PATH=$M1/lib:$M2/lib
 +
 
 +
  export MAKERULES TOSDIR TOSROOT CLASSPATH PYTHONPATH LD_LIBRARY_PATH
 +
  export LIBMSPGCC MOTECOM MAMMARK_DIR TOSMAKE_PATH
  
#!/bin/sh
 
  
MOTECOM="serial@/dev/ttyS0:telosb"
+
6) mspdebug for debugging with TI JTAG debugging probe (msp430 only)
  
TOSROOT=~/mm_t2/t2_cur/tinyos-2.x
+
mspdebug is an open source program that interfaces to the TI UIF JTAG pod for debugging
TOSDIR=$TOSROOT/tos
+
msp430 cpus.  It has a user interface as well as a remote gdb debugging server.
  
MAMMARK_DIR="/home/cire/mm_t2/t2_mm3"
+
mspdebug is available as a Ubuntu package for natty (11.04) and later releases.
TOSMAKE_PATH="$TOSMAKE_PATH $MAMMARK_DIR/support/make"
+
And can be downloaded and built for 10.04 from its git repository
 +
mspdebug.git.sourceforge.net/gitroot/mspdebug/mspdebug
  
M1="/opt/msp430"
+
The following additional packages are needed:
M2="/usr/msp430"
 
PATH="$PATH:$M1/bin:$M2/bin"
 
LD_LIBRARY_PATH="$LD_LIBRARY_PATH:$M1/lib:$M2/lib:/usr/local/lib"
 
  
MAN_PATH="$MAN_PATH:$M1/man:$M2/man"
+
    libusb libusb-dev libreadline-dev libreadline6-dev
  
MAKERULES=$TOSROOT/support/make/Makerules
 
CLASSPATH=.:$TOSROOT/support/sdk/java/tinyos.jar
 
  
PYTHONPATH=$TOSROOT/support/sdk/python:$PYTHONPATH
+
  sudo apt-get install libusb libusb-dev libreadline-dev libreadline6-dev
PYTHONPATH=$M1/lib:$M1/bin:$M2/lib:$M2/bin:$PYTHONPATH
+
  cd ~/mm
PYTHONPATH=$M1/lib/python2.3/site-packages:$PYTHONPATH
+
  mkdir Others
PYTHONPATH=$M2/lib/python2.3/site-packages:$PYTHONPATH
+
  cd Others
 +
  git clone git://mspdebug.git.sourceforge.net/gitroot/mspdebug/mspdebug
 +
  cd mspdebug
 +
  make
 +
  sudo make install
  
#LIBMSPGCC_PATH=$M1/lib:$M2/lib
+
mspdebug is installed into /usr/local.  This path must be included in your $PATH
 +
variable.
  
export MAKERULES TOSDIR TOSROOT CLASSPATH PYTHONPATH LD_LIBRARY_PATH
 
export LIBMSPGCC MOTECOM MAMMARK_DIR TOSMAKE_PATH
 
  
11) Build SerialForwarder and libmote library.
+
7) Build SerialForwarder and libmote library.
  
 
     Build the serial forwarder and associated library (also includes direct serial access)
 
     Build the serial forwarder and associated library (also includes direct serial access)
 
+
 
 
       cd $TOSROOT/support/sdk/c/sf
 
       cd $TOSROOT/support/sdk/c/sf
 
       ./bootstrap
 
       ./bootstrap
 
       ./configure --prefix=/opt/stow/sf_c
 
       ./configure --prefix=/opt/stow/sf_c
 
       make
 
       make
 
+
 
 
       sudo -s
 
       sudo -s
 
       make install
 
       make install
 
+
 
 
       ("sudo make install" for some reason doesn't pick up the value of $TOSROOT properly so
 
       ("sudo make install" for some reason doesn't pick up the value of $TOSROOT properly so
 
       the make install doesn't work write unless you are root first)
 
       the make install doesn't work write unless you are root first)
 
+
 
 
       This will install bin/{sf, sflisten, sfsend, seriallisten, serialsend}, include/{message.h,
 
       This will install bin/{sf, sflisten, sfsend, seriallisten, serialsend}, include/{message.h,
 
       serialsource.h, sfsource.h}, and lib/libmote.a.  These will be installed into /opt/stow/sf_c.
 
       serialsource.h, sfsource.h}, and lib/libmote.a.  These will be installed into /opt/stow/sf_c.
 
+
 
 
+
 
   c) Install into /opt/{bin,include,lib} using stow.
+
   Install into /opt/{bin,include,lib} using stow.
 
+
 
 
       cd /opt/stow
 
       cd /opt/stow
 
       stow sf_c
 
       stow sf_c
  
12) Using the serialforwarder/seriallistener
+
 
 +
8) Using the serialforwarder/seriallistener
  
 
     a) make sure that tinyos.jar has been built.  It should live in $TOSROOT/support/sdk/java/tinyos.jar
 
     a) make sure that tinyos.jar has been built.  It should live in $TOSROOT/support/sdk/java/tinyos.jar
 
     b) to rebuild:
 
     b) to rebuild:
 
+
 
 
       cd $TOSROOT/support/sdk/java/
 
       cd $TOSROOT/support/sdk/java/
 
       make tinyos.jar
 
       make tinyos.jar
 +
 
 +
    c) Install TOSComm JNI support if needed.  Did java bitch about not finding TOSComm JNI support?
 +
 
 +
      assuming tinyos-tools is installed run:
 +
 
 +
      tos-install-jni
 +
 
 +
    d) To watch raw bytes coming from the serial port
 +
 
 +
      Make sure CLASSPATH includes $TOSROOT/support/sdk/java/tinyos.jar, ie:
 +
 
 +
          CLASSPATH=.:/home/joe/t2_base/t2_cur/tinyos-2.x/support/sdk/java/tinyos.jar
  
    c) Install TOSComm JNI support if needed.  Did java bitch about not finding TOSComm JNI support?
+
execute:
  
       assuming tinyos-tools is installed run:
+
       java net.tinyos.tools.Listen -comm serial@/dev/ttyUSB0:telosb
  
      tos-install-jni
 
  
    d) Make sure CLASSPATH includes $TOSROOT/support/sdk/java/tinyos.jar, ie:
+
And you should see packets that look something like this:  (depends on what the mote is sending)
  
      CLASSPATH=.:/home/cire/mm_t2/t2_cur/tinyos-2.x/support/sdk/java/tinyos.jar
+
            00 FF FF 00 00 12 00 21 00 12 07 09 00 0C 9E 23 00 0C 9E 30 F6 2C FF D7 FF FF
 +
            00 FF FF 00 00 12 00 21 00 12 07 05 00 0C 9E 24 00 0C 9E 3F E5 AF B1 6F 9E D4
 +
            00 FF FF 00 00 0E 00 21 00 0E 07 06 00 0C 9E 33 00 0C 9E 46 78 80
 +
            00 FF FF 00 00 0E 00 21 00 0E 07 07 00 0C 9E 33 00 0C 9E 52 FF FF
 +
            00 FF FF 00 00 10 00 21 00 10 07 08 00 0C 9E 33 00 0C 9E 61 FF FF FF FF
 +
 
 +
            00 FF FF 00 00 10 00 21 00 10 07 08 00 0C 9E 33 00 0C 9E 61 FF FF FF FF
 +
            ^  ^    ^    ^  ^  ^  ^    ^  ^  | -- sensor 8 data
 +
            |  |    |    |  |  |  |    |  |- sensor id
 +
            |  |    |    |  |  |  |    |- sensor data type
 +
            |  |    |    |  |  |  |-- length of data block
 +
            |  |    |    |  |  |-- AM type MM3_DATA
 +
            |  |    |    |  |-- AM group
 +
            |  |    |    |-- serial length
 +
            |  |    |-- src addr         
 +
            |  |-- dest addr
 +
            |-- dispatch byte - 0 says AM
 +
                           
 +
If you define MOTECOM you won't need to specify the -comm parameter. ie:
  
To listen to packets coming from the serial port, one can run a simple listener:
+
      MOTECOM=serial@/dev/ttyUSB0:telosb
  
  java net.tinyos.tools.Listen -comm serial@/dev/ttyUSB0:telosb
+
[[Category:Installation]]

Latest revision as of 20:40, 29 November 2011

1) OS Install.

Install the OS, Ubuntu (Xubuntu uses less resources) on the box. Recommended is Xubuntu 10.04 (LTS). A simple install is fine and will take less time. Current ISO install images can be found at 10.04 ISO.

When the install is complete, boot the system, and use apt-get, synaptic or other package manager to make sure the following packages are installed:


 autobook  autoconf  automake  build-essentials
 libc6-dev  libtool  openssh-client  openssh-server 
 subversion  stow
 
 git-core git-doc gitk gitmagic


 sudo -s
 apt-get install autobook autoconf automake build-essentials
 apt-get install libc6-dev libtool openssh-client openssh-server 
 apt-get install subversion stow
 apt-get install git-core git-doc gitk gitmagic


2) Install TinyOS toolset (msp430, avr)

We want the tinyos toolset for the msp430 (telosb) and the avr (micaz, mica2). Debian packages are available from Stanford.

Modify the repository list using Applications->System->Software_Sources to include:

 http://tinyos.stanford.edu/tinyos/dists/ubuntu lucid main      <- if using Stanford

or

 echo "deb http://tinyos.stanford.edu/tinyos/dists/ubuntu lucid main" >> /etc/sources.list


Install the following packages:

 avr-binutils-tinyos  avrdude-tinyos  avr-gcc-tinyos  avr-libc-tinyos  
 avr-tinyos  avr-tinyos-base  deputy-tinyos  msp430-binutils-tinyos
 msp430-gcc-tinyos  msp430-libc-tinyos  msp430-tinyos  msp430-tinyos-base
 nesc  tinyos  tinyos-2.1  tinyos-base  tinyos-required  tinyos-tools


 sudo -s
 apt-get update
 apt-get install avr-binutils-tinyos  avrdude-tinyos  avr-gcc-tinyos  avr-libc-tinyos
 apt-get install avr-tinyos  avr-tinyos-base  deputy-tinyos  msp430-binutils-tinyos
 apt-get install msp430-gcc-tinyos  msp430-libc-tinyos  msp430-tinyos  msp430-tinyos-base
 apt-get install nesc  tinyos  tinyos-2.1  tinyos-base  tinyos-required  tinyos-tools


3) TinyOS 2.x tree checkout

Check out the current TinyOS 2.x tree. We use the head of the T2 development tree hosted at Google Code. This is a bit dangerous so pay attention to what comes in with an update.

<t2_base> refers to the root of the T2 tree. For example: /home/joe/t2_base or /home/joe/w (for working).


  a) cd <t2_base>
  b) mkdir <t2_cur> (one suggestion is to use t2_<date_stamp> and then ln -s t2_<date_stamp> t2_cur)
  c) cd t2_cur
  d) svn checkout http://tinyos-main.googlecode.com/svn/trunk/ tinyos-2.x


This will pull the current SVN T2 source tree into /home/joe/t2_cur/tinyos-2.x.


4) Modify PATH and LD_LIBRARY_PATH

Make sure your PATH and LD_LIBRARY_PATH include /opt/msp430 and /usr/msp430 as appropriate.

  M1="/opt/msp430"
  M2="/usr/msp430"
  export PATH="$PATH:$M1/bin:$M2/bin"
  export LD_LIBRARY_PATH="$LD_LIBRARY_PATH:$M1/lib:$M2/lib:/usr/local/lib"


5) Set up build environment settings

The following environment variables must be set to build.

   TOSROOT
   TOSDIR
   MAKERULES
   CLASSPATH
   TOSMAKE_PATH
   for example:  note: <t2_base> := ~/t2_base
 
 	#!/bin/sh
 
 	MOTECOM="serial@/dev/ttyS0:telosb"
 
 	TOSROOT=~/t2_base/t2_cur/tinyos-2.x
 	TOSDIR=$TOSROOT/tos
 
 	M1="/opt/msp430"
 	M2="/usr/msp430"
 	PATH="$PATH:$M1/bin:$M2/bin"
 	LD_LIBRARY_PATH="$LD_LIBRARY_PATH:$M1/lib:$M2/lib:/usr/local/lib"
 
 	MAN_PATH="$MAN_PATH:$M1/man:$M2/man"
 
 	MAKERULES=$TOSROOT/support/make/Makerules
 	CLASSPATH=.:$TOSROOT/support/sdk/java/tinyos.jar
 
 	PYTHONPATH=$TOSROOT/support/sdk/python:$PYTHONPATH
 	PYTHONPATH=$M1/lib:$M1/bin:$M2/lib:$M2/bin:$PYTHONPATH
 	PYTHONPATH=$M1/lib/python2.3/site-packages:$PYTHONPATH
 	PYTHONPATH=$M2/lib/python2.3/site-packages:$PYTHONPATH
 
 	#LIBMSPGCC_PATH=$M1/lib:$M2/lib
 
 	export MAKERULES TOSDIR TOSROOT CLASSPATH PYTHONPATH LD_LIBRARY_PATH
 	export LIBMSPGCC MOTECOM MAMMARK_DIR TOSMAKE_PATH


6) mspdebug for debugging with TI JTAG debugging probe (msp430 only)

mspdebug is an open source program that interfaces to the TI UIF JTAG pod for debugging msp430 cpus. It has a user interface as well as a remote gdb debugging server.

mspdebug is available as a Ubuntu package for natty (11.04) and later releases. And can be downloaded and built for 10.04 from its git repository mspdebug.git.sourceforge.net/gitroot/mspdebug/mspdebug

The following additional packages are needed:

   libusb libusb-dev libreadline-dev libreadline6-dev


 sudo apt-get install libusb libusb-dev libreadline-dev libreadline6-dev
 cd ~/mm
 mkdir Others
 cd Others
 git clone git://mspdebug.git.sourceforge.net/gitroot/mspdebug/mspdebug
 cd mspdebug
 make
 sudo make install

mspdebug is installed into /usr/local. This path must be included in your $PATH variable.


7) Build SerialForwarder and libmote library.

   Build the serial forwarder and associated library (also includes direct serial access)
 
     cd $TOSROOT/support/sdk/c/sf
     ./bootstrap
     ./configure --prefix=/opt/stow/sf_c
     make
 
     sudo -s
     make install
 
     ("sudo make install" for some reason doesn't pick up the value of $TOSROOT properly so
     the make install doesn't work write unless you are root first)
 
     This will install bin/{sf, sflisten, sfsend, seriallisten, serialsend}, include/{message.h,
     serialsource.h, sfsource.h}, and lib/libmote.a.  These will be installed into /opt/stow/sf_c.
 
 
  Install into /opt/{bin,include,lib} using stow.
 
     cd /opt/stow
     stow sf_c


8) Using the serialforwarder/seriallistener

   a) make sure that tinyos.jar has been built.  It should live in $TOSROOT/support/sdk/java/tinyos.jar
   b) to rebuild:
 
      cd $TOSROOT/support/sdk/java/
      make tinyos.jar
 
   c) Install TOSComm JNI support if needed.  Did java bitch about not finding TOSComm JNI support?
 
      assuming tinyos-tools is installed run:
 
      tos-install-jni
 
   d) To watch raw bytes coming from the serial port
 
      Make sure CLASSPATH includes $TOSROOT/support/sdk/java/tinyos.jar, ie:
 
          CLASSPATH=.:/home/joe/t2_base/t2_cur/tinyos-2.x/support/sdk/java/tinyos.jar

execute:

      java net.tinyos.tools.Listen -comm serial@/dev/ttyUSB0:telosb


And you should see packets that look something like this: (depends on what the mote is sending)

           00 FF FF 00 00 12 00 21 00 12 07 09 00 0C 9E 23 00 0C 9E 30 F6 2C FF D7 FF FF
           00 FF FF 00 00 12 00 21 00 12 07 05 00 0C 9E 24 00 0C 9E 3F E5 AF B1 6F 9E D4
           00 FF FF 00 00 0E 00 21 00 0E 07 06 00 0C 9E 33 00 0C 9E 46 78 80
           00 FF FF 00 00 0E 00 21 00 0E 07 07 00 0C 9E 33 00 0C 9E 52 FF FF
           00 FF FF 00 00 10 00 21 00 10 07 08 00 0C 9E 33 00 0C 9E 61 FF FF FF FF
 
           00 FF FF 00 00 10 00 21 00 10 07 08 00 0C 9E 33 00 0C 9E 61 FF FF FF FF
           ^  ^     ^     ^  ^  ^  ^     ^  ^  | -- sensor 8 data
           |  |     |     |  |  |  |     |  |- sensor id
           |  |     |     |  |  |  |     |- sensor data type
           |  |     |     |  |  |  |-- length of data block
           |  |     |     |  |  |-- AM type MM3_DATA
           |  |     |     |  |-- AM group
           |  |     |     |-- serial length
           |  |     |-- src addr           
           |  |-- dest addr
           |-- dispatch byte - 0 says AM
                            

If you define MOTECOM you won't need to specify the -comm parameter. ie:

      MOTECOM=serial@/dev/ttyUSB0:telosb