Mbed-os-example-filesystem example problems

Hello,

I’m trying to use mbed-os-example-filesystem .First of all - documentation of this example is definitely not complete and not so good.
For my hardware (LPC1768 + SD card) I need to modify code.

- LittleFileSystem fs("fs");
+ FATFileSystem fs("fs");

Look quite understandable for beginner except not mentioned corresponding libraries. It’s good this is mentioned in code itself.
For block device the situation is worse:

-SPIFBlockDevice bd(
-        MBED_CONF_SPIF_DRIVER_SPI_MOSI,
-        MBED_CONF_SPIF_DRIVER_SPI_MISO,
-        MBED_CONF_SPIF_DRIVER_SPI_CLK,
-        MBED_CONF_SPIF_DRIVER_SPI_CS);
+SDBlockDevice bd(
+        MBED_CONF_SD_SPI_MOSI,
+        MBED_CONF_SD_SPI_MISO,
+        MBED_CONF_SD_SPI_CLK,
+        MBED_CONF_SD_SPI_CS);

There is no things like “SPIFBlockDevice bd” so how to remove what not exist?
There is not mentioned need to modify/add mbed_app.json for SD use.
OK, solved this, Example now work on my hardware somehow.
So main problem now: this example does not work with file append.
FILE *f = fopen("/fs/numbers.txt", "a+");
After change of parameter from “r+” to “a” or “a+” mbed os crashes!!! It crashes when starting to write data to file. I tried similar example on Mbed OS2 - append worked perfectly.
And why there is no possibility to select/copy from terminal window in Mbed Studio?
Software, firmware are newest.
What I’m doing wrong or maybe there is some bug?
Update: Output copied from RealTerm (where the fault appears)

  • Opening “/fs/numbers.txt”… OK *
  • Incrementing numbers (0/10)… *
  • ++ MbedOS Error Info ++ *
  • Error Status: 0x80FF0100 Code: 256 Module: 255 *
  • Error Message: Fatal Run-time error *
  • Location: 0xA0C5 *
  • Error Value: 0x0 *
  • Current Thread: main Id: 0x10001B38 Entry: 0xACE5 StackSize: 0x1000 StackMem: 0x*
  • 10000548 SP: 0x10001494 *
  • For more info, visit: https://mbed.com/s/error?error=0x80FF0100&tgt=LPC1768 *
  • – MbedOS Error Info – *
  • error: No error (errno = 0) (0)*

OK, newer mind.
Solved by self somehow. Simplified and modified code to get what I need. Now it adds numbers in the end of file.
Why there was crash of OS after modification and why example from the beginning worked a bit different than written in documentation - I do not know.

Hi Romas,

could you raise an issue against mbed-os repo with full details of what you saw and how to reproduce the problem ?

Thanks
Anna