SDFileSystem Build Error

Hi, I’m trying to use SDcard on Nucleo F446re using the SDFileSystem library, but some error occurred when I compiled my project.

The Develop environment
Keil Studio Online Compiler

The Hardware and software(Mbed OS).
Nucleo F446re
Mbed OS 5.15.7

The library I used is below.
SDFileSystem

The Output (including the error message)
Build started
Using toolchain ARMC6 profile {‘ENV’: {‘ARMLMD_LICENSE_FILE’: ‘8224@10.100.158.60:8224@10.100.125.150’}, ‘PATHS’: {‘ARMC6_PATH’: ‘/opt/ARMCompiler6.15.13/bin/’, ‘ARM_PATH’: ‘/opt/armcc5_06_u6/’}, ‘common’: [‘-c’, ‘–gnu’, ‘-O3’, ‘-Otime’, ‘–split_sections’, ‘–apcs=interwork’], ‘cxx’: [‘–cpp’, ‘–no_rtti’], ‘COMPILE_C_AS_CPP’: False, ‘NEW_SCAN_RESOURCES’: True}
scan /tmp/chroots/ch-74e91526-af3e-407a-aaf9-656955529315/src
scan /tmp/chroots/ch-74e91526-af3e-407a-aaf9-656955529315/extras/mbed-os.lib
no member named ‘fsize’ in ‘FIL’
format specifies type ‘int’ but the argument has type ‘FSIZE_t’ (aka ‘unsigned long’) [-Wformat]
no member named ‘fsize’ in ‘FIL’
compile SDFileSystem/FATFileSystem/ChaN/ccsbcs.cpp
compile SDFileSystem/FATFileSystem/ChaN/ff.cpp
compile SDFileSystem/FATFileSystem/FATFileHandle.cpp
/src/SDFileSystem/FATFileSystem/FATFileHandle.cpp:65:25: error: no member named ‘fsize’ in ‘FIL’
position += _fh.fsize;
~~~ ^
/src/SDFileSystem/FATFileSystem/FATFileHandle.cpp:74:55: warning: format specifies type ‘int’ but the argument has type ‘FSIZE_t’ (aka ‘unsigned long’) [-Wformat]
debug_if(FFS_DBG, “lseek OK, returning %i\n”, _fh.fptr);
~~ ^~~~~~~~
%lu
/src/SDFileSystem/FATFileSystem/FATFileHandle.cpp:89:16: error: no member named ‘fsize’ in ‘FIL’
return _fh.fsize;
~~~ ^
1 warning and 2 errors generated.
Internal error.
Build failed
Build failed

According to the error message, It seems like the conflicts occurred in “FATFileSystem.cpp” and I found that the “_fh.fsize” was the problem.
After that, I tried to find the causes of the error from some libraries that were included in “FATFlieSystem.h”, because I thought there was no definition of “fsize”.
However, I found a definition of “fsize” in structure at “ff.h” that was imported by “FATFileSystem.cpp”.
In spite of this, the error occurred.
Now I have no idea to solve this problem. I’m really happy if you teach me the way to solve this problem.

Hello,

two questions:

  • Why do you want use MbedOS 5 instead of 6?
  • Why do you want use this old library? The MbedOS has it already build-in.

SDBlockDevice - APIs | Mbed OS 5 Documentation
FATFileSystem - APIs | Mbed OS 5 Documentation

BR, Jan

Hi Johnny
Thank you for your reply.

Why do you want use MbedOS 5 instead of 6?
->Because I’m belonging to the technological club at my school, and the os5 is used there. So, there are no especially reasons. Should I transfer to os6?

Why do you want to use this old library? The MbedOS has it already build-in.
->Because when I had searching the library for SDcard, I couldn’t find the latest library that is already build-in.
Should I use the latest library?

However, I could solve the problem by adding JSON files to the root directory and deleting the old FATFileSystem that is included in SDFileSystem.

BR,Kanato

Nice, that seems good. Do not be hesitate to ask for some help here on forum.

It depends. It is recommended to use latest Mbed OS (currently 6.17), but if this change will brake some necessary compatibility with old libraries, then stay on 5.17

It is recommended and I don’t know about reason why not.

BR, Jan

1 Like