mercredi 18 février 2009

Activating USB ports in a a VirtualMachine TOS installation

In order to have access to USB drivers of a Linux Host from a Virtual Machine (it could be vmware server or the SunxVM Virtual Box) you must modify the fstab file:
for a Ubuntu 8;10 Intrepid Ibex :
$sudo gedit /etc/fstab
Add these lines at the end of the file:

# USB for vmware/vbox and SunxVM VirtualBox
none /proc/bus/usb usbfs devgid=46,devmode=664 0

Ctrl+S (for saving)
restart the computer...
...

You can see then your USB ports available for use in the virtual machine

note:
Don't forget to give write permissions into the virtual machine TOS xubuntu installation:
$sudo chmod -R g+rw /dev/ttyUSB*

jeudi 12 février 2009

Basic Steps for programming in TOS - X

1. Identify the interfaces (and components) to use
2. Update the *module* block by adding *uses* statements for the interfaces used
3. Declare any new variable and add any needed initialization code
4. Add any program logic and calls to the used interfaces we need for our application
5. Implement any non-initialization events specified in the interfaces we plan on using
6. Update the implementation block of the application configuration file by adding a *components* statement for each component used that provides one of the interfaces chosen earlier
7. Wire the interfaces used by the application to the components which provide those interfaces

mercredi 11 février 2009

installing and using TOSSIM

In order to compile the tools located in /opt/tinyos-1.x/tools/java/net/tinyos/sim
it's necessary to install the javax.comm package (also known as the Java(tm) Communication API )available in
https://cds.sun.com/is-bin/INTERSHOP.enfinity/WFS/CDS-CDS_SMI-Site/en_US/-/USD/DownloadSingleSoftware-Start?ProductID=giPACUFBSTMAAAEYEnU5AXjS&LICENSE-aOPACUFBJXMAAAEYG3U5AXjS=on&s_eVar4=cds&VVA_00000000005000073514=Linux&VVA_00000000005000073513=English
Download the package
Unzip it wherever you want (eg in the Desktop)
copy it to yout jre library extensions directory
$sudo cp comm.jar /usr/lib/jvm/java-1.5.0-sun-1.5.0.11/jre/lib/ext/
And to your tinyos java jars directory (we never know)
$ cp comm.jar /opt/tinyos-1.x/tools/java/jars/

Now you can compile the sim tools!!

go to /opt/tinyos-1.x/tools/java

$ cd /opt/tinyos-1.x/tools/java
$ make
!!! OK!!
now you can go ahead with your tinyos Simulation tool

lundi 2 février 2009

Installing TinyOS-1.x TinyOS-2.x

I. Installation of tinyOS. No previous version is installed

The easiest way is by using the linux live cd:
http://docs.tinyos.net/index.php/Installing_TinyOS_2.0.2#One-step_Install_with_a_Live_CD

after installing you can update following these instructions:
Upgrade Feisty to Gutsy:
$sudo sed -i 's/feisty/gutsy/' /etc/apt/sources.list
$sudo apt-get update
$sudo apt-get dist-upgrade

II. Upgrading tinyOS installation

There are numerous collaboration works using TOS 1.x.
The following configuration steps are recommended in order to have a update version of TinyOS 1.1 (updated libraries and all capabilities for programming MICAZ motes).
To install the TinyOS CVS tree from sourceforge, assuming you have already
installed the TinyOS 1.1 distribution, do the following:

1. Backup your previous tinyos1.1 directory (if not, do nothing)
2. $ rpm -e tinyos
3. Check tinyos out from the sourceforge CVS repository:
$ cvs -d:pserver:anonymous@tinyos.cvs.sourceforge.net:/cvsroot/tinyos login
(you must ENTER when the password is demanded)
$cvs -z3 -d:pserver:anonymous@tinyos.cvs.sourceforge.net:/cvsroot/tinyos co tinyos-1.x

4. Don't forget to change the permission of tinyos-1.x directory:
sudo chmod -R g+rw tinyos-1.x/

5.- For compiling and installing the tinyOS 1.1 tools:
$cd $TOSROOT
$make
$sudo make install

6. As usual, compile the java code:
cd $TOSROOT/tools/java
make

III. Installation of SDK (development tools for tinyOS)
Download http://java.sun.com/javaee/sdk/ to the Desktop
$cd $HOME/Desktop/
$chmod +x java_app_platform_sdk-5_07-linux.bin
$./java_app_platform_sdk-5_07-linux.bin
when installation program is executed choice /opt/SDK as installing directory

