SlideShare a Scribd company logo
1 of 58
TinyOS
Hands-on Session
Goals
1.Install TinyOS
2.Layout of tinyos-2.x
3.Write two applications
  (A) DisseminationDemoClient
  (B) CollectionsDemoClient




                                2
Options
• LiveCD
  – XubunTOS
  – Customized Ubuntu 8.10 LiveCD     Today
• Native
  – Linux
     – .rpm packages
     – .deb packages                  Recommended
  – Windows: Cygwin + .rpm packages
  – MacOS X
     – stow
     – macports


                                         3
Other Options
• VMware
  – Jetos
     – based on JeOS (Ubuntu Server 8.04)
     – optimized for ssh access
     – very small: 190MB compressed
  – Lenny
     – based on Debian 5.0 “Lenny”
     – graphical interface using XFCE
     – bigger: 300MB compressed
  – XubunTOS


                                            4
Components
• NesC: nesc_*.deb
• Cross compiler
  – binutils: msp430-binutils-tinyos_*.deb
  – gcc: msp430-gcc-tinyos_*.deb
  – libc: msp430-libc-tinyos_*.deb
  – gdb (optional)
• Deputy: deputy-tinyos_*.deb

                                             5
Environment

export TOSROOT=$HOME/local/src/tinyos-2.x
export TOSDIR=$TOSROOT/tos

export MAKERULES=$TOSROOT/support/make/Makerules

export CLASSPATH=$TOSROOT/support/sdk/java/tinyos.jar:.
export PYTHONPATH=$TOSROOT/support/sdk/python




                                                   6
Architectures
• AVR                   • MSP430
  –   mica2, mica2dot     –   telosb, sky
  –   micaz               –   shimmer
  –   btnode              –   eyesIFX
  –   IRIS                –   tinynode
                          –   epic

• ARM                   • 8051
  – imote2                – CC2430
                          – CC1110/CC1111

                                            7
Layout
+ tinyos-2.x
  + apps
  + docs
  + support
  + tools
  + tos




                    8
Layout
+ apps
  + Blink
  + Null
  + RadioCountToLeds
  + MultihopOscilloscope
  + tests
    + ...
  + ...
+ docs
+ support
+ tools
+ tos
                           9
Layout
+ apps
+ docs
  + html
  + pdf
  + txt
  + ...
+ support
+ tools
+ tos




                     10
Layout
+ apps
+ docs
+ support
  + make
    - Makerules
    + avr/
    + msp/
    + ...
  + sdk
+ tools
+ tos

                    11
Layout
+ apps
+ docs
+ support
  + make
  + sdk
    +c
    + cpp
    + java
    + python
+ tools
+ tos

                    12
Layout
+ support
  + sdk
    +c
      + blip
      + sf
    + cpp
      + sf
    + java
      - tinyos.jar
    + python
      + tinyos
      - tos.py
                     13
Layout
+   apps
+   docs
+   support
+   tools
+   tos
    + chips
    + interfaces
    + lib
    + platforms
    + sensorboards
    + systems
    + types
                      14
Layout
+ tos
  + chips
    + atm128
    + msp430
    + pxa27x
    + cc2420
    + cc1000
    + at45db
    + stm25p
    + sht11
    + ...

                    15
Layout
+ tos
  + chips
  + interfaces
    - Boot.nc
    - SplitControl.nc
    - StdControl.nc
    - ...
  + lib
  + platforms
  + sensorboards
  + systems
  + types
                        16
Layout
+ tos
  + lib
    + net
    + printf
    + timer
    + tosthreads
    + serial
      - SerialActiveMessageC.nc
      - SerialAMSenderC.nc
      - SerialAMReceiverC.nc
      - ...
    + ...
                                  17
Layout
+ tos
  + lib
    + net
      + ctp
      + 4bitle
      + drip
      + Deluge
      + dip
      + blip
      + ...


                    18
Layout
+ tos
  + systems
    - AMReceiverC.nc
    - AMSenderC.nc
    - MainC.nc
    - LedsC.nc
    - TimerMilliC.nc
    - ...




                       19
Layout
+ tos
  + chips
  + interfaces
  + lib
  + platforms
  + sensorboards
  + systems
  + types
    - TinyError.h
    - messssage.h
    - ...

                    20
Applications

DisseminationDemo
 CollectionDemo
DisseminationDemo


              22
DisseminationDemo
• DisseminationDemoClient
  – start the radio
  – start Drip
  – when a new value is received print its contents
• DisseminationDemoServer
  –   start the radio
  –   start Drip
  –   start a periodic timer
  –   on each firing or the timer increment a counter and
      disseminate it

                                                 23
DisseminationDemoClient

                DisseminationDemoClientC



                                                           DisseminationValue
   Boot          SplitControl          StdControl
                                                              <nx_uint32_t>




MainC     ActiveMessageC        DisseminationC      DisseminatorC



                                                           24
