ARMCC temporary fixes for undefined errno symbols.

pull/3762/head
Simon D Hughes 2017-01-31 18:13:03 +00:00 committed by Simon Hughes
parent 29f8d838d0
commit aefb03ccd6
2 changed files with 16 additions and 1 deletions

View File

@ -77,6 +77,8 @@ PlatformMutex * get_fat_mutex() {
*/
static void FATFileSystemSetErrno(FRESULT res)
{
/* todo: remove this temporary fix to overcome undefined symbols when compile for ARMCC */
#ifndef TOOLCHAIN_ARM_STD
switch(res) {
case FR_DISK_ERR: /* (1) A hard error occurred in the low level disk I/O layer */
case FR_NOT_READY: /* (3) The physical drive cannot work */
@ -113,6 +115,7 @@ static void FATFileSystemSetErrno(FRESULT res)
errno = EBADF; /* Bad file number */
break;
}
#endif /* TOOLCHAIN_ARM_STD */
return;
}
@ -236,9 +239,12 @@ DirHandle *FATFileSystem::opendir(const char *name) {
int FATFileSystem::mkdir(const char *name, mode_t mode) {
lock();
FRESULT res = f_mkdir(name);
/* todo: remove this temporary fix to overcome undefined symbols when compile for ARMCC */
#ifndef TOOLCHAIN_ARM_STD
if (res != 0) {
errno = (res == FR_EXIST) ? EEXIST : 0;
}
#endif /* TOOLCHAIN_ARM_STD */
unlock();
return res == 0 ? 0 : -1;
}
@ -254,13 +260,15 @@ int FATFileSystem::stat(const char *name, struct stat *st) {
return -1;
}
/* todo: remove this temporary fix to overcome undefined symbols when compile for ARMCC */
#ifndef TOOLCHAIN_ARM_STD
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
unlock();
return 0;
}

View File

@ -58,6 +58,13 @@
#define FILE_HANDLE_RESERVED 0xFFFFFFFF
#ifdef TOOLCHAIN_ARM_STD
#define ENOENT 2 /* todo: remove this temporary fix to overcome undefined symbols when compiling for ARMCC */
#define EBADF 9 /* todo: remove this temporary fix to overcome undefined symbols when compiling for ARMCC */
#define EMFILE 24 /* todo: remove this temporary fix to overcome undefined symbols when compiling for ARMCC */
#endif
using namespace mbed;
#if defined(__MICROLIB) && (__ARMCC_VERSION>5030000)