April 15, 2005TinyOS: A Component Based OSPage 1 of 27 TinyOS A Component-Based Operating System for Networked Embedded Systems Tom Bush Graduate College.

Slides:



Advertisements
Similar presentations
How to use TinyOS Jason Hill Rob Szewczyk Alec Woo David Culler An event based execution environment for Networked Sensors.
Advertisements

1 Tomás Sánchez López July 9, 2004 Real-time & Embedded Systems Laboratory TinyOS … in deep.
NesC Prepared for the Multimedia Networks Group University of Virginia.
Feb 2007WSN Training: First Steps in nesC Programming1 First Steps in TinyOS and nesC Programming Topics  Timer Application: MyApp  Application directory.
1 Lab 3 Objectives  Case study: “Hello world” program on motes  Write you first program on mote.
The nesc Language: A Holistic Approach to Networked Embedded Systems David Gay, Philip Levis, Robert von Behren, Matt Welsh, Eric Brewer, David Culler.
Sensor Network Platforms and Tools
Overview: Chapter 7  Sensor node platforms must contend with many issues  Energy consumption  Sensing environment  Networking  Real-time constraints.
Mote Programming. 如何 compile 程式  make [re]install. : desired device address : target platform  install vs. reinstall install : compile the application.
TOSSIM A simulator for TinyOS Presented at SenSys 2003 Presented by : Bhavana Presented by : Bhavana 16 th March, 2005.
Chapter 13 Embedded Systems
TinyOS Introduction Advanced Computer Networks. TinyOS Outline  Introduction to the Architecture of TinyOS and nesC  Component Model –Components, interfaces,
Systems Wireless EmBedded nesC Update Eric Brewer with help from David Culler, David Gay, Phil Levis, Rob von Behren, and Matt Welsh.
How to Code on TinyOS Xufei Mao Advisor: Dr. Xiang-yang Li CS Dept. IIT.
Sample Project Ideas KD Kang. Project Idea 1: Real-time task scheduling in TinyOS EDF in TinyOS 2.x –Description is available at
OS Fall ’ 02 Introduction Operating Systems Fall 2002.
Generic Sensor Platform for Networked Sensors Haywood Ho.
Programming Motes A TinyOS and TOSSIM Tutorial By: Brent Rood.
Generic Sensor Platform for Networked Sensors Haywood Ho.
Development of a Mica2 Mote Sensor Network Cliff Macklin Bill Ehrbar December 8, 2004 University of Colorado, Colorado Springs.
1 TinyOS Mohammad Rahimi CSCI599-Spring Motivation  The new class of distributed tiny devices  The new generation of software.
TinyOS Software Engineering Sensor Networks for the Masses.
2008EECS Embedded Network Programming nesC, TinyOS, Networking, Microcontrollers Jonathan Hui University of California, Berkeley.
TinyOS Tutorial CS580S Sensor Networks and Systems February 7, 2007 Jisu Oh Dept. of Computer Science SUNY-Binghamton.
Advanced Topics on Information Systems Spring 2004 Dimitrios Lymberopoulos Advanced Topics on Information Systems Embedded Software: The Case of Sensor.
1 EE249 Discussion System Architecture Directions for Networked Sensors (J. Hill, et al) Presented By: Sarah Bergbreiter EE249 Discussion Section October.
NesC: 1.1 Bumps and Future Directions David Gay, Intel Research, Berkeley (and the nesC and TinyOS teams)
Chapter 13 Embedded Operating Systems Eighth Edition By William Stallings Operating Systems: Internals and Design Principles.
1 Lab 3 Objectives  Case study: “Hello world” program on motes  Write you first program on mote.
1 Software Development Infrastructure for Sensor Networks  Operating systems ( TinyOS )  Resource (device) management  Basic primitives  Protocols.
The nesC Language: A Holistic Approach to Networked Embedded Systems Tony Chen April 29, 2003.
TinyOS Tutorial Jianping Wang (merge several tutorials found online)
The University of Iowa. Copyright© 2005 A. Kruger 1 Introduction to Wireless Sensor Networks TinyOS Overview 10 February 2005.
Programming in nesC (and TOSSIM)
By: R Jayampathi Sampath
1 System Architecture Directions for Networked Sensors (TinyOS & Mica2) Presented by Jang Young, Kim (Chris)
1 TinyOS Computer Network Programming Wenyuan Xu Fall 2007.
TinyOS 1/2 Onsystech Sangjae Han.
1 Lab2 Objectives  Basics of TinyOS  Basics of nesC programming language.
1 Lab2 Objectives  Basics of TinyOS  Basics of nesC programming language.
TinyOS By Morgan Leider CS 411 with Mike Rowe with Mike Rowe.
Tmote Sky Doug Schultz for FWLUG (Fort Wayne Linux Users Group)
Vishal Jain, TinyOS Design Viewpoint “TinyOS” Design Viewpoint.
Dhanshree Nimje Smita Khartad
System Architecture Directions for Networked Sensors Jason Hill, Robert Szewczyk, Alec Woo, Seth Hollar, David Culler, Kris Pister Presented by Yang Zhao.
CIS 798 Sensor Network Implementation. Goals Learning sensor network programming with Crossbow motes Implement reasonable sized sensor applications Develop.
Lab 3 Introduction to TinyOS and nesC How to debug programs at PC Examples –Blink Timer –Blink –Hellow World Reference: 1.x/doc/tutorial/lesson1.html.
Simulation of Distributed Application and Protocols using TOSSIM Valliappan Annamalai.
TinyOS Tutorial Lesson 8 Data logging application.
HANBACK ELECTRONICS CO., LTD. 저자권 보호됨 TinyOS & NesC.
Part 2 TinyOS and nesC Programming Selected slides from:
Wireless Sensor Networks with Motes Gurdip Singh and Sumeet Gujrati.
@ nesC Programming KETI / Ubiquitous Computing Center Jeonghoon Kang
Main Issues Three major issues that we are concerned with in sensor networks are – Clustering Routing and Security To be considered against the backdrop.
Xiong Junjie Node-level debugging based on finite state machine in wireless sensor networks.
WSN Software Platforms - concepts Vinod Kulathumani Lecture uses some slides from tutorials prepared by authors of these platforms.
1 Lab2 Objectives  Basics of TinyOS  Basics of nesC programming language.
Lab 3, Part 2 Selected slides from: Wireless Sensor Networks Hardware/Software Tiny OS & NesC Programming borrowed from Turgay Korkmaz.
TinyOS Sandeep Gupta. Operating System (OS) What is an OS? Main functions  Process management  Memory management  Resource management Traditional OSs.
System Architecture Directions for Networked Sensors.
HANBACK ELECTRONICS CO., LTD. 저자권 보호됨 Lab1: LED Control ZigbeX mote has Red, Yellow, Green LED. This lab using LED control component provided by TinyOS.
Based on slides from Andreas Larsson Table from CY Chong, SP Kumar, BA Hamilton - Proceedings of the IEEE, 2003.
Blink Blink.nc configuration Blink { } implementation { components Main, BlinkM, SingleTimer, LedsC; Main.StdControl -> BlinkM.StdControl; Main.StdControl.
Why does it need? [USN] ( 주 ) 한백전자 Background Wireless Sensor Network (WSN)  Relationship between Sensor and WSN Individual sensors are very limited.
Software Architecture of Sensors. Hardware - Sensor Nodes Sensing: sensor --a transducer that converts a physical, chemical, or biological parameter into.
TinyOS Sandeep Gupta. TinyOS basics TinyOS is  Single tasking OS  Interrupt driven Written using a Component based language A set of components put.
TinyOS and nesC. Outline ● Wireless sensor networks and TinyOS ● Networked embedded system C (nesC) – Components – Interfaces – Concurrency model – Tool.
Simulation of Distributed Application and Protocols using TOSSIM
An Introduction to nesC
WSN Training: TinyOS/nesC Basic Concepts TinyOS and nesC
Presentation transcript:

April 15, 2005TinyOS: A Component Based OSPage 1 of 27 TinyOS A Component-Based Operating System for Networked Embedded Systems Tom Bush Graduate College of Union University

April 15, 2005TinyOS: A Component Based OSSlide 2 of 27 Overview Networked Embedded Systems Environment of TinyOS Implementation of TinyOS - nesC  Component model  Concurrency model  Compiler features Basic Example Evaluation of nesC implementation

April 15, 2005TinyOS: A Component Based OSSlide 3 of 27 Networked Embedded Systems What is a networked embedded system?  An interacting group of devices with computing components embedded in purpose built devices  Usually perform single task such as monitoring an environmental characteristic  Connected through some type of network  Usually not mobile, typically very small  Little if any human interaction

April 15, 2005TinyOS: A Component Based OSSlide 4 of 27 Networked Embedded Systems How NESs are used  Structural integrity of buildings, bridges  Monitor vehicle movements/traffic  Monitor movements of animals  Utilities data collection  Military uses Replace minefields Sniper detection

April 15, 2005TinyOS: A Component Based OSSlide 5 of 27 Networked Embedded Systems RF Mote Mica2 Golum Dust weC UCB Spec

April 15, 2005TinyOS: A Component Based OSSlide 6 of 27 Physical Constraints on NESs Relatively slow processors Small amount of memory and storage Limited battery life Must be self contained Radio or other communication Asynchronous hardware triggers

April 15, 2005TinyOS: A Component Based OSSlide 7 of 27 What is the TinyOS? An event-based operating system designed for wireless networked sensors Uses component based architecture Supports concurrent operations required by networked sensors Special purpose Single application (no multi-programming) Supports tasks (not threads)

April 15, 2005TinyOS: A Component Based OSSlide 8 of 27 TinyOS Environment NES operating system must support  Component based architecture  Tasks and event-based concurrency  Split-phase operations Commands Events

April 15, 2005TinyOS: A Component Based OSSlide 9 of 27 Introducing nesC A programming language for NESs  An extension of C  Static language, no dynamic memory allocation Supports concept of components and event-based concurrency model Whole program analysis & optimization

April 15, 2005TinyOS: A Component Based OSSlide 10 of 27 nesC Component Model Two types of components  Modules  Configurations Both types use and provide interfaces  Only point of access to components  Bi-directional; commands and events  Detailed implementation provided by components Component AComponent B

April 15, 2005TinyOS: A Component Based OSSlide 11 of 27 Interfaces A collection of 1 or more command and events Defines interaction boundary between components Providing component must implement the start and stop commands Using component must implement the fired event interface Timer { command result_t start( char type, uint32_t interval); command result_t stop(); event result_t fired(); }

April 15, 2005TinyOS: A Component Based OSSlide 12 of 27 Components Configurations  Wire other components together  Connect interfaces used by one component to those provided by another  Top level application Modules  Provide application code  Implement one or more interfaces

April 15, 2005TinyOS: A Component Based OSSlide 13 of 27 Example application Top Level Application Component C Component A Component B Component E Component D Provides Uses

April 15, 2005TinyOS: A Component Based OSSlide 14 of 27 Component Implementations configuration Blink { } implementation { components Main, BlinkM, SingleTimer, LedsC; Main.StdControl -> SingleTimer.StdControl; Main.StdControl -> BlinkM.StdControl; BlinkM.Timer -> SingleTimer.Timer; BlinkM.Leds -> LedsC; }

April 15, 2005TinyOS: A Component Based OSSlide 15 of 27 Component Implementations module BlinkM { provides interface StdControl; uses { interface Timer; interface Leds; } implementation { command result_t StdControl.init( ) { call Leds.init( ); return SUCCESS; } command result_t stdControl.start[int id] (char type, uint32_t interval) { return call Timer.start(Timer_Repeat, 1000); } command result_t StdControl.stop[int id]( ) { return call Timer.stop( ); } event result_t Timer.fired( ) { call Leds.redToggle( ); return SUCCESS; }

April 15, 2005TinyOS: A Component Based OSSlide 16 of 27 Concurrency Model Two types of concurrency in TinyOS  Tasks Travel down application graph (to HW)  Events (HW Interrupts) Travel up application graph (away from HW)

April 15, 2005TinyOS: A Component Based OSSlide 17 of 27 Tasks Delayed computations Posted by components Calls are non-blocking Handled by event scheduler (FIFO) Run to completion Can be preempted Do not preempt

April 15, 2005TinyOS: A Component Based OSSlide 18 of 27 Events Signify either  completion of a command (split-phase operation)  Hardware interrupt (environmental trigger) Run to completion Preempt tasks and other events Can call commands, post tasks, signal other events

April 15, 2005TinyOS: A Component Based OSSlide 19 of 27 Event/Task Example task void HandleFire() { uint8_t i; setIntervalFlag = 1; if (mState) { for (i=0;i<NUM_TIMERS;i++) { if (mState&(0x1<<i)) { mTimerList[i].ticksLeft -= (mInterval+1) ; if (mTimerList[i].ticksLeft<=2) { if (mTimerList[i].type==TIMER_REPEAT) { mTimerList[i].ticksLeft += mTimerList[i].ticks; } else {// one shot timer mState &=~(0x1<<i); } enqueue(i); post signalOneTimer(); } adjustInterval(); } async event result_t Clock.fire() { post HandleFire(); return SUCCESS; }

April 15, 2005TinyOS: A Component Based OSSlide 20 of 27 Concurrency Model Asynchronous code (AC) – reachable from at least one interrupt handler Synchronous code (SC) – code only reachable from tasks To prevent race conditions  Shared variables updated by SC only or in atomic code Must implement “atomic” keyword to disable interrupts when processing SC Keep atomic sections short to keep system reactive

April 15, 2005TinyOS: A Component Based OSSlide 21 of 27 Component Model Analysis ApplicationModules OS Modules (% of full OS) OS Modules (% of application) Lines OS Lines (% of full OS) OS Lines (% of application) Surge3127 (25%)87% (14%)76% Maté3528 (25%)80% (17%)53% TinyDB6538 (35%)58% (28%)36%

April 15, 2005TinyOS: A Component Based OSSlide 22 of 27 Concurrency Model Analysis nesC version 1.0  No race condition analysis  No atomic function nesC version 1.1  Added both  103 race conditions  Fixed by tasking or atomic statements

April 15, 2005TinyOS: A Component Based OSSlide 23 of 27 Fixing race conditions /* Contains a race: */ if (state == IDLE) { state = SENDING; count++; // send a packet } /* Fixed Version */ uint8_t oldState; atomic { oldState = state; if (state == IDLE) { state = SENDING; } if (oldState == IDLE) { count++; // send a packet }

April 15, 2005TinyOS: A Component Based OSSlide 24 of 27 Compiler Optimization Uses component model restrictions:  Eliminate unreachable code  Inline small functions Application Code SizeCode Reduction InlinedNoninlined Surge % Maté % TinyDB %

April 15, 2005TinyOS: A Component Based OSSlide 25 of 27 Support Functions TinyOS Simulator /*====== Core mote modes =============*/ DBG_BOOT =DBG_MODE(0),/* the boot sequence*/ DBG_CLOCK =DBG_MODE(1),/* clock*/ DBG_TASK =DBG_MODE(2),/* task stuff*/ DBG_SCHED =DBG_MODE(3),/* switch, scheduling*/ DBG_SENSOR =DBG_MODE(4),/* sensor readings*/ DBG_LED =DBG_MODE(5),/* LEDs*/ DBG_CRYPTO =DBG_MODE(6),/* Cryptography/security*/ /*====== Networking modes ============*/ DBG_ROUTE =DBG_MODE(7),/* network routing*/ DBG_AM =DBG_MODE(8),/* Active Messages*/ DBG_CRC =DBG_MODE(9),/* packet CRC stuff*/ DBG_PACKET =DBG_MODE(10),/* Packet level stuff */ DBG_ENCODE =DBG_MODE(11), /* Radio encoding/decoding*/ DBG_RADIO =DBG_MODE(12),/* radio bits*/

April 15, 2005TinyOS: A Component Based OSSlide 26 of 27 Conclusions nesC implements TinyOS concurrency and component models effectively ↑ nesC also provides compile time optimizations and race condition detection ↑ Component swapping ↑ TOSSIM and TinyViz support functions ↑ Rapidly changing hardware ↓ Everyone knows C ↑

April 15, 2005TinyOS: A Component Based OSSlide 27 of 27 Conclusions TinyOS provides great interface for distributed applications ↑ Not perfect for all applications ↓  18 pages of code to blink 1 LED?