DisseminationDemoClient

• Interfaces                  • Components
  –   Boot                     –   MainC
  –   StdControl               –   ActiveMessageC
  –   SplitControl             –   DisseminationC
  –   DisseminationValue<t>    –   DisseminatorC




                                              25
tos/interfaces/Boot.nc

interface Boot {
  event void booted();
}




                         26
tos/interfaces/StdControl.nc

interface StdControl
{
  command error_t start();
  command error_t stop();
}




                             27
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);
}




                                     28
tos/lib/net/DisseminationValue.nc

interface DisseminationValue<t> {
  command const t* get();
  command void set(const t*);
  event void changed();
}




                                    29
tos/system/MainC.nc

configuration MainC {
  provides interface Boot;
  uses interface Init as SoftwareInit;
}

implementation {
  ...
}




                                   30
tos/platforms/telosa/ActiveMessageC.nc


configuration ActiveMessageC {
  provides {
    interface SplitControl;
    ...
  }
}

implementation {
  ...
}


                                 31
tos/lib/net/drip/DisseminationC.nc


configuration DisseminationC {
  provides interface StdControl;
}

implementation {
  ...
}




                                   32
tos/lib/net/drip/DisseminatorC.nc


generic configuration DisseminatorC(typedef t,
                                    uint16_t key) {
  provides interface DisseminationValue<t>;
  provides interface DisseminationUpdate<t>;
}

implementation {
  ...
}




                                               33
Makefile
COMPONENT=DisseminationDemoClientAppC

CFLAGS += -I%T/lib/net
CFLAGS += -I%T/lib/net/drip
CFLAGS += -I%T/lib/printf

include $(MAKERULES)




                                   34
Commands
$ make telosb

$ make telosb install,42

$ tos-dump.py serial@/dev/ttyUSB0:115200




                                   35
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




                                   36
DisseminationDemoClientAppC.nc


configuration DisseminationDemoClientAppC { }

implementation
{
  components MainC;
  components DisseminationC;
  components new DisseminatorC(nx_uint32_t, 2009);
  components DisseminationDemoClientC;
  components ActiveMessageC;

    DisseminationDemoClientC.Boot -> MainC;
    DisseminationDemoClientC.DisseminationStdControl -> DisseminationC;
    DisseminationDemoClientC.DisseminationValue -> DisseminatorC;
    DisseminationDemoClientC.RadioSplitControl -> ActiveMessageC;
}




                                                              37
DisseminationDemoClientC.nc


module DisseminationDemoClientC
{
  uses {
    interface Boot;
    interface DisseminationValue<nx_uint32_t>;
    interface StdControl as DisseminationStdControl;
    interface SplitControl as RadioSplitControl;
  }
}

implementation
{
  nx_uint32_t counter;

    event void Boot.booted()
    {
      call RadioSplitControl.start();
    }

    ...

}


                                                       38
DisseminationDemoClientC.nc


module DisseminationDemoClientC
{
   ...
}

implementation
{

    ...

    event void RadioSplitControl.startDone(error_t error)
    {
      call DisseminationStdControl.start();
    }

    event void DisseminationValue.changed()
    {
      printf(quot;R: %lunquot;, *(call DisseminationValue.get()));
      printfflush();
    }

    event void RadioSplitControl.stopDone(error_t error) { }
}

                                                               39
http://docs.tinyos.net/index.php/Ipsn2009-tutorial




                                                     40
CollectionDemo


             41
CollectionDemo
• CollectionDemoClient
  –   start the radio
  –   start CTP
  –   start a periodic timer
  –   on each firing or the timer increment a counter and
      sent it over CTP
• CollectionDemoServer
  – start the radio
  – start CTP
  – when a new value is received print its contents

                                                 42
CollectionDemoClient

                    CollectionDemoClientC



                                                                    Timer
   Boot          SplitControl     StdControl      Send
                                                                   <TMilli>




MainC     ActiveMessageC    CollectionC   CollectionSenderC    TimerMilliC



                                                          43
CollectionDemoClient

• Interfaces          • Components
  –   Boot             –   MainC
  –   StdControl       –   ActiveMessageC
  –   SplitControl     –   CollectionC
  –   Send             –   CollectionSenderC
  –   Timer<TMilli>    –   TimerMilliC




                                       44
CollectionDemoClient

• Interfaces          • Components
  –   Boot             –   MainC
  –   StdControl       –   ActiveMessageC
  –   SplitControl     –   CollectionC
  –   Send             –   CollectionSenderC
  –   Timer<TMilli>    –   TimerMilliC




                                      45
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);
}




                                               46
tos/lib/net/ctp/CollectionC.nc

configuration CollectionC {
  provides {
    interface StdControl;
    ...
  }
}

implementation {
  ...
}




                                47
tos/lib/net/ctp/CollectionSenderC.nc

