SlideShare ist ein Scribd-Unternehmen logo
1 von 184
TinyOS 2.1 IPSN 2009 Stephen Dawson-Haggerty, Omprakash Gnawali, David Gay, Philip Levis, Răzvan Musăloiu-E., Kevin Klues, and John Regehr San Francisco, CA - April 16, 2009
Agenda ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
What? ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
Who are we? ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
Why? ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
Goals ,[object Object],[object Object],[object Object],[object Object],[object Object]
Schedule ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
Basics ,[object Object],[object Object]
Outline ,[object Object],[object Object],[object Object],[object Object],[object Object]
TinyOS Components ,[object Object],[object Object],[object Object],[object Object],[object Object],B A i
Components ,[object Object],[object Object],[object Object]
Component Example ,[object Object],module BlinkP { … } implementation { int c; void increment() {c++;} } configuration BlinkC { … } implementation { components new TimerC(); components BlinkC; BlinkC.Timer -> TimerC; } TimerC BlinkP Timer
Singletons and Generics ,[object Object],[object Object],configuration BlinkC { … } implementation { components new TimerC(); components BlinkC; BlinkC.Timer -> TimerC; }
Interfaces ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],interface Timer<tag> { command void startOneShot(uint32_t period); command void startPeriodic(uint32_t period); event void fired(); }
Outline ,[object Object],[object Object],[object Object],[object Object],[object Object]
Basic Example ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
The Basics – Let’s Get Started ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],interface Boot { /* Signaled when OS booted */ event void booted(); } interface Timer<tag> { command void startOneShot(uint32_t period); command void startPeriodic(uint32_t period); event void fired(); }
The Basics – Split-Phase Ops ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],interface Read<val_t> { command error_t read(); event void readDone(error_t ok, val_t val); }
The Basics – Split-Phase Ops ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],interface Read<val_t> { command error_t read(); event void readDone(error_t ok, val_t val); }
The Basics – Configurations ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],A configuration is a component built out of other components. It  wires  “used” to “provided” interfaces. It can instantiate  generic  components It can itself provide and use interfaces generic configuration TimerMilliC() { provides interface Timer<TMilli>; } implementation { ... } generic configuration PhotoC() { provides interface Read; } implementation { ... }
Components
Outline ,[object Object],[object Object],[object Object],[object Object],[object Object]
Tasks ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
Outline ,[object Object],[object Object],[object Object],[object Object],[object Object]
More Complex Application ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
Advanced Sensing, Tasks ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],interface ReadStream<val_t> { command error_t postBuffer(val_t* buf, uint16_t count); command error_t read(uint32_t period); event void readDone(error_t ok, uint32_t actualPeriod); }
Advanced Sensing, Tasks ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],In readDone, we need to compute the variance of the sample. We defer this “computationally-intensive” operation to a separate  task , using post. We then compute the variance and report theft.
TinyOS Execution Model RealMainP AccelStreamC AntiTheftC RealMainP Stack Task Queue Timer Alarm SchedulerP Interrupt table serial receive H/W timer A/D conv. AntiTheftC Timer Alarm
TinyOS Execution Model Stack Task Queue serial receive H/W timer A/D conv. Interrupt table RealMainP AccelStreamC AntiTheftC Timer Alarm SchedulerP timer task SchedulerP Alarm Timer
TinyOS Execution Model SchedulerP Stack Task Queue Interrupt table RealMainP AccelStreamC AntiTheftC Timer Alarm SchedulerP serial receive H/W timer A/D conv. timer task AntiTheftC AccelStreamC Timer
Networking – “External” Types ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],#ifndef ANTITHEFT_H #define ANTITHEFT_H typedef nx_struct { nx_uint8_t alert, detect; nx_uint16_t checkInterval; } settings_t; #endif ,[object Object],[object Object],[object Object],[object Object]
TinyOS/nesC Summary ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
Outline ,[object Object],[object Object],[object Object],[object Object],[object Object]
The Toolchain TinyOS App PC Applications Native binary: 03 2F 77 9A F2 FF ...
The Toolchain TinyOS PC Applications Compile TinyOS applications Native binary: 03 2F 77 9A F2 FF ... App
The Toolchain Native binary: 03 2F 77 9A F2 FF ... TinyOS App PC Applications Install applications on motes
The Toolchain TinyOS App PC Applications Build PC applications Native binary: 03 2F 77 9A F2 FF ...
The Toolchain TinyOS App PC Applications Document TinyOS Native binary: 03 2F 77 9A F2 FF ...
The “Make” System Native binary: 03 2F 77 9A F2 FF ... make telosb install automates nesC, C compilation, mote installation TinyOS App PC Applications
“ Make”: Compile Applications ncc gcc int main() {   scheduler_init();   ... } Native binary: 03 2F 77 9A F2 FF ...
“ Make”: Install Applications pybsl, uisp, etc deluge Native binary: 03 2F 77 9A F2 FF ...
Build PC Applications TinyOS Java, C, Python apps Packet formats, constants, etc Talk with motes Native binary: 03 2F 77 9A F2 FF ...
PC Applications: Extracting Information from TinyOS mig ncc  –dump ncg Java, C or Python app packet formats constants <the kitchen sink> TinyOS
PC Applications: Talking to Motes Java, C or Python app sf packet libs packet libs
Document TinyOS nesdoc
TOSSIM ,[object Object]
What is TOSSIM? ,[object Object],ns2
[object Object],[object Object],Alternatives
Two directions ,[object Object],[object Object],[object Object],[object Object],TOSSIM in tinyos-2.x TOSSIM in tinyos-1.x
Features ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
Anatomy TOSSIM tos/lib/tossim tos/chips/atm128/sim tos/chips/atm128/pins/sim tos/chips/atm128/timer/sim tos/chips/atm128/spi/sim tos/platforms/mica/sim tos/platforms/micaz/sim tos/platforms/micaz/chips/cc2420/sim Application Makefile *.nc *.h Simulation Driver *.py | *.cc
Quick Overview Glue Application Simulation NesC Python C++
The Building Process ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],pytossim.o tossim.o c-support.o sim.o app.xml _TOSSIMmodule.o TOSSIM.py
TOSSIM.py ,[object Object],[object Object],[object Object],[object Object],[object Object]
TOSSIM.Tossim ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
10 seconds ,[object Object],[object Object],[object Object],[object Object],[object Object]
dbg ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
Useful Functions typedef  long long int sim_time_t ; char* sim_time_string() sim_time_t sim_time() int sim_random() sim_time_t sim_ticks_per_sec()
Radio Model Closest-fit Pattern Matching (CPM) Improving Wireless Simulation Through Noise Modeling HyungJune Lee, Alberto Cerpa, and Philip Levis IPSN 2007
Radio Model Sender Receiver
Noise Level Meyer Heavy Casino Lab Signal SNR SNR
CC2420 SNR/PRR
TOSSIM.Radio ,[object Object],[object Object],[object Object]
TOSSIM.Mote ,[object Object],[object Object],[object Object],[object Object],[object Object]
Example ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],0 1 2 -50 dB -10 dB
Example (cont) ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],0 1 2 -50 dB -10 dB
Other Features ,[object Object],[object Object],[object Object],[object Object]
Improvements ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
Future ,[object Object],[object Object]
Safe TinyOS ,[object Object]
What is Safe TinyOS? ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
Using Safe TinyOS ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
Designed to Fail ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
FLIDs ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
Decoding a FLID ,[object Object],[object Object],[object Object],[object Object]
Safe Components ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
Porting Code to Safe TinyOS ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
Annotation 1 ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
Annotation 2 ,[object Object],[object Object],[object Object]
Annotation 3 ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
Annotation 4 ,[object Object],[object Object],[object Object]
Annotation 5 ,[object Object],[object Object],[object Object]
Interface Annotation 1 ,[object Object],[object Object]
Interface Annotation 2 ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
Safe TinyOS Summary ,[object Object],[object Object],[object Object],[object Object],[object Object]
Threads ,[object Object]
The Great Divide ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],void  myFunc() { error_t  e = read(); //continue execution flow } void  readDone( uint8_t  val,  error_t  e) { //read() continuation code } void  myFunc() { error_t  e; uint8_t  val = read(&e); //read() continuation code } TOSThreads aims to resolve this fundamental tension
TOSThreads in a Nutshell ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
Architecture Overview Task   Scheduler  Thread Scheduler System Calls TinyOS   Thread Application   Threads
Blink Example (nesC) configuration  BlinkAppC { } implementation  { components  MainC, BlinkC,  LedsC; components  new ThreadC(STACK_SIZE); MainC.Boot <- BlinkC; BlinkC.Thread -> ThreadC; BlinkC.Leds -> LedsC; } module  BlinkC { uses  { interface  Boot; interface  Thread; interface  Leds; } } implementation  { event  void Boot.booted() { call  Thread.start(NULL); } event  void Thread.run( void * arg) { for (;;) { call  Leds.led0Toggle(); call  Thread.sleep(BLINK_PERIOD); } }
Blink Example (standard C) #include  &quot;tosthread.h&quot; #include  &quot;tosthread_leds.h&quot; //Initialize variables associated with a thread tosthread_t blink; void  blink_thread( void * arg); void  tosthread_main( void * arg) { tosthread_create(&blink, blink_thread, NULL, STACK_SIZE); } void  blink_thread( void * arg) { for(;;) { led0Toggle(); tosthread_sleep(BLINK_PERIOD); } }
Modifications to TinyOS ,[object Object],[object Object],[object Object]
Boot Sequence event   void   TinyOS.booted() { atomic  { platform_bootstrap(); call   Scheduler.init();  call   PlatformInit.init();  while   (call Scheduler.runNextTask()); call   SoftwareInit.init();  while   (call Scheduler.runNextTask()); } signal   Boot.booted(); /* Spin in the Scheduler */  call   Scheduler.taskLoop(); } Standard TinyOS Boot Main int   main() { signal   TinyOS.booted(); //Should never get here return -1; }
Boot Sequence event   void   ThreadScheduler.booted() { setup_TinyOS_in_kernel_thread(); signal   TinyOSBoot.booted(); } Thread Scheduler Boot New Main int   main() { signal   ThreadScheduler.booted(); //Should never get here return -1; }
Task Scheduler command   void   Scheduler.taskLoop()  { for   (;;)  { uint8_t   nextTask; atomic   { while   ((nextTask = popTask()) == NO_TASK))   call  McuSleep.sleep(); } signal   TaskBasic.runTask[nextTask](); } } Original command   void   Scheduler.taskLoop()  { for   (;;)  { uint8_t   nextTask; atomic   { while   ((nextTask = popTask()) == NO_TASK)    call  ThreadScheduler.suspendThread(TOS_THREAD_ID); } signal   TaskBasic.runTask[nextTask](); } } New
Interrupt Handlers void   interruptCurrentThread() { if (  call   TaskScheduler.hasTasks() ) { call   ThreadScheduler.wakeupThread(TOS_THREAD_ID); call   ThreadScheduler.interruptCurrentThread(); } } TOSH_SIGNAL (ADC_VECTOR) { signal   SIGNAL_ADC_VECTOR.fired(); atomic  interruptCurrentThread(); } TOSH_SIGNAL (DACDMA_VECTOR) { signal   SIGNAL_DACDMA_VECTOR.fired(); atomic  interruptCurrentThread(); } … . … .
System Calls Task Queue Routing Arbiter System Call Task Receive Timer Send   Receive  Sense   Block  Storage  Application Thread  System Calls TinyOS Thread
Linking and Loading ,[object Object],[object Object],[object Object],[object Object]
Resources ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
Protocols ,[object Object]
Protocols in TinyOS 2.1 ,[object Object],[object Object],[object Object],[object Object],[object Object]
Collection ,[object Object],[object Object],[object Object]
MultihopLQI ,[object Object],[object Object],[object Object],[object Object]
CTP ,[object Object],[object Object],[object Object],[object Object]
CTP Architecture Router Forwarder Lnk Estimator Link Layer Application
CTP Link Estimator ,[object Object],[object Object],[object Object],[object Object],[object Object]
CTP Router ,[object Object],[object Object],[object Object],[object Object]
CTP Forwarder ,[object Object],[object Object],[object Object],[object Object]
CTP Reliability
Dissemination ,[object Object],[object Object],[object Object],[object Object]
Drip ,[object Object],[object Object],[object Object],[object Object]
DIP ,[object Object],[object Object],[object Object]
Deluge ,[object Object],[object Object],[object Object]
Deluge Details ,[object Object],[object Object],[object Object],[object Object],[object Object]
Time Synchronization ,[object Object],[object Object],[object Object],[object Object]
Upcoming Technologies ,[object Object]
“ Work in Progress” ,[object Object],[object Object],[object Object],[object Object],[object Object]
IEEE 802.15.4 ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
ZigBee ,[object Object],[object Object],[object Object],[object Object],[object Object]
IPv6 ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
IPv6 ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
An IP Network ,[object Object],[object Object],[object Object],[object Object],internet backhaul links edge routers node routers
Addressing ,[object Object],[object Object],Address type Example TinyOS usage Link-local unicast fe80::beef L2 Mapped Link-local multicast ff02::1 Radio local broadcast Global unicast 2001::64 Routable address Network ID/64 Interface ID/64
Useful Interfaces ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],interface ICMPPing { command error_t ping(struct in6_addr *target,    uint16_t period, uint16_t n); event void pingReply(struct in6_addr *source,    struct icmp_stats *stats); event void pingDone(uint16_t ping_rcv, uint16_t ping_n); } UDPSocketC ICMPResponderC
Address Structures ,[object Object],[object Object],[object Object],[object Object],[object Object]
Example App: Sense & Send ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],Configuration MyAppC{ } implementation { components MyAppP, new UdpSocketC(); MyAppP.UDP -> UdpSocketC; ... }
Conclusions ,[object Object],[object Object],[object Object],[object Object],[object Object]
Hands-on Session ,[object Object]
Goals ,[object Object],[object Object],[object Object],[object Object],[object Object]
Options ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],Recommended Today
Other Options ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
Components ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
Environment export TOSROOT=$HOME/local/src/tinyos-2.xexport TOSDIR=$TOSROOT/tos export MAKERULES=$TOSROOT/support/make/Makerules export CLASSPATH=$TOSROOT/support/sdk/java/tinyos.jar:.export PYTHONPATH=$TOSROOT/support/sdk/python
Architectures ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
Layout + tinyos-2.x + apps + docs + support + tools + tos
Layout + apps + Blink + Null + RadioCountToLeds + MultihopOscilloscope + tests + ... + ... + docs + support + tools + tos
Layout + apps + docs + html + pdf + txt + ... + support + tools + tos
Layout + apps + docs + support + make - Makerules + avr/ + msp/ + ... + sdk + tools + tos
Layout + apps + docs + support + make + sdk + c + cpp + java + python + tools + tos
Layout + support + sdk + c + blip + sf + cpp + sf + java - tinyos.jar + python + tinyos - tos.py
Layout + apps + docs + support + tools + tos + chips + interfaces + lib + platforms + sensorboards + systems + types
Layout + tos + chips + atm128 + msp430 + pxa27x + cc2420 + cc1000 + at45db + stm25p + sht11 + ...
Layout + tos + chips + interfaces - Boot.nc - SplitControl.nc - StdControl.nc - ... + lib + platforms + sensorboards + systems + types
Layout + tos + lib + net + printf + timer + tosthreads + serial - SerialActiveMessageC.nc - SerialAMSenderC.nc - SerialAMReceiverC.nc - ... + ...
Layout + tos + lib + net + ctp + 4bitle + drip + Deluge + dip + blip + ...
Layout + tos + systems - AMReceiverC.nc - AMSenderC.nc - MainC.nc - LedsC.nc - TimerMilliC.nc - ...
Layout + tos + chips + interfaces + lib + platforms + sensorboards + systems + types - TinyError.h - messssage.h - ...
Applications ,[object Object],[object Object]
DisseminationDemo
DisseminationDemo ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
DisseminationDemoClient MainC ActiveMessageC DisseminationC DisseminatorC DisseminationDemoClientC Boot SplitControl StdControl DisseminationValue <nx_uint32_t>
DisseminationDemoClient ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
tos/interfaces/Boot.nc interface Boot { event void booted(); }
tos/interfaces/StdControl.nc interface StdControl { command error_t start(); command error_t stop(); }
tos/interfaces/SplitControl.nc interface SplitControl { command error_t start(); event void startDone(error_t error); command error_t stop(); event void stopDone(error_t error); }
tos/lib/net/DisseminationValue.nc interface DisseminationValue<t> { command const t* get(); command void set(const t*); event void changed(); }
tos/system/MainC.nc configuration MainC { provides interface Boot; uses interface Init as SoftwareInit; } implementation { ... }
tos/platforms/telosa/ActiveMessageC.nc configuration ActiveMessageC { provides { interface SplitControl; ... } } implementation { ... }
tos/lib/net/drip/DisseminationC.nc configuration DisseminationC { provides interface StdControl; } implementation { ... }
tos/lib/net/drip/DisseminatorC.nc generic configuration DisseminatorC(typedef t, uint16_t key) { provides interface DisseminationValue<t>; provides interface DisseminationUpdate<t>; } implementation { ... }
Makefile COMPONENT=DisseminationDemoClientAppC CFLAGS += -I%T/lib/net CFLAGS += -I%T/lib/net/drip CFLAGS += -I%T/lib/printf include $(MAKERULES)
Commands $ make telosb $ make telosb install,42 $ tos-dump.py serial@/dev/ttyUSB0:115200
Summary tos/interfaces/Boot.nc tos/interfaces/StdControl.nc tos/interfaces/SplitControl.nc tos/system/MainC.nc tos/platforms/telosa/ActiveMessageC.nc tos/lib/net/drip/DisseminationC.nc tos/lib/net/drip/DisseminatorC.nc
DisseminationDemoClientAppC.nc ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
DisseminationDemoClientC.nc ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
DisseminationDemoClientC.nc ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
CollectionDemo
CollectionDemo ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
CollectionDemoClient MainC ActiveMessageC CollectionC CollectionSenderC CollectionDemoClientC Boot SplitControl StdControl Send TimerMilliC Timer <TMilli>
CollectionDemoClient ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
CollectionDemoClient ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
tos/interfaces/Send.nc interface Send { command error_t send(message_t* msg, uint8_t len); event void sendDone(message_t* msg, error_t error); command uint8_t maxPayloadLength(); command void* getPayload(message_t* msg, uint8_t len); command error_t cancel(message_t* msg); }
tos/lib/net/ctp/CollectionC.nc configuration CollectionC { provides { interface StdControl; ... } } implementation { ... }
tos/lib/net/ctp/CollectionSenderC.nc generic configuration CollectionSenderC(collection_id_t collectid) { provides { interface Send; interface Packet; } } implementation { ... }
tos/system/TimerMilliC.nc generic configuration TimerMilliC() { provides interface Timer<TMilli>; } implementation { ... }
Makefile COMPONENT=CollectionDemoClientAppC CFLAGS += -I%T/lib/net CFLAGS += -I%T/lib/net/ctp CFLAGS += -I%T/lib/net/4bitle CFLAGS += -I%T/lib/printf include $(MAKERULES)
Summary tos/interfaces/Boot.nc tos/interfaces/StdControl.nc tos/interfaces/SplitControl.nc tos/interfaces/Send.nc tos/lib/timer/Timer.nc tos/system/MainC.nc tos/system/TimerMilliC.nc tos/platforms/telosa/ActiveMessageC.nc tos/lib/net/ctp/CollectionC.nc tos/lib/net/ctp/CollectionSenderC.nc
CollectionDemoClientAppC.nc ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
CollectionDemoClientC.nc ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
CollectionDemoClientC.nc ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
CollectionDemoClientC.nc ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
CollectionDemoClientC.nc ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
Code available at http://docs.tinyos.net/index.php/Ipsn2009-tutorial
The End.

