link 1
http://hi.baidu.com/lxd_0401/blog/item/31b430f4dfbea232bc310991.html
It really helps. The example /opt/tinyos-2.1.1/apps/tutorials/BlinkConfig is a very good way to learn storage. Although the flash devices at45db and stm25p are used in different nodes (micaz uses at45db; telosb uses stm25p), in high level, they are similar and have the almost same interfaces.
link 2
http://www.tinyos.net/tinyos-2.x/doc/html/tep103.html
Actually, link 1 is only a translation for link2.
My debug record
The file StudtrackeC.nc can be successfully compiled for telosb but fails for micaz. Errors shown as follow:
mkdir -p build/micaz
tos-storage-at45db /opt/tinyos-2.1.1/tos/platforms/micaz <volumes-at45db.xml >build/micaz/StorageVolumes.h || rm -f build/micaz/StorageVolumes.h
out of space (using 1048576 bytes, have only 524288)
compiling StudentTrackerC to a micaz binary
ncc -o build/micaz/main.exe -Os -DCC2420_DEF_RFPOWER=6 -DTOSH_DATA_LENGTH=142 -fnesc-separator=__ -Wall -Wshadow -Wnesc-all -target=micaz -fnesc-cfile=build/micaz/app.c -board=micasb -DDEFINED_TOS_AM_GROUP=0x22 --param max-inline-insns-single=100000 -Ibuild/micaz -DIDENT_APPNAME=\"StudentTrackerC\" -DIDENT_USERNAME=\"root\" -DIDENT_HOSTNAME=\"xiao-Inspiron-N\" -DIDENT_USERHASH=0x86059519L -DIDENT_TIMESTAMP=0x4f467b3eL -DIDENT_UIDHASH=0x70fafcdfL -fnesc-dump=wiring -fnesc-dump='interfaces(!abstract())' -fnesc-dump='referenced(interfacedefs, components)' -fnesc-dumpfile=build/micaz/wiring-check.xml StudentTrackerC.nc -lm
StudentTrackerC.nc:34:24: error: UserButton.h: No such file or directory
StudentTrackerC.nc:37:28: error: StorageVolumes.h: No such file or directory
/opt/tinyos-2.1.1/tos/chips/cc2420/lpl/DummyLplC.nc:39:2: warning: #warning "*** LOW POWER COMMUNICATIONS DISABLED ***"
In component `StudentTrackerC':
StudentTrackerC.nc:51: `VOLUME_LOG' undeclared here (not in a function)
/opt/tinyos-2.1.1/tos/chips/at45db/At45dbStorageManagerC.nc:25:28: error: StorageVolumes.h: No such file or directory
StudentTrackerC.nc:52: `VOLUME_CONFIG' undeclared here (not in a function)
make: *** [exe0] Error 1
Actually, it is due to the overflow of the flash at45db, which is 1Mb while only shown 524288 bytes. In the interface "ConfigStorage.nc", the command getSize is noted as:
/**
* Report the usable volume size in bytes (this may be significantly
* different from the actual volume size, e.g., it's approximately
* half the volume size on the AT45DB implementation).
*
* @return Volume size. The result is undefined if the volume hasn't
* been mounted.
*/
command storage_len_t getSize();
So, after changing the LOG size as a small number like 131072 (which is 131072/256 = 512 logs) in the file " volumes-at45db.xml ", "make micaz" works well.
For each storage operation program, a .xml file must be included to show the volume distribution of the flash.