Home

Ragemaster

Recent Entries

Ragemaster

View

Advertisement

November 11th, 2008

Since upgrading my Ubuntu installation, I got plenty of compile warnings when compiling TinyOS applications.  To fix this, I just decided to reinstall TinyOS.  It can be a pain to install and each time I do it, I've got to look for resources on the internet and try a couple different things to get it working.  I'll try to keep this updated whenever I discover something new or have to upgrade or reinstall TinyOS again.  Here are the references I found to help me compile this:

All Platforms:
Installing TinyOS 2.0.2

Ubuntu:
5 Second Fuse - TinyOS Installation
Install TinyOS-2.x On Ubuntu << Udin Harun

I also got it running on my Leopard Macbook using this:
Installing TinyOS 2.x on Mac OS X (Tiger and Leopard)

This worked for me on Ubuntu 8.10 Intrepid Ibex.  I did have a previous install of TinyOS that I removed, but some stuff may have been left behind.

1.  Add the following line to /etc/apt/source.list:

deb http://tinyos.stanford.edu/tinyos/dists/ubuntu hardy main

Currently, there isn't any repository for Intrepid Ibex, but this seems to work fine.

2. Update the repository cache from a terminal window:

$sudo apt-get update

3.  Install TinyOS packages:


sudo apt-get install tinyos tinyos-avr tinyos-msp430 nesc tinyos-tools

In my case, "tinyos" caused a warning since it was an abstraction for several packages.  I installed "tinyos-2.0.2".

3a.  (Iris Support): Install TinyOS from CVS:

I also wished to have the latest TinyOS version from CVS since it seems those provided via the Stanford repository did not support the Iris mote.  To install from CVS, open a terminal window to the installation directory of your choice and run the following:

$cvs -d:pserver:anonymous@tinyos.cvs.sourceforge.net:/cvsroot/tinyos login
$cvs -z3 -d:pserver:anonymous@tinyos.cvs.sourceforge.net:/cvsroot/tinyos co tinyos-2.x
$cvs -z3 -d:pserver:anonymous@tinyos.cvs.sourceforge.net:/cvsroot/tinyos co tinyos-2.x-contrib

tinyos-2.x-contrib is a library of user-contributed code that can help in designing your own applications.  If you installed as su, you may want to change the permissions of your tinyos directory if you wish to compile anything in the apps directory or modify any TinyOS code:

$chown -R <uid> tinyos-2.x

4. Add the following environment variables to ~/.bashrc:
export TOSROOT=/opt/tinyos-2.x
export TOSDIR=$TOSROOT/tos
export CLASSPATH=$TOSROOT/support/sdk/java/tinyos.jar:.
export MAKERULES=$TOSROOT/support/make/Makerules
export PATH=/opt/msp430/bin:$PATH

Depending on the directory and version you have installed, you may need to change TOSROOT to reflect the correct directory.

5. Install TinyOS Java Toolset:

I had issues with this one: you may not have to do this step if you just use the tinyos package provided by the Stanford repository.  However, I installed via CVS and had to install the TinyOS Java toolset manually.  Ensure that you have performed Step 4 and modified your .bashrc file before proceeding.

First, from the terminal, run:
$sudo tos-install-jni

This will install the Java Toolset into your Java directory.  For some reason I had Java 1.5 (5.0), Java 1.6 (6.0), and OpenJDK installed on Ubuntu.  Oddly, javac pointed to Java 1.5 and the java command pointed to OpenJDK, which was causing errors when running TinyOS Java apps like TestSerial.  To fix this, I removed Java 1.6 and OpenJDK since these seemed to be causing nothing but problems and just about everything runs on 1.4 or 1.5 (including TinyOS Java libraries).  Now java and javac point to Java 1.5 (Hopefully doing this didn't toast some other application).

You can then compile the TinyOS Java libraries by running the following in the terminal:
$cd $TOSROOT/support/sdk/java
$make

6. Install Graphviz
This step seems to be optional, but you need it if you want to run the Oscilloscope application.  In a terminal, run:
$sudo apt-get install graphviz

TinyOS wants an old version of Graphviz, but Oscilloscope seems to run fine.

7. Check your TinyOS Installation:
From a terminal, run:
$ tos-check-env

Running this, I have received errors about the Graphviz version, but the Oscilloscope application runs fine with the newer version.

To test your installation with Telos-based motes, try:
$ cd /opt/tinyos-2.x/apps/Blink
$ make telosb install.0 bsl,/dev/ttyUSB0

To test with Iris motes, try:
$cd /opt/tinyos-2.x/apps/Blink
$make iris install.0 mib510,/dev/ttyUSB0

To test the serial connection with Telos-based motes, try:
$cd /opt/tinyos-2.x/apps/tests/TestSerial
$make telosb install.0 bsl,/dev/ttyUSB0
$java TestSerial -comm serial@/dev/ttyUSB0:telos

To test the serial connection with Iris-based motes, try:
$cd /opt/tinyos-2.x/apps/tests/TestSerial
$make iris install.0 bsl,/dev/ttyUSB0
$java TestSerial -comm serial@/dev/ttyUSB1:iris

It seems that with the Iris, applications must be installed via the mib510 board (ttyUSB0) and data can be retrieved by accessing the mote itself (ttyUSB1).

7.  Issues
In addition to the Graphviz errors, for some reason the motelist command does not see the mib510 interface board or the Iris.  However, when I install to /dev/ttyUSB0 or listen to /dev/ttyUSB1, the installation works fine.  motelist does recognize the Iris on OS X, however.

March 4th, 2008

More lab grading script

Add to Memories Tell a Friend
Got my lab grading script to account for infinite loops (hopefully, I'll have to test it more). Basically, if the read pipe from the student's running program has data to be read for at least x seconds, it will detect the program as being stuck in an infinite loop and kill the program. I also truncate any output produced to 1200 characters so that the log file is readable.

It seems that it wasn't working before because the php function to block until data could be read from the read pipe (stream_select()) was timing out too quickly, leading to data being sent to the write pipe prematurely.

Now anyone trying to screw with my auto-grading with an infinite loop won't be able to.

It's funny that I keep adding these features and there are only six labs left. Maybe some future TAs will want to use this script, as it seems much better than the grading scripts used by previous TAs.

March 2nd, 2008

Lab grading script

Add to Memories Tell a Friend
This week was the first lab where my intro Java students were supposed to write loops, so now I’ve got to modify my grading script to handle infinite loops. On each attempt to read output from the student’s program, I measure the current program execution time using microtime(). For some reason the PHP microtime() seems to screw with the input pipes from the executing program and the input and output streams aren't recorded in the correct order. I would be better off running a student's program from a separate thread and killing off the whole thread from the parent thread once the execution time passes some threshold. It seems the more code I put in the pipe I/O section of my code the weirder the order of the input and output becomes. This definitely seems like a timing issue. I don't think PHP allows for multi-threaded scripts -- I may be better off using this approach in C++ or Java, but then I would have to rewrite my whole grading script. I’ll try getting what I have to work first before thinking about the drastic step of rewriting everything in Java or C++.
Powered by LiveJournal.com