Merge pull request #887 from yygg/master

[BSP] fix compiling error for simulator bsp.
This commit is contained in:
Bernard Xiong 2017-10-20 15:07:35 +08:00 committed by GitHub
commit 8e398fe439
11 changed files with 141 additions and 332 deletions

View File

@ -26,64 +26,13 @@
#include <stdio.h> #include <stdio.h>
#include <board.h> #include <board.h>
#ifdef RT_USING_DFS
#include <dfs_fs.h>
#endif
#include "init.h"
void rt_init_thread_entry(void *parameter) void rt_init_thread_entry(void *parameter)
{ {
components_init(); #ifdef RT_USING_COMPONENTS_INIT
rt_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 #endif
#ifdef RT_USING_DFS_ELMFAT rt_kprintf("Hello RT-Thread!\n");
/* 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");
#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
} }
int rt_application_init() int rt_application_init()

View File

@ -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 <rtthread.h>
#include "init.h"
#ifdef RT_USING_FINSH
#include <finsh.h>
#include <shell.h>
#endif
#ifdef RT_USING_LWIP
#include <lwip/sys.h>
#include <netif/ethernetif.h>
extern void lwip_system_init(void);
#endif
#ifdef RT_USING_DFS
#include <dfs.h>
#include <dfs_fs.h>
#ifdef RT_USING_DFS_ELMFAT
#include <dfs_elm.h>
#endif
#if defined(RT_USING_LWIP) && defined(RT_USING_DFS_NFS)
#include <dfs_nfs.h>
#endif
#ifdef RT_USING_DFS_ROMFS
#include <dfs_romfs.h>
#endif
#ifdef RT_USING_DFS_DEVFS
#include <devfs.h>
#endif
#ifdef RT_USING_DFS_UFFS
#include <dfs_uffs.h>
#endif
#ifdef RT_USING_DFS_JFFS2
#include <dfs_jffs2.h>
#endif
#ifdef RT_USING_DFS_YAFFS2
#include <dfs_yaffs2.h>
#endif
#ifdef RT_USING_DFS_ROMFS
#include <dfs_romfs.h>
#endif
#endif
#ifdef RT_USING_NEWLIB
#include <libc.h>
#endif
#ifdef RT_USING_PTHREADS
#include <pthread.h>
#endif
#ifdef RT_USING_MODULE
#include <rtm.h>
#endif
#ifdef RT_USING_RTGUI
#include <rtgui/rtgui_system.h>
#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 */
}

View File

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

View File

@ -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 <rtthread.h>
#include <rtdevice.h>
#ifdef RT_USING_DFS
#include <dfs_fs.h>
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

View File

@ -25,4 +25,4 @@ void platform_init(void)
#endif /* RT_USING_DFS */ #endif /* RT_USING_DFS */
} }
INIT_DEVICE_EXPORT(platform_init);

View File

