Toolchain Setup

Updatede 01/11/2012 - emgaa07

Needed for avr c development: avr-binutils, avr-gcc, avr-libc.

Needed to interface with the jtag dongle: avarice

Needed for tinyos development: nesc, tinyos-tools

General info: we assume a *nix environment, either native (mac, linux) or emulated (cygwin if you use windows)

Mac

We use macports to automatize the process as much as possible.

NOTE: May have compabillity issues with version 1.7 and above, 1.6 is confirmed to work

Once you installed it, add our own repository by editing the file /opt/local/etc/macports/sources.conf (you need superuser rights to do it) so that it looks like that:

...
# maersk online repository
http://www.mmmi.sdu.dk/macports/
...
# official macports repository
rsync://rsync.macports.org/release/ports/
...

(where dots of course represent other eventual repositories you may have in your sources list); please note that it is important that the maersk repository appears BEFORE the official macports one in the list, as it overrides some ports already provided by the official distribution.

Then, issue a

sudo port sync

followed by a

sudo port install tinyos-tools avarice

This should install everything you need thanks to dependency chaining.

Linux (Ubuntu 12.04)

If you are running 64 bit i sugest using a 32 bit Virtualbox instead.

Installing tinyos.

Add software source

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

Update sourcelist:

sudo apt-get update

Install tinyos-2.1.1:

sudo apt-get install tinyos-2.1.1.

Change the enviroment variables:

sudo gedit ~/.bashrc

Add this to the end:

export TOSROOT=/opt/tinyos-2.1.1
export TOSDIR=$TOSROOT/tos
export CLASSPATH=$TOSROOT/support/sdk/java/tinyos.jar:.$CLASSPATH
export MAKERULES=$TOSROOT/support/make/Makerules
export PATH=/opt/msp430/bin:$PATH
source /opt/tinyos-2.1.1/tinyos.sh

Use command:

source ~/.bashrc

Get the access authority to the tinyos folder:

sudo chown usr_name:usr_name -R /opt/tinyos-2.1.1/
/opt/tinyos-2.x files: chown -R <your uid> /opt/tinyos-2.x

Install tinyos jave tools:

tos-install-jni

Go to “$TOSROOT/support/sdk/java/” and type:

make
make install

Go to Atron-specific software download

Linux (outdated)

You can follow the standard tinyos installation instructions although with a different repository, and you may need a patched version of avarice, not provided by default.

Instead of the repository suggested above, use e.g.

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

(if using a different version of Ubuntu, see [1] for available options). If you already have installed binutils-avr this will conflict, so uninstall that first.

Explanation for avarice: since at runtime we use the JTAG pins for serial communication with the robot (thus disabling the JTAG functionality), Avarice needs to keep the external reset pin high when programming the AVR in order not to make it boot and therefore disable JTAG. When I last checked, this was not a standard feature of Avarice, therefore I patched the 2.7 version with the files that you can find under the "files" folder of this archive http://www.mip.sdu.dk/macports/cross/avarice.tgz . More recent versions of Avarice may do this by default.

Windows (outdated)

If any windows - knowledgeable person wants to fill this section he/she is welcome to do so.

Some information can be found under the tinyos install page.

A reasonable easy way to be up and running using windows is to use the following procedure based on vmware, I assume you have a vmware player installed, otherwise you can get one from http://www.vmware.com/products/player/ most of this guide should also work for a regular ubuntu installation, just omit the vmware specifics.

Next I downloaded the most recent ubuntu vmware image from http://isv-image.ubuntu.com/vmware in my case this was the Ubuntu-7.10-desktop-i386.zip

Before running the image it is nessecary to add the following lines to the .vmx file in order to access USB, serial and network devices:

usb.present = "TRUE"
usb.generic.autoconnect = "FALSE"
serial0.present = "TRUE"
serial0.fileName = "Auto detect"
serial0.autodetect = "TRUE"
Ethernet0.connectionType = "nat"
serial0.startConnected = "FALSE"
tools.syncTime = "FALSE"
usb.autoConnect.device0 = "path:1/1/0 autoclean:1"
usb.autoConnect.device1 = ""

