TinyOS and nesC. Outline ● Wireless sensor networks and TinyOS ● Networked embedded system C (nesC) – Components – Interfaces – Concurrency model – Tool.

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

NesC Prepared for the Multimedia Networks Group University of Virginia.
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.
Lecturer: Sebastian Coope Ashton Building, Room G.18 COMP 201 web-page: Lecture.
TinyOS Introduction Advanced Computer Networks. TinyOS Outline  Introduction to the Architecture of TinyOS and nesC  Component Model –Components, interfaces,
Chapter 13 Embedded Systems Patricia Roy Manatee Community College, Venice, FL ©2008, Prentice Hall Operating Systems: Internals and Design Principles,
Static Analysis of Embedded C Code John Regehr University of Utah Joint work with Nathan Cooprider.
Vertically Integrated Analysis and Transformation for Embedded Software John Regehr University of Utah.
Contiki A Lightweight and Flexible Operating System for Tiny Networked Sensors Presented by: Jeremy Schiff.
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
1 Concurrent and Distributed Systems Introduction 8 lectures on concurrency control in centralised systems - interaction of components in main memory -
Tiny OS Optimistic Lightweight Interrupt Handler Simon Yau Alan Shieh CS252, CS262A, Fall The.
Tiny OS Optimistic Lightweight Interrupt Handler Simon Yau Alan Shieh
Development of a Mica2 Mote Sensor Network Cliff Macklin Bill Ehrbar December 8, 2004 University of Colorado, Colorado Springs.
Chapter 13 Embedded Systems
TinyOS Software Engineering Sensor Networks for the Masses.
Introduction to TinyOS. Faster, Smaller, Numerous Moore’s Law –“Stuff” (transistors, etc) doubling every 1-2 years Bell’s Law –New computing class every.
2008EECS Embedded Network Programming nesC, TinyOS, Networking, Microcontrollers Jonathan Hui University of California, Berkeley.
Software Issues Derived from Dr. Fawcett’s Slides Phil Pratt-Szeliga Fall 2009.
NesC: 1.1 Bumps and Future Directions David Gay, Intel Research, Berkeley (and the nesC and TinyOS teams)
PALM-3000 Software Architecture T. TRUONG Team Meeting #7 27 February 2008.
Chapter 13 Embedded Operating Systems Eighth Edition By William Stallings Operating Systems: Internals and Design Principles.
©Ian Sommerville 2004Software Engineering, 7th edition. Chapter 11 Slide 1 Architectural Design.
TinyOS 2.1 Jun Yi Partially based on the tutorial at IPSN 2009 By Stephen Dawson-Haggerty, Omprakash Gnawali, David Gay, Philip Levis, Răzvan Musăloiu-E.,
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.
Shahin Farshchi, Member, IEEE, Aleksey Pesterev, Paul Nuyujukian, Eric Guenterberg, Istvan Mody, and Jack W. Judy, Senior Member, IEEE, ” Structure of.
By: R Jayampathi Sampath
April 15, 2005TinyOS: A Component Based OSPage 1 of 27 TinyOS A Component-Based Operating System for Networked Embedded Systems Tom Bush Graduate College.
1 Lab2 Objectives  Basics of TinyOS  Basics of nesC programming language.
An Introduction to Software Architecture
1 Efficient Type and Memory Safety for Tiny Embedded Systems John Regehr Nathan Cooprider Will Archer Eric Eide University of Utah School of Computing.
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.
©Ian Sommerville 2000 Software Engineering, 6th edition. Chapter 10Slide 1 Architectural Design l Establishing the overall structure of a software system.
Simulation of Distributed Application and Protocols using TOSSIM Valliappan Annamalai.
HANBACK ELECTRONICS CO., LTD. 저자권 보호됨 TinyOS & NesC.
Part 2 TinyOS and nesC Programming Selected slides from:
System Architecture of Sensor Network Processors Alan Pilecki.
CE Operating Systems Lecture 3 Overview of OS functions and structure.
@ 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.
Chapter 13 – I/O Systems (Pgs ). Devices  Two conflicting properties A. Growing uniformity in interfaces (both h/w and s/w): e.g., USB, TWAIN.
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.
Slide 1 Chapter 8 Architectural Design. Slide 2 Topics covered l System structuring l Control models l Modular decomposition l Domain-specific architectures.
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 Introduction to Programming Pritee Parwekar.
Computer System Structures
John D. McGregor Module 3 Session 2 Architecture Analysis/Design
Lazy Preemption to Enable Path-Based Analysis of Interrupt-Driven Code
Simulation of Distributed Application and Protocols using TOSSIM
David Gay Intel Research Berkeley
Lecture 1: Multi-tier Architecture Overview
An Introduction to nesC
CS 501: Software Engineering Fall 1999
TinyOS CSE466 Final Project Presentation
An Introduction to Software Architecture
Modeling Event-Based Systems in Ptolemy II EE249 Project Status Report
Presentation transcript:

TinyOS and nesC

Outline ● Wireless sensor networks and TinyOS ● Networked embedded system C (nesC) – Components – Interfaces – Concurrency model – Tool chain ● Issues / conclusion