Weitere ähnliche Inhalte

Was ist angesagt?

Tiny os
Tiny osTiny os
Tiny osAcad
 
TheThingsConference 2019 Slides of Alex Raimondi
TheThingsConference 2019 Slides of Alex RaimondiTheThingsConference 2019 Slides of Alex Raimondi
TheThingsConference 2019 Slides of Alex RaimondiSchekeb Fateh
 
Engineering Cross-Layer Fault Tolerance in Many-Core Systems
Engineering Cross-Layer Fault Tolerance in Many-Core SystemsEngineering Cross-Layer Fault Tolerance in Many-Core Systems
Engineering Cross-Layer Fault Tolerance in Many-Core SystemsSERENEWorkshop
 

Was ist angesagt? (7)

Tiny os
Tiny osTiny os
Tiny os
 
TinyOS Course 01: Basic Programming
TinyOS Course 01: Basic ProgrammingTinyOS Course 01: Basic Programming
TinyOS Course 01: Basic Programming
 
Tossim
Tossim Tossim
Tossim
 
TinyOS Course 05: Advanced Protocols
TinyOS Course 05: Advanced ProtocolsTinyOS Course 05: Advanced Protocols
TinyOS Course 05: Advanced Protocols
 
TheThingsConference 2019 Slides of Alex Raimondi
TheThingsConference 2019 Slides of Alex RaimondiTheThingsConference 2019 Slides of Alex Raimondi
TheThingsConference 2019 Slides of Alex Raimondi
 
