app module support for simlator, first version

This commit is contained in:
prife
2013-02-27 00:37:57 +08:00
parent 242574a36f
commit a64ec10e68
7 changed files with 64 additions and 5 deletions
+39 -2
View File
@@ -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)
+2
View File
@@ -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)
+8
View File
@@ -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;
+4
View File
@@ -0,0 +1,4 @@
int dummy_main()
{
return 0;
}
+3
View File
@@ -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
+3 -3
View File
@@ -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 = ''