2009년 4월 25일 토요일

TinyOS Installation for Moteiv's Tmote Sky

TinyOS Installation for Moteiv's Tmote Sky

UPDATED: October 17, 2007
Shortcut: Now you could follow this install guide... Or you can download the LiveCD and make your life much easier. This guide is generic across Ubuntu/Kubuntu/Xubuntu and the CD is specifically for Xubuntu. It's really up to you. If you want it you can find it here or at a mirror. But I can tell you that the CD is great. Its what I use and everything works. You don't need to do anything. So by all means use it! It really is the fastest way to start working in wireless sensor networks.

If you just can't bring yourself to install over your Windows partition and rebooting into XubunTOS everytime you want to work on TinyOS is too much as well... Then you are in luck. Kevin Klues at Stanford has been nice enough to make a VMware image of XubunTOS which runs in VMware's free "Player" software. You can download the software here (User: xubuntos Passwd: tinyos). You can find a copy of the image here. Download it and and answer yes if it asks you to switch your floppy or CD-Rom.

I've updated the instructions to use Stanford's Ubuntu repository. These packages and instructions were specifically written for Fiesty Fawn (7.04) however with some simple path changes they should work (maybe/probably) for Edgy Eft or Breezy Badger

I referenced the following guides to install TinyOS:

http://moteiv.com/community/Tmote_Linux_install (Dead link)
http://www.comnets.uni-bremen.de/typo3site/index.php?id=48
http://www.tinyos.net/tinyos-2.x/doc/html/install-tinyos.html

I also stole heavily from Wade Simmons and his Toiler's version. Thanks Wade! Another big thank you to Leith Abdulla, the deb packager at Stanford. Leith has updated the Stanford msp430 toolchains to fix the previous problem where the TinyOS toolchain wouldn't compile all Boomerang apps.

This guide is specifically for getting Tmote Sky hardware from Moteiv to work. I don't have any other motes to test this against. That said this should generally work (I think) for other motes.

TinyOS 1.x: With every passing day I forget more and more about TinyOS 1.x. I don't use it and I don't recommend you use it unless you need a library/protocol/application that hasn't been ported. And even in that case, port it and move out of TinyOS 1.x. I only do a quick and dirty test of TinyOS 1.x and all you can be certain of is Blink and that the Java SDK works.

DISCLAIMER: This is how I got things working. I have seen many of the example applications working, TOSSIM, etc. But I haven't stressed tested anything. Your mileage may vary. Let me know if you find things working differently.

NOTE: Recently its come to my attention that a lot of people are using this guide. That's great. But please if you reference the guide in your own web pages include a link and don't just yank the content. Its just not cool.

Ubuntu Packages
In order to insure you have all the required packages, you'll need to add the universe and multiverse repositories for Fiesty. You'll also need to add Stanford's TinyOS repository.

First, as root, open the /etc/apt/sources.list file

Then add the universe, multiverse and Stanford repositories.

deb http://tinyos.stanford.edu/tinyos/dists/ubuntu edgy main
deb http://us.archive.ubuntu.com/ubuntu/ feisty main restricted
deb-src http://us.archive.ubuntu.com/ubuntu/ feisty main restricted
deb http://us.archive.ubuntu.com/ubuntu/ feisty-updates main restricted
deb-src http://us.archive.ubuntu.com/ubuntu/ feisty-updates main restricted
deb http://us.archive.ubuntu.com/ubuntu/ feisty universe
deb-src http://us.archive.ubuntu.com/ubuntu/ feisty universe
deb http://us.archive.ubuntu.com/ubuntu/ feisty multiverse
deb-src http://us.archive.ubuntu.com/ubuntu/ feisty multiverse
deb http://security.ubuntu.com/ubuntu feisty-security main restricted
deb-src http://security.ubuntu.com/ubuntu feisty-security main restricted
deb http://security.ubuntu.com/ubuntu feisty-security universe
deb-src http://security.ubuntu.com/ubuntu feisty-security universe
deb http://security.ubuntu.com/ubuntu feisty-security multiverse
deb-src http://security.ubuntu.com/ubuntu feisty-security multiverse
deb http://tinyos.stanford.edu/tinyos/dists/ubuntu feisty main

Now you just need to add the packages.

sudo apt-get install cvs subversion autoconf automake1.9 python-dev
sudo apt-get install g++ g++-3.4 gperf swig sun-java5-jdk graphviz alien fakeroot
sudo apt-get install tinyos-msp430 tinyos-avr