Engineering Cross-Layer Fault Tolerance in Many-Core Systems
Engineering Cross-Layer Fault Tolerance in Many-Core SystemsEngineering Cross-Layer Fault Tolerance in Many-Core Systems
Engineering Cross-Layer Fault Tolerance in Many-Core Systems
 
Rain technology seminar
Rain technology seminar Rain technology seminar
Rain technology seminar
 

Ähnlich wie TinyOS 2.1 tutorial at IPSN 2009

The Ring programming language version 1.7 book - Part 85 of 196
The Ring programming language version 1.7 book - Part 85 of 196The Ring programming language version 1.7 book - Part 85 of 196
The Ring programming language version 1.7 book - Part 85 of 196Mahmoud Samir Fayed
 
Possibility of arbitrary code execution by Step-Oriented Programming by Hiroa...
Possibility of arbitrary code execution by Step-Oriented Programming by Hiroa...Possibility of arbitrary code execution by Step-Oriented Programming by Hiroa...
Possibility of arbitrary code execution by Step-Oriented Programming by Hiroa...CODE BLUE
 
Possibility of arbitrary code execution by Step-Oriented Programming
Possibility of arbitrary code execution by Step-Oriented ProgrammingPossibility of arbitrary code execution by Step-Oriented Programming
Possibility of arbitrary code execution by Step-Oriented Programmingkozossakai
 
