Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

FATFileSystem::stat() function broken with IAR #10198

Closed
edablan opened this issue Mar 22, 2019 · 2 comments · Fixed by #11193

Comments

@edablan
Copy link

commented Mar 22, 2019

FATFileSystem::stat() function has the following #ifdef that only looks for TOOLCHAIN_GCC not __IAR_SYSTEMS_ICC__ :

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
@ciarmcom

This comment has been minimized.

Copy link
Member

commented Mar 22, 2019

@cmonr

This comment has been minimized.

Copy link
Contributor

commented Mar 25, 2019

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
4 participants
You can’t perform that action at this time.