Environment Variables
This guide sets up your development environment so you can use TinyOS 1.x, TinyOS 2.x, and Boomerang. To make life easy you can download this file here and save it to your home directory. You'll need to add a line to your .bashrc to source this file on login. If you use a different shell it would be fairly trivial to change over.

# Add this to your .bashrc
if [ -f ~/.bash_tinyos ]; then
. ~/.bash_tinyos
fi

This will allow you to switch between environments on fly.

metcalfc@TinyLaptop:~$ tos1
Setting up for TinyOS 1.x
... Do TinyOS 1.x work ...
metcalfc@TinyLaptop:~$ tos2
Setting up for TinyOS 2.x ...
... Do TinyOS 2.x work
metcalfc@TinyLaptop:~$ boomerang
Setting up for TinyOS 1.x with Boomerang
... Do TinyOS Boomerang work ...

Install TinyOS 1.x
cvs -d:pserver:anonymous@tinyos.cvs.sourceforge.net:/cvsroot/tinyos login
cvs -z3 -d:pserver:anonymous@tinyos.cvs.sourceforge.net:/cvsroot/tinyos co tinyos-1.x
sudo mv tinyos-1.x /opt

Install Boomerang
For the Moteiv specific Boomerang installation you'll need to get the files from... Someone who already has them. Moteiv is now Sentilla and they aren't supporting Boomerang.

mkdir tmote
cp tmote-tools-2_0_4.zip tmote
cd tmote
unzip tmote-tools-2_0_4.zip
cd common/rpms
fakeroot alien -d tinyos-moteiv-2.0.4-1.cygwin.noarch.rpm
sudo dpkg --install *.deb
cd ~
rm -rf tmote
sudo chown -R $USER /opt/moteiv

Optional: Install TinyOS from CVS
Most of the time I'm using TinyOS 2.x so I decided to use the bleeding edge from cvs. You can put it anywhere. I've chosen my home directory. You'll still have the official release in /opt. You'll also need to update your .bash_tinyos to reflect where you put it.

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

Java Serial Communications for TinyOS 1.x
You'll need to install TOSComm in order for your TinyOS 1.x Java toolchain to work. Yes, the TinyOS-tools package from TinyOS 2.x does this but it doesn't work for 1.x. And yes the two can coexist in your $JDKROOT.
The installer detects the wrong location to install the files to because of the alternatives setup.

Edit the JAVADIR rule in the $TOSROOT/beta/TOSComm/comm/Makefile with: JAVADIR=/usr/lib/jvm/java-1.5.0-sun

Now install it. We'll alias g++ to the correct version so we don't have to edit anymore makefiles.
alias g++=g++-3.4; cd $TOSROOT/beta/TOSComm/comm; sudo make install

The End

- 5secondfuse -

2009년 4월 24일 금요일

TinyOS 1 & 2 Installation on xubuntu 8.04 (hardy-heron) alternate

1. download - xubuntu 8.04 (hardy-heron) PC(Inel x86) alternate install CD alternate.
www.xubuntu.com/get

2. excute vmware.

3. installation xubuntu.

4. Add Stanford's TinyOS repository.
#vim /etc/apt/sources.list file
deb http://tinyos.stanford.edu/tinyos/dists/ubuntu hardy main

update repository.
#sudo apt-get update

4. Add the packages.
#sudo apt-get install cvs subversion autoconf automake1.9 python-dev
#sudo apt-get install g++ g++-3.4 gperf swig sun-java5-jdk graphviz alien fakeroot
#sudo apt-get install msp430-tinyos avr-tinyos
#sudo apt-get install tinyos-tools (include all files)

5. Environment Variables
#vim /etc/profile.d/tinyos.sh
----------------------------------------------------------------------
#Java
export JAVA_HOME=/usr/lib/jvm/java-1.5.0-sun
export JDKROOT=$JAVA_HOME
export PATH=$JAVA_HOME/bin:$JAVA_HOME/jre/bin:$PATH
export CLASSPATH=$CLASSPATH:.

#Java can find libtoscomm.so and libgetenv.so
export LD_LIBRARY_PATH=$JDKROOT/jre/lib/i386

#Conditional environmental setup for TinyOS-1.x
export TOSROOT=/opt/tinyos-1.x
export TOSDIR=$TOSROOT/tos
export MAKERULES=$TOSROOT/tools/make/Makerules
export CLASSPATH=$CLASSPATH:$TOSROOT/tools/java

# Finally set the path for the MSPGCCROOT
export MSPGCCROOT=/usr/msp430
export PATH="$MSPGCCROOT/bin:$PATH"
---------------------------------------------------------------------------