Taming startup dynamics - Magnus Jungsbluth & Domagoj Cosic
Taming startup dynamics - Magnus Jungsbluth & Domagoj CosicTaming startup dynamics - Magnus Jungsbluth & Domagoj Cosic
Taming startup dynamics - Magnus Jungsbluth & Domagoj Cosicmfrancis
 
maXbox Starter 36 Software Testing
maXbox Starter 36 Software TestingmaXbox Starter 36 Software Testing
maXbox Starter 36 Software TestingMax Kleiner
 
Advanced malwareanalysis training session2 botnet analysis part1
Advanced malwareanalysis training session2 botnet analysis part1Advanced malwareanalysis training session2 botnet analysis part1
Advanced malwareanalysis training session2 botnet analysis part1Cysinfo Cyber Security Community
 
Reactive Extensions: classic Observer in .NET
Reactive Extensions: classic Observer in .NETReactive Extensions: classic Observer in .NET
Reactive Extensions: classic Observer in .NETEPAM
 
Inside the android_application_framework
Inside the android_application_frameworkInside the android_application_framework
Inside the android_application_frameworksurendray
 
TCP Sockets Tutor maXbox starter26
TCP Sockets Tutor maXbox starter26TCP Sockets Tutor maXbox starter26
TCP Sockets Tutor maXbox starter26Max Kleiner
 
