Mbed Sdcard Error

Hi I am trying to use Mbed and SdCard file system on MAC and ubuntu but I always get this error
src/main.cpp:2:10: fatal error: FATFileSystem.h: No such file or directory

#include “FATFileSystem.h”

I wrote in platform.ini file
build_flags = -DPIO_FRAMEWORK_MBED_FILESYSTEM_PRESENT

but the problem are still present

Is outdated and was removed.

By adding build_flags = -DPIO_FRAMEWORK_MBED_RTOS_PRESENT this example code compiles. Although it attempts to compile the whole mbed-framework with all the features/ stuff too, like cellular etc… It seems odd to me that we need to activate the RTOS so that PIO can find the filesystem library. One should not require the other…

Looking at the documentation it doesn’t seem clear to me how to add a library dependency declaration into the mbed_app.json@ivankravets or @valeros can maybe help?

As you may know, recently we’ve refactored mbed build script and now it uses native mbed tools in order to enable mbed-specific workflow (support for mbed_app.json config files, original build logic, etc) and several options like PIO_FRAMEWORK_MBED_FILESYSTEM_PRESENT became unnecessary (like it or not, but mbed tools build the entire framework). Since the mbed framework exists in two forms - mbed 2.0 and mbed OS 5 we decided to keep -DPIO_FRAMEWORK_MBED_RTOS_PRESENT option to allow the user to switch between these forms. I’m not entirely sure, but filesystem feature depends on OS functionality and without OS you’ll just get a bunch of compilation errors. But I think it might be possible to add this feature to the project as a standalone library. In any case, please let me know if you are able to compile your code without OS in the online mbed compiler.

And as I mentioned above, the configuration of the project should be done in the mbed_app.json file, something like this:

{
    "target_overrides": {
        "*": {
            "target.features_add": ["STORAGE"],
            "target.components_add": ["SD"],
            "platform.stdio-baud-rate": 115200,
            "target.stdio_uart_tx": "PA_9",
            "target.stdio_uart_rx": "PA_10"
        }
    }
}
2 Likes