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

Slides:



Advertisements
Similar presentations
A System Architecture for Networked Sensors Jason Hill, Robert Szewczyk, Alec Woo, Seth Hollar, David Culler, Kris Pister
Advertisements

Network II.5 simulator ..
David Culler, Jason Hill, Robert Szewczyk, Alec Woo U.C. Berkeley 2/9/2001 TinyOS Programming Boot Camp Part IV – Tiny OS 4.3 Component Overview.
A System Architecture for Tiny Networked Devices
Towards System Architecture for Tiny Networked Devices Jason Hill U.C. Berkeley.
1 Tomás Sánchez López July 9, 2004 Real-time & Embedded Systems Laboratory TinyOS … in deep.
System Integration and Performance
OPERATING SYSTEMS PROCESSES
WHAT IS AN OPERATING SYSTEM? An interface between users and hardware - an environment "architecture ” Allows convenient usage; hides the tedious stuff.
Sensor Network Platforms and Tools
U NIVERSITY OF M ASSACHUSETTS, A MHERST Department of Computer Science Emery Berger University of Massachusetts Amherst Operating Systems CMPSCI 377 Lecture.
Computer Systems/Operating Systems - Class 8
System Architecture Directions for Networked Sensors Jason Hill, Rober Szewczyk, Alec Woo, Seth hollar, David Culler & Kristofer Pister Presented by Israel.
Towards System Architecture for Tiny Networked Devices David Culler U.C. Berkeley Wireless hoo-hah 5/30/2000.
Jason Hill, Robert Szewczyk, Alec Woo Spring 2000 TinyOS Operating System for Networked Sensors Networked SensorsSystem Structure Composing Components.
Reconfigurable Sensor Networks Chris Elliott Honours in Digital Systems Charles Greif and Nandita Bhattacharjee.
Tiny OS Optimistic Lightweight Interrupt Handler Simon Yau Alan Shieh
Home: Phones OFF Please Unix Kernel Parminder Singh Kang Home:
A System Architecture for Tiny Networked Devices Jason Hill U.C. Berkeley 9/22/2000.
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.
1 EE249 Discussion System Architecture Directions for Networked Sensors (J. Hill, et al) Presented By: Sarah Bergbreiter EE249 Discussion Section October.
Mehmet Can Vuran, Instructor University of Nebraska-Lincoln Acknowledgement: Overheads adapted from those provided by the authors of the textbook.
A. Frank - P. Weisberg Operating Systems Introduction to Cooperating Processes.
Spring 2000, 4/27/00 Power evaluation of SmartDust remote sensors CS 252 Project Presentation Robert Szewczyk Andras Ferencz.
System Calls 1.
A System Architecture for Networked Sensors Jason Hill, Robert Szewczyk, Alec Woo, Seth Hollar, David Culler, Kris Pister
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.
LOGO OPERATING SYSTEM Dalia AL-Dabbagh
Operating System Review September 10, 2012Introduction to Computer Security ©2004 Matt Bishop Slide #1-1.
Recall: Three I/O Methods Synchronous: Wait for I/O operation to complete. Asynchronous: Post I/O request and switch to other work. DMA (Direct Memory.
Other Chapters From the text by Valvano: Introduction to Embedded Systems: Interfacing to the Freescale 9S12.
Overview of: System Architecture Directions for Networked Sensors John Kerwin CSE 291 Sensor Networks Paper by: Jason Hill, Robert Szewczyk, Alec Woo,
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.
Simulation of Distributed Application and Protocols using TOSSIM Valliappan Annamalai.
HANBACK ELECTRONICS CO., LTD. 저자권 보호됨 TinyOS & NesC.
TinyOS and UC Berkeley Motes Hardware and Programming Tools Some slides and information was taken from Boot1.ppt and Boot2.ppt on the Berkeley TinyOS website.
System Architecture Directions for Networked Sensors Jason Hill, Robert Szewczyk, Alec Woo, Seth Hollar, David Culler, Kris Pister Presenter: James.
Processes CS 6560: Operating Systems Design. 2 Von Neuman Model Both text (program) and data reside in memory Execution cycle Fetch instruction Decode.
1 Computer Systems II Introduction to Processes. 2 First Two Major Computer System Evolution Steps Led to the idea of multiprogramming (multiple concurrent.
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.
Assoc. Prof. Dr. Ahmet Turan ÖZCERİT.  What Operating Systems Do  Computer-System Organization  Computer-System Architecture  Operating-System Structure.
Active Message Application: CONNECT Presented by Xiaozhou David Zhu Oommen Regi July 6, 2001.
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.
Embedded Real-Time Systems Processing interrupts Lecturer Department University.
CSCI/CMPE 4334 Operating Systems Review: Exam 1 1.
Why does it need? [USN] ( 주 ) 한백전자 Background Wireless Sensor Network (WSN)  Relationship between Sensor and WSN Individual sensors are very limited.
TinyOS Sandeep Gupta. TinyOS basics TinyOS is  Single tasking OS  Interrupt driven Written using a Component based language A set of components put.
Multiprogramming. Readings r Chapter 2.1 of the textbook.
Introduction to Operating Systems Concepts
INTRODUCTION TO WIRELESS SENSOR NETWORKS
Chapter 4: Threads Modified by Dr. Neerja Mhaskar for CS 3SH3.
Simulation of Distributed Application and Protocols using TOSSIM
Interrupts and signals
Elaine Cheong Yang Zhao December 8, 2001
Chapter 2: System Structures
Lecture 1 Runtime environments.
I/O Systems I/O Hardware Application I/O Interface
TinyOS CSE466 Final Project Presentation
Chapter 2: Operating-System Structures
Chapter 13: I/O Systems I/O Hardware Application I/O Interface
Lecture 1 Runtime environments.
CSE 153 Design of Operating Systems Winter 2019
Chapter 2: Operating-System Structures
Modeling Event-Based Systems in Ptolemy II EE249 Project Status Report
Chapter 13: I/O Systems “The two main jobs of a computer are I/O and [CPU] processing. In many cases, the main job is I/O, and the [CPU] processing is.
Presentation transcript:

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

Keep in mind the goals: Support high levels of concurrency Provide efficient modularity Support Network Sensor regime – Real time requirements – Small memory size – Low CPU speed – Power efficiency is critical

A Component has: Internal, fixed size storage frame. List of Commands it handles and Events it fires. – Similar to the interface it provides List of Commands it uses and Events if handles. – Similar to the interfaces it uses. Bundle of tasks that perform work.

A Messaging Component Definition: //ACCEPTS: char TOS_COMMAND(AM_send_msg)(int addr, int type, char* data); void TOS_COMMAND(AM_power)(char mode); char TOS_COMMAND(AM_init)(); //SIGNALS: char AM_msg_rec(int type, char* data); char AM_msg_send_done(char success); //HANDLES: char AM_TX_packet_done(char success); char AM_RX_packet_done(char* packet); //USES: char TOS_COMMAND(AM_SUB_TX_packet)(char* data); void TOS_COMMAND(AM_SUB_power)(char mode); char TOS_COMMAND(AM_SUB_init)();

Storage Frame: Contains all permanent state for component (lives across events, commands, and threads) Threads, events, and commands execute inside the components frame Only one per component – Like static class variables, not internal class variables. Fixed size Allocated at compile time

Example Frame Declaration: #define TOS_FRAME_TYPE AM_obj_frame TOS_FRAME_BEGIN(AM_obj_frame) { int addr; char type; char state; char* data; char msgbuf[30]; } TOS_FRAME_END(AM_obj_frame); VAR(state) = 0; Frame Declaration: Use of frame Variables:

Commands: void TOS_COMMAND(command_name)(arguments); – Commands can call lower level commands and post tasks. – USE: TOS_POST_COMMAND(BEACON_SUB_power)(0); void event_name(arguments); – Events can call lower level commands, post tasks and fire higher level events. These restrictions prevents cycles in the event/command chain. Events:

Tasks: Tasks perform work that is computationally intensive. They run to completion. Can be temporarily interrupted by events. Task declaration: TOS_TASK(task_name){….} Posting a task: – Asynchronous call to schedule the task for later execution – USE: TOS_POST_TASK(avg_task);

Sample Application A identity broadcast application: – Sleep for a majority of the time – Wake up periodically and check light sensor value – Send out identity and light reading – Go back to sleep

Your application must be structured around events: You must ask yourself: – How will I get the execution context? 1) Through the init command. –Bad idea! Implies you can never sleep. 2) From a command – Good for subcomponents, but not applications. 3) From an event –Good idea!! –This could be a timer event, a message arrived event, a sensor read completion event, or a hardware interrupt.