Capacity Planning for Linux Systems
Capacity Planning for Linux SystemsCapacity Planning for Linux Systems
Capacity Planning for Linux SystemsRodrigo Campos
 
Async programming and python
Async programming and pythonAsync programming and python
Async programming and pythonChetan Giridhar
 
The Ring programming language version 1.10 book - Part 102 of 212
The Ring programming language version 1.10 book - Part 102 of 212The Ring programming language version 1.10 book - Part 102 of 212
The Ring programming language version 1.10 book - Part 102 of 212Mahmoud Samir Fayed
 
Threads, Queues, and More: Async Programming in iOS
Threads, Queues, and More: Async Programming in iOSThreads, Queues, and More: Async Programming in iOS
Threads, Queues, and More: Async Programming in iOSTechWell
 
Microservices for building an IDE - The innards of JetBrains Rider - NDC Oslo...
Microservices for building an IDE - The innards of JetBrains Rider - NDC Oslo...Microservices for building an IDE - The innards of JetBrains Rider - NDC Oslo...
Microservices for building an IDE - The innards of JetBrains Rider - NDC Oslo...Maarten Balliauw
 
Building Hermetic Systems (without Docker)
Building Hermetic Systems (without Docker)Building Hermetic Systems (without Docker)
Building Hermetic Systems (without Docker)William Farrell
 

Ähnlich wie TinyOS 2.1 tutorial at IPSN 2009 (20)

The Ring programming language version 1.7 book - Part 85 of 196
The Ring programming language version 1.7 book - Part 85 of 196The Ring programming language version 1.7 book - Part 85 of 196
The Ring programming language version 1.7 book - Part 85 of 196
 
Possibility of arbitrary code execution by Step-Oriented Programming by Hiroa...
Possibility of arbitrary code execution by Step-Oriented Programming by Hiroa...Possibility of arbitrary code execution by Step-Oriented Programming by Hiroa...
Possibility of arbitrary code execution by Step-Oriented Programming by Hiroa...
 
Possibility of arbitrary code execution by Step-Oriented Programming
Possibility of arbitrary code execution by Step-Oriented ProgrammingPossibility of arbitrary code execution by Step-Oriented Programming
Possibility of arbitrary code execution by Step-Oriented Programming
 
Taming startup dynamics - Magnus Jungsbluth & Domagoj Cosic
Taming startup dynamics - Magnus Jungsbluth & Domagoj CosicTaming startup dynamics - Magnus Jungsbluth & Domagoj Cosic
Taming startup dynamics - Magnus Jungsbluth & Domagoj Cosic
 
1230 Rtf Final
1230 Rtf Final1230 Rtf Final
1230 Rtf Final
 
Node
NodeNode
Node
 
maXbox Starter 36 Software Testing
maXbox Starter 36 Software TestingmaXbox Starter 36 Software Testing
maXbox Starter 36 Software Testing
 
Activity 5
Activity 5Activity 5
Activity 5
 
Advanced malwareanalysis training session2 botnet analysis part1
Advanced malwareanalysis training session2 botnet analysis part1Advanced malwareanalysis training session2 botnet analysis part1
Advanced malwareanalysis training session2 botnet analysis part1
 
AMC Minor Technical Issues
AMC Minor Technical IssuesAMC Minor Technical Issues
AMC Minor Technical Issues
 
Reactive Extensions: classic Observer in .NET
Reactive Extensions: classic Observer in .NETReactive Extensions: classic Observer in .NET
Reactive Extensions: classic Observer in .NET
 
Inside the android_application_framework
Inside the android_application_frameworkInside the android_application_framework
Inside the android_application_framework
 
TCP Sockets Tutor maXbox starter26
TCP Sockets Tutor maXbox starter26TCP Sockets Tutor maXbox starter26
TCP Sockets Tutor maXbox starter26
 
Java Concurrency
Java ConcurrencyJava Concurrency
Java Concurrency
 
Capacity Planning for Linux Systems
Capacity Planning for Linux SystemsCapacity Planning for Linux Systems
Capacity Planning for Linux Systems
 
Async programming and python
Async programming and pythonAsync programming and python
Async programming and python
 
The Ring programming language version 1.10 book - Part 102 of 212
The Ring programming language version 1.10 book - Part 102 of 212The Ring programming language version 1.10 book - Part 102 of 212
The Ring programming language version 1.10 book - Part 102 of 212
 
Threads, Queues, and More: Async Programming in iOS
Threads, Queues, and More: Async Programming in iOSThreads, Queues, and More: Async Programming in iOS
Threads, Queues, and More: Async Programming in iOS
 
Microservices for building an IDE - The innards of JetBrains Rider - NDC Oslo...
Microservices for building an IDE - The innards of JetBrains Rider - NDC Oslo...Microservices for building an IDE - The innards of JetBrains Rider - NDC Oslo...
Microservices for building an IDE - The innards of JetBrains Rider - NDC Oslo...
 
Building Hermetic Systems (without Docker)
Building Hermetic Systems (without Docker)Building Hermetic Systems (without Docker)
Building Hermetic Systems (without Docker)
 

Kürzlich hochgeladen

#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024BookNet Canada
 
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure serviceWhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure servicePooja Nehwal
 
FULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | Delhi
FULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | DelhiFULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | Delhi
FULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | Delhisoniya singh
 
Key Features Of Token Development (1).pptx
Key  Features Of Token  Development (1).pptxKey  Features Of Token  Development (1).pptx
Key Features Of Token Development (1).pptxLBM Solutions
 
