1 / 16

A Quick Note on TinyOS

A Quick Note on TinyOS. Chris Merlin Group Meeting January 21 st , 2009. Outline. TinyOS: What Is It? TOSSIM, The TinyOS Simulator Dynamic Memory Allocation in TinyOS Concluding Remarks. TinyOS: What is it?. TOSSIM, the TinyOS Simulator. Dynamic Memory Allocation in TinyOS.

golda
Download Presentation

A Quick Note on TinyOS

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. A Quick Note on TinyOS Chris Merlin Group Meeting January 21st, 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 Simulator Dynamic 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 Simulator Dynamic 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 Simulator Dynamic 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 Simulator Dynamic 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 Simulator Dynamic 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 Simulator Dynamic Memory Allocation in TinyOS

  8. Compiling and Running a Simulation • Execute: build/pc/main.exe [options] num_nodes -b=<sec>: time over which motes boot -l=<scale>: runs sim. at <scale> times real time -r=<radio>: radio model: simple, static, lossy -rf=<file>: input file for lossy model -t=<time>: runs sim. for <time> virtual seconds num_nodes: number of nodes TinyOS: What is it? TOSSIM, the TinyOS Simulator Dynamic 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 • <mote ID>:<mote ID>:ber 1 1 1 0 0 1 1 TinyOS: What is it? TOSSIM, the TinyOS Simulator Dynamic Memory Allocation in TinyOS

  10. Outline • TinyOS: What Is It? • TOSSIM, The TinyOS Simulator • Dynamic Memory Allocation in TinyOS • Concluding Remarks TinyOS: What is it? TOSSIM, the TinyOS Simulator Dynamic 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 Simulator Dynamic 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 Simulator Dynamic 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 Simulator Dynamic 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 Handle array; call MemAlloc.allocate(&array, 2*sizeof(ArrayEntry)); ArrayEntry *entry = (ArrayEntry*)(*array+sizeof(ArrayEntry)) TinyOS: What is it? TOSSIM, the TinyOS Simulator Dynamic Memory Allocation in TinyOS

  15. Outline • TinyOS: What Is It? • TOSSIM, The TinyOS Simulator • Dynamic Memory Allocation in TinyOS • Concluding Remarks TinyOS: What is it? TOSSIM, the TinyOS Simulator Dynamic 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

More Related