storage abstractions in tinyos 2.x
DESCRIPTION
Storage Abstractions in TinyOS 2.x. Jonathan Hui [email protected] University of California, Berkeley. David Gay [email protected] Intel Research, Berkeley. Non-Volatile Storage. Flash storage becoming more widely used “Mass” data storage logging sensor data network programming - PowerPoint PPT PresentationTRANSCRIPT
![Page 1: Storage Abstractions in TinyOS 2.x](https://reader036.vdocuments.site/reader036/viewer/2022062805/56814e4a550346895dbbd046/html5/thumbnails/1.jpg)
Feb. 11, 2005 TinyOS Technology Exchange 1
Storage Abstractionsin TinyOS 2.x
Jonathan [email protected]
University of California, Berkeley
David [email protected]
Intel Research, Berkeley
![Page 2: Storage Abstractions in TinyOS 2.x](https://reader036.vdocuments.site/reader036/viewer/2022062805/56814e4a550346895dbbd046/html5/thumbnails/2.jpg)
TinyOS Technology Exchange 2Feb. 11, 2005
Non-Volatile Storage
Flash storage becoming more widely used“Mass” data storage
logging sensor data network programming event logging for debugging
Configuration data that survives power-failure reprogramming
![Page 3: Storage Abstractions in TinyOS 2.x](https://reader036.vdocuments.site/reader036/viewer/2022062805/56814e4a550346895dbbd046/html5/thumbnails/3.jpg)
TinyOS Technology Exchange 3Feb. 11, 2005
Flash Storage Variety
STMicro M25P (NOR)Telos rev. B, Eyes 1
Intel StrataFlash (NOR) iMote 2
Atmel AT45DB (NOR)Mica Family, Telos rev. A, Eyes 2But has very different characteristics
![Page 4: Storage Abstractions in TinyOS 2.x](https://reader036.vdocuments.site/reader036/viewer/2022062805/56814e4a550346895dbbd046/html5/thumbnails/4.jpg)
TinyOS Technology Exchange 4Feb. 11, 2005
Technology Differences
NOR AT45DB NAND
Erase Slow (seconds) Fast (ms) Fast (ms)
Erase Unit Large (64K-128K) Small (256) Medium (8K-32K)
Writes Slow (100 kB/s) Slow (60 kB/s) Fast (MB/s)
Write Unit 1 bit 256 bytes 100’s bytes
Bit-Errors Low Low High (requires ECC)
Read Fast Slow + I/O Bus Fast + I/O Bus
Erase Cycles 10^4 – 10^5 10^4 10^5 – 10^7
Intended Use Code storage Data storage Data storage
One write per bit per erase cycle Flash characteristics:
Not used in current motes
![Page 5: Storage Abstractions in TinyOS 2.x](https://reader036.vdocuments.site/reader036/viewer/2022062805/56814e4a550346895dbbd046/html5/thumbnails/5.jpg)
TinyOS Technology Exchange 5Feb. 11, 2005
Architecture
Differences + limited RAM preclude common low-level HIL interfaces (e.g. block interface)
Provide high-level storage services useful for sensor network applications Large Objects Small Objects Large Sequential Objects
Separate implementations of these abstractions for each class of storage chip
![Page 6: Storage Abstractions in TinyOS 2.x](https://reader036.vdocuments.site/reader036/viewer/2022062805/56814e4a550346895dbbd046/html5/thumbnails/6.jpg)
TinyOS Technology Exchange 6Feb. 11, 2005
Large Objects
Get a large object, write to each byte once in any arbitrary order, and commit.
Characteristics Size: Large (100B to 100KB, or more) Reads: random Writes: random (write once) Fault tolerance: validity check
Example Applications Network Programming Large Data Transfer
![Page 7: Storage Abstractions in TinyOS 2.x](https://reader036.vdocuments.site/reader036/viewer/2022062805/56814e4a550346895dbbd046/html5/thumbnails/7.jpg)
TinyOS Technology Exchange 7Feb. 11, 2005
Small Objects
Maintain a small chunk of values. Requires multiple and random reads/writes.
Characteristics Size: Small (< 100B) Reads: random Writes: random Fault tolerance: writes are atomic
Failure between/during writes no data loss
Example Applications: Configuration data storage
![Page 8: Storage Abstractions in TinyOS 2.x](https://reader036.vdocuments.site/reader036/viewer/2022062805/56814e4a550346895dbbd046/html5/thumbnails/8.jpg)
TinyOS Technology Exchange 8Feb. 11, 2005
Large Sequential Object
Some applications (e.g., low-rate data collection) may want to reliably log all their results.
Characteristics Size: Large Reads: sequential Writes: sequential Fault tolerance: user-specified commit points
Failure between/during writes entire object is not lost
Example Applications Logging
![Page 9: Storage Abstractions in TinyOS 2.x](https://reader036.vdocuments.site/reader036/viewer/2022062805/56814e4a550346895dbbd046/html5/thumbnails/9.jpg)
TinyOS Technology Exchange 9Feb. 11, 2005
Putting It Together
Sharing the flash through Volumes, with numerical identifiers
Volumes allocated similar to using fdisk. A utility explicitly “formats” the flash.
1) Init volume table
2) Allocate each desired volume (user specifies UID and size)
3) Commit volume table
Volume table kept in non-volatile storage.
Volume 0 Volume 1 Volume 2 Volume 3Flash
![Page 10: Storage Abstractions in TinyOS 2.x](https://reader036.vdocuments.site/reader036/viewer/2022062805/56814e4a550346895dbbd046/html5/thumbnails/10.jpg)
TinyOS Technology Exchange 10Feb. 11, 2005
Putting It Together
TinyOS apps must mount volume before use. Mount by specifying UID of volume No unmount operation
A volume is used by at most one HIL. Allows switching of applications while managing
the sharing of flash.
Volume 0 Volume 1 Volume 2 Volume 3
Small Object Large Object Log Log
Flash
![Page 11: Storage Abstractions in TinyOS 2.x](https://reader036.vdocuments.site/reader036/viewer/2022062805/56814e4a550346895dbbd046/html5/thumbnails/11.jpg)
TinyOS Technology Exchange 11Feb. 11, 2005
Implementation Status
Currently under development:AT45DB – Mica family, Telos rev. A, Eyes 2STM25P – Telos rev. B, Eyes 1
Alpha (incomplete, etc) code on SourceForge, in: tinyos-2.x/tos/chips/at45db tinyos-2.x/tos/chips/stm25p
Thanks!
![Page 12: Storage Abstractions in TinyOS 2.x](https://reader036.vdocuments.site/reader036/viewer/2022062805/56814e4a550346895dbbd046/html5/thumbnails/12.jpg)
TinyOS Technology Exchange 12Feb. 11, 2005
Backup Slides
![Page 13: Storage Abstractions in TinyOS 2.x](https://reader036.vdocuments.site/reader036/viewer/2022062805/56814e4a550346895dbbd046/html5/thumbnails/13.jpg)
TinyOS Technology Exchange 13Feb. 11, 2005
BlockStorage
interface BlockRead { command result_t read(addr_t addr, void* dest, addr_t len); event void readDone(storage_result_t result); command result_t verify(); event void verifyDone(storage_result_t result); }
interface BlockWrite { command result_t write(addr_t addr, void* source, addr_t len); event void writeDone(storage_result_t result); command result_t erase(); event void eraseDone(storage_result_t result); command result_t commit(); event void commitDone(storage_result_t result); }
![Page 14: Storage Abstractions in TinyOS 2.x](https://reader036.vdocuments.site/reader036/viewer/2022062805/56814e4a550346895dbbd046/html5/thumbnails/14.jpg)
TinyOS Technology Exchange 14Feb. 11, 2005
ConfigStorage
interface ConfigStorage { command result_t read(addr_t addr, void* dest, addr_t len); event void readDone(storage_result_t result);
command result_t write(addr_t addr void* source, addr_t len); event void writeDone(storage_result_t result);
command result_t commit(); event void commitDone(storage_result_t result); }
![Page 15: Storage Abstractions in TinyOS 2.x](https://reader036.vdocuments.site/reader036/viewer/2022062805/56814e4a550346895dbbd046/html5/thumbnails/15.jpg)
TinyOS Technology Exchange 15Feb. 11, 2005
Logger
interface LogRead { command result_t read(uint8_t* data, uint32_t numBytes); event void readDone(uint8_t* data, uint32_t numBytes, storage_result_t success); command result_t seek(uint32_t cookie); event void seekDone(storage_result_t success); }
interface LogWrite { command result_t erase(); event void eraseDone(storage_result_t success); command result_t append(uint8_t* data, uint32_t numBytes); event void appendDone(uint8_t* data, uint32_t numBytes, storage_result_t success); command uint32_t currentOffset(); command result_t sync(); event void syncDone(storage_result_t success); }
![Page 16: Storage Abstractions in TinyOS 2.x](https://reader036.vdocuments.site/reader036/viewer/2022062805/56814e4a550346895dbbd046/html5/thumbnails/16.jpg)
TinyOS Technology Exchange 16Feb. 11, 2005
Volume Management
interface FStorage { command result_t init(); command result_t allocate(uint8_t id, addr_t size); command result_t allocateFixed(uint8_t id, addr_t addr,
addr_t size); command result_t commit(); event void commitDone(storage_result_t result, uint8_t id); }
interface Mount { command result_t mount(uint8_t id); event void mountDone(storage_result_t result, uint8_t id); }