6. Install TinyOS 1.x
cvs -d:pserver:anonymous@tinyos.cvs.sourceforge.net:/cvsroot/tinyos login
cvs -z3 -d:pserver:anonymous@tinyos.cvs.sourceforge.net:/cvsroot/tinyos co tinyos-1.x
# sudo mv tinyos-1.x /opt

7. Install TinyOS 2.x
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
# sudo mv tinyos-2.x /opt
# sudo mv tinyos-2.x-contrib /opt

8. Java Serial Communications for TinyOS 1.x
$TOSROOT/beta/TOSComm/comm/Makefile with:
JAVADIR=/usr/lib/jvm/java-1.5.0-sun
Now install it.
#alias g++=g++-3.4; cd $TOSROOT/beta/TOSComm/comm; sudo make install

or,,

RXTXComm install...
download site http://.www.rxtx.org/

$JAVA_HOME/jre/lib/i386/
librxtxParallel.so & librxtxSerial.so file

$JAVA_HOME/jre/lib/ext/
RXTXComm.jar file

tinyos java application source file modify...
import javax.comm.*; -> import gnu.io.*;

ubuntu 환경에서 rpm 파일을 deb 파일로 변환 설치

우분투에서는 rpm파일을 rpm으로 설치하지 않고 이를 우분투용 패키지 설치파일인 deb로 변환 한 다음 설치해야 한다.
이 변환프로그램이 바로 alien인데 apt-get으로 패키지를 설치 할 수 있다.

# sudo apt-get install alien

alien이 설치되었다면 rpm을 deb로 변환해 주어야한다.

# sudo alien -c rpmfilename.rpm

변환과정이 끝나면 debfilename.deb파일이 생성된 것을 볼 수 있다.

이제 deb파일을 다음과 같이 설치한다.

# sudo dpkg -i rpmfilename.deb

2009년 4월 19일 일요일

vmware에서 xubuntu 사용 시 휠 마우스 문제

/etc/X11/xorg.conf 파일을 다음과 같이 수정한다.

----------------------------------------
Section "InputDevice"
Identifier "Configured Mouse"
Driver "vmmouse"
Option "CorePointer"
Option "Device" "/dev/input/mice"
Option "Protocol" "ExplorerPS/2"
Option "ZAxisMapping" "4 5"
Option "Emulate3Buttons" "true"
EndSection
----------------------------------------

2009년 4월 7일 화요일

fedora 10에 이클립스 설치 후 nescdt plugin 추가.

nescdt eclipse plugin 설치는 정말 간단하다.
다음의 링크에서 nescdt plugin을 다운로드 받아 eclipse가 설치된 폴더의 plugin 폴더에 삽입하면 끝.

http://docs.tinyos.net/index.php/NESCDT-_An_editor_for_nesC_in_Eclipse

2009년 4월 3일 금요일

Fedora 10에 eclipse 설치 및 환경설정

1. eclipse를 다운로드 받는다. eclipse는 ganymede 3.4.2 classic 이다.
www.eclipse.org/ganymede

2. 사용자 계정(root 계정이 아닌)의 localhost 에 압축을 푼다.
$> tar -xvf

3. 압축을 풀고 실행을 하면 에러메시지가 뜨면서 동작하지 않는다. -.-
이를 해결하기 위해 eclipse 폴더에 있는 eclipse.ini 파일에 다음의 내용을 추가하고 재실행 한다.

.............................................
org.eclipse.platform
--launcher.XXMaxPermSize
256m
-vm
/opt/ibm/java2-i386-50/bin
-vmargs
.............................................

이제 이클립스가 정상적으로 동작할 것이다.

2009년 4월 1일 수요일

Fedora10 환경에서 TinyOS-1.x 와 TinyOS-2.x 사용하기.

먼저 앞에서 다룬 내용을 참고하여 TinyOS-1.x를 설치하고, 다음 페이지를 참고하여 TinyOS-2.x 를 설치한다.

http://docs.tinyos.net/index.php/Installing_TinyOS_2.1#One-step_Install_with_a_live_CD

TinySO-2.x 를 다운로드 후 설치한다.
$>rpm -ivh --nodeps rpmname

그럼 /opt 폴더 아래 1.x와 2.x가 존재한다.
따로 설치가 되었지만 각각 사용하는 툴 및 컴파일러 등등은 같이 사용하는 것이므로 최신버전을 설치하는것이 좋다.

설치가 끝나면 환경설정을 해야한다.
상세 내용은 env.scripts 참조...