summaryrefslogtreecommitdiff
path: root/components
diff options
context:
space:
mode:
Diffstat (limited to 'components')
-rw-r--r--components/SConscript41
-rw-r--r--components/dfs/SConscript42
-rw-r--r--components/dfs/src/dfs_posix.c1
-rw-r--r--components/finsh/SConscript28
-rw-r--r--components/libc/minilibc/SConscript12
-rw-r--r--components/libc/newlib/SConscript12
-rw-r--r--components/libc/newlib/syscalls.c2
-rw-r--r--components/libdl/SConscript27
-rw-r--r--components/net/apps/SConscript11
-rw-r--r--components/net/freemodbus/SConscript27
-rw-r--r--components/net/lwip/SConscript27
-rw-r--r--components/pthreads/SConscript28
-rw-r--r--components/rtgui/SConscript28
-rw-r--r--components/usb/SConscript28
14 files changed, 71 insertions, 243 deletions
diff --git a/components/SConscript b/components/SConscript
index bd6f6323ad..517e80b11f 100644
--- a/components/SConscript
+++ b/components/SConscript
@@ -1,36 +1,13 @@
-# for module compile
-Import('env')
-Import('rtconfig')
+# for module compiling
+import os
+Import('RTT_ROOT')
-# build each components
-objs = ''
+objs = []
+list = os.listdir(os.path.join(RTT_ROOT, 'components'))
-if rtconfig.CROSS_TOOL == 'gcc':
- if 'RT_USING_NEWLIB' in dir(rtconfig) and rtconfig.RT_USING_NEWLIB:
- objs = objs + SConscript('libc/newlib/SConscript')
- else:
- rtconfig.RT_USING_MINILIBC = True
- objs = objs + SConscript('libc/minilibc/SConscript')
-
-if 'RT_USING_PTHREAD' in dir(rtconfig) and rtconfig.RT_USING_PTHREAD:
- objs = objs + SConscript('pthreads/SConscript')
-
-if 'RT_USING_FINSH' in dir(rtconfig) and rtconfig.RT_USING_FINSH:
- objs = objs + SConscript('finsh/SConscript')
-
-if 'RT_USING_DFS' in dir(rtconfig) and rtconfig.RT_USING_DFS:
- objs = objs + SConscript('dfs/SConscript')
-
-if 'RT_USING_LWIP' in dir(rtconfig) and rtconfig.RT_USING_LWIP:
- objs = objs + SConscript('net/lwip/SConscript')
-
-if 'RT_USING_MODBUS' in dir(rtconfig) and rtconfig.RT_USING_MODBUS:
- objs = objs + SConscript('net/freemodbus/SConscript')
-
-if 'RT_USING_RTGUI' in dir(rtconfig) and rtconfig.RT_USING_RTGUI:
- objs = objs + SConscript('rtgui/SConscript')
-
-if 'RT_USING_FTK' in dir(rtconfig) and rtconfig.RT_USING_FTK:
- objs = objs + SConscript('external/ftk/ftk/src/os/rt-thread/SConscript')
+for d in list:
+ path = os.path.join(RTT_ROOT, 'components', d)
+ if os.path.isfile(os.path.join(path, 'SConscript')):
+ objs = objs + SConscript(os.path.join(d, 'SConscript'))
Return('objs')
diff --git a/components/dfs/SConscript b/components/dfs/SConscript
index 0eb0902636..bf1f76b52b 100644
--- a/components/dfs/SConscript
+++ b/components/dfs/SConscript
@@ -1,8 +1,8 @@
-Import('env')
-Import('rtconfig')
Import('RTT_ROOT')
-Import('projects')
+Import('rtconfig')
+from building import *
+# The set of source files associated with this SConscript file.
dfs = Split("""
src/dfs.c
src/dfs_fs.c
@@ -67,45 +67,27 @@ src_local = dfs
# The set of source files associated with this SConscript file.
path = [RTT_ROOT + '/components/dfs', RTT_ROOT + '/components/dfs/include']
-if 'RT_USING_DFS_YAFFS2' in dir(rtconfig) and rtconfig.RT_USING_DFS_YAFFS2:
+if GetDepend('RT_USING_DFS_YAFFS2'):
src_local = src_local + yaffs2_main + yaffs2_comm
path = path + [RTT_ROOT + '/components/dfs/filesystems/yaffs2', RTT_ROOT + '/components/dfs/filesystems/yaffs2/direct']
-if 'RT_DFS_ELM_USE_LFN' in dir(rtconfig) and rtconfig.RT_DFS_ELM_USE_LFN:
- elmfat += ['filesystems/elmfat/option/cc936.c']
-
-if 'RT_USING_DFS_ELMFAT' in dir(rtconfig) and rtconfig.RT_USING_DFS_ELMFAT:
+if GetDepend('RT_USING_DFS_ELMFAT'):
+ if GetDepend('RT_DFS_ELM_USE_LFN'):
+ elmfat += ['filesystems/elmfat/option/cc936.c']
src_local = src_local + elmfat
-if 'RT_USING_DFS_NFS' in dir(rtconfig) and rtconfig.RT_USING_DFS_NFS and rtconfig.RT_USING_LWIP:
+if GetDepend(['RT_USING_DFS_NFS', 'RT_USING_LWIP']):
src_local = src_local + nfs
path = path + [RTT_ROOT + '/components/dfs/filesystems/nfs']
-if 'RT_USING_DFS_ROMFS' in dir(rtconfig) and rtconfig.RT_USING_DFS_ROMFS:
+if GetDepend('RT_USING_DFS_ROMFS'):
src_local = src_local + romfs
path = path + [RTT_ROOT + '/components/dfs/filesystems/romfs']
-if 'RT_USING_DFS_DEVFS' in dir(rtconfig) and rtconfig.RT_USING_DFS_DEVFS:
+if GetDepend('RT_USING_DFS_DEVFS'):
src_local = src_local + devfs
path = path + [RTT_ROOT + '/components/dfs/filesystems/devfs']
-# group definitions
-group = {}
-group['name'] = 'Filesystem'
-group['src'] = File(src_local)
-group['CCFLAGS'] = ''
-group['CPPPATH'] = path
-group['CPPDEFINES'] = ''
-group['LINKFLAGS'] = ''
-
-# add group to project list
-projects.append(group)
-
-env.Append(CCFLAGS = group['CCFLAGS'])
-env.Append(CPPPATH = group['CPPPATH'])
-env.Append(CPPDEFINES = group['CPPDEFINES'])
-env.Append(LINKFLAGS = group['LINKFLAGS'])
-
-obj = env.Object(group['src'])
+group = DefineGroup('Filesystem', src_local, depend = ['RT_USING_DFS'], CPPPATH = path)
-Return('obj')
+Return('group')
diff --git a/components/dfs/src/dfs_posix.c b/components/dfs/src/dfs_posix.c
index f1c01605f9..6a3517e89d 100644
--- a/components/dfs/src/dfs_posix.c
+++ b/components/dfs/src/dfs_posix.c
@@ -282,7 +282,6 @@ int stat(const char *file, struct stat *buf)
*/
int fstat(int fildes, struct stat *buf)
{
- int result;
struct dfs_fd* d;
/* get the fd */
diff --git a/components/finsh/SConscript b/components/finsh/SConscript
index 5b6e9b1278..9c5bd0c37e 100644
--- a/components/finsh/SConscript
+++ b/components/finsh/SConscript
@@ -1,28 +1,14 @@
-Import('env')
-Import('projects')
Import('RTT_ROOT')
Import('rtconfig')
+from building import *
-# group definitions
-group = {}
-group['name'] = 'finsh'
-group['src'] = Glob('*.c')
-group['CCFLAGS'] = ''
-group['CPPPATH'] = [RTT_ROOT + '/components/finsh']
-group['CPPDEFINES'] = ''
+src = Glob('*.c')
+CPPPATH = [RTT_ROOT + '/components/finsh']
if rtconfig.CROSS_TOOL == 'keil':
- group['LINKFLAGS'] = ' --keep __fsym_* --keep __vsym_*'
+ LINKFLAGS = ' --keep __fsym_* --keep __vsym_*'
else:
- group['LINKFLAGS'] = ''
+ LINKFLAGS = ''
-# add group to project list
-projects.append(group)
+group = DefineGroup('finsh', src, depend = ['RT_USING_FINSH'], CPPPATH = CPPPATH, LINKFLAGS = LINKFLAGS)
-env.Append(CCFLAGS = group['CCFLAGS'])
-env.Append(CPPPATH = group['CPPPATH'])
-env.Append(CPPDEFINES = group['CPPDEFINES'])
-env.Append(LINKFLAGS = group['LINKFLAGS'])
-
-objs = env.Object(group['src'])
-
-Return('objs')
+Return('group')
diff --git a/components/libc/minilibc/SConscript b/components/libc/minilibc/SConscript
index 70122c43df..8eb7e0b58e 100644
--- a/components/libc/minilibc/SConscript
+++ b/components/libc/minilibc/SConscript
@@ -1,10 +1,8 @@
-Import('env')
Import('RTT_ROOT')
+from building import *
-# The set of source files associated with this SConscript file.
-src_local = Glob('*.c')
+src = Glob('*.c')
+CPPPATH = [RTT_ROOT + '/components/libc/minilibc']
+group = DefineGroup('minilibc', src, depend = ['RT_USING_MINILIBC'], CPPPATH = CPPPATH)
-env.Append(CPPPATH = RTT_ROOT + '/components/libc/minilibc', CPPDEFINES='RT_USING_MINILIBC')
-
-obj = env.Object(src_local)
-Return('obj')
+Return('group')
diff --git a/components/libc/newlib/SConscript b/components/libc/newlib/SConscript
index 2de094db01..d8ce850d0f 100644
--- a/components/libc/newlib/SConscript
+++ b/components/libc/newlib/SConscript
@@ -1,10 +1,8 @@
-Import('env')
Import('RTT_ROOT')
+from building import *
-# The set of source files associated with this SConscript file.
-src_local = Glob('*.c')
+src = Glob('*.c')
+CPPPATH = [RTT_ROOT + '/components/libc/newlib']
+group = DefineGroup('newlib', src, depend = ['RT_USING_NEWLIB'], CPPPATH = CPPPATH)
-env.Append(CPPPATH = RTT_ROOT + '/components/libc/newlib')
-
-obj = env.Object(src_local)
-Return('obj')
+Return('group')
diff --git a/components/libc/newlib/syscalls.c b/components/libc/newlib/syscalls.c
index 39bdeecfaa..6b040822ab 100644
--- a/components/libc/newlib/syscalls.c
+++ b/components/libc/newlib/syscalls.c
@@ -201,12 +201,14 @@ _free_r (struct _reent *ptr, void *addr)
rt_free (addr);
}
+#if 0
void __assert(const char *file, int line, const char *failedexpr)
{
rt_kprintf("assertion \"%s\" failed: file \"%s\", line %d\n",
failedexpr, file, line);
RT_ASSERT(0);
}
+#endif
void
_exit (int status)
diff --git a/components/libdl/SConscript b/components/libdl/SConscript
index df7c8814ca..dbd5bcea32 100644
--- a/components/libdl/SConscript
+++ b/components/libdl/SConscript
@@ -1,26 +1,9 @@
-Import('env')
-Import('projects')
Import('RTT_ROOT')
Import('rtconfig')
+from building import *
-# group definitions
-group = {}
-group['name'] = 'libdl'
-group['src'] = Glob('*.c')
-group['depend'] = 'RT_USING_LIBDL'
-group['CCFLAGS'] = ''
-group['CPPPATH'] = [RTT_ROOT + '/components/libdl']
-group['CPPDEFINES'] = ''
-group['LINKFLAGS'] = ''
+src = Glob('*.c')
+CPPPATH = [RTT_ROOT + '/components/libdl']
+group = DefineGroup('libdl', src, depend = ['RT_USING_MODULE', 'RT_USING_LIBDL'], CPPPATH = CPPPATH)
-# add group to project list
-projects.append(group)
-
-env.Append(CCFLAGS = group['CCFLAGS'])
-env.Append(CPPPATH = group['CPPPATH'])
-env.Append(CPPDEFINES = group['CPPDEFINES'])
-env.Append(LINKFLAGS = group['LINKFLAGS'])
-
-objs = env.Object(group['src'])
-
-Return('objs')
+Return('group')
diff --git a/components/net/apps/SConscript b/components/net/apps/SConscript
index b0e7fb2716..a0822b53fa 100644
--- a/components/net/apps/SConscript
+++ b/components/net/apps/SConscript
@@ -1,10 +1,7 @@
-Import('env')
-Import('rtconfig')
Import('RTT_ROOT')
+from building import *
-# The set of source files associated with this SConscript file.
-src_local = Glob('*.c')
+src = Glob('*.c')
+group = DefineGroup('netutils', src, depend = ['RT_USING_NETUTILS'])
-obj = env.Object(src_local)
-
-Return('obj') \ No newline at end of file
+Return('group')
diff --git a/components/net/freemodbus/SConscript b/components/net/freemodbus/SConscript
index 61e254bb2b..588f31b458 100644
--- a/components/net/freemodbus/SConscript
+++ b/components/net/freemodbus/SConscript
@@ -1,9 +1,7 @@
-Import('env')
-Import('rtconfig')
Import('RTT_ROOT')
-Import('projects')
+from building import *
-src_local = Split("""
+src = Split("""
modbus/mb.c
modbus/mbmaster.c
modbus/ascii/mbascii.c
@@ -30,23 +28,6 @@ path = [RTT_ROOT + '/components/net/freemodbus/modbus/include',
RTT_ROOT + '/components/net/freemodbus/modbus/rtu',
RTT_ROOT + '/components/net/freemodbus/modbus/ascii']
-# group definitions
-group = {}
-group['name'] = 'FreeModBus'
-group['src'] = File(src_local)
-group['CCFLAGS'] = ''
-group['CPPPATH'] = path
-group['CPPDEFINES'] = ''
-group['LINKFLAGS'] = ''
+group = DefineGroup('FreeModbus', src, depend = ['RT_USING_FREEMODBUS'], CPPPATH = path)
-# add group to project list
-projects.append(group)
-
-env.Append(CCFLAGS = group['CCFLAGS'])
-env.Append(CPPPATH = group['CPPPATH'])
-env.Append(CPPDEFINES = group['CPPDEFINES'])
-env.Append(LINKFLAGS = group['LINKFLAGS'])
-
-objs = env.Object(group['src'])
-
-Return('objs')
+Return('group')
diff --git a/components/net/lwip/SConscript b/components/net/lwip/SConscript
index 3f0197fd9d..496b915f01 100644
--- a/components/net/lwip/SConscript
+++ b/components/net/lwip/SConscript
@@ -1,9 +1,7 @@
-Import('env')
-Import('rtconfig')
Import('RTT_ROOT')
-Import('projects')
+from building import *
-src_local = Split("""
+src = Split("""
src/api/api_lib.c
src/api/api_msg.c
src/api/err.c
@@ -68,23 +66,6 @@ path = [RTT_ROOT + '/components/net/lwip/src',
RTT_ROOT + '/components/net/lwip/src/include/netif',
RTT_ROOT + '/components/net/lwip/src/netif/ppp']
-# group definitions
-group = {}
-group['name'] = 'LwIP'
-group['src'] = File(src_local)
-group['CCFLAGS'] = ''
-group['CPPPATH'] = path
-group['CPPDEFINES'] = ''
-group['LINKFLAGS'] = ''
+group = DefineGroup('LwIP', src, depend = ['RT_USING_LWIP'], CPPPATH = path)
-# add group to project list
-projects.append(group)
-
-env.Append(CCFLAGS = group['CCFLAGS'])
-env.Append(CPPPATH = group['CPPPATH'])
-env.Append(CPPDEFINES = group['CPPDEFINES'])
-env.Append(LINKFLAGS = group['LINKFLAGS'])
-
-obj = env.Object(group['src'])
-
-Return('obj')
+Return('group')
diff --git a/components/pthreads/SConscript b/components/pthreads/SConscript
index 8dc41edc0d..9fe796d225 100644
--- a/components/pthreads/SConscript
+++ b/components/pthreads/SConscript
@@ -1,26 +1,8 @@
-Import('env')
-Import('projects')
Import('RTT_ROOT')
-Import('rtconfig')
+from building import *
-# group definitions
-group = {}
-group['name'] = 'pthreads'
-group['src'] = Glob('*.c')
-group['depend'] = 'RT_USING_PTHREAD'
-group['CCFLAGS'] = ''
-group['CPPPATH'] = [RTT_ROOT + '/components/pthreads']
-group['CPPDEFINES'] = ''
-group['LINKFLAGS'] = ''
+src = Glob('*.c')
+CPPPATH = [RTT_ROOT + '/components/pthreads']
+group = DefineGroup('pthreads', src, depend = ['RT_USING_PTHREADS'], CPPPATH = CPPPATH)
-# add group to project list
-projects.append(group)
-
-env.Append(CCFLAGS = group['CCFLAGS'])
-env.Append(CPPPATH = group['CPPPATH'])
-env.Append(CPPDEFINES = group['CPPDEFINES'])
-env.Append(LINKFLAGS = group['LINKFLAGS'])
-
-objs = env.Object(group['src'])
-
-Return('objs')
+Return('group')
diff --git a/components/rtgui/SConscript b/components/rtgui/SConscript
index 88da95fdca..625771459b 100644
--- a/components/rtgui/SConscript
+++ b/components/rtgui/SConscript
@@ -1,7 +1,5 @@
-Import('env')
-Import('rtconfig')
Import('RTT_ROOT')
-Import('projects')
+from building import *
common_src = Split("""
common/blit.c
@@ -63,30 +61,12 @@ widgets/workbench.c
""")
# The set of source files associated with this SConscript file.
-src_local = common_src + server_src + widgets_src
+src = common_src + server_src + widgets_src
path = [RTT_ROOT + '/components/rtgui/include',
RTT_ROOT + '/components/rgtui/common',
RTT_ROOT + '/components/rtgui/server',
RTT_ROOT + '/components/rtgui/widgets']
+group = DefineGroup('RTGUI', src, depend = ['RT_USING_RTGUI'], CPPPATH = path)
-# group definitions
-group = {}
-group['name'] = 'GUI'
-group['src'] = File(src_local)
-group['CCFLAGS'] = ''
-group['CPPPATH'] = path
-group['CPPDEFINES'] = ''
-group['LINKFLAGS'] = ''
-
-# add group to project list
-projects.append(group)
-
-env.Append(CCFLAGS = group['CCFLAGS'])
-env.Append(CPPPATH = group['CPPPATH'])
-env.Append(CPPDEFINES = group['CPPDEFINES'])
-env.Append(LINKFLAGS = group['LINKFLAGS'])
-
-objs = env.Object(group['src'])
-
-Return('objs')
+Return('group')
diff --git a/components/usb/SConscript b/components/usb/SConscript
index 0acf9f2305..5199a9bdd4 100644
--- a/components/usb/SConscript
+++ b/components/usb/SConscript
@@ -1,26 +1,8 @@
-Import('env')
-Import('projects')
Import('RTT_ROOT')
-Import('rtconfig')
+from building import *
-# group definitions
-group = {}
-group['name'] = 'USB'
-group['src'] = Glob('*.c')
-group['CCFLAGS'] = ''
-group['CPPPATH'] = [RTT_ROOT + '/components/usb']
-group['CPPDEFINES'] = ''
-group['LINKFLAGS'] = ''
-group['DEPEND'] = 'RT_USING_USB'
+src = Glob('*.c')
+CPPPATH = [RTT_ROOT + '/components/usb']
+group = DefineGroup('USB', src, depend = ['RT_USING_USB_DEVICE'], CPPPATH = CPPPATH)
-# add group to project list
-projects.append(group)
-
-env.Append(CCFLAGS = group['CCFLAGS'])
-env.Append(CPPPATH = group['CPPPATH'])
-env.Append(CPPDEFINES = group['CPPDEFINES'])
-env.Append(LINKFLAGS = group['LINKFLAGS'])
-
-objs = env.Object(group['src'])
-
-Return('objs')
+Return('group')