generic configuration
CollectionSenderC(collection_id_t collectid) {
  provides {
    interface Send;
    interface Packet;
  }
}

implementation {
  ...
}




                                                 48
tos/system/TimerMilliC.nc

generic configuration TimerMilliC() {
  provides interface Timer<TMilli>;
}

implementation {
  ...
}




                                        49
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)




                                     50
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
                                   51
CollectionDemoClientAppC.nc


configuration CollectionDemoClientAppC { }

implementation
{
  components MainC;
  components ActiveMessageC;
  components CollectionC;
  components new CollectionSenderC(16);
  components new TimerMilliC() as Timer;
  components CollectionDemoClientC;

    CollectionDemoClientC.Boot -> MainC;
    CollectionDemoClientC.RadioSplitControl -> ActiveMessageC;
    CollectionDemoClientC.CollectionStdControl -> CollectionC;
    CollectionDemoClientC.Send -> CollectionSenderC;
    CollectionDemoClientC.Timer -> Timer;
}

                                                                 52
CollectionDemoClientC.nc


module CollectionDemoClientC
{
  uses {
    interface Boot;
    interface SplitControl as RadioSplitControl;
    interface StdControl as CollectionStdControl;
    interface Send;
    interface Timer<TMilli>;
  }
}

implementation
{
  message_t smsg;

    typedef nx_struct {
      nx_uint8_t string[8];
      nx_uint16_t counter;
    } name_t;
    name_t *name;

    ...
}

                                                    53
CollectionDemoClientC.nc


module CollectionDemoClientC
{
  ...
}

implementation
{

    ...

    event void Boot.booted()
    {
      name = call Send.getPayload(&smsg, sizeof(name_t));
      strcpy((char*)name->string, quot;namequot;);
      name->counter = 0;
      call RadioSplitControl.start();
    }

    ...

}



                                                            54
CollectionDemoClientC.nc


module CollectionDemoClientC
{
  ...
}

implementation
{

    ...

    event void RadioSplitControl.startDone(error_t error)
    {
      call CollectionStdControl.start();
      call Timer.startPeriodic(1024);
    }


    ...

}




                                                            55
CollectionDemoClientC.nc


module CollectionDemoClientC
{
  ...
}

implementation
{

    ...

    event void Timer.fired()
    {
      error_t error;
      name->counter++;
      error = call Send.send(&smsg, sizeof(name_t));
      printf(quot;S: %d %dnquot;, name->counter, error);
      printfflush();
    }

    event void Send.sendDone(message_t* msg, error_t error) { }
    event void RadioSplitControl.stopDone(error_t error) { }
}


                                                              56
http://docs.tinyos.net/index.php/Ipsn2009-tutorial




                                                     57
The End.


           58

More Related Content

What's hot

도커 없이 컨테이너 만들기 5편 마운트 네임스페이스와 오버레이 파일시스템
도커 없이 컨테이너 만들기 5편 마운트 네임스페이스와 오버레이 파일시스템도커 없이 컨테이너 만들기 5편 마운트 네임스페이스와 오버레이 파일시스템
도커 없이 컨테이너 만들기 5편 마운트 네임스페이스와 오버레이 파일시스템Sam Kim
 
Performance tweaks and tools for Linux (Joe Damato)
Performance tweaks and tools for Linux (Joe Damato)Performance tweaks and tools for Linux (Joe Damato)
Performance tweaks and tools for Linux (Joe Damato)Ontico
 
Q4.11: Using GCC Auto-Vectorizer
Q4.11: Using GCC Auto-VectorizerQ4.11: Using GCC Auto-Vectorizer
Q4.11: Using GCC Auto-VectorizerLinaro
 
最後の楽園の開発をちょこっとだけ手伝った話
最後の楽園の開発をちょこっとだけ手伝った話最後の楽園の開発をちょこっとだけ手伝った話
最後の楽園の開発をちょこっとだけ手伝った話nullnilaki
 
OpenBSD/sgi SMP implementation for Origin 350
OpenBSD/sgi SMP implementation for Origin 350OpenBSD/sgi SMP implementation for Origin 350
OpenBSD/sgi SMP implementation for Origin 350Takuya ASADA
 
SMP Implementation for OpenBSD/sgi [Japanese Edition]
SMP Implementation for OpenBSD/sgi [Japanese Edition]SMP Implementation for OpenBSD/sgi [Japanese Edition]
SMP Implementation for OpenBSD/sgi [Japanese Edition]Takuya ASADA
 
Leak kernel pointer by exploiting uninitialized uses in Linux kernel
Leak kernel pointer by exploiting uninitialized uses in Linux kernelLeak kernel pointer by exploiting uninitialized uses in Linux kernel
Leak kernel pointer by exploiting uninitialized uses in Linux kernelJinbumPark
 
Debugging Ruby Systems
Debugging Ruby SystemsDebugging Ruby Systems
Debugging Ruby SystemsEngine Yard
 
