Presentation is loading. Please wait.

Presentation is loading. Please wait.

A Quick Note on TinyOS Chris Merlin Group Meeting January 21 st, 2009.

Similar presentations


Presentation on theme: "A Quick Note on TinyOS Chris Merlin Group Meeting January 21 st, 2009."— Presentation transcript:

1 A Quick Note on TinyOS Chris Merlin Group Meeting January 21 st, 2009

2 Outline TinyOS: What Is It? TOSSIM, The TinyOS Simulator Dynamic Memory Allocation in TinyOS Concluding Remarks TinyOS: What is it?TOSSIM, the TinyOS SimulatorDynamic Memory Allocation in TinyOS

3 TinyOS: A Quick Reminder A Simple and stripped down operating system for motes nesC language  C Based  For component-based programming Maybe a quarter million programmers in the world TinyOS: What is it?TOSSIM, the TinyOS SimulatorDynamic Memory Allocation in TinyOS

4 (…2) TinyOS: A Quick Reminder Components: black boxes whose input and output functions are known (interfaces) Configurations:  assemble other components together  link interfaces used by components to providers Modules:  Provide application code  Use and provide interfaces TinyOS: What is it?TOSSIM, the TinyOS SimulatorDynamic Memory Allocation in TinyOS

5 (…3) TinyOS: A Quick Reminder Consider a module called Application that needs to turn LEDs on and off The Leds interface provides functions to turn on/off, initialize, toggle LEDs Application would like to use that interface LedsC is a component that provides Leds interface Application.Leds -> LedsC.Leds; TinyOS: What is it?TOSSIM, the TinyOS SimulatorDynamic Memory Allocation in TinyOS

6 Outline TinyOS: What Is It? TOSSIM, The TinyOS Simulator Dynamic Memory Allocation in TinyOS Concluding Remarks TinyOS: What is it?TOSSIM, the TinyOS SimulatorDynamic Memory Allocation in TinyOS

7 TOSSIM: Generalities Simulator:  Built with make pc  Runs with DBG=[name], build/pc/main.exe [options] What it does:  Displays traces  Emulates mote+radio behavior What it doesn’t do:  Model radio propagation  Model power drain / energy consumption TinyOS: What is it?TOSSIM, the TinyOS SimulatorDynamic Memory Allocation in TinyOS

8 Compiling and Running a Simulation Execute: build/pc/main.exe [options] num_nodes -b= : time over which motes boot -l= : runs sim. at times real time -r= : radio model: simple, static, lossy -rf= : input file for lossy model -t= : runs sim. for virtual seconds num_nodes : number of nodes TinyOS: What is it?TOSSIM, the TinyOS SimulatorDynamic Memory Allocation in TinyOS

9 The Lossy Radio Model Input file can specify links’ bit error rates Lossy radio model can help create multi- hop networks of nodes : :ber TinyOS: What is it?TOSSIM, the TinyOS SimulatorDynamic Memory Allocation in TinyOS 0 0 11 1 1 1

10 Outline TinyOS: What Is It? TOSSIM, The TinyOS Simulator Dynamic Memory Allocation in TinyOS Concluding Remarks TinyOS: What is it?TOSSIM, the TinyOS SimulatorDynamic Memory Allocation in TinyOS

11 Dynamic Memory Allocation “TinyOS does not allow dynamic memory allocation” True: malloc will occasionally crash, realloc not supported on real motes False: malloc, realloc, free all work fine in TOSSIM. MemAlloc provides some DMA for real motes TinyOS: What is it?TOSSIM, the TinyOS SimulatorDynamic Memory Allocation in TinyOS

12 Memory Model of TinyOS Simplicity of TinyOS allows only static mem. alloc (no management of dynamic heap) malloc must find space of appropriate size: can be resource consuming, esp. when mem. very fragmented TinyOS: What is it?TOSSIM, the TinyOS SimulatorDynamic Memory Allocation in TinyOS

13 MemAlloc MemAlloc is provided by TinyAlloc Some commands are:  allocate(HandlePtr hptr, int size) : allocate memory region of size  reallocate(Handle h, int size)  free(Handle h) However, MemAlloc is split-phase Events:  allocComplete(HandlePtr hptr, result_t outcome) : indicate an allocation has completed  reallocComplete(Handle h, result_t outcome) TinyOS: What is it?TOSSIM, the TinyOS SimulatorDynamic Memory Allocation in TinyOS

14 MemAlloc Example TinyAlloc implements managed heap: simple array of handles Memory regions are referenced indirectly by another array Double dereferencing is needed TinyOS: What is it?TOSSIM, the TinyOS SimulatorDynamic Memory Allocation in TinyOS Handle array; call MemAlloc.allocate(&array, 2*sizeof(ArrayEntry)); ArrayEntry *entry = (ArrayEntry*)(*array+sizeof(ArrayEntry))

15 Outline TinyOS: What Is It? TOSSIM, The TinyOS Simulator Dynamic Memory Allocation in TinyOS Concluding Remarks TinyOS: What is it?TOSSIM, the TinyOS SimulatorDynamic Memory Allocation in TinyOS

16 Remarks If you have suggestions, pieces of code to add, let me know Compiled in Tutorial on WCNG website / my Academic page


Download ppt "A Quick Note on TinyOS Chris Merlin Group Meeting January 21 st, 2009."

Similar presentations


Ads by Google