Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
BaiXuePrincess
rt-thread
提交
8e398fe4
R
rt-thread
项目概览
BaiXuePrincess
/
rt-thread
与 Fork 源项目一致
Fork自
RT-Thread / rt-thread
通知
1
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
R
rt-thread
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
提交
8e398fe4
编写于
10月 20, 2017
作者:
B
Bernard Xiong
提交者:
GitHub
10月 20, 2017
浏览文件
操作
浏览文件
下载
差异文件
Merge pull request #887 from yygg/master
[BSP] fix compiling error for simulator bsp.
上级
fbe3a4d1
2d0c10a0
变更
11
隐藏空白更改
内联
并排
Showing
11 changed file
with
141 addition
and
332 deletion
+141
-332
bsp/simulator/applications/application.c
bsp/simulator/applications/application.c
+3
-54
bsp/simulator/applications/init.c
bsp/simulator/applications/init.c
+0
-170
bsp/simulator/applications/init.h
bsp/simulator/applications/init.h
+0
-31
bsp/simulator/applications/mnt.c
bsp/simulator/applications/mnt.c
+53
-0
bsp/simulator/applications/platform.c
bsp/simulator/applications/platform.c
+1
-1
bsp/simulator/drivers/dfs_win32.c
bsp/simulator/drivers/dfs_win32.c
+51
-51
bsp/simulator/drivers/sd_sim.c
bsp/simulator/drivers/sd_sim.c
+8
-5
bsp/simulator/rtconfig.h
bsp/simulator/rtconfig.h
+5
-9
bsp/simulator/rtconfig.py
bsp/simulator/rtconfig.py
+14
-11
include/libc/libc_fcntl.h
include/libc/libc_fcntl.h
+1
-0
include/rtlibc.h
include/rtlibc.h
+5
-0
未找到文件。
bsp/simulator/applications/application.c
浏览文件 @
8e398fe4
...
...
@@ -26,64 +26,13 @@
#include <stdio.h>
#include <board.h>
#ifdef RT_USING_DFS
#include <dfs_fs.h>
#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
()
...
...
bsp/simulator/applications/init.c
已删除
100644 → 0
浏览文件 @
fbe3a4d1
/*
* 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 */
}
bsp/simulator/applications/init.h
已删除
100644 → 0
浏览文件 @
fbe3a4d1
/*
* 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
bsp/simulator/applications/mnt.c
0 → 100644
浏览文件 @
8e398fe4
/*
* File : mnt.c
* COPYRIGHT (C) 2008 - 2016, RT-Thread Development Team
*
* Change Logs:
* Date Author Notes
* 201743 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
bsp/simulator/applications/platform.c
浏览文件 @
8e398fe4
...
...
@@ -25,4 +25,4 @@ void platform_init(void)
#endif
/* RT_USING_DFS */
}
INIT_DEVICE_EXPORT
(
platform_init
);
bsp/simulator/drivers/dfs_win32.c
浏览文件 @
8e398fe4
...
...
@@ -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 <rtthread.h>
#include <rtlibc.h>
#include <dfs_fs.h>
#include <dfs_
def
.h>
#include <dfs_
file
.h>
#include <rtdevice.h>
//#include "dfs_win32.h"
#include <io.h>
#include <fcntl.h>
...
...
@@ -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
;
in
t
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
=
D
FS_D
T_DIR
;
d
->
d_type
=
DT_DIR
;
else
d
->
d_type
=
D
FS_D
T_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_file
system_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
,
...
...
bsp/simulator/drivers/sd_sim.c
浏览文件 @
8e398fe4
#include <rtthread.h>
#include <dfs.h>
#include <stdio.h>
#include <string.h>
#ifdef _WIN32
#include <stdlib.h>
#endif
#i
nclude <rtthread.h>
#
include <dfs_def.h>
// #define SD_TRACE rt_kprintf
#
define SD_TRACE(...)
#i
fdef DEBUG
#
define SD_TRACE rt_kprintf
#else
# define SD_TRACE(...)
#
endif
#define SDCARD_SIM "sd.bin"
#define SDCARD_SIZE (16*1024*1024) //16M
...
...
bsp/simulator/rtconfig.h
浏览文件 @
8e398fe4
...
...
@@ -98,6 +98,8 @@
// #define RT_USING_LIBC
// <bool name="RT_USING_PTHREADS" description="Using POSIX threads library" default="true" />
// #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" />
// #define RT_USING_MODULE
// </section>
...
...
@@ -131,7 +133,9 @@
// <bool name="RT_USING_DFS_NFS" description="Using NFS v3 client file system" default="false" />
// #define RT_USING_DFS_NFS
// <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 name="RT_USING_LWIP" description="lwip, a lightweight TCP/IP protocol stack" default="true" >
...
...
@@ -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
bsp/simulator/rtconfig.py
浏览文件 @
8e398fe4
...
...
@@ -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
=
'm
svc
'
CROSS_TOOL
=
'm
ingw
'
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'
:
...
...
include/libc/libc_fcntl.h
浏览文件 @
8e398fe4
...
...
@@ -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
...
...
include/rtlibc.h
浏览文件 @
8e398fe4
...
...
@@ -38,5 +38,10 @@
typedef
signed
long
off_t
;
#endif
#if defined(__MINGW32__)
typedef
signed
long
off_t
;
typedef
int
mode_t
;
#endif
#endif
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录