File system in zephyr flashed on Arduino 101


Ani
 

I am using zephyr RTOS on Arduino 101. Ihave flashed the file system code where in the data is written in a file using fs_write as mentioned in the sample code. The changes I made are :
1. changed FS_SEEK_SET to FS_SEEK_END in fs_seek
2. and not deleting the file after writing

The problem is that after executing the code the no. of free blocks reduced from 1700+ to 200 . Now I am not able to retrieve the blocks again even after deleting. Can anyone help


Thanks and Regards, 
Anila


Ani
 

Can anyone tell me where the file is stored I mean which part if the memory

On Mar 21, 2017 4:13 PM, "Anila Sri" <anilasri.y1995@...> wrote:

I am using zephyr RTOS on Arduino 101. Ihave flashed the file system code where in the data is written in a file using fs_write as mentioned in the sample code. The changes I made are :
1. changed FS_SEEK_SET to FS_SEEK_END in fs_seek
2. and not deleting the file after writing

The problem is that after executing the code the no. of free blocks reduced from 1700+ to 200 . Now I am not able to retrieve the blocks again even after deleting. Can anyone help


Thanks and Regards, 
Anila


Thomas, Ramesh
 

On Tue, Mar 21, 2017 at 21:28:41, Anila Sri wrote:
Can anyone tell me where the file is stored I mean which part if the
memory

On Mar 21, 2017 4:13 PM, "Anila Sri" <anilasri.y1995@gmail.com
<mailto:anilasri.y1995@gmail.com> > wrote:


I am using zephyr RTOS on Arduino 101. Ihave flashed the file
system code where in the data is written in a file using fs_write as
mentioned in the sample code. The changes I made are :
1. changed FS_SEEK_SET to FS_SEEK_END in fs_seek
2. and not deleting the file after writing
Not clear where you made these changes. Are you referring to the
sample app function test_file_write()?


The problem is that after executing the code the no. of free
blocks reduced from 1700+ to 200 . Now I am not able to retrieve the
blocks again even after deleting. Can anyone help
Not sure what is going on. Assuming the file system got corrupted,
you can try recreating it.

We currently do not have an external API/tool like "format" to recreate
the file system. There is a Jira story for that
https://jira.zephyrproject.org/browse/ZEP-903

For now you can make a temporary change in code to force recreation
of the file system.

In subsys/fs/fat_fs.c, in fs_init() function, comment out

res = f_mount(&fat_fs, "", 1);

and add a line
res = FR_NO_FILESYSTEM

This will force entry into the if condition block that calls f_mkfs() which
will recreate the file system at the next boot. After one reboot, you
can undo the above changes.



Thanks and Regards,
Anila