diff --git a/bsp/simulator/applications/application.c b/bsp/simulator/applications/application.c index df34aa87c95ad77b2b628cd8c3455e7c75576fa5..a16d731295aa887a2756e520b598385b90e15757 100755 --- a/bsp/simulator/applications/application.c +++ b/bsp/simulator/applications/application.c @@ -26,64 +26,13 @@ #include #include -#ifdef RT_USING_DFS -#include -#endif - -#include "init.h" - void rt_init_thread_entry(void *parameter) { - components_init(); - - /* File system Initialization */ -#ifdef RT_USING_DFS - { -#ifdef RT_USING_DFS_WINSHAREDIR - { - extern rt_err_t rt_win_sharedir_init(const char *name); - extern int dfs_win32_init(void); - - rt_win_sharedir_init("wdd"); - dfs_win32_init(); - - if (dfs_mount("wdd", "/", "wdir", 0, 0) == 0) - rt_kprintf("win32 share directory initialized!\n"); - else - rt_kprintf("win32 share directory initialized failed!\n"); - } -#endif - -#ifdef RT_USING_DFS_ELMFAT - /* mount sd card fatfs as root directory */ -#ifdef _WIN32 - if (dfs_mount("sd0", "/disk/sd", "elm", 0, 0) == 0) -#else - if (dfs_mount("sd0", "/", "elm", 0, 0) == 0) -#endif - rt_kprintf("fatfs initialized!\n"); - else - rt_kprintf("fatfs initialization failed!\n"); -#endif - -#ifdef RT_USING_DFS_UFFS - /* mount uffs as the nand flash file system */ - if (dfs_mount("nand0", "/disk/nand", "uffs", 0, 0) == 0) - rt_kprintf("uffs initialized!\n"); - else - rt_kprintf("uffs initialization failed!\n"); +#ifdef RT_USING_COMPONENTS_INIT + rt_components_init(); #endif -#ifdef RT_USING_DFS_JFFS2 - /* mount jffs2 as the nor flash file system */ - if (dfs_mount("nor", "/disk/nor", "jffs2", 0, 0) == 0) - rt_kprintf("jffs2 initialized!\n"); - else - rt_kprintf("jffs2 initialization failed!\n"); -#endif - - } -#endif + rt_kprintf("Hello RT-Thread!\n"); } int rt_application_init() diff --git a/bsp/simulator/applications/init.c b/bsp/simulator/applications/init.c deleted file mode 100644 index 731846a7dd29fa768ab7dfcf3228d2936f6b3ed4..0000000000000000000000000000000000000000 --- a/bsp/simulator/applications/init.c +++ /dev/null @@ -1,170 +0,0 @@ -/* - * File : init.h - * This file is part of RT-Thread RTOS - * COPYRIGHT (C) 2006 - 2015, RT-Thread Development Team - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Change Logs: - * Date Author Notes - * 2015-09-30 Bernard the first version - */ - -#include - -#include "init.h" - -#ifdef RT_USING_FINSH -#include -#include -#endif - -#ifdef RT_USING_LWIP -#include -#include -extern void lwip_system_init(void); -#endif - -#ifdef RT_USING_DFS -#include -#include -#ifdef RT_USING_DFS_ELMFAT -#include -#endif -#if defined(RT_USING_LWIP) && defined(RT_USING_DFS_NFS) -#include -#endif -#ifdef RT_USING_DFS_ROMFS -#include -#endif -#ifdef RT_USING_DFS_DEVFS -#include -#endif -#ifdef RT_USING_DFS_UFFS -#include -#endif -#ifdef RT_USING_DFS_JFFS2 -#include -#endif -#ifdef RT_USING_DFS_YAFFS2 -#include -#endif -#ifdef RT_USING_DFS_ROMFS -#include -#endif -#endif - -#ifdef RT_USING_NEWLIB -#include -#endif -#ifdef RT_USING_PTHREADS -#include -#endif - -#ifdef RT_USING_MODULE -#include -#endif - -#ifdef RT_USING_RTGUI -#include -#endif - -/* components initialization for simulator */ -void components_init(void) -{ - platform_init(); - -#ifdef RT_USING_MODULE - rt_system_module_init(); -#endif - -#ifdef RT_USING_FINSH - /* initialize finsh */ - finsh_system_init(); - finsh_set_device(RT_CONSOLE_DEVICE_NAME); -#endif - -#ifdef RT_USING_LWIP - /* initialize lwip stack */ - /* register ethernetif device */ - eth_system_device_init(); - - /* initialize lwip system */ - lwip_system_init(); - rt_kprintf("TCP/IP initialized!\n"); -#endif - -#ifdef RT_USING_DFS - /* initialize the device file system */ - dfs_init(); - -#ifdef RT_USING_DFS_ELMFAT - /* initialize the elm chan FatFS file system*/ - elm_init(); -#endif - -#if defined(RT_USING_DFS_NFS) && defined(RT_USING_LWIP) - /* initialize NFSv3 client file system */ - nfs_init(); -#endif - -#ifdef RT_USING_DFS_YAFFS2 - dfs_yaffs2_init(); -#endif - -#ifdef RT_USING_DFS_UFFS - dfs_uffs_init(); -#endif - -#ifdef RT_USING_DFS_JFFS2 - dfs_jffs2_init(); -#endif - -#ifdef RT_USING_DFS_ROMFS - dfs_romfs_init(); -#endif - -#ifdef RT_USING_DFS_RAMFS - dfs_ramfs_init(); -#endif - -#ifdef RT_USING_DFS_DEVFS - devfs_init(); -#endif -#endif /* end of RT_USING_DFS */ - -#ifdef RT_USING_NEWLIB - libc_system_init(RT_CONSOLE_DEVICE_NAME); -#else - /* the pthread system initialization will be initiallized in libc */ -#ifdef RT_USING_PTHREADS - pthread_system_init(); -#endif -#endif - -#ifdef RT_USING_RTGUI - rtgui_system_server_init(); -#endif - -#ifdef RT_USING_USB_HOST - rt_usb_host_init(); -#endif - -#ifdef RT_USING_RTGUI - /* start sdl thread to simulate an LCD. SDL may depend on DFS and should be - * called after rt_components_init. */ - rt_hw_sdl_start(); -#endif /* RT_USING_RTGUI */ -} diff --git a/bsp/simulator/applications/init.h b/bsp/simulator/applications/init.h deleted file mode 100644 index ae8c838e1e51d6de969e60ddf90627ea93bbc9ed..0000000000000000000000000000000000000000 --- a/bsp/simulator/applications/init.h +++ /dev/null @@ -1,31 +0,0 @@ -/* - * File : init.h - * This file is part of RT-Thread RTOS - * COPYRIGHT (C) 2006 - 2015, RT-Thread Development Team - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Change Logs: - * Date Author Notes - * 2015-09-30 Bernard the first version - */ - -#ifndef INIT_H__ -#define INIT_H__ - -void platform_init(void); -void components_init(void); - -#endif diff --git a/bsp/simulator/applications/mnt.c b/bsp/simulator/applications/mnt.c new file mode 100644 index 0000000000000000000000000000000000000000..3a0628e985b44c064a45d46ae7fa66a44d273f17 --- /dev/null +++ b/bsp/simulator/applications/mnt.c @@ -0,0 +1,53 @@ +/* + * File : mnt.c + * COPYRIGHT (C) 2008 - 2016, RT-Thread Development Team + * + * Change Logs: + * Date Author Notes + * 2017Äê4ÔÂ3ÈÕ Urey the first version + */ + +#include +#include + +#ifdef RT_USING_DFS +#include + +int mnt_init(void) +{ +#ifdef RT_USING_DFS_WINSHAREDIR + dfs_win32_init(); + rt_win_sharedir_init("wshare"); + + if (dfs_mount("wshare", "/", "wdir", 0, 0) == 0) + { + rt_kprintf("File System on root initialized!\n"); + } + else + { + rt_kprintf("File System on root initialization failed!\n"); + } + + if (dfs_mount("sd0", "/sd", "elm", 0, 0) == 0) + { + rt_kprintf("File System on sd initialized!\n"); + } + else + { + rt_kprintf("File System on sd initialization failed!\n"); + } +#else + if (dfs_mount("sd0", "/", "elm", 0, 0) == 0) + { + rt_kprintf("File System on sd initialized!\n"); + } + else + { + rt_kprintf("File System on sd initialization failed!\n"); + } +#endif + +} +INIT_ENV_EXPORT(mnt_init); + +#endif diff --git a/bsp/simulator/applications/platform.c b/bsp/simulator/applications/platform.c index 229c507c9ad4a84b6c56ab37717707f568a084f6..f79bd6143fb8e8d4b3dc29c1351e101a47e0f331 100644 --- a/bsp/simulator/applications/platform.c +++ b/bsp/simulator/applications/platform.c @@ -25,4 +25,4 @@ void platform_init(void) #endif /* RT_USING_DFS */ } - +INIT_DEVICE_EXPORT(platform_init); diff --git a/bsp/simulator/drivers/dfs_win32.c b/bsp/simulator/drivers/dfs_win32.c index 68ac541770dca6c8b8ea8ef2903cea94c7e104a5..b868d421f9d50fed34aa0d34ad540638a24a5b91 100644 --- a/bsp/simulator/drivers/dfs_win32.c +++ b/bsp/simulator/drivers/dfs_win32.c @@ -11,13 +11,14 @@ * Date Author Notes * 2012-11-27 prife the first version * 2013-03-03 aozima add dfs_win32_stat st_mtime support. + * 2017-10-20 urey support rt-thread 3.0 */ #include +#include #include -#include +#include #include -//#include "dfs_win32.h" #include #include @@ -48,7 +49,7 @@ */ #define FILE_PATH_MAX 256 /* the longest file path */ -#define WIN32_DIRDISK_ROOT "." /* "F:\\Project\\svn\\rtt\\trunk\\bsp\\simulator_test" */ +#define WIN32_DIRDISK_ROOT "./disk" /* "F:\\Project\\svn\\rtt\\trunk\\bsp\\simulator_test" */ typedef struct { HANDLE handle; @@ -71,13 +72,13 @@ struct _errcode_map static const struct _errcode_map errcode_table[] = { - {DFS_STATUS_ENOENT, ERROR_FILE_NOT_FOUND }, - {DFS_STATUS_ENOENT, ERROR_PATH_NOT_FOUND }, - {DFS_STATUS_EEXIST, ERROR_FILE_EXISTS }, - {DFS_STATUS_EEXIST, ERROR_ALREADY_EXISTS }, - {DFS_STATUS_ENOTEMPTY, ERROR_DIR_NOT_EMPTY }, - {DFS_STATUS_EBUSY, ERROR_PATH_BUSY }, - {DFS_STATUS_EINVAL, ERROR_ACCESS_DENIED }, + {ENOENT, ERROR_FILE_NOT_FOUND }, + {ENOENT, ERROR_PATH_NOT_FOUND }, + {EEXIST, ERROR_FILE_EXISTS }, + {EEXIST, ERROR_ALREADY_EXISTS }, + {ENOTEMPTY, ERROR_DIR_NOT_EMPTY }, + {EBUSY, ERROR_PATH_BUSY }, + {EINVAL, ERROR_ACCESS_DENIED }, #if 0 /* TODO: MORE NEED BE ADDED */ {DFS_STATUS_EISDIR, ERROR_FILE_EXISTS }, @@ -121,13 +122,13 @@ static int dfs_win32_unmount(struct dfs_filesystem *fs) static int dfs_win32_mkfs(rt_device_t devid) { - return -DFS_STATUS_ENOSYS; + return -ENOSYS; } static int dfs_win32_statfs(struct dfs_filesystem *fs, struct statfs *buf) { - return -DFS_STATUS_ENOSYS; + return -ENOSYS; } static char *winpath_dirdup(char *des, const char *src) @@ -167,12 +168,12 @@ char * dfs_win32_dirdup(char * path) static int dfs_win32_open(struct dfs_fd *file) { int fd; - int oflag, mode; + uint32_t oflag, mode; char *file_path; int res; oflag = file->flags; - if (oflag & DFS_O_DIRECTORY) /* operations about dir */ + if (oflag & O_DIRECTORY) /* operations about dir */ { WINDIR *wdirp; HANDLE handle; @@ -180,7 +181,7 @@ static int dfs_win32_open(struct dfs_fd *file) file_path = winpath_dirdup(WIN32_DIRDISK_ROOT, file->path); - if (oflag & DFS_O_CREAT) /* create a dir*/ + if (oflag & O_CREAT) /* create a dir*/ { res = CreateDirectory(file_path, NULL); if (res == 0) @@ -218,19 +219,19 @@ static int dfs_win32_open(struct dfs_fd *file) file->data = (void *)wdirp; rt_free(file_path); - return DFS_STATUS_OK; + return 0; } /* regular file operations */ mode = O_BINARY; - if (oflag & DFS_O_RDONLY) mode |= O_RDONLY; - if (oflag & DFS_O_WRONLY) mode |= O_WRONLY; - if (oflag & DFS_O_RDWR) mode |= O_RDWR; + if (oflag & O_RDONLY) mode |= O_RDONLY; + if (oflag & O_WRONLY) mode |= O_WRONLY; + if (oflag & O_RDWR) mode |= O_RDWR; /* Opens the file, if it is existing. If not, a new file is created. */ - if (oflag & DFS_O_CREAT) mode |= O_CREAT; + if (oflag & O_CREAT) mode |= O_CREAT; /* Creates a new file. If the file is existing, it is truncated and overwritten. */ - if (oflag & DFS_O_TRUNC) mode |= O_TRUNC; + if (oflag & O_TRUNC) mode |= O_TRUNC; /* Creates a new file. The function fails if the file is already existing. */ - if (oflag & DFS_O_EXCL) mode |= O_EXCL; + if (oflag & O_EXCL) mode |= O_EXCL; file_path = winpath_dirdup(WIN32_DIRDISK_ROOT, file->path); fd = _open(file_path, mode, 0x0100 | 0x0080); /* _S_IREAD | _S_IWRITE */ @@ -245,7 +246,7 @@ static int dfs_win32_open(struct dfs_fd *file) file->pos = 0; file->size = _lseek(fd, 0, SEEK_END); - if (oflag & DFS_O_APPEND) + if (oflag & O_APPEND) { file->pos = file->size; } @@ -261,7 +262,7 @@ __err: static int dfs_win32_close(struct dfs_fd *file) { - if (file->flags & DFS_O_DIRECTORY) + if (file->flags & O_DIRECTORY) { WINDIR *wdirp = (WINDIR*)(file->data); RT_ASSERT(wdirp != RT_NULL); @@ -282,10 +283,10 @@ static int dfs_win32_close(struct dfs_fd *file) static int dfs_win32_ioctl(struct dfs_fd *file, int cmd, void *args) { - return -DFS_STATUS_ENOSYS; + return -ENOSYS; } -static int dfs_win32_read(struct dfs_fd *file, void *buf, rt_size_t len) +static int dfs_win32_read(struct dfs_fd *file, void *buf, size_t len) { int fd; int char_read; @@ -300,9 +301,7 @@ static int dfs_win32_read(struct dfs_fd *file, void *buf, rt_size_t len) return char_read; } -static int dfs_win32_write(struct dfs_fd *file, - const void *buf, - rt_size_t len) +static int dfs_win32_write(struct dfs_fd *file, const void *buf, size_t len) { int fd; int char_write; @@ -347,10 +346,7 @@ static int dfs_win32_seek(struct dfs_fd *file, } /* return the size of struct dirent*/ -static int dfs_win32_getdents( - struct dfs_fd *file, - struct dirent *dirp, - rt_uint32_t count) +static int dfs_win32_getdents(struct dfs_fd *file, struct dirent *dirp, rt_uint32_t count) { WINDIR *wdirp; struct dirent *d = dirp; @@ -358,7 +354,7 @@ static int dfs_win32_getdents( /* make integer count */ if (count / sizeof(struct dirent) != 1) - return -DFS_STATUS_EINVAL; + return -EINVAL; wdirp = (WINDIR*)(file->data); RT_ASSERT(wdirp != RT_NULL); @@ -367,9 +363,9 @@ static int dfs_win32_getdents( /* get the current entry */ if (wdirp->finddata.attrib & _A_SUBDIR) - d->d_type = DFS_DT_DIR; + d->d_type = DT_DIR; else - d->d_type = DFS_DT_REG; + d->d_type = DT_REG; d->d_namlen = strlen(wdirp->curr); strncpy(d->d_name, wdirp->curr, DFS_PATH_MAX); d->d_reclen = (rt_uint16_t)sizeof(struct dirent); @@ -408,7 +404,7 @@ static int dfs_win32_unlink(struct dfs_filesystem *fs, const char *path) if (fp == RT_NULL) { rt_kprintf("out of memory.\n"); - return -DFS_STATUS_ENOMEM; + return -ENOMEM; } result = GetFileAttributes(fp); @@ -445,7 +441,7 @@ static int dfs_win32_rename( if (op == RT_NULL || np == RT_NULL) { rt_kprintf("out of memory.\n"); - return -DFS_STATUS_ENOMEM; + return -ENOMEM; } /* If the function fails, the return value is zero. */ @@ -469,7 +465,7 @@ static int dfs_win32_stat(struct dfs_filesystem *fs, const char *path, struct st if (fp == RT_NULL) { rt_kprintf("out of memory.\n"); - return -DFS_STATUS_ENOMEM; + return -ENOMEM; } hFind = FindFirstFile(fp, &fileInfo); @@ -478,14 +474,14 @@ static int dfs_win32_stat(struct dfs_filesystem *fs, const char *path, struct st if (hFind == INVALID_HANDLE_VALUE) goto __err; - st->st_mode = DFS_S_IFREG | DFS_S_IRUSR | DFS_S_IRGRP | DFS_S_IROTH | - DFS_S_IWUSR | DFS_S_IWGRP | DFS_S_IWOTH; + st->st_mode = S_IFREG | S_IRUSR | S_IRGRP | S_IROTH | + S_IWUSR | S_IWGRP | S_IWOTH; /* convert file info to dfs stat structure */ if (fileInfo.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) { - st->st_mode &= ~DFS_S_IFREG; - st->st_mode |= DFS_S_IFDIR | DFS_S_IXUSR | DFS_S_IXGRP | DFS_S_IXOTH; + st->st_mode &= ~S_IFREG; + st->st_mode |= S_IFDIR | S_IXUSR | S_IXGRP | S_IXOTH; } st->st_dev = 0; @@ -513,15 +509,8 @@ __err: return win32_result_to_dfs(GetLastError()); } -static const struct dfs_filesystem_operation dfs_win32_ops = +static const struct dfs_file_ops dfs_win32_file_ops = { - "wdir", /* file system type: dir */ - DFS_FS_FLAG_DEFAULT, - dfs_win32_mount, - dfs_win32_unmount, - dfs_win32_mkfs, - dfs_win32_statfs, - dfs_win32_open, dfs_win32_close, dfs_win32_ioctl, @@ -530,6 +519,17 @@ static const struct dfs_filesystem_operation dfs_win32_ops = dfs_win32_flush, dfs_win32_seek, dfs_win32_getdents, +}; + +static const struct dfs_filesystem_ops dfs_win32_ops = +{ + "wdir", /* file system type: dir */ + DFS_FS_FLAG_DEFAULT, + &dfs_win32_file_ops, + dfs_win32_mount, + dfs_win32_unmount, + dfs_win32_mkfs, + dfs_win32_statfs, dfs_win32_unlink, dfs_win32_stat, dfs_win32_rename, diff --git a/bsp/simulator/drivers/sd_sim.c b/bsp/simulator/drivers/sd_sim.c index 77adfba02421cc9af651f58c4dcca68fb4490aa0..4a5739b4b6ffb4403366b59b1def33dcb939b2c3 100755 --- a/bsp/simulator/drivers/sd_sim.c +++ b/bsp/simulator/drivers/sd_sim.c @@ -1,14 +1,17 @@ +#include +#include + #include #include #ifdef _WIN32 #include #endif -#include -#include - -// #define SD_TRACE rt_kprintf -#define SD_TRACE(...) +#ifdef DEBUG +# define SD_TRACE rt_kprintf +#else +# define SD_TRACE(...) +#endif #define SDCARD_SIM "sd.bin" #define SDCARD_SIZE (16*1024*1024) //16M diff --git a/bsp/simulator/rtconfig.h b/bsp/simulator/rtconfig.h index 70c68f34031f0cdc9c5144dd6d63f75deac7a0ce..2b048a19e06216880231afecd3305c77e963689c 100755 --- a/bsp/simulator/rtconfig.h +++ b/bsp/simulator/rtconfig.h @@ -98,6 +98,8 @@ // #define RT_USING_LIBC // // #define RT_USING_PTHREADS +// +#define RT_USING_COMPONENTS_INIT // // #define RT_USING_MODULE // @@ -131,7 +133,9 @@ // // #define RT_USING_DFS_NFS // -#define RT_NFS_HOST_EXPORT "192.168.1.5:/" +#define RT_NFS_HOST_EXPORT "192.168.1.5:/" +// +#define RT_USING_DFS_WINSHAREDIR // //
@@ -232,14 +236,6 @@ #elif defined(__GNUC__) #define RT_USING_NOLIBC -#if defined(__MINGW32__) -#define _NO_OLDNAMES /* to ignore: mode_t in sys/type.h */ -#endif /* end of __MINGW32__ */ - #endif /* end of _MSC_VER */ -#ifdef _Win32 -#define RT_USING_DFS_WINSHAREDIR -#endif - #endif diff --git a/bsp/simulator/rtconfig.py b/bsp/simulator/rtconfig.py index 8ccacadfd621fef6c8ac76fa82f277a05aeebd18..4aefff78abf271325b9f79375c1fe3b59f6e3356 100755 --- a/bsp/simulator/rtconfig.py +++ b/bsp/simulator/rtconfig.py @@ -5,7 +5,7 @@ ARCH='sim' #CROSS_TOOL='msvc' or 'gcc' or 'mingw' #'msvc' and 'mingw' are both for windows # 'gcc' is for linux -CROSS_TOOL='msvc' +CROSS_TOOL='mingw' if os.getenv('RTT_CC'): CROSS_TOOL = os.getenv('RTT_CC') @@ -67,23 +67,25 @@ if PLATFORM == 'gcc': POST_ACTION = '' elif PLATFORM == 'mingw': - # toolchains + # toolchains PREFIX = '' - CC = PREFIX + 'gcc' - AS = PREFIX + 'gcc' - AR = PREFIX + 'ar' - LINK = PREFIX + 'gcc' + CC = PREFIX + 'gcc' + CXX = PREFIX + 'g++' + AS = PREFIX + 'gcc' + AR = PREFIX + 'ar' + LINK = PREFIX + 'g++' TARGET_EXT = 'exe' SIZE = PREFIX + 'size' OBJDUMP = PREFIX + 'objdump' OBJCPY = PREFIX + 'objcopy' - DEVICE = ' -ffunction-sections -fdata-sections' - DEVICE = ' ' - CFLAGS = DEVICE +# DEVICE = ' -ffunction-sections -fdata-sections' + DEVICE = '' + CFLAGS = DEVICE + ' -D_Win32 -DNO_OLDNAMES -fno-pic -fno-builtin -fno-exceptions -fno-omit-frame-pointer' + + AFLAGS = ' -c' + DEVICE + ' -x assembler-with-cpp' - DEFFILE_LFLAGS = DEVICE + ' -Wl,-Map=rtthread-win32.map,--output-def,rtthread.def -T mingw.ld ' - LFLAGS = DEVICE + ' -Wl,-Map=rtthread-win32.map -T mingw.ld ' + LFLAGS = DEVICE + ' -static-libgcc -Wl,--gc-sections,-Map=rtthread-win32.map -T mingw.ld ' CPATH = '' LPATH = '' @@ -93,6 +95,7 @@ elif PLATFORM == 'mingw': else: CFLAGS += ' -O2' + CXXFLAGS = CFLAGS POST_ACTION = '' elif PLATFORM == 'cl': diff --git a/include/libc/libc_fcntl.h b/include/libc/libc_fcntl.h index 6d6f8ee6d7e3ad975e8a1c1a316ebf0b2a4d10b3..68b714b855e6a59772a0e91f3167644d01395075 100644 --- a/include/libc/libc_fcntl.h +++ b/include/libc/libc_fcntl.h @@ -25,6 +25,7 @@ #define O_DSYNC 010000 #define O_SYNC 04010000 #define O_RSYNC 04010000 +#define O_BINARY 0100000 #define O_DIRECTORY 0200000 #define O_NOFOLLOW 0400000 #define O_CLOEXEC 02000000 diff --git a/include/rtlibc.h b/include/rtlibc.h index 5d6b5a78e303489b93cc2d52fe2276e177606ab0..757329a22cb1f078a01e646b6f65a2b3bccd4c65 100644 --- a/include/rtlibc.h +++ b/include/rtlibc.h @@ -38,5 +38,10 @@ typedef signed long off_t; #endif +#if defined(__MINGW32__) +typedef signed long off_t; +typedef int mode_t; +#endif + #endif