from Binary to Binary: How Qemu Works
from Binary to Binary: How Qemu Worksfrom Binary to Binary: How Qemu Works
from Binary to Binary: How Qemu WorksZhen Wei
 
TinyML - 4 speech recognition
TinyML - 4 speech recognition TinyML - 4 speech recognition
TinyML - 4 speech recognition 艾鍗科技
 
Gameboy emulator in rust and web assembly
Gameboy emulator in rust and web assemblyGameboy emulator in rust and web assembly
Gameboy emulator in rust and web assemblyYodalee
 
General Purpose Computing using Graphics Hardware
General Purpose Computing using Graphics HardwareGeneral Purpose Computing using Graphics Hardware
General Purpose Computing using Graphics HardwareDaniel Blezek
 
Building Network Functions with eBPF & BCC
Building Network Functions with eBPF & BCCBuilding Network Functions with eBPF & BCC
Building Network Functions with eBPF & BCCKernel TLV
 
matplotlib-installatin-interactive-contour-example-guide
matplotlib-installatin-interactive-contour-example-guidematplotlib-installatin-interactive-contour-example-guide
matplotlib-installatin-interactive-contour-example-guideArulalan T
 
Make A Shoot ‘Em Up Game with Amethyst Framework
Make A Shoot ‘Em Up Game with Amethyst FrameworkMake A Shoot ‘Em Up Game with Amethyst Framework
Make A Shoot ‘Em Up Game with Amethyst FrameworkYodalee
 
Vectorization on x86: all you need to know
Vectorization on x86: all you need to knowVectorization on x86: all you need to know
Vectorization on x86: all you need to knowRoberto Agostino Vitillo
 

What's hot (19)

도커 없이 컨테이너 만들기 5편 마운트 네임스페이스와 오버레이 파일시스템
도커 없이 컨테이너 만들기 5편 마운트 네임스페이스와 오버레이 파일시스템도커 없이 컨테이너 만들기 5편 마운트 네임스페이스와 오버레이 파일시스템
도커 없이 컨테이너 만들기 5편 마운트 네임스페이스와 오버레이 파일시스템
 
Performance tweaks and tools for Linux (Joe Damato)
Performance tweaks and tools for Linux (Joe Damato)Performance tweaks and tools for Linux (Joe Damato)
Performance tweaks and tools for Linux (Joe Damato)
 
Q4.11: Using GCC Auto-Vectorizer
Q4.11: Using GCC Auto-VectorizerQ4.11: Using GCC Auto-Vectorizer
Q4.11: Using GCC Auto-Vectorizer
 
最後の楽園の開発をちょこっとだけ手伝った話
最後の楽園の開発をちょこっとだけ手伝った話最後の楽園の開発をちょこっとだけ手伝った話
最後の楽園の開発をちょこっとだけ手伝った話
 
OpenBSD/sgi SMP implementation for Origin 350
OpenBSD/sgi SMP implementation for Origin 350OpenBSD/sgi SMP implementation for Origin 350
OpenBSD/sgi SMP implementation for Origin 350
 
SMP Implementation for OpenBSD/sgi [Japanese Edition]
SMP Implementation for OpenBSD/sgi [Japanese Edition]SMP Implementation for OpenBSD/sgi [Japanese Edition]
SMP Implementation for OpenBSD/sgi [Japanese Edition]
 
Leak kernel pointer by exploiting uninitialized uses in Linux kernel
Leak kernel pointer by exploiting uninitialized uses in Linux kernelLeak kernel pointer by exploiting uninitialized uses in Linux kernel
Leak kernel pointer by exploiting uninitialized uses in Linux kernel
 
Debugging Ruby Systems
Debugging Ruby SystemsDebugging Ruby Systems
Debugging Ruby Systems
 
from Binary to Binary: How Qemu Works
from Binary to Binary: How Qemu Worksfrom Binary to Binary: How Qemu Works
from Binary to Binary: How Qemu Works
 
TinyML - 4 speech recognition
TinyML - 4 speech recognition TinyML - 4 speech recognition
TinyML - 4 speech recognition
 
Gameboy emulator in rust and web assembly
Gameboy emulator in rust and web assemblyGameboy emulator in rust and web assembly
Gameboy emulator in rust and web assembly
 
mTCP使ってみた
mTCP使ってみたmTCP使ってみた
mTCP使ってみた
 
General Purpose Computing using Graphics Hardware
General Purpose Computing using Graphics HardwareGeneral Purpose Computing using Graphics Hardware
General Purpose Computing using Graphics Hardware
 
Juggva cloud
Juggva cloudJuggva cloud
Juggva cloud
 
Building Network Functions with eBPF & BCC
Building Network Functions with eBPF & BCCBuilding Network Functions with eBPF & BCC
Building Network Functions with eBPF & BCC
 