Wireless Sensor Networks ● Vision: ubiquitous computing ● Extreme dynamics ● Interact with environment using sensors and radio ● Immense scale ● Limited access ● Small, cheap, low-power systems

Concepts in Sensor Networks ● In-network processing and data aggregation – Radio activity 1000 times as expensive as processing ● Duty-cycling: different modes of operation – Power down unused hardware ● Systems run a single application ● Applications are deeply tied to hardware – Require customized and optimized OS

Challenges ● Limited resources: energy consumption dominates ● Concurrency: driven by interaction with environment ● Soft real-time requirements ● Reliability: reduce run-time errors, e.g. races ● High diversity of platforms ● No well-defined software/hardware boundary

TinyOS ● Component-based architecture – Reusable system components: ADC, Timer, Radio ● Tasks and event-based concurrency – No user-space or context switching supported by hardware – Tasks run to completion only preempted by interrupts ● All long-latency operations are split-phase – Operation request and completion are separate functions

Introducing nesC ● A “holistic” approach to networked embedded systems ● Supports and reflects TinyOS's design ● Extends a subset of C ● A static language – All resources known at compile-time – Call-graph fully known at compile-time

Design Decisions for nesC ● Components ● Bidirectional interfaces ● Simple expressive concurrency model ● Whole-program analysis

Components ● Challenge: platform diversity, flexible SW/HW boundary, applications deeply tied to hardware ● Encourages modular design ● Restrict access to private data ● Allow underlying implementations to be replaced easily ● Can abstract HW using thin wrappers ● Allow specialization of applications to hardware

Example Component Graph

Module Components ● Modules implement application code ● Modules have private state – Sharing of data among components is discouraged ● Convention: – Module names end with 'M', e.g. BlinkM – Module variables start with 'm_', e.g. m_timers

Configuration Components ● Configurations wire other components together ● All applications have a top-level configuration ● A component interface may be wired zero or more times – Used for StdControl to implement power management ● Convention: – Configuration names end with 'C', e.g. TimerC (unless it is the top-level configuration ;-)

Modules and Configurations

Bidirectional Interfaces ● Challenge: flexible SW/HW boundary and concurrency ● Support split-phase operations ● Commands: call down the component graph – Implemented by provider ● Events: call up the component graph – Implemented by user

Interfaces

Parameterized Interfaces

Concurrency Model ● Challenge: extreme dynamics and soft real-time requirements ● Cooperative scheduling ● Light-weight tasks ● Split-phase operations: non-blocking requests ● Built-in atomic sections – Limited crossing of module boundaries

Sources of Concurrency ● Tasks – Deferred computation – Run sequential and to completion – Do not preempt ● Events – Run to completion, and may preempt tasks and events – Origin: hardware interrupts or split-phase completion

Tasks and Events

Whole-Program Analysis ● Compilation can examine complete call-graph – Remove dead-code – Eliminate costly module boundary crossings – Inline small functions ● Back-end C compiler can optimize whole program – Perform cross component optimizations – Constant propagation, common subexpression elimination ● Allows detection of race conditions

Synchronous and Asynchronous ● Asynchronous code (AC): – Code reachable from at least one interrupt handler – Events signaled directly or indirectly by hardware interrupts ● Synchronous code (SC): – “Everything else...” – Primarily tasks

Detecting Race Conditions ● Invariant: SC is atomic with respect to other SC ● Two claims about updates for AC/AC and SC/AC: – Any update to shared state from AC is a potential race condition – Any update to shared state from SC that is also updated from AC is a potential race condition ● Race-free invariant enforced at compile time: – Updates to shared state is either SC only or in atomic section

Dealing with Race Conditions ● Use atomic sections to update shared state – atomic { shared_var = 1; } ● Convert code with updates to shared state to tasks ● Mark false positive with norace qualifier – norace uint8_t variable;

The nesC Toolchain: nesdoc ● Generate code documentation using simple tags ● Same concept as javadoc ● Can generate a component graph using dot

The nesC Toolchain: nescc ● The nesC compiler for TinyOS ● Implemented as an extension to GCC ● Called via TinyOS wrapper ncc ● Input: path to TinyOS code + nesC files – Platform code implements API of macros and functions in C ● Output: C code or object code (if supported by GCC)

The nesC Toolchain: ncg and mig ● Allows integration with Java code ● Typical use: interact with network through base station ● ncg - extract constants from nesC files – Generates class that contains constants ● mig - message interface generator for nesC – Generates class that encodes and decodes messages

Issues for nesC ● Problem for data shared across components – False positives for buffer swapping ● Problem for data shared between split-phase operations – Event can potentially fire if other components access HW ● Some TinyOS idioms are not well expressed – Parameterized interfaces each with private state

Issues for Applications ● Focus early on modeling it as a state-machine ● Design duty-cycling from the start – Affect the state-machine so hard to add later ● Abstracting functionality into components – Makes it harder to access shared state: encapsulate shared state in a separate module ● Configuring TinyOS for the application needs – By default there can only be 8 posted tasks

Conclusions for nesC ● Bidirectional interfaces fit the TinyOS model ● Components are a good abstraction ● Concurrency model meets requirements in applications ● The restrictions in nesC introduce practical problems ● Not limited to the domain of embedded systems