Post on 19-Jan-2016
description
transcript
Feb. 11, 2005 TinyOS Technology Exchange 1
Storage Abstractionsin TinyOS 2.x
Jonathan Huijwhui@cs.berkeley.edu
University of California, Berkeley
David Gaydgay@acm.org
Intel Research, Berkeley
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
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
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
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
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
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
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
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
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
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!
TinyOS Technology Exchange 12Feb. 11, 2005
Backup Slides
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); }
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); }
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); }
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); }