170 likes | 286 Vues
This document presents a comprehensive overview of non-volatile storage solutions within the TinyOS 2.x environment, focusing on the integration of various flash storage technologies. With rising demands for mass data storage, logging sensor data, and maintaining configuration data through power failures, we detail the characteristics and applications of large and small object storage. The architecture of storage services is designed for sensor network applications, emphasizing fault tolerance and efficient data management through volume allocation. Current implementations are discussed, as well as future enhancements for block storage and logging mechanisms.
E N D
Storage Abstractionsin TinyOS 2.x Jonathan Hui jwhui@cs.berkeley.edu University of California, Berkeley David Gay dgay@acm.org Intel Research, Berkeley TinyOS Technology Exchange
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
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 2 • But has very different characteristics TinyOS Technology Exchange
Technology Differences • One write per bit per erase cycle • Flash characteristics: Not used in current motes TinyOS Technology Exchange
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
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
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
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
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 3 Flash TinyOS Technology Exchange
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. Small Object Large Object Log Log Volume 0 Volume 1 Volume 2 Volume 3 Flash TinyOS Technology Exchange
Implementation Status • Currently under development: • AT45DB – Mica family, Telos rev. A, Eyes 2 • STM25P – 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
Backup Slides TinyOS Technology Exchange
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
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
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
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); } TinyOS Technology Exchange