If you are using Windows, see the short form of these instructions: Ptolemy II PtinyOS Domain Installation Notes for Cygwin
These installation instructions assume that you already have Viptos (or a release of Ptolemy II that includes the PtinyOS domain) installed. Viptos is a configuration of Ptolemy II, which means that it contains a specialized subset of the domains in the full version of Ptolemy II. If you already have the full version of Ptolemy II installed (i.e., your ptII installation includes the $PTII/ptolemy/domains/ptinyos directory), then you do not need to install a Viptos release, unless you are upgrading your version of Ptolemy II or Viptos. In any case, if you want to use Viptos or Ptolemy II with Viptos capabilities, you need to follow the instructions below to install the necessary tools.
svn co https://source.eecs.berkeley.edu/svn/chess/ptII/trunk ptII cd ptII export PTII=`pwd` ./configure make
cd $PTII mkdir -p vendors/ptinyos cd $PTII/vendors/ptinyos wget http://ptolemy.berkeley.edu/viptos/viptos1.0/tinyos-1.x-2007-01-17.tar.gz tar -zxf tinyos-1.x-2007-01-17.tar.gz
/usr/include/pthread.h:502: requested alignment is not a constant
, see
http://bugs.gentoo.org/145870.
cd $PTII/vendors/ptinyos wget "http://downloads.sourceforge.net/project/nescc/nescc/v1.2.8/nesc-1.2.8a.tar.gz?r=http%3A%2F%2Fsourceforge.net%2Fprojects%2Fnescc%2Ffiles%2Fnescc%2Fv1.2.8%2F&ts=1298084236&use_mirror=superb-sea2" tar -zxf nesc-1.2.8a.tar.gz cd nesc-1.2.8a ./configure make sudo make install
export TOSROOT=$PTII/vendors/ptinyos/tinyos-1.x export TOSDIR=$TOSROOT/tos export PTINYOS_MOMLROOT=$PTII/vendors/ptinyos/moml
cd $PTII ./configure
cd $TOSROOT/tools/src/ncc ./Bootstrap ./configure make sudo make install
cd $TOSROOT/apps/Blink make pc ./build/pc/main.exe 1
cd $PTII/vendors/ptinyos cat $PTII/ptolemy/domains/ptinyos/util/nc2moml/nc2moml-tinyos-1.1.15Dec2005cvs-1.tar.gz | gunzip | tar -xvf - cd $PTII/vendors/ptinyos cat $PTII/ptolemy/domains/ptinyos/util/ncapp2moml/ncapp2moml-tinyos-1.1.15Dec2005cvs-1.tar.gz | gunzip | tar -xvf -
$PTII/bin/viptos $PTII/ptolemy/domains/ptinyos/demo/SenseToLeds/SenseToLeds-InWireless.xml
Important information about running under Windows To invoke Viptos, we use $PTII/jni/launcher/launcher.exe. This tool solves problems with Cygwin and JNI.
Windows users should verify that JNI works before proceeding
cd /usr/bin cp make.exe gmake.exe cd $PTII ./configure make cd $PTII/jni/test makeYou should see:Failed: 0 Total Tests: 4 ((Passed: 4, Newly Passed: 0) Known Failed: 0) C:/cxh/ptII/jni/testIf you are using Cygwin, and the above tests fail for you, then it is very unlikely that running a TinyOS model within Viptos (or Ptolemy II) will work.
If the any of the tests above fail for you, Windows users and other users can still generate code by changing the PtinyOSDirector target from
ptII
topc
or some other TinyOS target likemica
ormica install
. See$PTII/ptolemy/configs/viptos/help.htm
for details. Only running a simulation within ptII involves JNI.Cygwin users should make sure that
/usr/local/bin
is in your path before/usr/bin
Under Cygwin, the easiest way to add/usr/local/bin
to your path is to edit$HOME/.bashrc
and addPATH=/usr/local/bin:${PATH}Another way is via the System control panel (For details, see Set the value of the PTII environment variable).If you use the Ptolemy II 6.0 cygwinDevel, you may also need to upgrade to
- autoconf-2.53 or later, (2.59 preferred)
- automake-1.5 or later (1.9.6 preferred)
- bison
- emacs
- emacs-el
- gperf
- make-3.80 or later (3.80 preferred)
- rpm
For each of the packages, download the .tar.gz or bzip2 file from one of the GNU Mirrors, unzip it, and run
configure make make install
If you wish to use pre-existing installations of nesC and TinyOS 1.x, please set up the environment variables described in the steps below to point to the proper directories. Otherwise, skip ahead to the installation instructions.
Using preexisting installations of TinyOS 1.x and nesC (v1.2.2 or later)
- If you already have TinyOS 1.x and nesC (version 1.2.2 or later, from CVS or a .tar.gz distribution) and the AVR tools and make (version 3.80 or later) installed, try:
cd $PTII mkdir -p vendors/ptinyos cd $PTII/vendors/ptinyos ln -s location_of_your_tinyos-1.x_tree tinyos-1.x ln -s location_of_your_nesc_tree nesc- Proceed to the step to Set up the necessary environment variables below.
- Proceed to the step to Reconfigure Viptos (or Ptolemy II) to recognize the new paths
Instructions for installing the AVR tools are below:
Note: If the files below do not work for you, you can use
the older files instead:
http://www.tinyos.net/dist-1.1.0/tools
. See the
original TinyOS 1.x installation directions
for additional instructions.
Choose and follow the appropriate directions for your operating system:
http://sourceforge.net/project/showfiles.php?group_id=68108
WinAVR-20040404-bin-install.exe
WinAVR-20050214-install.exe
, as of 10/05,
it will not work. When converting .nc files to .moml files,
you will see messages about avr-gcc not being able to find
cc1. Instead, install
WinAVR-20040404-bin-install.exe
.
C:\WinAVR
is preferred.
FIXME: Directories with spaces in the pathname might not work?
Installing the rpms under Cygwin is not recommended, it causes include file problems later.
rpm --ignoreos -ivh *.rpmin the directory where you saved the files.
If you get a message about checksum errors, complain
to the TinyOS authors and then reinstall Cygwin with
Unix
line endings.
Note to tinyos developers: Unix line endings are not the right choice for naive Windows users.
If you get
bash-3.00$ rpm --ignoreos -ivh *.rpm error: Failed dependencies: /bin/sh is needed by make-3.80tinyos-1 /bin/sh is needed by mspgcc-win32tinyos-20041204-2 bash-3.00$Then try
rpm --ignoreos --nodeps -ivh *.rpmNote: make is installed in the next step.
rpm -ivh *.rpmin the directory where you saved the files.
If the rpm command fails with:
error: Failed dependencies: libstdc++.so.5 is needed by avarice-2.3.20041206cvs-1.i386 libstdc++.so.5(CXXABI_1.2) is needed by avarice-2.3.20041206cvs-1.i386 libstdc++.so.5(GLIBCPP_3.2) is needed by avarice-2.3.20041206cvs-1.i386Then try:
yum install compat-libstdc++-33.i686
sudo apt-get install cvs autoconf automake java-package fakeroot gcc-3.4 sudo apt-get install gperf swig p7zip gcc-avr avr-libc binutils-avr uispThese instructions are borrowed from http://www.chadmetcalf.com/tinyos-1x-on-ubuntu. Some of the above packages may not be needed, depending on your configuration. I actually used the graphical interface provided by the Synaptic Package Manager from the System | Administration menu instead.
Note: These installation instructions have not been tested. For your convenience, the recommended installation order and flags are noted in the instructions below. The flags are from the .conf files located at http://www.tinyos.net/dist-1.1.0/tools/source.
Download the following files:
Install them with the following commands:
tar xzvf avr-binutils-2.15tinyos.tgz cd avr-binutils-2.15tinyos ./configure --target=avr make sudo make install tar xzvf avr-gcc-3.4.3.tgz cd avr-gcc-3.4.3 ./configure --target=avr --disable-nls --enable-languages=c make sudo make install cd .. tar xzvf avr-libc-1.2.3.tar.gz cd avr-libc-1.2.3 ./doconf ./domake sudo ./domake install cd .. tar --bzip2 -xvf avarice-2.4.tar.bz2 cd avarice-2.4 ./configure make sudo install tar xzvf avr-insight-6.3.tar.gz cd avr-insight-6.3 ./configure --target=avr --with-gnu-ld --with-gnu-as make sudo install
make
version 3.80 or later
installed. To check your make version, run make --version
.
If you have an earlier version, please choose the
option that corresponds to your operating system:
tar -zxf make-3.80.tar.gz cd make-3.80 ./configure make make install cd /usr/local/bin cp make.exe gmake.exe
or
Ptolemy II 3.0 CygwinDevel users will not have rpm installed, so this step won't work. Grab the tar file instead. Download http://www.tinyos.net/dist-2.0.0/tools/windows/make-3.80tinyos-1.cygwin.i386.rpm Install the rpm on the command line with
rpm -ivh make-3.80tinyos-1.cygwin.i386.rpmin the directory where you saved the file.
rpm -ivh make-3.80tinyos-1.i386.rpmin the directory where you saved the file.
/usr/local/bin
is in your path and comes
before any other paths to any older version.
mkdir -p $PTII/vendors/ptinyosThe rest of these instructions assume the above path.
Note that the value of $PTII
should not have spaces in it.
$PTII/vendors/ptinyos
cd $PTII/vendors/ptinyos gunzip nesc-1.2.7a.tar.gz tar xf nesc-1.2.7a.tarThis should create a directory called
nesc-1.2.7a
.
cd nesc-1.2.7a
Under Linux or Cygwin, you must have the following programs installed on your system:
For help with how to install these in Cygwin, see the Ptolemy II Cygwin Instructions. Note that most installations will not have gperf on them, at least, so you will likely need to install at least that.
http://sourceforge.net/cvs/?group_id=56288
cd $PTII/vendors/ptinyos cvs -d:pserver:anonymous@nescc.cvs.sourceforge.net:/cvsroot/nescc login Hit Enter when prompted for a password cvs -z3 -d:pserver:anonymous@nescc.cvs.sourceforge.net:/cvsroot/nescc co -P nesc
cd $PTII/vendors/ptinyos/nesc ./Bootstrap
./configureBy default, this configuration will cause nesC to be installed in
/usr/local
.
Make sure that /usr/local/bin
is in your path.
If you wish to install in a different directory, run
./configure --prefix=<MYDIR>
instead and add
the bin
directory to your path.
make make install
c:/cygwin/usr/local/lib/ncc/
to
c:/usr/local/lib/ncc/
:
mkdir -p c:/usr/local/lib cd c:/usr/local/lib cp -r /usr/local/lib/ncc .The reason is that Cygwin mounts directories under c:/cygwin and the WinAVR binaries don't know how to handle that.
Under Windows with WinAVR-20040404, we also had to modify c:\usr\local\lib\ncc\nesc_nx.h
so that
#include <inttypes.h>is changed to
#include <sys/types.h>Otherwise, when we try to compile nesC applications, the compiler complains that it cannot find the file.
cd $PTII/vendors/ptinyos cvs -d:pserver:anonymous@tinyos.cvs.sourceforge.net:/cvsroot/tinyos login Hit Enter when prompted for a password cvs -z3 -d:pserver:anonymous@tinyos.cvs.sourceforge.net:/cvsroot/tinyos co -P tinyos-1.x
Note to tinyos developers: why is this download so large? Perhaps there should be a core cvs module and then a contrib module?
This will create a directory tinyos-1.x
. For more
information, see http://sourceforge.net/cvs/?group_id=28656
.
tos
subdirectory in the TinyOS source
tree. PTINYOS_MOMLROOT sets the MoML output directory.
export TOSROOT=$PTII/vendors/ptinyos/tinyos-1.x export TOSDIR=$TOSROOT/tos export PTINYOS_MOMLROOT=$PTII/vendors/ptinyos/moml
setenv TOSROOT $PTII/vendors/ptinyos/tinyos-1.x setenv TOSDIR $TOSROOT/tos setenv PTINYOS_MOMLROOT $PTII/vendors/ptinyos/moml
Go to Start Menu -> Settings -> Control Panels -> System -> Advanced -> Environment Variables.
Set TOSROOT
to %PTII%/vendors/ptinyos/tinyos-1.x
Set TOSDIR
to %PTII%/vendors/ptinyos/tinyos-1.x/tos
Set PTINYOS_MOMLROOT
to %PTII%/vendors/ptinyos/moml
Note: If you are using Cygwin, and configure has trouble
finding TOSROOT
or TOSDIR
, try
expanding your $PTII
environment variable to
/cygdrive/c/ptII
or something similar. Also
try expanding the TOSROOT
and
TOSDIR
environment variables if you still have
problems.
cd $PTII ./configure
/usr/local/bin
is in your path and comes before any
other paths to any older version.
Configure and install the TinyOS 1.x nesC tools.
cd $TOSROOT/tools/src/ncc ./Bootstrap ./configureBy default, this configuration will cause the tools to be installed in
/usr/local
. We assume that
/usr/local/bin
is in your path. If you wish to
install in a different directory, run ./configure
--prefix=<MYDIR>
instead and add the
bin
directory to your path.
make make install
cd $TOSROOT/apps/Blink make pc ./build/pc/main.exe 1The Blink application should successfully compile. When running the executable, you should see TOSSIM output. See $TOSROOT/doc/tutorial/lesson5.html or the online version of tutorial lesson 5 for more information.
cd $PTII/vendors/ptinyos cat $PTII/ptolemy/domains/ptinyos/util/nc2moml/nc2moml-tinyos-1.1.15Dec2005cvs-1.tar.gz | gunzip | tar -xvf -This will create
$PTII/vendors/ptinyos/moml
and contains the MoML libraries corresponding to the Dec 2005 TinyOS RPM release.
If you want to generate the MoML library files from scratch, see $PTII/ptolemy/domains/ptinyos/util/nc2moml/index.htm
cd $PTII/vendors/ptinyos cat $PTII/ptolemy/domains/ptinyos/util/ncapp2moml/ncapp2moml-tinyos-1.1.15Dec2005cvs-1.tar.gz | gunzip | tar -xvf -This will create
$PTII/vendors/ptinyos/momlapp
and contains the MoML applications corresponding to the Dec 2005 TinyOS RPM release.
If you want to generate the MoML application files from scratch, see $PTII/ptolemy/domains/ptinyos/util/ncapp2moml/index.htm
$PTII/bin/viptos
and run one of the demos.