FileSystem API

fopen fails when I try to open a file in FLASH0, whereas the same works with files in RAM0.

Do anyone have such problem. Im using Netos60,do i need to upgrade it netos61 for this to work.Or am i doing something wrong here when intialising FLASH?

FSInitialize(2) ;
FSInstallFileSystem(“FLASH0”);
FSStartServer();

Then I start using FileSystem API.

Regards,Kishore

Just a question -

Are you using the standard compile? If so, then you don’t need to call the FS functions, they are called in the BSP. If that is the case, then you need to erase the default FLASH0 (sort of like formatting a floppy) with the erase sample program that Cameron posted a few months ago.

-Erik

If i dont call FSInitialize and FSStartServer ,i cant start the FTP server.
And If I dont call the FSInstallFileSystem(FLASH0), directory with FLASH0 is not available via FTP.

So,I will use NAFS_openfile() for now, although I prefer a solution with File System API.

I see. I avoid the Digi FTP and HTTP stuff (too kludgy) so I wasn’t thinking of that. Yes, you need FSInitialize() for the FTP. I don’t see why you need the FSInstallFileSystem() though. What you might be missing is that you need to prepend a "FLASH0" before all the files when reading or writing. It is kind of like a drive letter. "RAM0" for NVRAM. The files will not open or be found without it.
Without FSInstallFileSystem() I use open(), close(), read(), and write() all of the time. The only NAFS functions I need to call are ones for mkdir(), rmdir(), opendir(), and readdir() and I wrote library add-ons for those a year ago and haven’t thought about it since.

-Erik

My app only needed read permissions, so I got around this problem by changing the read permission for the Flash “volume” in bsp/platforms/connectme_lsk/startfilesystem.c:

old code:

struct fs_config_t fs_conf[] = {

“FLASH0”,
NASYSACC_FS_GROUP2_READ | NASYSACC_FS_GROUP2_WRITE,

new code:

struct fs_config_t fs_conf[] = {

“FLASH0”,
NASYSACC_FS_GROUP2_READ | NASYSACC_FS_GROUP1_READ | NASYSACC_FS_GROUP2_WRITE,

recompile bsp, relink app.

I call FSInstallFileSytem(/FLASH0) to mouunt the file system to Ftp server.And attribute for this method is the default directory for the FTP Server.

I always try accessing the files with forward slash when i try to access in root directory.In my case
fopen(“FLASH0/test.xml”)

Since the same works well for RAM0,i think this is a problem with access rights at FLASH0? But not sure,I ll check this out today.
thanks n regards

Which version of the FTP server are you using? Digi provides three different samples, and I can’t find FSInstallFileSystem() on any of them. Is this something new with 6.0e? I haven’t upgraded yet.

-Erik

I still have NET-OS 60 , not updated.The FSInstallFilesystem is defined in the interface, between NETOS FTP Server and NETOS file system n this header “ftpsvrfs.h”.

You can find an example of its usage here
netos60_gnu\src\examples
aftpsvr_fs

Regards,
Kishore

I guess what I was asking is which flavor of FTP server are you using? Looking I see that “naftpsvr_fs” seems to be your template. Does the template work by itself without any changes?

Also, did you try what I mentioned before and run the erase code for the FLASH0 file system - I have seen this many times - it just won’t work without it and you just spin your wheels trying to figure out why. (The factory FLASH0 Filesystem is not compatible with the BSP.)

-Erik