Pigging Solutions in Pet Food Manufacturing
Pigging Solutions in Pet Food ManufacturingPigging Solutions in Pet Food Manufacturing
Pigging Solutions in Pet Food ManufacturingPigging Solutions
 
Unblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen FramesUnblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen FramesSinan KOZAK
 
The Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxThe Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxMalak Abu Hammad
 
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...HostedbyConfluent
 
SQL Database Design For Developers at php[tek] 2024
SQL Database Design For Developers at php[tek] 2024SQL Database Design For Developers at php[tek] 2024
SQL Database Design For Developers at php[tek] 2024Scott Keck-Warren
 
Install Stable Diffusion in windows machine
Install Stable Diffusion in windows machineInstall Stable Diffusion in windows machine
Install Stable Diffusion in windows machinePadma Pradeep
 
Beyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
Beyond Boundaries: Leveraging No-Code Solutions for Industry InnovationBeyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
Beyond Boundaries: Leveraging No-Code Solutions for Industry InnovationSafe Software
 
Breaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountBreaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountPuma Security, LLC
 
Salesforce Community Group Quito, Salesforce 101
Salesforce Community Group Quito, Salesforce 101Salesforce Community Group Quito, Salesforce 101
Salesforce Community Group Quito, Salesforce 101Paola De la Torre
 