@ -11,13 +11,14 @@
* Date Author Notes * Date Author Notes
* 2012-11-27 prife the first version * 2012-11-27 prife the first version
* 2013-03-03 aozima add dfs_win32_stat st_mtime support. * 2013-03-03 aozima add dfs_win32_stat st_mtime support.
* 2017-10-20 urey support rt-thread 3.0
*/ */
#include <rtthread.h> #include <rtthread.h>
#include <rtlibc.h>
#include <dfs_fs.h> #include <dfs_fs.h>
#include <dfs_def.h> #include <dfs_file.h>
#include <rtdevice.h> #include <rtdevice.h>
//#include "dfs_win32.h"
#include <io.h> #include <io.h>
#include <fcntl.h> #include <fcntl.h>
@ -48,7 +49,7 @@
*/ */
#define FILE_PATH_MAX 256 /* the longest file path */ #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 { typedef struct {
HANDLE handle; HANDLE handle;
@ -71,13 +72,13 @@ struct _errcode_map
static const struct _errcode_map errcode_table[] = static const struct _errcode_map errcode_table[] =
{ {
{DFS_STATUS_ENOENT, ERROR_FILE_NOT_FOUND }, {ENOENT, ERROR_FILE_NOT_FOUND },
{DFS_STATUS_ENOENT, ERROR_PATH_NOT_FOUND }, {ENOENT, ERROR_PATH_NOT_FOUND },
{DFS_STATUS_EEXIST, ERROR_FILE_EXISTS }, {EEXIST, ERROR_FILE_EXISTS },
{DFS_STATUS_EEXIST, ERROR_ALREADY_EXISTS }, {EEXIST, ERROR_ALREADY_EXISTS },
{DFS_STATUS_ENOTEMPTY, ERROR_DIR_NOT_EMPTY }, {ENOTEMPTY, ERROR_DIR_NOT_EMPTY },
{DFS_STATUS_EBUSY, ERROR_PATH_BUSY }, {EBUSY, ERROR_PATH_BUSY },
{DFS_STATUS_EINVAL, ERROR_ACCESS_DENIED }, {EINVAL, ERROR_ACCESS_DENIED },
#if 0 /* TODO: MORE NEED BE ADDED */ #if 0 /* TODO: MORE NEED BE ADDED */
{DFS_STATUS_EISDIR, ERROR_FILE_EXISTS }, {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) static int dfs_win32_mkfs(rt_device_t devid)
{ {
return -DFS_STATUS_ENOSYS; return -ENOSYS;
} }
static int dfs_win32_statfs(struct dfs_filesystem *fs, static int dfs_win32_statfs(struct dfs_filesystem *fs,
struct statfs *buf) struct statfs *buf)
{ {
return -DFS_STATUS_ENOSYS; return -ENOSYS;
} }
static char *winpath_dirdup(char *des, const char *src) 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) static int dfs_win32_open(struct dfs_fd *file)
{ {
int fd; int fd;
int oflag, mode; uint32_t oflag, mode;
char *file_path; char *file_path;
int res; int res;
oflag = file->flags; oflag = file->flags;
if (oflag & DFS_O_DIRECTORY) /* operations about dir */ if (oflag & O_DIRECTORY) /* operations about dir */
{ {
WINDIR *wdirp; WINDIR *wdirp;
HANDLE handle; HANDLE handle;
@ -180,7 +181,7 @@ static int dfs_win32_open(struct dfs_fd *file)
file_path = winpath_dirdup(WIN32_DIRDISK_ROOT, file->path); 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); res = CreateDirectory(file_path, NULL);
if (res == 0) if (res == 0)
@ -218,19 +219,19 @@ static int dfs_win32_open(struct dfs_fd *file)
file->data = (void *)wdirp; file->data = (void *)wdirp;
rt_free(file_path); rt_free(file_path);
return DFS_STATUS_OK; return 0;
} }
/* regular file operations */ /* regular file operations */
mode = O_BINARY; mode = O_BINARY;
if (oflag & DFS_O_RDONLY) mode |= O_RDONLY; if (oflag & O_RDONLY) mode |= O_RDONLY;
if (oflag & DFS_O_WRONLY) mode |= O_WRONLY; if (oflag & O_WRONLY) mode |= O_WRONLY;
if (oflag & DFS_O_RDWR) mode |= O_RDWR; if (oflag & O_RDWR) mode |= O_RDWR;
/* Opens the file, if it is existing. If not, a new file is created. */ /* 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. */ /* 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. */ /* 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); file_path = winpath_dirdup(WIN32_DIRDISK_ROOT, file->path);
fd = _open(file_path, mode, 0x0100 | 0x0080); /* _S_IREAD | _S_IWRITE */ 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->pos = 0;
file->size = _lseek(fd, 0, SEEK_END); file->size = _lseek(fd, 0, SEEK_END);
if (oflag & DFS_O_APPEND) if (oflag & O_APPEND)
{ {
file->pos = file->size; file->pos = file->size;
} }
@ -261,7 +262,7 @@ __err:
static int dfs_win32_close(struct dfs_fd *file) 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); WINDIR *wdirp = (WINDIR*)(file->data);
RT_ASSERT(wdirp != RT_NULL); 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) 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 fd;
int char_read; 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; return char_read;
} }
static int dfs_win32_write(struct dfs_fd *file, static int dfs_win32_write(struct dfs_fd *file, const void *buf, size_t len)
const void *buf,
rt_size_t len)
{ {
int fd; int fd;
int char_write; int char_write;
@ -347,10 +346,7 @@ static int dfs_win32_seek(struct dfs_fd *file,
} }
/* return the size of struct dirent*/ /* return the size of struct dirent*/
static int dfs_win32_getdents( static int dfs_win32_getdents(struct dfs_fd *file, struct dirent *dirp, rt_uint32_t count)
struct dfs_fd *file,
struct dirent *dirp,
rt_uint32_t count)
{ {
WINDIR *wdirp; WINDIR *wdirp;
struct dirent *d = dirp; struct dirent *d = dirp;
@ -358,7 +354,7 @@ static int dfs_win32_getdents(
/* make integer count */ /* make integer count */
if (count / sizeof(struct dirent) != 1) if (count / sizeof(struct dirent) != 1)
return -DFS_STATUS_EINVAL; return -EINVAL;
wdirp = (WINDIR*)(file->data); wdirp = (WINDIR*)(file->data);
RT_ASSERT(wdirp != RT_NULL); RT_ASSERT(wdirp != RT_NULL);
@ -367,9 +363,9 @@ static int dfs_win32_getdents(
/* get the current entry */ /* get the current entry */
if (wdirp->finddata.attrib & _A_SUBDIR) if (wdirp->finddata.attrib & _A_SUBDIR)
d->d_type = DFS_DT_DIR; d->d_type = DT_DIR;
else else
d->d_type = DFS_DT_REG; d->d_type = DT_REG;
d->d_namlen = strlen(wdirp->curr); d->d_namlen = strlen(wdirp->curr);
strncpy(d->d_name, wdirp->curr, DFS_PATH_MAX); strncpy(d->d_name, wdirp->curr, DFS_PATH_MAX);
d->d_reclen = (rt_uint16_t)sizeof(struct dirent); 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) if (fp == RT_NULL)
{ {
rt_kprintf("out of memory.\n"); rt_kprintf("out of memory.\n");
return -DFS_STATUS_ENOMEM; return -ENOMEM;
} }
result = GetFileAttributes(fp); result = GetFileAttributes(fp);
@ -445,7 +441,7 @@ static int dfs_win32_rename(
if (op == RT_NULL || np == RT_NULL) if (op == RT_NULL || np == RT_NULL)
{ {
rt_kprintf("out of memory.\n"); rt_kprintf("out of memory.\n");
return -DFS_STATUS_ENOMEM; return -ENOMEM;
} }
/* If the function fails, the return value is zero. */ /* 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) if (fp == RT_NULL)
{ {
rt_kprintf("out of memory.\n"); rt_kprintf("out of memory.\n");
return -DFS_STATUS_ENOMEM; return -ENOMEM;
} }
hFind = FindFirstFile(fp, &fileInfo); 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) if (hFind == INVALID_HANDLE_VALUE)
goto __err; goto __err;
st->st_mode = DFS_S_IFREG | DFS_S_IRUSR | DFS_S_IRGRP | DFS_S_IROTH | st->st_mode = S_IFREG | S_IRUSR | S_IRGRP | S_IROTH |
DFS_S_IWUSR | DFS_S_IWGRP | DFS_S_IWOTH; S_IWUSR | S_IWGRP | S_IWOTH;
/* convert file info to dfs stat structure */ /* convert file info to dfs stat structure */
if (fileInfo.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) if (fileInfo.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY)
{ {
st->st_mode &= ~DFS_S_IFREG; st->st_mode &= ~S_IFREG;
st->st_mode |= DFS_S_IFDIR | DFS_S_IXUSR | DFS_S_IXGRP | DFS_S_IXOTH; st->st_mode |= S_IFDIR | S_IXUSR | S_IXGRP | S_IXOTH;
} }
st->st_dev = 0; st->st_dev = 0;
@ -513,15 +509,8 @@ __err:
return win32_result_to_dfs(GetLastError()); 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_open,
dfs_win32_close, dfs_win32_close,
dfs_win32_ioctl, dfs_win32_ioctl,
@ -530,6 +519,17 @@ static const struct dfs_filesystem_operation dfs_win32_ops =
dfs_win32_flush, dfs_win32_flush,
dfs_win32_seek, dfs_win32_seek,
dfs_win32_getdents, 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_unlink,
dfs_win32_stat, dfs_win32_stat,
dfs_win32_rename, dfs_win32_rename,

View File

@ -1,14 +1,17 @@
#include <rtthread.h>
#include <dfs.h>
#include <stdio.h> #include <stdio.h>
#include <string.h> #include <string.h>
#ifdef _WIN32 #ifdef _WIN32
#include <stdlib.h> #include <stdlib.h>
#endif #endif
#include <rtthread.h> #ifdef DEBUG
#include <dfs_def.h> # define SD_TRACE rt_kprintf
#else
// #define SD_TRACE rt_kprintf # define SD_TRACE(...)
#define SD_TRACE(...) #endif
#define SDCARD_SIM "sd.bin" #define SDCARD_SIM "sd.bin"
#define SDCARD_SIZE (16*1024*1024) //16M #define SDCARD_SIZE (16*1024*1024) //16M

View File

@ -98,6 +98,8 @@
// #define RT_USING_LIBC // #define RT_USING_LIBC
// <bool name="RT_USING_PTHREADS" description="Using POSIX threads library" default="true" /> // <bool name="RT_USING_PTHREADS" description="Using POSIX threads library" default="true" />
// #define RT_USING_PTHREADS // #define RT_USING_PTHREADS
// <bool name="RT_USING_COMPONENTS_INIT" description="Using automatically component initialization." default="true" />
#define RT_USING_COMPONENTS_INIT
// <bool name="RT_USING_MODULE" description="Enable Moudle Application" default="true" /> // <bool name="RT_USING_MODULE" description="Enable Moudle Application" default="true" />
// #define RT_USING_MODULE // #define RT_USING_MODULE
// </section> // </section>
@ -131,7 +133,9 @@
// <bool name="RT_USING_DFS_NFS" description="Using NFS v3 client file system" default="false" /> // <bool name="RT_USING_DFS_NFS" description="Using NFS v3 client file system" default="false" />
// #define RT_USING_DFS_NFS // #define RT_USING_DFS_NFS
// <string name="RT_NFS_HOST_EXPORT" description="NFSv3 host export" default="192.168.1.5:/" /> // <string name="RT_NFS_HOST_EXPORT" description="NFSv3 host export" default="192.168.1.5:/" />
#define RT_NFS_HOST_EXPORT "192.168.1.5:/" #define RT_NFS_HOST_EXPORT "192.168.1.5:/"
// <bool name="RT_USING_DFS_WINSHAREDIR" description="shared windows file to rtt" default="false" />
#define RT_USING_DFS_WINSHAREDIR
// </section> // </section>
// <section name="RT_USING_LWIP" description="lwip, a lightweight TCP/IP protocol stack" default="true" > // <section name="RT_USING_LWIP" description="lwip, a lightweight TCP/IP protocol stack" default="true" >
@ -232,14 +236,6 @@
#elif defined(__GNUC__) #elif defined(__GNUC__)
#define RT_USING_NOLIBC #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 */ #endif /* end of _MSC_VER */
#ifdef _Win32
#define RT_USING_DFS_WINSHAREDIR
#endif
#endif #endif

View File

@ -5,7 +5,7 @@ ARCH='sim'
#CROSS_TOOL='msvc' or 'gcc' or 'mingw' #CROSS_TOOL='msvc' or 'gcc' or 'mingw'
#'msvc' and 'mingw' are both for windows #'msvc' and 'mingw' are both for windows
# 'gcc' is for linux # 'gcc' is for linux
CROSS_TOOL='msvc' CROSS_TOOL='mingw'
if os.getenv('RTT_CC'): if os.getenv('RTT_CC'):
CROSS_TOOL = os.getenv('RTT_CC') CROSS_TOOL = os.getenv('RTT_CC')
@ -67,23 +67,25 @@ if PLATFORM == 'gcc':
POST_ACTION = '' POST_ACTION = ''
elif PLATFORM == 'mingw': elif PLATFORM == 'mingw':
# toolchains # toolchains
PREFIX = '' PREFIX = ''
CC = PREFIX + 'gcc' CC = PREFIX + 'gcc'
AS = PREFIX + 'gcc' CXX = PREFIX + 'g++'
AR = PREFIX + 'ar' AS = PREFIX + 'gcc'
LINK = PREFIX + 'gcc' AR = PREFIX + 'ar'
LINK = PREFIX + 'g++'
TARGET_EXT = 'exe' TARGET_EXT = 'exe'
SIZE = PREFIX + 'size' SIZE = PREFIX + 'size'
OBJDUMP = PREFIX + 'objdump' OBJDUMP = PREFIX + 'objdump'
OBJCPY = PREFIX + 'objcopy' OBJCPY = PREFIX + 'objcopy'
DEVICE = ' -ffunction-sections -fdata-sections' # DEVICE = ' -ffunction-sections -fdata-sections'
DEVICE = ' ' DEVICE = ''
CFLAGS = DEVICE CFLAGS = DEVICE + ' -D_Win32 -DNO_OLDNAMES -fno-pic -fno-builtin -fno-exceptions -fno-omit-frame-pointer'
AFLAGS = ' -c' + DEVICE + ' -x assembler-with-cpp' AFLAGS = ' -c' + DEVICE + ' -x assembler-with-cpp'
DEFFILE_LFLAGS = DEVICE + ' -Wl,-Map=rtthread-win32.map,--output-def,rtthread.def -T mingw.ld ' LFLAGS = DEVICE + ' -static-libgcc -Wl,--gc-sections,-Map=rtthread-win32.map -T mingw.ld '
LFLAGS = DEVICE + ' -Wl,-Map=rtthread-win32.map -T mingw.ld '
CPATH = '' CPATH = ''
LPATH = '' LPATH = ''
@ -93,6 +95,7 @@ elif PLATFORM == 'mingw':
else: else:
CFLAGS += ' -O2' CFLAGS += ' -O2'
CXXFLAGS = CFLAGS
POST_ACTION = '' POST_ACTION = ''
elif PLATFORM == 'cl': elif PLATFORM == 'cl':

View File

@ -25,6 +25,7 @@
#define O_DSYNC 010000 #define O_DSYNC 010000
#define O_SYNC 04010000 #define O_SYNC 04010000
#define O_RSYNC 04010000 #define O_RSYNC 04010000
#define O_BINARY 0100000
#define O_DIRECTORY 0200000 #define O_DIRECTORY 0200000
#define O_NOFOLLOW 0400000 #define O_NOFOLLOW 0400000
#define O_CLOEXEC 02000000 #define O_CLOEXEC 02000000

View File

@ -38,5 +38,10 @@
typedef signed long off_t; typedef signed long off_t;
#endif #endif
#if defined(__MINGW32__)
typedef signed long off_t;
typedef int mode_t;
#endif
#endif #endif