提交 a64ec10e 编写于 作者: P prife

app module support for simlator, first version

上级 242574a3
......@@ -106,8 +106,45 @@ if GetDepend('RT_USING_RTGUI'):
if GetDepend('RT_USING_TC'):
objs = objs + SConscript(RTT_ROOT + '/examples/kernel/SConscript', variant_dir = 'build/tc/kernel', duplicate=0)
# build program
program = env.Program(TARGET, objs)
def ObjRemove(objs, remove):
for item in objs:
# print type(item), os.path.basename(str(item))
if os.path.basename(str(item)) in remove:
objs.remove(item)
return
# build program -shared
if GetDepend('RT_USING_MODULE'):
# Remove module.c in $RTT_ROOT/src
ObjRemove(objs, ['module.obj', 'module.o'])
AddOption('--def',
dest='def',
nargs=1, type='string',
action='store',
metavar='DIR',
help='installation prefix')
res = GetOption('def')
if res is None:
program = env.Program(TARGET, objs)
elif res == 'update':
env['LINKFLAGS'] = rtconfig.DEFFILE_LFLAGS
env.SharedLibrary("rtthread.dll", objs)
program = ''
elif res == 'yes':
if rtconfig.PLATFORM == 'cl':
objs += ['rtthread.def']
env.SharedLibrary("rtthread.dll", objs)
program = env.Program(TARGET, 'dummy.c', LIBS='rtthread', LIBPATH='.')
else:
print "bad arguments, you can use the following command:"
print "\t --def=update to create .def"
print "\t --def=yes to create final exe"
exit()
else:
# env.SharedLibrary("rtthread.dll", objs)
program = env.Program(TARGET, objs)
# end building
EndBuilding(TARGET, program)
......@@ -6,6 +6,8 @@ src = Glob('*.c')
# remove no need file.
if GetDepend('RT_USING_DFS_WINSHAREDIR') == False:
SrcRemove(src, 'dfs_win32.c')
if GetDepend('RT_USING_MODULE') == False:
SrcRemove(src, ['module_win32.c'])
CPPPATH = [cwd, str(Dir('#'))]
group = DefineGroup('Applications', src, depend = [''], CPPPATH = CPPPATH)
......
......@@ -148,6 +148,14 @@ static char *winpath_dirdup(char *des, const char *src)
return path;
}
/* This function can convert the path in rt-thread/dfs to the path in windows */
char * dfs_win32_dirdup(char * path)
{
char * file_path;
file_path = winpath_dirdup(WIN32_DIRDISK_ROOT, path);
return file_path;
}
static int dfs_win32_open(struct dfs_fd *file)
{
int fd;
......
int dummy_main()
{
return 0;
}
......@@ -99,6 +99,9 @@
/* SECTION: component options */
#define RT_USING_COMPONENTS_INIT
/* SECTION: APP MODULE */
#define RT_USING_MODULE
/* SECTION: MTD interface options */
/* using mtd nand flash */
#define RT_USING_MTD_NAND
......
......@@ -71,10 +71,10 @@ elif PLATFORM == 'mingw':
DEVICE = ' -ffunction-sections -fdata-sections'
DEVICE = ' '
CFLAGS = ' -Wl,--output-def '
CFLAGS = DEVICE
AFLAGS = ' -c' + DEVICE + ' -x assembler-with-cpp'
#LFLAGS = DEVICE + ' -Wl,-Map=rtthread-win32.map -T mingw.ld'
LFLAGS = DEVICE + ' -Wl,-Map=rtthread-win32.map --gc-sections,--whole-archive -T mingw.ld '
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 '
CPATH = ''
LPATH = ''
......
......@@ -21,6 +21,9 @@ struct rt_module_symtab
const char *name;
};
#if defined(_MSC_VER) || defined(__MINGW32__)
#define RTM_EXPORT(symbol)
#else
#define RTM_EXPORT(symbol) \
const char __rtmsym_##symbol##_name[] = #symbol; \
const struct rt_module_symtab __rtmsym_##symbol SECTION("RTMSymTab")= \
......@@ -28,6 +31,8 @@ const struct rt_module_symtab __rtmsym_##symbol SECTION("RTMSymTab")= \
(void *)&symbol, \
__rtmsym_##symbol##_name \
};
#endif
#else
#define RTM_EXPORT(symbol)
#endif
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册