matplotlib-installatin-interactive-contour-example-guide
matplotlib-installatin-interactive-contour-example-guidematplotlib-installatin-interactive-contour-example-guide
matplotlib-installatin-interactive-contour-example-guide
 
Make A Shoot ‘Em Up Game with Amethyst Framework
Make A Shoot ‘Em Up Game with Amethyst FrameworkMake A Shoot ‘Em Up Game with Amethyst Framework
Make A Shoot ‘Em Up Game with Amethyst Framework
 
Linux Device Tree
Linux Device TreeLinux Device Tree
Linux Device Tree
 
Vectorization on x86: all you need to know
Vectorization on x86: all you need to knowVectorization on x86: all you need to know
Vectorization on x86: all you need to know
 

Similar to TinyOS 2.1 Tutorial: Hands-on Session

Troubleshooting .net core on linux
Troubleshooting .net core on linuxTroubleshooting .net core on linux
Troubleshooting .net core on linuxPavel Klimiankou
 
PVS-Studio and Continuous Integration: TeamCity. Analysis of the Open RollerC...
PVS-Studio and Continuous Integration: TeamCity. Analysis of the Open RollerC...PVS-Studio and Continuous Integration: TeamCity. Analysis of the Open RollerC...
PVS-Studio and Continuous Integration: TeamCity. Analysis of the Open RollerC...Andrey Karpov
 
Debugging linux kernel tools and techniques
Debugging linux kernel tools and  techniquesDebugging linux kernel tools and  techniques
Debugging linux kernel tools and techniquesSatpal Parmar
 
Modern Linux Tracing Landscape
Modern Linux Tracing LandscapeModern Linux Tracing Landscape
Modern Linux Tracing LandscapeSasha Goldshtein
 
Code on the Beach 2019 - Let's Take a Tour of .Net Core: CLI
Code on the Beach 2019 - Let's Take a Tour of .Net Core: CLICode on the Beach 2019 - Let's Take a Tour of .Net Core: CLI
Code on the Beach 2019 - Let's Take a Tour of .Net Core: CLIBrian McKeiver
 
Accelerated .NET Memory Dump Analysis training public slides
Accelerated .NET Memory Dump Analysis training public slidesAccelerated .NET Memory Dump Analysis training public slides
Accelerated .NET Memory Dump Analysis training public slidesDmitry Vostokov
 
Moving from Jenkins 1 to 2 declarative pipeline adventures
Moving from Jenkins 1 to 2 declarative pipeline adventuresMoving from Jenkins 1 to 2 declarative pipeline adventures
Moving from Jenkins 1 to 2 declarative pipeline adventuresFrits Van Der Holst
 
Windbg랑 친해지기
Windbg랑 친해지기Windbg랑 친해지기
Windbg랑 친해지기Ji Hun Kim
 
100 bugs in Open Source C/C++ projects
100 bugs in Open Source C/C++ projects 100 bugs in Open Source C/C++ projects
100 bugs in Open Source C/C++ projects Andrey Karpov
 
IIT-RTC 2017 Qt WebRTC Tutorial (Qt Janus Client)
IIT-RTC 2017 Qt WebRTC Tutorial (Qt Janus Client)IIT-RTC 2017 Qt WebRTC Tutorial (Qt Janus Client)
IIT-RTC 2017 Qt WebRTC Tutorial (Qt Janus Client)Alexandre Gouaillard
 
XebiCon'16 : Server-Side Swift. Par Simone Civetta, Développeur iOS chez Xebia
XebiCon'16 : Server-Side Swift. Par Simone Civetta, Développeur iOS chez XebiaXebiCon'16 : Server-Side Swift. Par Simone Civetta, Développeur iOS chez Xebia
XebiCon'16 : Server-Side Swift. Par Simone Civetta, Développeur iOS chez XebiaPublicis Sapient Engineering
 
Didactum SNMP Manual
Didactum SNMP ManualDidactum SNMP Manual
Didactum SNMP ManualDidactum
 
Untitled presentation(4)
Untitled presentation(4)Untitled presentation(4)
Untitled presentation(4)chan20kaur
 
Labs_BT_20221017.pptx
Labs_BT_20221017.pptxLabs_BT_20221017.pptx
Labs_BT_20221017.pptxssuserb4d806
 
So You Want To Write Your Own Benchmark
So You Want To Write Your Own BenchmarkSo You Want To Write Your Own Benchmark
So You Want To Write Your Own BenchmarkDror Bereznitsky
 
KDD 2016 Streaming Analytics Tutorial
KDD 2016 Streaming Analytics TutorialKDD 2016 Streaming Analytics Tutorial
KDD 2016 Streaming Analytics TutorialNeera Agarwal
 
CiklumCPPSat: Alexey Podoba "Automatic assembly. Cmake"
CiklumCPPSat: Alexey Podoba "Automatic assembly. Cmake"CiklumCPPSat: Alexey Podoba "Automatic assembly. Cmake"
CiklumCPPSat: Alexey Podoba "Automatic assembly. Cmake"Ciklum Ukraine
 