Next run the vmware image, and create users if desired, the default root passwd is 'ubuntu' but you might want to change this...

In order to bring the image up-to-date run the following, this updates all the packages installed and might take a while.

apt-get update
apt-get upgrade

Next add the following line to the file /etc/apt/sources.list in order to add the tinyos repository to the apt sources. This assumes that you are running the ubuntu version named 'hardy'.

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

Now we are ready to install the tinyos stuff.

apt-get update
apt-get install tinyos-2.1.0 subversion

And then a regular svn checkout:

svn co https://svn.mip.sdu.dk/mpl/atronSDK

and adding the following lines to the .bashrc file will setup the evironment variables:

sudo gedit ~/.bashrc
export ATRON_SDK=/path-to-atronSDK/atronSDK
export ATRON_SDK_VERSION=trunk
source $ATRON_SDK/$ATRON_SDK_VERSION/env_variables
export JTAG=/dev/ttyS0
source ~/.bashrc

for downloading to the modules I use avrdude, example:

avrdude -p m128 -u -U flash:w:main.ihex -C /etc/avrdude/avrdude.conf -c jtag2

this will download the file main.ihex using a standard Atmel JTAGICE mkII programmer, this is not compatible with the propox devices.

Atron-specific software download

Inside a folder of your choice (say, "/path-to-atronSDK"), checkout the atronSDK specific tinyos source tree:

svn co https://svn.mip.sdu.dk/mpl/atronSDK/tinyos-2.x

Then (issue the command from the SAME location!) checkout the version you want to use of the sdk itself:

svn co https://svn.mip.sdu.dk/mpl/atronSDK/tags/version

where version is a specific release, like 0.1 (see release history below), or

svn co https://svn.mip.sdu.dk/mpl/atronSDK/trunk

for the svn version (bleeding edge, not recommended).

Then, define two environment variables to point to the atronSDK folder and the version you are using and source a file containing the extra env stuff we need.

Most probably you will do so by editing you .profile or .bashrc file and adding:

sudo gedit ~/.bashrc
export ATRON_SDK=/path-to-atronSDK/atronSDK
export ATRON_SDK_VERSION=tags/version
# the next one if you use the svn version
#export ATRON_SDK_VERSION=trunk
source $ATRON_SDK/$ATRON_SDK_VERSION/env_variables
source ~/.bashrc

 

ATRON programming for dummies (software people like Ulrik)

Valid make targets are

  • Compile program for northern hemisphere
make atronNorth
  • Compile program for southern hemisphere
make atronSouth
  • Programming e.g. northern hemisphere using JTAG
make atronNorth reinstall
  • Recompiling and programming e.g. northern hemispere (e.g., everything):
make atronNorth install

The makefiles require you to set the JTAG environment variable to point to the USB connection, e.g.

export JTAG=/dev/ttyUSB0

(Note that the actual value should be whatever special device is assigned to the programmer on your system - if you change the programmer the file name also changes.)

You might need to get permission to use the usb:

sudo chmod 666 /dev/ttyUSB0

You may need drivers for the JTAG programmer, which can be found here.

If you are using Virtualbox and can't find any usb devices, check this link

Connecting and working with the Propox JTAG programmer and ATRON:

  • The jumper controls whether the module is powered from the JTAG programmer (closed means powered from the programmer), use this to enable programming the module without having it powered
  • All three LEDs on the programmer should be lit, the green seems to indicate whether there is a physical connection whereas the yellow seems to indicate whether communication is really working. If the yellow light is off, unplug the programmer from the computer and plug it in OK, that should fix the problem.

Connecting and working with the serial debugging cable:

  • Connect to a USB port, on mac the special device /dev/tty.Pololu should appear. The jumper enables powering through the cable, do not use while powered through the battery. The button on the connector board resets.
  • You should have the appropriate TinyOS Java classes in your path to be able to write:
java net.tinyos.tools.PrintfClient -comm serial@/dev/tty.Pololu:2400

to get the debugging output. This Java class is available from:

tinyos-2.x/support/sdk/java/tinyos.jar

 


Previous page: Atron
Next page: Publications