190 likes | 359 Views
COE 499 Wireless Sensor Networks. LAB 1. Material covered in this lab. Definition of Tiny Operating System. The need for TinyOS Development and History of TinyOS Component, Event Driven and Object Oriented Programming Using TinyOS Environment and Instillation nesC. Definition of TinyOS.
E N D
COE 499Wireless Sensor Networks LAB1 KFUPM, COE 499. Ayman Al Bassam
Material covered in this lab KFUPM, COE 499. Ayman Al Bassam • Definition of Tiny Operating System. • The need for TinyOS • Development and History of TinyOS • Component, Event Driven and Object Oriented Programming • Using TinyOS • Environment and Instillation • nesC
Definition of TinyOS KFUPM, COE 499. Ayman Al Bassam Formal Definition: TinyOS is an open-source operating system designed for wireless embedded sensor networks. It features a component-based architecture which enables rapid innovation and implementation while minimizing code size as required by the severe memory constraints inherent in sensor networks. TinyOS's component library includes network protocols, distributed services, sensor drivers, and data acquisition tools – all of which can be used as-is or be further refined for a custom application. TinyOS's event-driven execution model enables fine-grained power management yet allows the scheduling flexibility made necessary by the unpredictable nature of wireless communication and physical world interfaces.
Definition of TinyOS • TinyOS has been ported to over a dozen platforms and numerous sensor boards. A wide community uses it in simulation to develop and test various algorithms and protocols. New releases see over 10,000 downloads. Over 500 research groups and companies are using TinyOS on the Berkeley/Crossbow Motes. Numerous groups are actively contributing code to the sourceforge site and working together to establish standard, interoperable network services built from a base of direct experience and honed through competitive analysis in an open environment. KFUPM, COE 499. Ayman Al Bassam
Definition of TinyOS KFUPM, COE 499. Ayman Al Bassam In Simple words: Tiny OS is an open source programming environment that is portable across different platforms (Motes) and works under Linux like environment. TinyOS implements Component-based Programming i.e. It provides different libraries and code that can be used in conjunction with the developer’s code. Main component includes the Boot sequence the OS scheduler and different interfaces to interact with different peripherals (sensors, radio chips ...) Basically you are tailoring your own OS according to your needs !!
The need for TinyOS KFUPM, COE 499. Ayman Al Bassam • To set a standard operating system and programming tools that can be used in the industry. making merging applications from generation of hardware to a newer one easier. • Many constrains are imposed by the hardware like: power consumption, limited computational power and storage thus, the need for a specialized OS. • Allowing different devices from different manufactures to use the same code.
Development & History of TinyOS • TinyOS began as a project at UC Berkeley as part of the DARPA NEST program. It has since grown to involve thousands of academic and commercial developers and users worldwide. (list in reverse chronological order). • 1999: First TinyOS platform (WeC) and OS implementations are developed at Berkeley. KFUPM, COE 499. Ayman Al Bassam
Development & History of TinyOS • 2000: Berkeley designs the rene platform and partners with Crossbow, Inc., who mass produces the hardware. TinyOS version 0.43 is made available to the public via SourceForge. Pre-1.0 versions of TinyOS are a mix of C and Perl scripts. • April 2002: Work on the nesC programming language begins as a collaboration between Intel Research and UC Berkeley. • September 2002: TinyOS version 1.0, implemented in nesC, is released. KFUPM, COE 499. Ayman Al Bassam
Development & History of TinyOS • June 2004: Working group forms on next steps for TinyOS, based on experiences porting to new platforms. Group agrees to start work on 2.0. • November 2006: TinyOS 2.0 released at the SenSys conference in Boulder, CO. • August 2008: TinyOS 2.1.0 released. KFUPM, COE 499. Ayman Al Bassam
Component, Event Driven and Object Oriented Programming KFUPM, COE 499. Ayman Al Bassam Tiny OS introduces a new concept in programming called Component-based Programming. The idea is to create different components and “wire” them together. A whole application can be created with out writing a single line of code. Event driven programming is used heavily in case of an event happened a component signals another component to continue processing. Object oriented programming is implemented in means of hierarchy (the use of interfaces like Java)
Tiny OS Code Example This is the configuration file configuration BlinkAppC{ } implementation{ components MainC, BlinkC, LedsC; components new TimerMilliC() as Timer0; components new TimerMilliC() as Timer1; components new TimerMilliC() as Timer2; BlinkC -> MainC.Boot; BlinkC.Timer0 -> Timer0; BlinkC.Timer1 -> Timer1; BlinkC.Timer2 -> Timer2; BlinkC.Leds -> LedsC; } KFUPM, COE 499. Ayman Al Bassam
TinyOS Code Example The implementation Code module BlinkC { uses interface Timer<TMilli> as Timer0; uses interface Timer<TMilli> as Timer1; uses interface Timer<TMilli> as Timer2; uses interface Leds; uses interface Boot;} implementation{ event void Boot.booted() { call Timer0.startPeriodic( 250 ); call Timer1.startPeriodic( 500 ); call Timer2.startPeriodic( 1000 ); } event void Timer0.fired() { call Leds.led0Toggle(); } event void Timer1.fired() { call Leds.led1Toggle(); } event void Timer2.fired() { call Leds.led2Toggle(); } } KFUPM, COE 499. Ayman Al Bassam
Using TinyOS • TinyOS is designed to operate on Linux environment • Since most of us are used to deal with Windows a better solution has to be found. • There are 3 workarounds that we will discuss in the next slides KFUPM, COE 499. Ayman Al Bassam
Option I: Using Cygwin & Installing TOS manually • Cygwin is a freely available Linux API emulator under Windows that gives the feel and looks of Linux/Unix environment. • The disadvantage is that after installing Cygwin TOS has to be installed manually. • A tedious job but very rewarding. • Will be discussed next lab. KFUPM, COE 499. Ayman Al Bassam
Option II: Using Xubuntos Live CD • Xubuntos is a pre configure Linux distribution with TinyOS 2.0.2 • Freely available and can be booted directly from the live CD or installed as a second OS on the host machine. • Easiest way to do it and very convenient. KFUPM, COE 499. Ayman Al Bassam
Option III: Using VMWare Player & Xubuntos • VMWare player is a free Virtual machine emulator that can be used to run different images of different operating system on top of windows. • The idea is OS within another OS. • Xubuntos runs on top of Windows using VMWare player. • Very Easy and convenient to use. KFUPM, COE 499. Ayman Al Bassam
Using TinyOS • All files will be available thru the lab administrator or on the course website. • All the tools can also be obtained freely online KFUPM, COE 499. Ayman Al Bassam
nesC • Network embedded system C. • A derivative of the C programming language. • Developed by a collaboration between UC Berkley and Intel. • Modified to handle special data structures and the Object oriented/ Component-based nature of TOS. • More details will be given later on. KFUPM, COE 499. Ayman Al Bassam
Recourses • www.tinyos.net • Discussion boards and e-mail groups. • Start Goggling !! KFUPM, COE 499. Ayman Al Bassam