Microservices in GO - Massimiliano Dessì - Codemotion Rome 2017
Microservices in GO - Massimiliano Dessì - Codemotion Rome 2017Microservices in GO - Massimiliano Dessì - Codemotion Rome 2017
Microservices in GO - Massimiliano Dessì - Codemotion Rome 2017Codemotion
 

Similar to TinyOS 2.1 Tutorial: Hands-on Session (20)

Troubleshooting .net core on linux
Troubleshooting .net core on linuxTroubleshooting .net core on linux
Troubleshooting .net core on linux
 
PVS-Studio and Continuous Integration: TeamCity. Analysis of the Open RollerC...
PVS-Studio and Continuous Integration: TeamCity. Analysis of the Open RollerC...PVS-Studio and Continuous Integration: TeamCity. Analysis of the Open RollerC...
PVS-Studio and Continuous Integration: TeamCity. Analysis of the Open RollerC...
 
Debugging linux kernel tools and techniques
Debugging linux kernel tools and  techniquesDebugging linux kernel tools and  techniques
Debugging linux kernel tools and techniques
 
Modern Linux Tracing Landscape
Modern Linux Tracing LandscapeModern Linux Tracing Landscape
Modern Linux Tracing Landscape
 
Code on the Beach 2019 - Let's Take a Tour of .Net Core: CLI
Code on the Beach 2019 - Let's Take a Tour of .Net Core: CLICode on the Beach 2019 - Let's Take a Tour of .Net Core: CLI
Code on the Beach 2019 - Let's Take a Tour of .Net Core: CLI
 
Accelerated .NET Memory Dump Analysis training public slides
Accelerated .NET Memory Dump Analysis training public slidesAccelerated .NET Memory Dump Analysis training public slides
Accelerated .NET Memory Dump Analysis training public slides
 
Moving from Jenkins 1 to 2 declarative pipeline adventures
Moving from Jenkins 1 to 2 declarative pipeline adventuresMoving from Jenkins 1 to 2 declarative pipeline adventures
Moving from Jenkins 1 to 2 declarative pipeline adventures
 
Windbg랑 친해지기
Windbg랑 친해지기Windbg랑 친해지기
Windbg랑 친해지기
 
100 bugs in Open Source C/C++ projects
100 bugs in Open Source C/C++ projects 100 bugs in Open Source C/C++ projects
100 bugs in Open Source C/C++ projects
 
IIT-RTC 2017 Qt WebRTC Tutorial (Qt Janus Client)
IIT-RTC 2017 Qt WebRTC Tutorial (Qt Janus Client)IIT-RTC 2017 Qt WebRTC Tutorial (Qt Janus Client)
IIT-RTC 2017 Qt WebRTC Tutorial (Qt Janus Client)
 
XebiCon'16 : Server-Side Swift. Par Simone Civetta, Développeur iOS chez Xebia
XebiCon'16 : Server-Side Swift. Par Simone Civetta, Développeur iOS chez XebiaXebiCon'16 : Server-Side Swift. Par Simone Civetta, Développeur iOS chez Xebia
XebiCon'16 : Server-Side Swift. Par Simone Civetta, Développeur iOS chez Xebia
 
Didactum SNMP Manual
Didactum SNMP ManualDidactum SNMP Manual
Didactum SNMP Manual
 
Untitled presentation(4)
Untitled presentation(4)Untitled presentation(4)
Untitled presentation(4)
 
Qt coin3d soqt
Qt coin3d soqtQt coin3d soqt
Qt coin3d soqt
 
Labs_BT_20221017.pptx
Labs_BT_20221017.pptxLabs_BT_20221017.pptx
Labs_BT_20221017.pptx
 
So You Want To Write Your Own Benchmark
So You Want To Write Your Own BenchmarkSo You Want To Write Your Own Benchmark
So You Want To Write Your Own Benchmark
 
KDD 2016 Streaming Analytics Tutorial
KDD 2016 Streaming Analytics TutorialKDD 2016 Streaming Analytics Tutorial
KDD 2016 Streaming Analytics Tutorial
 
CiklumCPPSat: Alexey Podoba "Automatic assembly. Cmake"
CiklumCPPSat: Alexey Podoba "Automatic assembly. Cmake"CiklumCPPSat: Alexey Podoba "Automatic assembly. Cmake"
CiklumCPPSat: Alexey Podoba "Automatic assembly. Cmake"
 
Microservices in GO - Massimiliano Dessì - Codemotion Rome 2017
Microservices in GO - Massimiliano Dessì - Codemotion Rome 2017Microservices in GO - Massimiliano Dessì - Codemotion Rome 2017
Microservices in GO - Massimiliano Dessì - Codemotion Rome 2017
 
Onnc intro
Onnc introOnnc intro
Onnc intro
 

Recently uploaded

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
 
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
 
