5 years, 12 months ago.

Problem with LocalFileSystem with gcc4mbed compiler

Hi After compilation (LPC1768) in eclipse using gcc4mbed there is problem with LocalFileSystem. My program can not see file in mbed flash memory there is no problm with SD memory but the same program compiling on cloud working ok. I got newest version of gcc4mbed.

Question relating to:

1 Answer

5 years, 12 months ago.

I am a little confused by your comments since you mention LocalFileSystem and SD memory. They are different so I don't know which one you are actually trying to use. Can you share a sample program which works with the online compiler but not with gcc4mbed? There are a couple of samples that ship with gcc4mbed which successfully use the LocalFileSystem and I tested them before making the latest release.

PS: It should be noted that if you are using a debug build with GCC4MBED on a LPC1768 then LocalFileSystem requests will be shuttled over to GDB and it will instead access files from GDB's current directory on your PC. You could build and run a Release build instead and then LocalFileSystem should work as expected.

Accepted Answer

I found it when i put "rb" flag in FILE *Image = fopen((const char *) &filename[0], "rb"); then loading bmp file from sd card but not from local and when I use "r" flag in FILE *Image = fopen((const char *) &filename[0], "r"); then loading bnf file from local but not from sd card. I dont know how to resolved.

posted by Wojciech Biegun 09 Mar 2015

Sorted, problem was that flag must be "r" not "rb" and sd card wasn't inserted correctly.

posted by Wojciech Biegun 09 Mar 2015

But why program was working after online compilation with "rb" flag?

posted by Wojciech Biegun 09 Mar 2015

The online Keil compiler and GCC for ARM Embedded use a different standard C library. One ignores the b flag and the other passes it down to the LocalFileSystem object where it isn't supported so an error is generated.

posted by Adam Green 09 Mar 2015