[Tinyos-help] Clearing FLASH memory on a mica2/mica2dot
Scott Schoen
schoen at mac.com
Sat Jan 17 12:58:30 PST 2004
I tried using PageEEPROM to erase all of the pages, and it didn't seem
to change anything. Below is my simple application. When I run it to
completion (suspiciously this happens very quickly) the file system
still has exactly the same corrupted files list. Any ideas at what I'm
doing wrong here?
~> cat tinyos-xbow/apps/EraseFLASH/EraseFLASH.nc
configuration EraseFLASH {
}
implementation {
components Main, PageEEPROMC, LedsC, EraseFLASHM;
Main.StdControl -> EraseFLASHM;
EraseFLASHM.PageEEPROM -> PageEEPROMC.PageEEPROM[unique("PageEEPROM")];
EraseFLASHM.Leds -> LedsC;
}
~> cat tinyos-xbow/apps/EraseFLASH/EraseFLASHM.nc
includes PageEEPROM;
module EraseFLASHM {
provides {
interface StdControl;
}
uses {
interface PageEEPROM;
interface Leds;
}
}
implementation {
int block;
task void erase_block ()
{
call Leds.yellowOn();
call PageEEPROM.erase(block, TOS_EEPROM_DONT_ERASE);
}
command result_t StdControl.init () {
block = 0;
return call Leds.init();
}
command result_t StdControl.start () {
call Leds.greenOff();
post erase_block();
return SUCCESS;
}
command result_t StdControl.stop () {
return SUCCESS;
}
event result_t PageEEPROM.eraseDone(result_t result) {
call Leds.yellowOff();
if (result != SUCCESS) {
call Leds.redToggle();
}
if (++block >= TOS_EEPROM_MAX_PAGES) {
call PageEEPROM.flushAll();
} else {
post erase_block();
}
return SUCCESS;
}
event result_t PageEEPROM.flushDone(result_t result) {
call Leds.greenOn();
return SUCCESS;
}
event result_t writeDone(result_t result) { return SUCCESS; }
event result_t PageEEPROM.writeDone(result_t result){ return SUCCESS; }
event result_t PageEEPROM.syncDone(result_t result) { return SUCCESS; }
event result_t PageEEPROM.readDone(result_t result) { return SUCCESS; }
event result_t PageEEPROM.computeCrcDone(result_t result, uint16_t crc)
{ return SUCCESS; }
}
kwright at EECS.Berkeley.EDU wrote:
>Matchbox will have a function added soonish that will initialize your filesystem. In the meantime, you can hack something up that will do it for you.
>
>You can use the PageEEPROM interface. Use the PageEEPROM.erase() command -- maybe setup a loop to erase from page 0 to TOS_EEPROM_MAX_PAGES.
>
>-kw
>
>----- Original Message -----
>From: Scott Schoen <schoen at mac.com>
>Date: Thursday, January 15, 2004 1:09 pm
>Subject: [Tinyos-help] Clearing FLASH memory on a mica2/mica2dot
>
>
>
>>I'm using the Matchbox component for my file system on a mica2 and
>>somehow the file
>>system became corrupted. It lists a garbage file name (probably
>>not
>>null terminated)
>>repeatedly that I can't delete. Is there a way to clear out the
>>FLASH
>>so I can just start
>>over? As far as I can tell there is no command on the Matchbox
>>component that resets
>>the file system. I tried burrowing down to inspect the underlying
>>
>>MetaData component
>>that actually locates the BOOT block and it has logic that handles
>>when
>>there is not a
>>BOOT block, but I haven't been able to insinuate myself into the
>>infrastructure to mimic
>>that logic.
>>
>>Thanks,
>>Scott Schoen
>>
>>_______________________________________________
>>Tinyos-help mailing list
>>Tinyos-help at Millennium.Berkeley.EDU
>>http://mail.Millennium.Berkeley.EDU/mailman/listinfo/tinyos-help
>>
>>
>>
>
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://Mail.Millennium.Berkeley.EDU/pipermail/tinyos-help/attachments/20040117/4732e6b5/attachment.htm
More information about the Tinyos-help
mailing list