-
Notifications
You must be signed in to change notification settings - Fork 3k
Closed
Labels
Description
FATFileSystem::stat() function has the following #ifdef that only looks for TOOLCHAIN_GCC
not __IAR_SYSTEMS_ICC__
:
mbed-os/features/storage/filesystem/fat/FATFileSystem.cpp
Lines 513 to 530 in f76436c
FRESULT res = f_stat(fpath, &f); | |
if (res != FR_OK) { | |
unlock(); | |
return fat_error_remap(res); | |
} | |
/* ARMCC doesnt support stat(), and these symbols are not defined by the toolchain. */ | |
#ifdef TOOLCHAIN_GCC | |
st->st_size = f.fsize; | |
st->st_mode = 0; | |
st->st_mode |= (f.fattrib & AM_DIR) ? S_IFDIR : S_IFREG; | |
st->st_mode |= (f.fattrib & AM_RDO) ? | |
(S_IRUSR | S_IXUSR | S_IRGRP | S_IXGRP | S_IROTH | S_IXOTH) : | |
(S_IRWXU | S_IRWXG | S_IRWXO); | |
#endif /* TOOLCHAIN_GCC */ | |
unlock(); | |
return 0; |
I understand from the comment that ARMCC doesn't support stat, but IAR is not ARMCC and I have verified going through the call chain that the correct file size is returned from the FILEINFO struct after the call to f_stat(). I guess the other compiler option was accidently ommitted.
I'll patch on my end with #if defined(TOOLCHAIN_GCC) || defined(__IAR_SYSTEMS_ICC__)
. Maybe someone can take a look to see what other FATFileSystem functions have this valid compiler option omitted.
Description
Target: K64F
Issue request type
[ ] Question
[ ] Enhancement
[x] Bug