can I get the flash address of a file in the LocalFileSystem?

05 Mar 2010

Hello, I would like to be able to access the contents of a file I've placed in the mbed's LocalFileSystem from my mbed program as if it were an array of bytes or ints (i.e. random access rather than the sequential access of FileHandle::read()).  So, my first question is: are files of LocalFileSystem actually stored in the on-board flash of the LPC1768?  Second question would probably require first question to be true.  Second question: is there a hidden mbed function to obtain the address of the start of file in flash (something like FileHandle::getFlashAddress(void) see below)?

Here is pseudocode of what I'd like to be able to do:

LocalFileSystem local("pm");

void foo(void) {
    FILE *fp;
    char *pbar;
    fp = fopen("/pm/bar");
    pbar = fp.getFlashAddress();

    // use pbar for read-only data access
}

thanks,

!!Dean

05 Mar 2010

LocalFileSystem uses the separate flash chip and not the internal flash of the LPC1768. So if you need it in memory, you'll have to malloc() a buffer and fread() into it.