User Tools

Site Tools


wsn:tinyos:esb

TinyOS Installation for ESB

What you need and where you get it

TinyOS installer Get the tinyos-1.1.11-3is.exe installer here http://www.tinyos.net/windows-1_1_0.html or direct link Installer Orignal install and download instructions Here

GCC-MSP430-toolchain Download mspgcc-win32 from http://sourceforge.net/project/showfiles.php?group_id=42303&package_id=68584

1.1.15 TinyOS CVS Snapshot Download the 1.1.15 or most recent TinyOS rpm file from http://webs.cs.berkeley.edu/tos/dist-1.1.0/tinyos/windows/

TinyOS ESB extension Download the esb platform extension from http://www.inf.fu-berlin.de/inst/ag-tech/scatterweb_net/tools/downloads/esb.exe

Install instructions

  1. First use the tinyos installer and install tinyos to the default path. This installs everything you need. Includes Cygwin, java…
  2. Update cygwin with the cygwin setup. Here
  3. Install mspgcc-win32 to the default path and delete or rename the cygwin1.dll located in the defaultpath/bin folder
  4. Copy the Tinyos 1.1.15 rpm somewhere into your cygwin home path. To upgrade execute rpm –force –ignoreos -Uvh Name.rpm with Name = name of the rpm file in the folder containing the rpm file
  5. Extract the esb platform extnsion and
  • Copy the Target (esb.target and esb_flash.target) and extra (esw.extra) files to (installfolder)\cygwin\opt\tinyos-1.x\tools\make
  • Copy the ESB subfolder to (installfolder)\cygwin\opt\tinyos-1.x\tos\platform
  1. File Updates: to make it work you need to update some files.
  • “(installfolder)\cygwin\opt\tinyos-1.x\tos\platform\esb\msp430hardware.h”
In file "msp430hardware.h" replace line 157 "inline void TOSH_sleep() {" with "inline void __nesc_atomic_sleep() {"
  • “(installfolder)\cygwin\opt\tinyos-1.x\tos\platform\esb\HPLPowerManagementM.nc”
Replace in file "HPLPowerManagementM.nc" from line 42 til 50
----------------------------------------
  command result_t Enable() {
    LPMode_enable();
    return SUCCESS;
  }
 
  command result_t Disable() {
    LPMode_disable();
    return SUCCESS;
  }

replace this with


  async command result_t PowerManagement.enable() {
    LPMode_enable();
    return SUCCESS;
  }
 
  async command result_t PowerManagement.disable() {
    LPMode_disable();
    return SUCCESS;
  }
 
  command result_t Enable() {
    return call PowerManagement.enable();
  }
 
  command result_t Disable() {
    return call PowerManagement.disable();
  }

You are ready to build your first TinyOS application.

First steps - Programming TinyOS

First steps on TinyOS

I’ll make a little introduction to TinyOS. How to create applications and how to get them running on our nodes.

First change to (installpath)/opt/tinyos-1.x/apps and create a new directory for your first application. I'll use MyApp. We will create two files for our example. First MyAppC.nc. This is the configuration file. All applications need a top-level configuration file typically named after the application itself.

MyAppC.nc 
configuration MyAppC {
}
implementation {
  components Main, MyAppM;
 
  Main.StdControl -> MyAppM.StdControl;
 
}

The next file we will create is the module file. A module file is not always necessary. Doe to the fact that our application provides the StdControl interface we have to include every function and event provided by that interface. That are init(), start() and stop().

MyAppM.nc 
module MyAppM {
  provides {
    interface StdControl;
  }
}
implementation {
 
  command result_t StdControl.init() {
    return SUCCESS;
  }
 
  command result_t StdControl.start() {
    return SUCCESS;
  }
 
  command result_t StdControl.stop() {
    return SUCCESS
  }
 
}

Until now our little application does nothing and if we flash it on out nodes we can't see anything. To change that and to show that our nodes are alive we will extend this little basic application with a timer that periodically turns one of our leds on and off.

First we need to include the configuration files for the timer and the leds. SingleTimer and LedsC.

Our configuration file now looks like this:

MyAppC.nc 
configuration MyAppC {
}
implementation {
  components Main, MyAppM, SingleTimer, LedsC;
 
  Main.StdControl -> MyAppM.StdControl;
  Main.StdControl -> SingleTimer.StdControl;
  MyAppM.Timer -> SingleTimer.Timer;
  MyAppM.Leds -> LedsC;
 
 
}

In the components line we included the SingleTimer and LedsC configuration files. After that we wired the stdcontrol of the single timer with the main std control. The timer and leds are now wired with the interface we use in our module file.

The module file now looks like this:

MyAppM.nc 
 
module MyAppM {
  provides {
    interface StdControl;
  }
  uses {
    interface Timer;
    interface Leds;
  }
}
implementation {
 
  command result_t StdControl.init() {
    call Leds.init();
    return SUCCESS;
  }
 
  command result_t StdControl.start() {
    return call Timer.start(TIMER_REPEAT, 1000) ;
  }
 
  command result_t StdControl.stop() {
    return call Timer.stop();
  }
 
  event result_t Timer.fired()
  {
    call Leds.redToggle();
    return SUCCESS;
  }
}

Now we are ready to compile and flash our little application onto our node.

First lets see if there are any compiling errors in our code. Type 'make esb' to compile the app. If there are no errors we are ready to flash it on the node. Type 'make esb_flash' to compile our app and flash it on the node. If the process finishes our node should start flashing.

For further informations there is a Tutorial that comes with TinyOS. The location is (installfolder)\cygwin\opt\tinyos-1.x\doc\tutorial\index.html

wsn/tinyos/esb.txt · Last modified: 2012/11/08 14:14 (external edit)