IV. Compile TinyOS tools
$cd /opt/tinyos-1.x/tools/java
$make clean
$make all


mercredi 28 janvier 2009

uploading an application

FIRST!!!
1. Erase the memory:
$ uisp -dprog=mib510 -dpart=ATmega128 -dserial=/dev/ttyUSB0 --erase
You must use mib510 for mib510 and mib520 XBow cards
ATmega128 is for MICAZ mote
/dev/ttyUSB0 is the writing port (it's the 1st of two available ports) - you must count with write/read permission
2. compiling & uploading the program
make micaz install,0 mib510,/dev/ttyUSB0

Installing TinyOS 1.x

There are numerous collaboration works using TOS 1.x.
The following configuration steps are recommended in order to have a update version of TinyOS 1.1 (updated libraries and all capabilities for programming MICAZ motes).
To install the TinyOS CVS tree from sourceforge, assuming you have already
installed the TinyOS 1.1 distribution, do the following:

1. Backup your previous tinyos1.1 directory (if not, do nothing)
2. $ rpm -e tinyos
3. Check tinyos out from the sourceforge CVS repository:
$ cvs -d:pserver:anonymous@tinyos.cvs.sourceforge.net:/cvsroot/tinyos login
(you must ENTER when the password is demanded)
$cvs -z3 -d:pserver:anonymous@tinyos.cvs.sourceforge.net:/cvsroot/tinyos co tinyos-1.x

4. Don't forget to change the permission of tinyos-1.x directory:
sudo chmod -R g+rw tinyos-1.x/

5.- For compiling and installing the tinyOS 1.1 tools:
$cd $TOSROOT
$make
$sudo make install

6. As usual, compile the java code:
cd $TOSROOT/tools/java
make

mercredi 17 décembre 2008

Installing TinyOs in Ubuntu 8.10 IntrIepid Ibex

in the ~/.bashrc file
add at the end
# Set up TinyOS environment according to
# http://5secondfuse.com/tinyos/install.html
if [ -f ~/.bash_tinyos ]; then
. ~/.bash_tinyos
fi

create a .bash_tinyos and write
# Configuration file for tinyOS 2.0.2 in Ubuntu Intrepid Ibex

#write the path corresponding to you system configuration. Use $locate for finding the java files
#as you have installed java from tinyOS repository:
# Java
export JDKROOT=/usr/lib/jvm/java-1.5.0-sun
export JAVAXROOT=$JDKROOT
#if [ "$LD_LIBRARY_PATH" == "" ]; then
# # So Java can find libtoscomm.so and libgetenv.so
export LD_LIBRARY_PATH=$JDKROOT/jre/lib/i386
#fi
echo "Setting up for TinyOS 2.0.2"
export TOSROOT=/opt/tinyos-2.0.2
export TOSDIR=$TOSROOT/tos

export CLASSPATH=$CLASSPATH:$TOSROOT/support/sdk/java/tinyos.jar:$TOSROOT/support/sdk/java/:.

export PYTHONPATH=:$TOSROOT/support/sdk/python/
export MAKERULES=$TOSROOT/support/make/Makerules

#DEPENDING OF YOUR OWN CONFIGURATION!!!!

export MSPGCCROOT=/usr/msp430


export PATH="$MSPGCCROOT/bin:$MSPGCCROOT/include:/usr/include/linux:/usr/bin:$PATH"

# Helpful aliases
alias sf="java net.tinyos.sf.SerialForwarder"
alias listen="java net.tinyos.tools.Listen"

alias apps="cd $TOSROOT/apps"
alias tos="cd $TOSROOT/tos"

# Environment changing functions

# Change this shell's environment to support Tinyos 2.x development
function tos2 () {
export TINYOS_VER=2
. ~/.bash_tinyos
}

# Change this shell's environment to support Tinyos 1.x development
function tos1 () {
export TINYOS_VER=1
. ~/.bash_tinyos
}

function setMoteCom () {
MOTE=`motelist -c| cut -d, -f2`

TYPE="telosb"

export MOTECOM="serial@$MOTE:$TYPE"
}

# Change ownership of the TinyOS directories to the TinyOS group
function tos-fix-permissions () {
echo "sudo may prompt you for your password."
sudo chown -R root:tinyos /opt/tinyos-*
sudo chmod -R g+w /opt/tinyos-*
sudo find /opt/tinyos-* -type d -exec chmod 2775 {} \;
}