Components you will build your application on: Light sensor object (light.h) – To collect values from the light sensing hardware Active messaging component (AM.h) – To interface with the network Clock component (Clock.h) – To provide periodic events

Where to start…. Initializing components – All components implement initialization methods that are invoked at startup High level components are required to initialize all subcomponents that they use We initialize, Photo, AM, and Clock components.

State Machine Diagram Get_Light Send_MsgSleep Clock Event / Light Request Command Light done event / Msg send command Msg sent event / Power down command

Declaration of Application //ACCEPTS: char TOS_COMMAND(init)(); //SIGNALS: //HANDLES: char AM_msg_send_done(char success); void light_done(int reading); void clock_event(); //USES: char TOS_COMMAND(AM_init)(); char TOS_COMMAND(AM_send_msg)(int addr, int type, char* data); void TOS_COMMAND(AM_power)(char mode); void TOS_COMMAND(Photo_init)(); void TOS_COMMAND(Photo_read)(); void TOS_COMMAND(Clock_init)(char interval);

Lets code it….

Lets add a task…. We will also transfer the running average of light readings. The calculation of this average is computationally intensive and needs to be placed in a task. We also need to add state to keep track of past average.

State Machine Diagram Get_Light Send_MsgSleep Clock Event / Light Request Command Thread Schedule / Msg send command Msg sent event / Power down command Calc. Average Light done event / Post Task

Cut to the code… We need to add: – state management – a task to perform the averaging

How do you ever debug this thing? Run it on your PC!!! The #ifdef FULLPC is used to allow the code to be executed on a PC. Lower levels of networking and UART components are faked out using UNIX networking. FULLPC_DEBUG is commonly used to print out debugging information.

How do we wire the components together? Currently set-up for use with the Work View CAD tools Each components has a symbol with pins corresponding to the events and command it uses or handles Components are connected by connecting their pins Structural VHDL is exported and used at compile time super.h is produced from the structural VHDL

How does our messaging protocol work? To send use: char TOS_COMMAND (AM_send_msg)(int addr,int type, char* data); To receive messages you must register your event handler in AM_dispatch.c – This function performs the dynamic dispatching. – Eventually, this function will be automatically generated based on the handlers you link in

Why these funky macros? For use with static verification tools – Not yet developed We will be able to easily analyze event propagation dependencies

How do you know if you code will fit on the device 1)GCC will complain at link time 2)Img.file will show you the breakdown of memory usage for your program. Output of make: Max text: 0x2000, Max data: 0x200 0x00000c0a _etext=. 0x _edata=. 0x d _end=.