08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking MenDelhi Call girls
 
Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024BookNet Canada
 
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking MenDelhi Call girls
 
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
 
#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
 
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 3652toLead Limited
 
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
 
Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)Allon Mureinik
 
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
 
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
 
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...Patryk Bandurski
 
Slack Application Development 101 Slides
Slack Application Development 101 SlidesSlack Application Development 101 Slides
Slack Application Development 101 Slidespraypatel2
 
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
 
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 Remove Document Management Hurdles with X-Docs?
How to Remove Document Management Hurdles with X-Docs?How to Remove Document Management Hurdles with X-Docs?
How to Remove Document Management Hurdles with X-Docs?XfilesPro
 
Enhancing Worker Digital Experience: A Hands-on Workshop for Partners
Enhancing Worker Digital Experience: A Hands-on Workshop for PartnersEnhancing Worker Digital Experience: A Hands-on Workshop for Partners
Enhancing Worker Digital Experience: A Hands-on Workshop for PartnersThousandEyes
 
Human Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR SystemsHuman Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR SystemsMark Billinghurst
 
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
 

Recently uploaded (20)

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
 
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
 
08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men
 
Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
 
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
 
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
 
#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
 
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
 
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
 
Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)
 
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
 
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
 
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
 
Slack Application Development 101 Slides
Slack Application Development 101 SlidesSlack Application Development 101 Slides
Slack Application Development 101 Slides
 
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
 
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 Remove Document Management Hurdles with X-Docs?
How to Remove Document Management Hurdles with X-Docs?How to Remove Document Management Hurdles with X-Docs?
How to Remove Document Management Hurdles with X-Docs?
 
Enhancing Worker Digital Experience: A Hands-on Workshop for Partners
Enhancing Worker Digital Experience: A Hands-on Workshop for PartnersEnhancing Worker Digital Experience: A Hands-on Workshop for Partners
Enhancing Worker Digital Experience: A Hands-on Workshop for Partners
 
Human Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR SystemsHuman Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR Systems
 
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
 

TinyOS 2.1 Tutorial: Hands-on Session