[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdfhans926745
 
Scaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationScaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationRadu Cotescu
 
Handwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsHandwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsMaria Levchenko
 
Presentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreterPresentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreternaman860154
 
Benefits Of Flutter Compared To Other Frameworks
Benefits Of Flutter Compared To Other FrameworksBenefits Of Flutter Compared To Other Frameworks
Benefits Of Flutter Compared To Other FrameworksSoftradix Technologies
 
How to convert PDF to text with Nanonets
How to convert PDF to text with NanonetsHow to convert PDF to text with Nanonets
How to convert PDF to text with Nanonetsnaman860154
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerThousandEyes
 

Kürzlich hochgeladen (20)

#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
 
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure serviceWhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
 
FULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | Delhi
FULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | DelhiFULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | Delhi
FULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | Delhi
 
Key Features Of Token Development (1).pptx
Key  Features Of Token  Development (1).pptxKey  Features Of Token  Development (1).pptx
Key Features Of Token Development (1).pptx
 
Pigging Solutions in Pet Food Manufacturing
Pigging Solutions in Pet Food ManufacturingPigging Solutions in Pet Food Manufacturing
Pigging Solutions in Pet Food Manufacturing
 
Unblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen FramesUnblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen Frames
 
The Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxThe Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptx
 
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...
 
SQL Database Design For Developers at php[tek] 2024
SQL Database Design For Developers at php[tek] 2024SQL Database Design For Developers at php[tek] 2024
SQL Database Design For Developers at php[tek] 2024
 
Install Stable Diffusion in windows machine
Install Stable Diffusion in windows machineInstall Stable Diffusion in windows machine
Install Stable Diffusion in windows machine
 
Beyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
Beyond Boundaries: Leveraging No-Code Solutions for Industry InnovationBeyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
Beyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
 
Breaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountBreaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path Mount
 
Salesforce Community Group Quito, Salesforce 101
Salesforce Community Group Quito, Salesforce 101Salesforce Community Group Quito, Salesforce 101
Salesforce Community Group Quito, Salesforce 101
 
[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf
 
Scaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationScaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organization
 
Handwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsHandwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed texts
 
Presentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreterPresentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreter
 
Benefits Of Flutter Compared To Other Frameworks
Benefits Of Flutter Compared To Other FrameworksBenefits Of Flutter Compared To Other Frameworks
Benefits Of Flutter Compared To Other Frameworks
 
How to convert PDF to text with Nanonets
How to convert PDF to text with NanonetsHow to convert PDF to text with Nanonets
How to convert PDF to text with Nanonets
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
 

TinyOS 2.1 tutorial at IPSN 2009

  • 1. TinyOS 2.1 IPSN 2009 Stephen Dawson-Haggerty, Omprakash Gnawali, David Gay, Philip Levis, Răzvan Musăloiu-E., Kevin Klues, and John Regehr San Francisco, CA - April 16, 2009
  • 2.
  • 3.
  • 4.
  • 5.
  • 6.
  • 7.
  • 8.
  • 9.
  • 10.
  • 11.
  • 12.
  • 13.
  • 14.
  • 15.
  • 16.
  • 17.
  • 18.
  • 19.
  • 20.
  • 22.
  • 23.
  • 24.
  • 25.
  • 26.
  • 27.
  • 28. TinyOS Execution Model RealMainP AccelStreamC AntiTheftC RealMainP Stack Task Queue Timer Alarm SchedulerP Interrupt table serial receive H/W timer A/D conv. AntiTheftC Timer Alarm
  • 29. TinyOS Execution Model Stack Task Queue serial receive H/W timer A/D conv. Interrupt table RealMainP AccelStreamC AntiTheftC Timer Alarm SchedulerP timer task SchedulerP Alarm Timer
  • 30. TinyOS Execution Model SchedulerP Stack Task Queue Interrupt table RealMainP AccelStreamC AntiTheftC Timer Alarm SchedulerP serial receive H/W timer A/D conv. timer task AntiTheftC AccelStreamC Timer
  • 31.
  • 32.
  • 33.
  • 34. The Toolchain TinyOS App PC Applications Native binary: 03 2F 77 9A F2 FF ...
  • 35. The Toolchain TinyOS PC Applications Compile TinyOS applications Native binary: 03 2F 77 9A F2 FF ... App
  • 36. The Toolchain Native binary: 03 2F 77 9A F2 FF ... TinyOS App PC Applications Install applications on motes
  • 37. The Toolchain TinyOS App PC Applications Build PC applications Native binary: 03 2F 77 9A F2 FF ...
  • 38. The Toolchain TinyOS App PC Applications Document TinyOS Native binary: 03 2F 77 9A F2 FF ...
  • 39. The “Make” System Native binary: 03 2F 77 9A F2 FF ... make telosb install automates nesC, C compilation, mote installation TinyOS App PC Applications
  • 40. “ Make”: Compile Applications ncc gcc int main() { scheduler_init(); ... } Native binary: 03 2F 77 9A F2 FF ...
  • 41. “ Make”: Install Applications pybsl, uisp, etc deluge Native binary: 03 2F 77 9A F2 FF ...
  • 42. Build PC Applications TinyOS Java, C, Python apps Packet formats, constants, etc Talk with motes Native binary: 03 2F 77 9A F2 FF ...
  • 43. PC Applications: Extracting Information from TinyOS mig ncc –dump ncg Java, C or Python app packet formats constants <the kitchen sink> TinyOS
  • 44. PC Applications: Talking to Motes Java, C or Python app sf packet libs packet libs
  • 46.
  • 47.
  • 48.
  • 49.
  • 50.
  • 51. Anatomy TOSSIM tos/lib/tossim tos/chips/atm128/sim tos/chips/atm128/pins/sim tos/chips/atm128/timer/sim tos/chips/atm128/spi/sim tos/platforms/mica/sim tos/platforms/micaz/sim tos/platforms/micaz/chips/cc2420/sim Application Makefile *.nc *.h Simulation Driver *.py | *.cc
  • 52. Quick Overview Glue Application Simulation NesC Python C++
  • 53.
  • 54.
  • 55.
  • 56.
  • 57.
  • 58. Useful Functions typedef long long int sim_time_t ; char* sim_time_string() sim_time_t sim_time() int sim_random() sim_time_t sim_ticks_per_sec()
  • 59. Radio Model Closest-fit Pattern Matching (CPM) Improving Wireless Simulation Through Noise Modeling HyungJune Lee, Alberto Cerpa, and Philip Levis IPSN 2007
  • 60. Radio Model Sender Receiver
  • 61. Noise Level Meyer Heavy Casino Lab Signal SNR SNR
  • 63.
  • 64.
  • 65.
  • 66.
  • 67.
  • 68.
  • 69.
  • 70.
  • 71.
  • 72.
  • 73.
  • 74.
  • 75.
  • 76.
  • 77.
  • 78.
  • 79.
  • 80.
  • 81.
  • 82.
  • 83.
  • 84.
  • 85.
  • 86.
  • 87.
  • 88.
  • 89. Architecture Overview Task Scheduler Thread Scheduler System Calls TinyOS Thread Application Threads
  • 90. Blink Example (nesC) configuration BlinkAppC { } implementation { components MainC, BlinkC, LedsC; components new ThreadC(STACK_SIZE); MainC.Boot <- BlinkC; BlinkC.Thread -> ThreadC; BlinkC.Leds -> LedsC; } module BlinkC { uses { interface Boot; interface Thread; interface Leds; } } implementation { event void Boot.booted() { call Thread.start(NULL); } event void Thread.run( void * arg) { for (;;) { call Leds.led0Toggle(); call Thread.sleep(BLINK_PERIOD); } }
  • 91. Blink Example (standard C) #include &quot;tosthread.h&quot; #include &quot;tosthread_leds.h&quot; //Initialize variables associated with a thread tosthread_t blink; void blink_thread( void * arg); void tosthread_main( void * arg) { tosthread_create(&blink, blink_thread, NULL, STACK_SIZE); } void blink_thread( void * arg) { for(;;) { led0Toggle(); tosthread_sleep(BLINK_PERIOD); } }
  • 92.
  • 93. Boot Sequence event void TinyOS.booted() { atomic { platform_bootstrap(); call Scheduler.init(); call PlatformInit.init(); while (call Scheduler.runNextTask()); call SoftwareInit.init(); while (call Scheduler.runNextTask()); } signal Boot.booted(); /* Spin in the Scheduler */ call Scheduler.taskLoop(); } Standard TinyOS Boot Main int main() { signal TinyOS.booted(); //Should never get here return -1; }
  • 94. Boot Sequence event void ThreadScheduler.booted() { setup_TinyOS_in_kernel_thread(); signal TinyOSBoot.booted(); } Thread Scheduler Boot New Main int main() { signal ThreadScheduler.booted(); //Should never get here return -1; }
  • 95. Task Scheduler command void Scheduler.taskLoop() { for (;;) { uint8_t nextTask; atomic { while ((nextTask = popTask()) == NO_TASK)) call McuSleep.sleep(); } signal TaskBasic.runTask[nextTask](); } } Original command void Scheduler.taskLoop() { for (;;) { uint8_t nextTask; atomic { while ((nextTask = popTask()) == NO_TASK) call ThreadScheduler.suspendThread(TOS_THREAD_ID); } signal TaskBasic.runTask[nextTask](); } } New
  • 96. Interrupt Handlers void interruptCurrentThread() { if ( call TaskScheduler.hasTasks() ) { call ThreadScheduler.wakeupThread(TOS_THREAD_ID); call ThreadScheduler.interruptCurrentThread(); } } TOSH_SIGNAL (ADC_VECTOR) { signal SIGNAL_ADC_VECTOR.fired(); atomic interruptCurrentThread(); } TOSH_SIGNAL (DACDMA_VECTOR) { signal SIGNAL_DACDMA_VECTOR.fired(); atomic interruptCurrentThread(); } … . … .
  • 97. System Calls Task Queue Routing Arbiter System Call Task Receive Timer Send Receive Sense Block Storage Application Thread System Calls TinyOS Thread
  • 98.
  • 99.
  • 100.
  • 101.
  • 102.
  • 103.
  • 104.
  • 105. CTP Architecture Router Forwarder Lnk Estimator Link Layer Application
  • 106.
  • 107.
  • 108.
  • 110.
  • 111.
  • 112.
  • 113.
  • 114.
  • 115.
  • 116.
  • 117.
  • 118.
  • 119.
  • 120.
  • 121.
  • 122.
  • 123.
  • 124.
  • 125.
  • 126.
  • 127.
  • 128.
  • 129.
  • 130.
  • 131.
  • 132.
  • 133. Environment export TOSROOT=$HOME/local/src/tinyos-2.xexport TOSDIR=$TOSROOT/tos export MAKERULES=$TOSROOT/support/make/Makerules export CLASSPATH=$TOSROOT/support/sdk/java/tinyos.jar:.export PYTHONPATH=$TOSROOT/support/sdk/python
  • 134.
  • 135. Layout + tinyos-2.x + apps + docs + support + tools + tos
  • 136. Layout + apps + Blink + Null + RadioCountToLeds + MultihopOscilloscope + tests + ... + ... + docs + support + tools + tos
  • 137. Layout + apps + docs + html + pdf + txt + ... + support + tools + tos
  • 138. Layout + apps + docs + support + make - Makerules + avr/ + msp/ + ... + sdk + tools + tos
  • 139. Layout + apps + docs + support + make + sdk + c + cpp + java + python + tools + tos
  • 140. Layout + support + sdk + c + blip + sf + cpp + sf + java - tinyos.jar + python + tinyos - tos.py
  • 141. Layout + apps + docs + support + tools + tos + chips + interfaces + lib + platforms + sensorboards + systems + types
  • 142. Layout + tos + chips + atm128 + msp430 + pxa27x + cc2420 + cc1000 + at45db + stm25p + sht11 + ...
  • 143. Layout + tos + chips + interfaces - Boot.nc - SplitControl.nc - StdControl.nc - ... + lib + platforms + sensorboards + systems + types
  • 144. Layout + tos + lib + net + printf + timer + tosthreads + serial - SerialActiveMessageC.nc - SerialAMSenderC.nc - SerialAMReceiverC.nc - ... + ...
  • 145. Layout + tos + lib + net + ctp + 4bitle + drip + Deluge + dip + blip + ...
  • 146. Layout + tos + systems - AMReceiverC.nc - AMSenderC.nc - MainC.nc - LedsC.nc - TimerMilliC.nc - ...
  • 147. Layout + tos + chips + interfaces + lib + platforms + sensorboards + systems + types - TinyError.h - messssage.h - ...
  • 148.
  • 150.
  • 151. DisseminationDemoClient MainC ActiveMessageC DisseminationC DisseminatorC DisseminationDemoClientC Boot SplitControl StdControl DisseminationValue <nx_uint32_t>
  • 152.
  • 153. tos/interfaces/Boot.nc interface Boot { event void booted(); }
  • 154. tos/interfaces/StdControl.nc interface StdControl { command error_t start(); command error_t stop(); }
  • 155. tos/interfaces/SplitControl.nc interface SplitControl { command error_t start(); event void startDone(error_t error); command error_t stop(); event void stopDone(error_t error); }
  • 156. tos/lib/net/DisseminationValue.nc interface DisseminationValue<t> { command const t* get(); command void set(const t*); event void changed(); }
  • 157. tos/system/MainC.nc configuration MainC { provides interface Boot; uses interface Init as SoftwareInit; } implementation { ... }
  • 158. tos/platforms/telosa/ActiveMessageC.nc configuration ActiveMessageC { provides { interface SplitControl; ... } } implementation { ... }
  • 159. tos/lib/net/drip/DisseminationC.nc configuration DisseminationC { provides interface StdControl; } implementation { ... }
  • 160. tos/lib/net/drip/DisseminatorC.nc generic configuration DisseminatorC(typedef t, uint16_t key) { provides interface DisseminationValue<t>; provides interface DisseminationUpdate<t>; } implementation { ... }
  • 161. Makefile COMPONENT=DisseminationDemoClientAppC CFLAGS += -I%T/lib/net CFLAGS += -I%T/lib/net/drip CFLAGS += -I%T/lib/printf include $(MAKERULES)
  • 162. Commands $ make telosb $ make telosb install,42 $ tos-dump.py serial@/dev/ttyUSB0:115200
  • 163. Summary tos/interfaces/Boot.nc tos/interfaces/StdControl.nc tos/interfaces/SplitControl.nc tos/system/MainC.nc tos/platforms/telosa/ActiveMessageC.nc tos/lib/net/drip/DisseminationC.nc tos/lib/net/drip/DisseminatorC.nc
  • 164.
  • 165.
  • 166.
  • 168.
  • 169. CollectionDemoClient MainC ActiveMessageC CollectionC CollectionSenderC CollectionDemoClientC Boot SplitControl StdControl Send TimerMilliC Timer <TMilli>
  • 170.
  • 171.
  • 172. tos/interfaces/Send.nc interface Send { command error_t send(message_t* msg, uint8_t len); event void sendDone(message_t* msg, error_t error); command uint8_t maxPayloadLength(); command void* getPayload(message_t* msg, uint8_t len); command error_t cancel(message_t* msg); }
  • 173. tos/lib/net/ctp/CollectionC.nc configuration CollectionC { provides { interface StdControl; ... } } implementation { ... }
  • 174. tos/lib/net/ctp/CollectionSenderC.nc generic configuration CollectionSenderC(collection_id_t collectid) { provides { interface Send; interface Packet; } } implementation { ... }
  • 175. tos/system/TimerMilliC.nc generic configuration TimerMilliC() { provides interface Timer<TMilli>; } implementation { ... }
  • 176. Makefile COMPONENT=CollectionDemoClientAppC CFLAGS += -I%T/lib/net CFLAGS += -I%T/lib/net/ctp CFLAGS += -I%T/lib/net/4bitle CFLAGS += -I%T/lib/printf include $(MAKERULES)
  • 177. Summary tos/interfaces/Boot.nc tos/interfaces/StdControl.nc tos/interfaces/SplitControl.nc tos/interfaces/Send.nc tos/lib/timer/Timer.nc tos/system/MainC.nc tos/system/TimerMilliC.nc tos/platforms/telosa/ActiveMessageC.nc tos/lib/net/ctp/CollectionC.nc tos/lib/net/ctp/CollectionSenderC.nc
  • 178.
  • 179.
  • 180.
  • 181.
  • 182.
  • 183. Code available at http://docs.tinyos.net/index.php/Ipsn2009-tutorial