Oops! Corrupt filesystem from LocalFileSystem library?
#include "mbed.h"
Ticker timer1;
Ticker timer2;
double start, end;
Timer timer;
DigitalOut led1(LED1);
DigitalOut led2(LED2);
DigitalOut led3(LED3);
LocalFileSystem local("local"); // Create the local filesystem under the name "local"
void attime()
{
led1 = !led1;
}
void attime2()
{
led2 = !led2;
}
int main()
{
FILE *fp = fopen("/local/HelloKitty.txt", "w");
fprintf(fp, "Hello Kitty!\n");
timer.start();
start = timer.read_us();
led3 = !led3;
end = timer.read_us();
fprintf(fp, "Toggling led takes about %f us.\n",end-start);
fclose(fp);
timer1.attach(&attime, 2);
timer2.attach(&attime2,3);
while(1) {
led3 = !led3;
}
}
~$ ls /media/MBED/ -l
total 531777
drwx------ 4 marcus marcus 512 2008-01-01 11:00 about 2..000
-rwxr-xr-x 1 marcus marcus 51 2008-01-01 11:00 HELLOKIT.TXT
-rwxr-xr-x 1 marcus marcus 51 2008-01-01 11:00 HELLOKIT.TXT
-r-xr-xr-x 1 marcus marcus 544433515 1996-03-04 11:43 hello ki.tty
-rwxr-xr-x 1 marcus marcus 23472 2010-10-14 21:41 HelloWorld_LPC1768.bin
-rwxr-xr-x 1 marcus marcus 23472 2010-10-14 21:41 HelloWorld_LPC1768.bin
-rwxr-xr-x 1 marcus marcus 340 2008-01-01 11:00 MBED.HTM
-rwxr-xr-x 1 marcus marcus 28088 2010-10-14 22:17 test1_LPC1768.bin
-rwxr-xr-x 1 marcus marcus 28088 2010-10-14 22:17 test1_LPC1768.bin
Copying files to the mbed was not successful. Deleting files was not successful.
Formating the mbed and making a fat filesystem set things back to normal again.
~$ sudo mkfs.vfat -n mbed -I /dev/sdb
The cause for the filesystem corruption is unclear, but I have some good ideas.
0 comments
You need to log in to post a comment