Editor's Notes

  1. Hi. I&#x2019;m R&#x103;zvan Mus&#x103;loiu-E. and I&#x2019;m going to be your host for this hands-on session.
  2. Today we are going to try to achieve 3 goals. First we&#x2019;ll look at the options available for installing TinyOS, then we will take a quick tour of the layout of the tinyos-2.x sources and then we&#x2019;ll discuss and try to write two application: one based on dissemination and one based on collection.
  3. The quickest way to get TinyOS is using a LiveCD. Right now we have two of these: one is XubunTOS and the other one is a customized Ubntul 8.10 LiveCD. Xubuntos is based on an older version and Xubuntu and beside tinyos-2.x it also contains tinyos-1.x and TOSKI, the ArchRock TinyOS Kernel. The customized Ubuntu 8.10 LiveCD comes only with tinyos-2.x. When 9.04 will be out we will start using that. The other direction to get TinyOS is to install it on the your current OS. For Linux we have set of .rpm packages and Stanford is maintaining an Ubuntu/Debian repository with the .deb packages. If you want to run TinyOS on Windows you&#x2019;ll have to install cygwin. For MacOS X there are also two options: one based on stow with prebuilt binaries and also a one based on macports.
  4. Other popular way to run TinyOS is using VMware. For this we have several images: Jetos is very small and optimized for ssh access; Lenny is an image based on the the latest Debian stable release. Some people also like to run XubunTOS.
  5. Here is the way things are split into packages. NesC compiler has its own package and so is deputy, a tool that is used by Safe TinyOS. Each architecture has its own set of packages. The binutils is the one containing the assembler, linker (ld) and several other tools for dealing with object files (objdump, readelf, etc). Then there is the gcc which contains the C compiler and finally a libc package that contains the precompiled C library. The gdb debugger also has its own packet.
  6. This is the way the environment needs to be setup. The most important one is the MAKERULES because that we are going to include in the Makefiles of any applications.
  7. The AVR and MSP430 are the best supported platforms. The ARM is also supported for the Imote2 platform. We are also working on making 8051 a first class citizen. This is used in some several System-on-a-Chip like CC2430/CC1110/C1111.
  8. This is the high level layout of the source code. In the following slides we will briefly go over each of these directories.
  9. As the name indicates, the apps/ directory contains the applications. Some popular applications are: - Blink: toggles the leds with various frequencies. This is the equivalent of &#x201C;Hello World!&#x201D; for TinyOS. - Null: it really doesn&#x2019;t do anything. Can be used to check the current draw in sleep mode. - RadioCountToLeds: 2 motes are needed for this application. It can be used to see if the radio works. - MultihopOscilloscope: this application implements network collection using CTP. In apps/tests/ there are a many tests that are used to check if various parts of TinyOS are working properly. Some of the code is also useful as examples.
  10. The docs/ contains the TEPs (TinyOS Enhancement Proposals) in various formats. These documents describe in great detail various parts of TinyOS.
  11. The support/make contains the make infrastructure. Here is were the Makerules sits.
  12. In support/sdk/ there is one folder for several languages. Each of them contains various tools and libraries that implements the communication between PC and motes.
  13. The support/sdk/c/blib contains the code necessary for the IPv6 stack contributed by Berkeley. The support/sdk/c/sf contains a few programs (sf, sflisten, prettylisten, etc) and also the libmote.a C library. The support/sdk/cpp/sf contains a more complex and versatile version of sf. The tinyos.jar from support/sdk/java contains all the classes necessary to access the motes from Java. The support/sdk/python/tos.py is used by Deluge T2 and the tos-dump program.
  14. The tos/ directory contains the main code of the TinyOS.
  15. The tos/chips contains one directory for each supported chip. Some are MCUs (atm128, msp430), radios (cc2420, cc1000), flash chips (at45db, stm25p), sensors (sht11), etc.
  16. In tos/interfaces are all the definition of all general interfaces.
  17. The tos/lib contains the more complicated platform independent code. The printf library, the serial stack, the timer support are a few examples.
  18. The tos/lib/net contains the network protocols. 4bitle and le are link estimators, ctp and lqi are collection protocols, drip and dip are dissemination protocols, Deluge is a bulk dissemination service use to implement network reprogramming.
  19. In tos/systems are a few general components like: - MainC: provides the Booted event which is signaled after a mote comes up. - LedsC: access to the Leds interface to control the leds. - TimerMilliC: used to get timers with millisecond accuracy. - AMSenderC and AMReceiveC: used to send and receive packets over the radio.
  20. Finally, in tos/types there a few important .h files: the TinyError.h contains the definitions for all the error codes and message.h contains the definition of the message_t structure which is used by radio and serial packets.
  21. Let&#x2019;s now move to the the two applications.
  22. The DisseminationDemo is made of two applications: a client and a server. The DisseminationDemoClient will need to perform the following tasks: turn on the radio, start the dissemination service and when a new value is receive it needs to print it on the serial port. The DisseminationDemoServer will also start the radio and the dissemination service but after that it will start a timer and each time the timer fires it will increment a counter and disseminate it. I&#x2019;m going to run the server so what we are going to do next is to try to write and run the client part.
  23. These are the components we going to use and the way they are interconnected with the application. The Boot from MainC is used in order to receive a signal that the mote is up, the SplitControl from ActiveMessageC is used to turn the radio on, the StdControl from DisseminationC is used to start the dissemination service and the DisseminatorC is used to subscribe to the updates of a certain dissemination key. This key plays in the dissemination the same role as ports play in UDP and TCP.
  24. Here are a summary of the interfaces and components we are going to use. In the following slides we are going to briefly look at each of them.
  25. The Boot interface is very simple and straightforward. It contains only one signal which is called after the mote receives power.
  26. Only two commands are in StdControl: start and stop. Their return code indicates if the start or stop succeeded or not.
  27. This is similar with StdControl but it&#x2019;s split phase so the startDone and stopDone are the one that indicates when and if the operation was successful. The most important components that provide this interface are the ActiveMessageC and SerialActiveMessageC.
  28. This is the interface provided by DisseminatorC. The changed event is signaled when an update to the key is receive. The get can be used to obtain a pointer to the current value. The set command can be used to set an initial value. The t is the type of the key.
  29. This is the MainC components with the Boot interface that we are interested in.
  30. DisseminatorC is a generic component and the two parameters we&#x2019;ll have to give are the type of disseminated value and the key. The DisseminationUpdate which we are not going to go into is used by the server to inject updates.
  31. This is the Makefile we are going to need.
  32. And these are the commands to compile, install and read the results.
  33. The type of the key is a nx_uint32_t and the key value is 2009.
  34. The printfflush is necessary to force the the printf library to send the contents of its buffer immediately.
  35. The code for the server is available on the TinyOS wiki at this address.
  36. Let&#x2019;s now move to the second application.
  37. Again we have a client and server. The client will have to start the radio, start the collection service and the periodically increment a counter and then the value. The server will be the root of the collection tree and will receive all the values and print them on the screen. This is the code I&#x2019;m going to run. Now let&#x2019;s try to write and run the code for the client.
  38. This is the components and interfaces we need. The CollectionC is component that offers the StdControl interface for collection. The CollectionSenderC is the offering a Send interface to send the value up on the tree.
  39. This is a summary of the interfaces and components we are going to use.
  40. We are going to only look at the news ones.
  41. This is the Makefile we are going to use. Note that I picked the 4bitle for link estimation.
  42. Note that the collection id I picked is 16.
  43. Note that the collection id I picked is 16.
  44. Please replace &#x201C;name&#x201D; with your name.
  45. The code for the server is available on the TinyOS wiki at this address.