summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author[email protected] <[email protected]>2010-11-20 12:31:00 +0000
committer[email protected] <[email protected]>2010-11-20 12:31:00 +0000
commit10732a76e9a3bf1ead47cf9848c6838236e4e343 (patch)
tree7475b1f6ff77e80bd357fc551de80565c9486080
parent2fce1a91e2577f06b68151dffa15558750346d02 (diff)
cleanup scons building script
git-svn-id: https://rt-thread.googlecode.com/svn/trunk@1065 bbd45198-f89e-11dd-88c7-29a3b14d5316
-rw-r--r--bsp/dev3210/SConscript33
-rw-r--r--bsp/dev3210/SConstruct28
-rw-r--r--bsp/dev3210/rtconfig.py64
-rw-r--r--bsp/lpc176x/SConscript33
-rw-r--r--bsp/lpc176x/SConstruct40
-rw-r--r--bsp/lpc176x/project.Uv2217
-rw-r--r--bsp/lpc176x/rtconfig.py46
-rw-r--r--bsp/mini2440/SConscript47
-rw-r--r--bsp/mini2440/SConstruct75
-rw-r--r--bsp/mini2440/rtconfig.py80
-rw-r--r--bsp/stm3210/Libraries/SConscript25
-rw-r--r--bsp/stm3210/SConscript34
-rw-r--r--bsp/stm3210/SConstruct38
-rw-r--r--bsp/stm3210/project.Uv2166
-rw-r--r--bsp/stm3210/rtconfig.py47
-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
-rw-r--r--examples/gui/SConscript23
-rw-r--r--examples/kernel/SConscript10
-rw-r--r--examples/libc/SConscript10
-rw-r--r--libcpu/SConscript29
-rw-r--r--src/SConscript25
-rw-r--r--src/ipc.c8
-rw-r--r--tools/building.py334
36 files changed, 716 insertions, 1010 deletions
diff --git a/bsp/dev3210/SConscript b/bsp/dev3210/SConscript
index 350f0e71a7..fb50794533 100644
--- a/bsp/dev3210/SConscript
+++ b/bsp/dev3210/SConscript
@@ -1,29 +1,10 @@
-Import('env')
-Import('projects')
Import('RTT_ROOT')
-Import('rtconfig')
+from building import *
-# group definitions
-group = {}
-group['name'] = 'Startup'
-group['CCFLAGS'] = ''
-group['CPPPATH'] = [RTT_ROOT + '/bsp/dev3210']
-group['CPPDEFINES'] = []
-group['LINKFLAGS'] = ''
+src_bsp = ['application.c', 'startup.c', 'board.c']
+src_drv = ['uart.c', 'lnn800x480.c']
+src = File(src_bsp + src_drv)
+CPPPATH = [RTT_ROOT + '/bsp/dev3210']
+group = DefineGroup('Startup', src, depend = [''], CPPPATH = CPPPATH)
-src_bsp = ['application.c', 'startup.c', 'board.c']
-src_drv = ['uart.c', 'lnn800x480.c']
-
-group['src'] = File(src_bsp + src_drv)
-
-# 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/bsp/dev3210/SConstruct b/bsp/dev3210/SConstruct
index daef695079..061f726069 100644
--- a/bsp/dev3210/SConstruct
+++ b/bsp/dev3210/SConstruct
@@ -4,9 +4,9 @@ import rtconfig
RTT_ROOT = os.path.normpath(os.getcwd() + '/../..')
sys.path = sys.path + [os.path.join(RTT_ROOT, 'tools')]
+from building import *
-target = 'rtthread'
-projects = []
+TARGET = 'rtthread.' + rtconfig.TARGET_EXT
env = Environment(tools = ['mingw'],
AS = rtconfig.AS, ASFLAGS = rtconfig.AFLAGS,
@@ -15,26 +15,14 @@ env = Environment(tools = ['mingw'],
LINK = rtconfig.LINK, LINKFLAGS = rtconfig.LFLAGS)
env.PrependENVPath('PATH', rtconfig.EXEC_PATH)
-Export('env')
Export('RTT_ROOT')
Export('rtconfig')
-Export('projects')
-# kernel building script
-objs = SConscript(RTT_ROOT + '/src/SConscript', variant_dir='build/src', duplicate=0)
-# arch building script
-objs = objs + SConscript(RTT_ROOT + '/libcpu/SConscript', variant_dir='build/libcpu', duplicate=0)
+# prepare building environment
+objs = PrepareBuilding(env, RTT_ROOT)
-# component script
-Repository(RTT_ROOT)
-objs = objs + SConscript('components/SConscript')
-
-# board build script
-objs = objs + SConscript('SConscript', variant_dir='build/bsp', duplicate=0)
-
-if rtconfig.RT_USING_RTGUI:
- objs = objs + SConscript(RTT_ROOT + '/examples/gui/SConscript', variant_dir='build/examples/gui', duplicate=0)
-
-TARGET = target + '.' + rtconfig.TARGET_EXT
+# build program
env.Program(TARGET, objs)
-env.AddPostAction(TARGET, rtconfig.POST_ACTION)
+
+# end building
+EndBuilding(TARGET)
diff --git a/bsp/dev3210/rtconfig.py b/bsp/dev3210/rtconfig.py
index 2f7b09c52f..0a582912d1 100644
--- a/bsp/dev3210/rtconfig.py
+++ b/bsp/dev3210/rtconfig.py
@@ -1,61 +1,12 @@
-import SCons.cpp
-
-# component options
-
-# make all component false
-RT_USING_FINSH = False
-RT_USING_DFS = False
-RT_USING_DFS_ELMFAT = False
-RT_USING_DFS_YAFFS2 = False
-RT_USING_LWIP = False
-RT_USING_WEBSERVER = False
-RT_USING_RTGUI = False
-RT_USING_MODULE = False
-
-# parse rtconfig.h to get used component
-PreProcessor = SCons.cpp.PreProcessor()
-f = file('rtconfig.h', 'r')
-contents = f.read()
-f.close()
-PreProcessor.process_contents(contents)
-rtconfig_ns = PreProcessor.cpp_namespace
-
-# finsh shell options
-if rtconfig_ns.has_key('RT_USING_FINSH'):
- RT_USING_FINSH = True
-
-# device virtual filesystem options
-if rtconfig_ns.has_key('RT_USING_DFS'):
- RT_USING_DFS = True
-
- if rtconfig_ns.has_key('RT_USING_DFS_ELMFAT'):
- RT_USING_DFS_ELMFAT = True
- if rtconfig_ns.has_key('RT_USING_DFS_YAFFS2'):
- RT_USING_DFS_YAFFS2 = True
-
-# lwip options
-if rtconfig_ns.has_key('RT_USING_LWIP'):
- RT_USING_LWIP = True
- if rtconfig_ns.has_key('RT_USING_WEBSERVER'):
- RT_USING_WEBSERVER = True
-
-# rtgui options
-if rtconfig_ns.has_key('RT_USING_RTGUI'):
- RT_USING_RTGUI = True
-
-# module options
-if rtconfig_ns.has_key('RT_USING_MODULE'):
- RT_USING_MODULE = True
-
# CPU options
ARCH='mips'
CPU ='loongson'
# toolchains options
CROSS_TOOL = 'gcc'
-PLATFORM = 'gcc'
-EXEC_PATH = 'E:/Program Files/CodeSourcery/Sourcery G++ Lite/bin'
-BUILD = 'debug'
+PLATFORM = 'gcc'
+EXEC_PATH = 'E:/Program Files/CodeSourcery/Sourcery G++ Lite/bin'
+BUILD = 'debug'
PREFIX = 'mips-sde-elf-'
CC = PREFIX + 'gcc'
@@ -77,12 +28,11 @@ CPATH = ''
LPATH = ''
if BUILD == 'debug':
- CFLAGS += ' -O0 -gdwarf-2'
- AFLAGS += ' -gdwarf-2'
+ CFLAGS += ' -O0 -gdwarf-2'
+ AFLAGS += ' -gdwarf-2'
else:
- CFLAGS += ' -O2'
+ CFLAGS += ' -O2'
-RT_USING_MINILIBC = True
DUMP_ACTION = OBJDUMP + ' -D -S $TARGET > rtt.asm\n'
READELF_ACTION = READELF + ' -a $TARGET > rtt.map\n'
-POST_ACTION = OBJCPY + ' -O binary $TARGET rtthread.bin\n' + SIZE + ' $TARGET \n' + READELF_ACTION
+POST_ACTION = OBJCPY + ' -O binary $TARGET rtthread.bin\n' + SIZE + ' $TARGET \n'
diff --git a/bsp/lpc176x/SConscript b/bsp/lpc176x/SConscript
index 12284e970b..c4866729f3 100644
--- a/bsp/lpc176x/SConscript
+++ b/bsp/lpc176x/SConscript
@@ -1,36 +1,19 @@
-Import('env')
-Import('projects')
+import rtconfig
Import('RTT_ROOT')
-Import('rtconfig')
-
-# group definitions
-group = {}
-group['name'] = 'Startup'
-group['CCFLAGS'] = ''
-group['CPPPATH'] = [ RTT_ROOT + '/bsp/lpc176x/CMSIS/CM3/CoreSupport', RTT_ROOT + '/bsp/lpc176x/CMSIS/CM3/DeviceSupport/NXP/LPC17xx',RTT_ROOT + '/bsp/lpc176x']
-group['CPPDEFINES'] = []
-group['LINKFLAGS'] = ''
+from building import *
src_bsp = ['application.c', 'startup.c', 'board.c']
src_drv = ['uart.c', 'led.c']
src_cmsis = ['CMSIS/CM3/CoreSupport/core_cm3.c', 'CMSIS/CM3/DeviceSupport/NXP/LPC17xx/system_LPC17xx.c']
-if rtconfig.RT_USING_DFS:
+if GetDepend('RT_USING_DFS'):
src_drv += ['sd.c', 'spi.c']
-if rtconfig.RT_USING_LWIP:
+if GetDepend('RT_USING_LWIP'):
src_drv += ['emac.c']
-group['src'] = File(src_bsp + src_drv + src_cmsis)
-
-# 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'])
+src = File(src_bsp + src_drv + src_cmsis)
+CPPPATH = [ RTT_ROOT + '/bsp/lpc176x/CMSIS/CM3/CoreSupport', RTT_ROOT + '/bsp/lpc176x/CMSIS/CM3/DeviceSupport/NXP/LPC17xx',RTT_ROOT + '/bsp/lpc176x']
+group = DefineGroup('Startup', src, depend = [''], CPPPATH = CPPPATH)
-Return('obj')
+Return('group')
diff --git a/bsp/lpc176x/SConstruct b/bsp/lpc176x/SConstruct
index e3e8593216..4eb3bef0da 100644
--- a/bsp/lpc176x/SConstruct
+++ b/bsp/lpc176x/SConstruct
@@ -4,18 +4,9 @@ import rtconfig
RTT_ROOT = os.path.normpath(os.getcwd() + '/../..')
sys.path = sys.path + [os.path.join(RTT_ROOT, 'tools')]
-import mdk
+from building import *
-target = 'rtthread-lpc176x'
-projects = []
-
-AddOption('--target',
- dest='target',
- type='string',
- help='set target project: mdk')
-
-if GetOption('target'):
- SetOption('no_exec', 1)
+TARGET = 'rtthread-lpc176x.' + rtconfig.TARGET_EXT
env = Environment(tools = ['mingw'],
AS = rtconfig.AS, ASFLAGS = rtconfig.AFLAGS,
@@ -24,26 +15,23 @@ env = Environment(tools = ['mingw'],
LINK = rtconfig.LINK, LINKFLAGS = rtconfig.LFLAGS)
env.PrependENVPath('PATH', rtconfig.EXEC_PATH)
-Export('env')
Export('RTT_ROOT')
Export('rtconfig')
-Export('projects')
-# kernel building script
-objs = SConscript(RTT_ROOT + '/src/SConscript', variant_dir='build/src', duplicate=0)
-# arch building script
-objs = objs + SConscript(RTT_ROOT + '/libcpu/SConscript', variant_dir='build/libcpu', duplicate=0)
+# prepare building environment
+objs = PrepareBuilding(env, RTT_ROOT)
+
+if GetDepend('RT_USING_WEBSERVER'):
+ objs = objs + SConscript(RTT_ROOT + '/components/net/webserver/SConscript', variant_dir='build/net/webserver', duplicate=0)
-# component script
-Repository(RTT_ROOT)
-objs = objs + SConscript('components/SConscript')
+if GetDepend('RT_USING_RTGUI'):
+ objs = objs + SConscript(RTT_ROOT + '/examples/gui/SConscript', variant_dir='build/examples/gui', duplicate=0)
-# board build script
-objs = objs + SConscript('SConscript', variant_dir='build/bsp', duplicate=0)
+# libc testsuite
+# objs = objs + SConscript(RTT_ROOT + '/examples/libc/SConscript', variant_dir='build/examples/libc', duplicate=0)
-TARGET = target + '.' + rtconfig.TARGET_EXT
+# build program
env.Program(TARGET, objs)
-env.AddPostAction(TARGET, rtconfig.POST_ACTION)
-if GetOption('target') == 'mdk':
- mdk.MDKProject('project.uV2', projects)
+# end building
+EndBuilding(TARGET)
diff --git a/bsp/lpc176x/project.Uv2 b/bsp/lpc176x/project.Uv2
index a5a120d62e..357b1f99e0 100644
--- a/bsp/lpc176x/project.Uv2
+++ b/bsp/lpc176x/project.Uv2
@@ -3,124 +3,121 @@
Target (RT-Thread LPC17xx), 0x0004 // Tools: 'ARM-ADS'
+Group (Startup)
Group (Kernel)
Group (LPC17XX)
-Group (finsh)
Group (Filesystem)
+Group (finsh)
Group (LwIP)
-Group (Startup)
-File 1,1,<..\..\src\clock.c><clock.c>
-File 1,1,<..\..\src\device.c><device.c>
-File 1,1,<..\..\src\idle.c><idle.c>
-File 1,1,<..\..\src\ipc.c><ipc.c>
-File 1,1,<..\..\src\irq.c><irq.c>
-File 1,1,<..\..\src\kservice.c><kservice.c>
-File 1,1,<..\..\src\mem.c><mem.c>
-File 1,1,<..\..\src\mempool.c><mempool.c>
-File 1,1,<..\..\src\module.c><module.c>
-File 1,1,<..\..\src\object.c><object.c>
-File 1,1,<..\..\src\rtm.c><rtm.c>
-File 1,1,<..\..\src\scheduler.c><scheduler.c>
-File 1,1,<..\..\src\slab.c><slab.c>
-File 1,1,<..\..\src\thread.c><thread.c>
-File 1,1,<..\..\src\timer.c><timer.c>
-File 2,1,<..\..\libcpu\arm\lpc17xx\cpu.c><cpu.c>
-File 2,1,<..\..\libcpu\arm\lpc17xx\fault.c><fault.c>
-File 2,1,<..\..\libcpu\arm\lpc17xx\interrupt.c><interrupt.c>
-File 2,1,<..\..\libcpu\arm\lpc17xx\stack.c><stack.c>
-File 2,2,<..\..\libcpu\arm\lpc17xx\context_rvds.S><context_rvds.S>
-File 2,2,<..\..\libcpu\arm\lpc17xx\fault_rvds.S><fault_rvds.S>
-File 2,2,<..\..\libcpu\arm\lpc17xx\start_rvds.S><start_rvds.S>
-File 2,1,<..\..\libcpu\arm\common\backtrace.c><backtrace.c>
-File 2,1,<..\..\libcpu\arm\common\div0.c><div0.c>
-File 2,1,<..\..\libcpu\arm\common\showmem.c><showmem.c>
-File 3,1,<..\..\components\finsh\cmd.c><cmd.c>
-File 3,1,<..\..\components\finsh\finsh_compiler.c><finsh_compiler.c>
-File 3,1,<..\..\components\finsh\finsh_error.c><finsh_error.c>
-File 3,1,<..\..\components\finsh\finsh_heap.c><finsh_heap.c>
-File 3,1,<..\..\components\finsh\finsh_init.c><finsh_init.c>
-File 3,1,<..\..\components\finsh\finsh_node.c><finsh_node.c>
-File 3,1,<..\..\components\finsh\finsh_ops.c><finsh_ops.c>
-File 3,1,<..\..\components\finsh\finsh_parser.c><finsh_parser.c>
-File 3,1,<..\..\components\finsh\finsh_token.c><finsh_token.c>
-File 3,1,<..\..\components\finsh\finsh_var.c><finsh_var.c>
-File 3,1,<..\..\components\finsh\finsh_vm.c><finsh_vm.c>
-File 3,1,<..\..\components\finsh\shell.c><shell.c>
-File 3,1,<..\..\components\finsh\symbol.c><symbol.c>
+File 1,1,<.\application.c><application.c>
+File 1,1,<.\startup.c><startup.c>
+File 1,1,<.\board.c><board.c>
+File 1,1,<.\uart.c><uart.c>
+File 1,1,<.\led.c><led.c>
+File 1,1,<.\sd.c><sd.c>
+File 1,1,<.\spi.c><spi.c>
+File 1,1,<.\emac.c><emac.c>
+File 1,1,<CMSIS\CM3\CoreSupport\core_cm3.c><core_cm3.c>
+File 1,1,<CMSIS\CM3\DeviceSupport\NXP\LPC17xx\system_LPC17xx.c><system_LPC17xx.c>
+File 2,1,<..\..\src\clock.c><clock.c>
+File 2,1,<..\..\src\device.c><device.c>
+File 2,1,<..\..\src\idle.c><idle.c>
+File 2,1,<..\..\src\ipc.c><ipc.c>
+File 2,1,<..\..\src\irq.c><irq.c>
+File 2,1,<..\..\src\kservice.c><kservice.c>
+File 2,1,<..\..\src\mem.c><mem.c>
+File 2,1,<..\..\src\mempool.c><mempool.c>
+File 2,1,<..\..\src\module.c><module.c>
+File 2,1,<..\..\src\object.c><object.c>
+File 2,1,<..\..\src\rtm.c><rtm.c>
+File 2,1,<..\..\src\scheduler.c><scheduler.c>
+File 2,1,<..\..\src\slab.c><slab.c>
+File 2,1,<..\..\src\thread.c><thread.c>
+File 2,1,<..\..\src\timer.c><timer.c>
+File 3,1,<..\..\libcpu\arm\lpc17xx\cpu.c><cpu.c>
+File 3,1,<..\..\libcpu\arm\lpc17xx\fault.c><fault.c>
+File 3,1,<..\..\libcpu\arm\lpc17xx\interrupt.c><interrupt.c>
+File 3,1,<..\..\libcpu\arm\lpc17xx\stack.c><stack.c>
+File 3,2,<..\..\libcpu\arm\lpc17xx\context_rvds.S><context_rvds.S>
+File 3,2,<..\..\libcpu\arm\lpc17xx\fault_rvds.S><fault_rvds.S>
+File 3,2,<..\..\libcpu\arm\lpc17xx\start_rvds.S><start_rvds.S>
+File 3,1,<..\..\libcpu\arm\common\backtrace.c><backtrace.c>
+File 3,1,<..\..\libcpu\arm\common\div0.c><div0.c>
+File 3,1,<..\..\libcpu\arm\common\showmem.c><showmem.c>
+File 4,1,<..\..\components\dfs\src\dfs.c><dfs.c>
File 4,1,<..\..\components\dfs\src\dfs_fs.c><dfs_fs.c>
-File 4,1,<..\..\components\dfs\src\dfs_init.c><dfs_init.c>
+File 4,1,<..\..\components\dfs\src\dfs_file.c><dfs_file.c>
File 4,1,<..\..\components\dfs\src\dfs_posix.c><dfs_posix.c>
-File 4,1,<..\..\components\dfs\src\dfs_raw.c><dfs_raw.c>
-File 4,1,<..\..\components\dfs\src\dfs_util.c><dfs_util.c>
File 4,1,<..\..\components\dfs\filesystems\elmfat\dfs_elm.c><dfs_elm.c>
File 4,1,<..\..\components\dfs\filesystems\elmfat\ff.c><ff.c>
-File 5,1,<..\..\components\net\lwip\src\api\api_lib.c><api_lib.c>
-File 5,1,<..\..\components\net\lwip\src\api\api_msg.c><api_msg.c>
-File 5,1,<..\..\components\net\lwip\src\api\err.c><err.c>
-File 5,1,<..\..\components\net\lwip\src\api\netbuf.c><netbuf.c>
-File 5,1,<..\..\components\net\lwip\src\api\netdb.c><netdb.c>
-File 5,1,<..\..\components\net\lwip\src\api\netifapi.c><netifapi.c>
-File 5,1,<..\..\components\net\lwip\src\api\sockets.c><sockets.c>
-File 5,1,<..\..\components\net\lwip\src\api\tcpip.c><tcpip.c>
-File 5,1,<..\..\components\net\lwip\src\arch\sys_arch.c><sys_arch.c>
-File 5,1,<..\..\components\net\lwip\src\arch\sys_arch_init.c><sys_arch_init.c>
-File 5,1,<..\..\components\net\lwip\src\core\dhcp.c><dhcp.c>
-File 5,1,<..\..\components\net\lwip\src\core\dns.c><dns.c>
-File 5,1,<..\..\components\net\lwip\src\core\init.c><init.c>
-File 5,1,<..\..\components\net\lwip\src\core\memp.c><memp.c>
-File 5,1,<..\..\components\net\lwip\src\core\netif.c><netif.c>
-File 5,1,<..\..\components\net\lwip\src\core\pbuf.c><pbuf.c>
-File 5,1,<..\..\components\net\lwip\src\core\raw.c><raw.c>
-File 5,1,<..\..\components\net\lwip\src\core\stats.c><stats.c>
-File 5,1,<..\..\components\net\lwip\src\core\sys.c><sys.c>
-File 5,1,<..\..\components\net\lwip\src\core\tcp.c><tcp.c>
-File 5,1,<..\..\components\net\lwip\src\core\tcp_in.c><tcp_in.c>
-File 5,1,<..\..\components\net\lwip\src\core\tcp_out.c><tcp_out.c>
-File 5,1,<..\..\components\net\lwip\src\core\udp.c><udp.c>
-File 5,1,<..\..\components\net\lwip\src\core\ipv4\autoip.c><autoip.c>
-File 5,1,<..\..\components\net\lwip\src\core\ipv4\icmp.c><icmp.c>
-File 5,1,<..\..\components\net\lwip\src\core\ipv4\igmp.c><igmp.c>
-File 5,1,<..\..\components\net\lwip\src\core\ipv4\inet.c><inet.c>
-File 5,1,<..\..\components\net\lwip\src\core\ipv4\inet_chksum.c><inet_chksum.c>
-File 5,1,<..\..\components\net\lwip\src\core\ipv4\ip.c><ip.c>
-File 5,1,<..\..\components\net\lwip\src\core\ipv4\ip_addr.c><ip_addr.c>
-File 5,1,<..\..\components\net\lwip\src\core\ipv4\ip_frag.c><ip_frag.c>
-File 5,1,<..\..\components\net\lwip\src\core\snmp\asn1_dec.c><asn1_dec.c>
-File 5,1,<..\..\components\net\lwip\src\core\snmp\asn1_enc.c><asn1_enc.c>
-File 5,1,<..\..\components\net\lwip\src\core\snmp\mib2.c><mib2.c>
-File 5,1,<..\..\components\net\lwip\src\core\snmp\mib_structs.c><mib_structs.c>
-File 5,1,<..\..\components\net\lwip\src\core\snmp\msg_in.c><msg_in.c>
-File 5,1,<..\..\components\net\lwip\src\core\snmp\msg_out.c><msg_out.c>
-File 5,1,<..\..\components\net\lwip\src\netif\etharp.c><etharp.c>
-File 5,1,<..\..\components\net\lwip\src\netif\ethernetif.c><ethernetif.c>
-File 5,1,<..\..\components\net\lwip\src\netif\loopif.c><loopif.c>
-File 5,1,<..\..\components\net\lwip\src\netif\slipif.c><slipif.c>
-File 5,1,<..\..\components\net\lwip\src\netif\ppp\auth.c><auth.c>
-File 5,1,<..\..\components\net\lwip\src\netif\ppp\chap.c><chap.c>
-File 5,1,<..\..\components\net\lwip\src\netif\ppp\chpms.c><chpms.c>
-File 5,1,<..\..\components\net\lwip\src\netif\ppp\fsm.c><fsm.c>
-File 5,1,<..\..\components\net\lwip\src\netif\ppp\ipcp.c><ipcp.c>
-File 5,1,<..\..\components\net\lwip\src\netif\ppp\lcp.c><lcp.c>
-File 5,1,<..\..\components\net\lwip\src\netif\ppp\magic.c><magic.c>
-File 5,1,<..\..\components\net\lwip\src\netif\ppp\md5.c><md5.c>
-File 5,1,<..\..\components\net\lwip\src\netif\ppp\pap.c><pap.c>
-File 5,1,<..\..\components\net\lwip\src\netif\ppp\ppp.c><ppp.c>
-File 5,1,<..\..\components\net\lwip\src\netif\ppp\ppp_oe.c><ppp_oe.c>
-File 5,1,<..\..\components\net\lwip\src\netif\ppp\randm.c><randm.c>
-File 5,1,<..\..\components\net\lwip\src\netif\ppp\vj.c><vj.c>
-File 6,1,<.\application.c><application.c>
-File 6,1,<.\startup.c><startup.c>
-File 6,1,<.\board.c><board.c>
-File 6,1,<.\uart.c><uart.c>
-File 6,1,<.\led.c><led.c>
-File 6,1,<.\sd.c><sd.c>
-File 6,1,<.\spi.c><spi.c>
-File 6,1,<.\emac.c><emac.c>
-File 6,1,<CMSIS\CM3\CoreSupport\core_cm3.c><core_cm3.c>
-File 6,1,<CMSIS\CM3\DeviceSupport\NXP\LPC17xx\system_LPC17xx.c><system_LPC17xx.c>
-
-
+File 5,1,<..\..\components\finsh\cmd.c><cmd.c>
+File 5,1,<..\..\components\finsh\finsh_compiler.c><finsh_compiler.c>
+File 5,1,<..\..\components\finsh\finsh_error.c><finsh_error.c>
+File 5,1,<..\..\components\finsh\finsh_heap.c><finsh_heap.c>
+File 5,1,<..\..\components\finsh\finsh_init.c><finsh_init.c>
+File 5,1,<..\..\components\finsh\finsh_node.c><finsh_node.c>
+File 5,1,<..\..\components\finsh\finsh_ops.c><finsh_ops.c>
+File 5,1,<..\..\components\finsh\finsh_parser.c><finsh_parser.c>
+File 5,1,<..\..\components\finsh\finsh_token.c><finsh_token.c>
+File 5,1,<..\..\components\finsh\finsh_var.c><finsh_var.c>
+File 5,1,<..\..\components\finsh\finsh_vm.c><finsh_vm.c>
+File 5,1,<..\..\components\finsh\shell.c><shell.c>
+File 5,1,<..\..\components\finsh\symbol.c><symbol.c>
+File 6,1,<..\..\components\net\lwip\src\api\api_lib.c><api_lib.c>
+File 6,1,<..\..\components\net\lwip\src\api\api_msg.c><api_msg.c>
+File 6,1,<..\..\components\net\lwip\src\api\err.c><err.c>
+File 6,1,<..\..\components\net\lwip\src\api\netbuf.c><netbuf.c>
+File 6,1,<..\..\components\net\lwip\src\api\netdb.c><netdb.c>
+File 6,1,<..\..\components\net\lwip\src\api\netifapi.c><netifapi.c>
+File 6,1,<..\..\components\net\lwip\src\api\sockets.c><sockets.c>
+File 6,1,<..\..\components\net\lwip\src\api\tcpip.c><tcpip.c>
+File 6,1,<..\..\components\net\lwip\src\arch\sys_arch.c><sys_arch.c>
+File 6,1,<..\..\components\net\lwip\src\arch\sys_arch_init.c><sys_arch_init.c>
+File 6,1,<..\..\components\net\lwip\src\core\dhcp.c><dhcp.c>
+File 6,1,<..\..\components\net\lwip\src\core\dns.c><dns.c>
+File 6,1,<..\..\components\net\lwip\src\core\init.c><init.c>
+File 6,1,<..\..\components\net\lwip\src\core\memp.c><memp.c>
+File 6,1,<..\..\components\net\lwip\src\core\netif.c><netif.c>
+File 6,1,<..\..\components\net\lwip\src\core\pbuf.c><pbuf.c>
+File 6,1,<..\..\components\net\lwip\src\core\raw.c><raw.c>
+File 6,1,<..\..\components\net\lwip\src\core\stats.c><stats.c>
+File 6,1,<..\..\components\net\lwip\src\core\sys.c><sys.c>
+File 6,1,<..\..\components\net\lwip\src\core\tcp.c><tcp.c>
+File 6,1,<..\..\components\net\lwip\src\core\tcp_in.c><tcp_in.c>
+File 6,1,<..\..\components\net\lwip\src\core\tcp_out.c><tcp_out.c>
+File 6,1,<..\..\components\net\lwip\src\core\udp.c><udp.c>
+File 6,1,<..\..\components\net\lwip\src\core\ipv4\autoip.c><autoip.c>
+File 6,1,<..\..\components\net\lwip\src\core\ipv4\icmp.c><icmp.c>
+File 6,1,<..\..\components\net\lwip\src\core\ipv4\igmp.c><igmp.c>
+File 6,1,<..\..\components\net\lwip\src\core\ipv4\inet.c><inet.c>
+File 6,1,<..\..\components\net\lwip\src\core\ipv4\inet_chksum.c><inet_chksum.c>
+File 6,1,<..\..\components\net\lwip\src\core\ipv4\ip.c><ip.c>
+File 6,1,<..\..\components\net\lwip\src\core\ipv4\ip_addr.c><ip_addr.c>
+File 6,1,<..\..\components\net\lwip\src\core\ipv4\ip_frag.c><ip_frag.c>
+File 6,1,<..\..\components\net\lwip\src\core\snmp\asn1_dec.c><asn1_dec.c>
+File 6,1,<..\..\components\net\lwip\src\core\snmp\asn1_enc.c><asn1_enc.c>
+File 6,1,<..\..\components\net\lwip\src\core\snmp\mib2.c><mib2.c>
+File 6,1,<..\..\components\net\lwip\src\core\snmp\mib_structs.c><mib_structs.c>
+File 6,1,<..\..\components\net\lwip\src\core\snmp\msg_in.c><msg_in.c>
+File 6,1,<..\..\components\net\lwip\src\core\snmp\msg_out.c><msg_out.c>
+File 6,1,<..\..\components\net\lwip\src\netif\etharp.c><etharp.c>
+File 6,1,<..\..\components\net\lwip\src\netif\ethernetif.c><ethernetif.c>
+File 6,1,<..\..\components\net\lwip\src\netif\loopif.c><loopif.c>
+File 6,1,<..\..\components\net\lwip\src\netif\slipif.c><slipif.c>
+File 6,1,<..\..\components\net\lwip\src\netif\ppp\auth.c><auth.c>
+File 6,1,<..\..\components\net\lwip\src\netif\ppp\chap.c><chap.c>
+File 6,1,<..\..\components\net\lwip\src\netif\ppp\chpms.c><chpms.c>
+File 6,1,<..\..\components\net\lwip\src\netif\ppp\fsm.c><fsm.c>
+File 6,1,<..\..\components\net\lwip\src\netif\ppp\ipcp.c><ipcp.c>
+File 6,1,<..\..\components\net\lwip\src\netif\ppp\lcp.c><lcp.c>
+File 6,1,<..\..\components\net\lwip\src\netif\ppp\magic.c><magic.c>
+File 6,1,<..\..\components\net\lwip\src\netif\ppp\md5.c><md5.c>
+File 6,1,<..\..\components\net\lwip\src\netif\ppp\pap.c><pap.c>
+File 6,1,<..\..\components\net\lwip\src\netif\ppp\ppp.c><ppp.c>
+File 6,1,<..\..\components\net\lwip\src\netif\ppp\ppp_oe.c><ppp_oe.c>
+File 6,1,<..\..\components\net\lwip\src\netif\ppp\randm.c><randm.c>
+File 6,1,<..\..\components\net\lwip\src\netif\ppp\vj.c><vj.c>
Options 1,0,0 // Target 'RT-Thread LPC17xx'
@@ -181,7 +178,7 @@ Options 1,0,0 // Target 'RT-Thread LPC17xx'
ADSCMISC ()
ADSCDEFN ()
ADSCUDEF ()
- ADSCINCD (..\..\components\net\lwip\src\include\ipv4;..\..\components\dfs;CMSIS\CM3\DeviceSupport\NXP\LPC17xx;..\..\components\net\lwip\src\include;.;..\..\libcpu\arm\lpc17xx;..\..\include;..\..\components\net\lwip\src\arch\include;..\..\components\dfs\include;..\..\components\net\lwip\src;..\..\components\net\lwip\src\netif\ppp;CMSIS\CM3\CoreSupport;..\..\components\finsh;..\..\components\net\lwip\src\include\netif)
+ ADSCINCD (..\..\components\net\lwip\src\include\ipv4;..\..\components\dfs;CMSIS\CM3\DeviceSupport\NXP\LPC17xx;..\..\components\net\lwip\src\include;.;..\..\libcpu\arm\lpc17xx;..\..\include;..\..\components\net\lwip\src\arch\include;..\..\components\dfs\include;..\..\components\net\lwip\src;..\..\libcpu\arm\common;..\..\components\net\lwip\src\netif\ppp;CMSIS\CM3\CoreSupport;..\..\components\finsh;..\..\components\net\lwip\src\include\netif)
ADSASFLG { 1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 }
ADSAMISC ()
ADSADEFN ()
diff --git a/bsp/lpc176x/rtconfig.py b/bsp/lpc176x/rtconfig.py
index 1f0f0cea16..c99291f7a4 100644
--- a/bsp/lpc176x/rtconfig.py
+++ b/bsp/lpc176x/rtconfig.py
@@ -1,47 +1,3 @@
-import SCons.cpp
-
-# component options
-
-# make all component false
-RT_USING_FINSH = False
-RT_USING_DFS = False
-RT_USING_DFS_ELMFAT = False
-RT_USING_DFS_YAFFS2 = False
-RT_USING_LWIP = False
-RT_USING_WEBSERVER = False
-RT_USING_RTGUI = False
-
-# parse rtconfig.h to get used component
-PreProcessor = SCons.cpp.PreProcessor()
-f = file('rtconfig.h', 'r')
-contents = f.read()
-f.close()
-PreProcessor.process_contents(contents)
-rtconfig_ns = PreProcessor.cpp_namespace
-
-# finsh shell options
-if rtconfig_ns.has_key('RT_USING_FINSH'):
- RT_USING_FINSH = True
-
-# device virtual filesystem options
-if rtconfig_ns.has_key('RT_USING_DFS'):
- RT_USING_DFS = True
-
- if rtconfig_ns.has_key('RT_USING_DFS_ELMFAT'):
- RT_USING_DFS_ELMFAT = True
- if rtconfig_ns.has_key('RT_USING_DFS_YAFFS2'):
- RT_USING_DFS_YAFFS2 = True
-
-# lwip options
-if rtconfig_ns.has_key('RT_USING_LWIP'):
- RT_USING_LWIP = True
- if rtconfig_ns.has_key('RT_USING_WEBSERVER'):
- RT_USING_WEBSERVER = True
-
-# rtgui options
-if rtconfig_ns.has_key('RT_USING_RTGUI'):
- RT_USING_RTGUI = True
-
# toolchains options
ARCH='arm'
CPU='lpc17xx'
@@ -82,7 +38,6 @@ if PLATFORM == 'gcc':
else:
CFLAGS += ' -O2'
- RT_USING_MINILIBC = True
POST_ACTION = OBJCPY + ' -O binary $TARGET rtthread.bin\n' + SIZE + ' $TARGET \n'
elif PLATFORM == 'armcc':
@@ -109,7 +64,6 @@ elif PLATFORM == 'armcc':
else:
CFLAGS += ' -O2'
- RT_USING_MINILIBC = False
POST_ACTION = 'fromelf --bin $TARGET --output rtthread.bin \nfromelf -z $TARGET'
elif PLATFORM == 'iar':
diff --git a/bsp/mini2440/SConscript b/bsp/mini2440/SConscript
index bf611ca4cc..85e56d1fc0 100644
--- a/bsp/mini2440/SConscript
+++ b/bsp/mini2440/SConscript
@@ -1,32 +1,23 @@
-Import('env')
-Import('projects')
+import rtconfig
Import('RTT_ROOT')
-Import('rtconfig')
-
-# group definitions
-group = {}
-group['name'] = 'Startup'
-group['CCFLAGS'] = ''
-group['CPPPATH'] = [RTT_ROOT + '/bsp/mini2440']
-group['CPPDEFINES'] = []
-group['LINKFLAGS'] = ''
+from building import *
src_bsp = ['application.c', 'startup.c', 'board.c', 'calendar.c']
src_drv = ['console.c', 'led.c']
-if rtconfig.RT_USING_DFS:
+if GetDepend('RT_USING_DFS'):
src_drv += ['sdcard.c']
-if rtconfig.RT_USING_LWIP:
+if GetDepend('RT_USING_LWIP'):
src_drv += ['dm9000.c']
-if rtconfig.RT_USING_RTGUI:
+if GetDepend('RT_USING_RTGUI'):
src_drv += ['touch.c', 'key.c', 'calibration.c']
-if rtconfig.RT_USING_FTK:
+if GetDepend('RT_USING_FTK'):
src_drv += ['touch.c', 'key.c']
-if rtconfig.RT_USING_RTGUI:
+if GetDepend('RT_USING_RTGUI') or GetDepend('RT_USING_FTK'):
if rtconfig.RT_USING_LCD_TYPE == 'PNL_A70':
src_drv += ['lcd_a70.c']
elif rtconfig.RT_USING_LCD_TYPE == 'PNL_N35':
@@ -34,24 +25,8 @@ if rtconfig.RT_USING_RTGUI:
elif rtconfig.RT_USING_LCD_TYPE == 'PNL_T35':
src_drv += ['lcd_t35.c']
-if rtconfig.RT_USING_FTK:
- if rtconfig.RT_USING_LCD_TYPE == 'PNL_A70':
- src_drv += ['lcd_a70.c']
- elif rtconfig.RT_USING_LCD_TYPE == 'PNL_N35':
- src_drv += ['lcd_n35.c']
- elif rtconfig.RT_USING_LCD_TYPE == 'PNL_T35':
- src_drv += ['lcd_t35.c']
-
-group['src'] = File(src_bsp + src_drv)
-
-# 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'])
+src = File(src_bsp + src_drv)
+CPPPATH = [RTT_ROOT + '/bsp/mini2440']
+group = DefineGroup('Startup', src, depend = [''], CPPPATH = CPPPATH)
-Return('obj')
+Return('group')
diff --git a/bsp/mini2440/SConstruct b/bsp/mini2440/SConstruct
index 462e20a79e..75a0429dde 100644
--- a/bsp/mini2440/SConstruct
+++ b/bsp/mini2440/SConstruct
@@ -4,20 +4,9 @@ import rtconfig
RTT_ROOT = os.path.normpath(os.getcwd() + '/../..')
sys.path = sys.path + [os.path.join(RTT_ROOT, 'tools')]
-import mdk
+from building import *
-target = 'rtthread-mini2440'
-projects = []
-
-AddOption('--target',
- dest='target',
- type='string',
- help='set target project: mdk')
-
-if GetOption('target'):
- SetOption('no_exec', 1)
-
-TARGET = target + '.' + rtconfig.TARGET_EXT
+TARGET = 'rtthread-mini2440.' + rtconfig.TARGET_EXT
env = Environment(tools = ['mingw'],
AS = rtconfig.AS, ASFLAGS = rtconfig.AFLAGS,
@@ -26,61 +15,23 @@ env = Environment(tools = ['mingw'],
LINK = rtconfig.LINK, LINKFLAGS = rtconfig.LFLAGS)
env.PrependENVPath('PATH', rtconfig.EXEC_PATH)
-Export('env')
Export('RTT_ROOT')
Export('rtconfig')
-Export('projects')
-Export('TARGET')
-
-if env['PLATFORM'] == 'win32' and rtconfig.PLATFORM == 'gcc':
- import win32file
- import win32event
- import win32process
- import win32security
-
- def my_spawn(sh, escape, cmd, args, spawnenv):
- for var in spawnenv:
- spawnenv[var] = spawnenv[var].encode('ascii', 'replace')
-
- sAttrs = win32security.SECURITY_ATTRIBUTES()
- StartupInfo = win32process.STARTUPINFO()
- newargs = ' '.join(map(escape, args[1:]))
- cmdline = cmd + " " + newargs
-
- # check for any special operating system commands
- if cmd == 'del':
- for arg in args[1:]:
- win32file.DeleteFile(arg)
- exit_code = 0
- else:
- # otherwise execute the command.
- hProcess, hThread, dwPid, dwTid = win32process.CreateProcess(None, cmdline, None, None, 1, 0, spawnenv, None, StartupInfo)
- win32event.WaitForSingleObject(hProcess, win32event.INFINITE)
- exit_code = win32process.GetExitCodeProcess(hProcess)
- win32file.CloseHandle(hProcess);
- win32file.CloseHandle(hThread);
- return exit_code
-
- env['SPAWN'] = my_spawn
-
-objs = SConscript(RTT_ROOT + '/src/SConscript', variant_dir='build/src', duplicate=0)
-objs = objs + SConscript(RTT_ROOT + '/libcpu/SConscript', variant_dir='build/libcpu', duplicate=0)
-if rtconfig.RT_USING_WEBSERVER:
- objs = objs + SConscript(RTT_ROOT + '/components/net/webserver/SConscript', variant_dir='build/net/webserver', duplicate=0)
+# prepare building environment
+objs = PrepareBuilding(env, RTT_ROOT)
-if rtconfig.RT_USING_RTGUI:
- objs = objs + SConscript(RTT_ROOT + '/examples/gui/SConscript', variant_dir='build/examples/gui', duplicate=0)
+if GetDepend('RT_USING_WEBSERVER'):
+ objs = objs + SConscript(RTT_ROOT + '/components/net/webserver/SConscript', variant_dir='build/net/webserver', duplicate=0)
-# board build script
-objs = objs + SConscript('SConscript', variant_dir='build/bsp', duplicate=0)
+if GetDepend('RT_USING_RTGUI'):
+ objs = objs + SConscript(RTT_ROOT + '/examples/gui/SConscript', variant_dir='build/examples/gui', duplicate=0)
-# component script
-Repository(RTT_ROOT)
-objs = objs + SConscript('components/SConscript')
+# libc testsuite
+# objs = objs + SConscript(RTT_ROOT + '/examples/libc/SConscript', variant_dir='build/examples/libc', duplicate=0)
+# build program
env.Program(TARGET, objs)
-env.AddPostAction(TARGET, rtconfig.POST_ACTION)
-if GetOption('target') == 'mdk':
- mdk.MDKProject('project.uV2', projects)
+# end building
+EndBuilding(TARGET)
diff --git a/bsp/mini2440/rtconfig.py b/bsp/mini2440/rtconfig.py
index 90b8c8f6db..dce03130e1 100644
--- a/bsp/mini2440/rtconfig.py
+++ b/bsp/mini2440/rtconfig.py
@@ -1,77 +1,3 @@
-import SCons.cpp
-
-# component options
-
-# make all component false
-RT_USING_FINSH = False
-RT_USING_DFS = False
-RT_USING_DFS_ELMFAT = False
-RT_USING_DFS_YAFFS2 = False
-RT_USING_DFS_NFS = False
-RT_USING_DFS_ROMFS = False
-RT_USING_DFS_DEVFS = False
-RT_USING_LWIP = False
-RT_USING_WEBSERVER = False
-RT_USING_RTGUI = False
-RT_USING_MODBUS = False
-RT_USING_MODULE = False
-RT_USING_FTK = False
-RT_USING_NEWLIB = False
-RT_USING_PTHREAD = False
-
-# parse rtconfig.h to get used component
-PreProcessor = SCons.cpp.PreProcessor()
-f = file('rtconfig.h', 'r')
-contents = f.read()
-f.close()
-PreProcessor.process_contents(contents)
-rtconfig_ns = PreProcessor.cpp_namespace
-
-# libc options
-if rtconfig_ns.has_key('RT_USING_NEWLIB'):
- RT_USING_NEWLIB = True
-
-if rtconfig_ns.has_key('RT_USING_PTHREAD'):
- RT_USING_PTHREAD = True
-
-# finsh shell options
-if rtconfig_ns.has_key('RT_USING_FINSH'):
- RT_USING_FINSH = True
-
-# device virtual filesystem options
-if rtconfig_ns.has_key('RT_USING_DFS'):
- RT_USING_DFS = True
-
- if rtconfig_ns.has_key('RT_USING_DFS_ELMFAT'):
- RT_USING_DFS_ELMFAT = True
- if rtconfig_ns.has_key('RT_DFS_ELM_USE_LFN'):
- RT_DFS_ELM_USE_LFN = True
- if rtconfig_ns.has_key('RT_USING_DFS_YAFFS2'):
- RT_USING_DFS_YAFFS2 = True
- if rtconfig_ns.has_key('RT_USING_DFS_NFS'):
- RT_USING_DFS_NFS = True
- if rtconfig_ns.has_key('RT_USING_DFS_ROMFS'):
- RT_USING_DFS_ROMFS = True
- if rtconfig_ns.has_key('RT_USING_DFS_DEVFS'):
- RT_USING_DFS_DEVFS = True
-
-# lwip options
-if rtconfig_ns.has_key('RT_USING_LWIP'):
- RT_USING_LWIP = True
- if rtconfig_ns.has_key('RT_USING_WEBSERVER'):
- RT_USING_WEBSERVER = True
-
-# rtgui options
-if rtconfig_ns.has_key('RT_USING_RTGUI'):
- RT_USING_RTGUI = True
-
-if rtconfig_ns.has_key('RT_USING_FTK'):
- RT_USING_FTK = True
-
-# module options
-if rtconfig_ns.has_key('RT_USING_MODULE'):
- RT_USING_MODULE = True
-
# panel options
# 'PNL_A70','PNL_N35', 'PNL_T35'
RT_USING_LCD_TYPE = 'PNL_T35'
@@ -117,9 +43,6 @@ if PLATFORM == 'gcc':
else:
CFLAGS += ' -O2'
- if RT_USING_WEBSERVER:
- CFLAGS += ' -DWEBS -DUEMF -DRTT -D__NO_FCNTL=1 -DRT_USING_WEBSERVER'
-
POST_ACTION = OBJCPY + ' -O binary $TARGET rtthread.bin\n' + SIZE + ' $TARGET \n'
elif PLATFORM == 'armcc':
@@ -146,9 +69,6 @@ elif PLATFORM == 'armcc':
else:
CFLAGS += ' -O2'
- RT_USING_MINILIBC = False
- if RT_USING_WEBSERVER:
- CFLAGS += ' -DWEBS -DUEMF -DRTT -D__NO_FCNTL=1 -DRT_USING_WEBSERVER'
POST_ACTION = 'fromelf --bin $TARGET --output rtthread.bin \nfromelf -z $TARGET'
elif PLATFORM == 'iar':
diff --git a/bsp/stm3210/Libraries/SConscript b/bsp/stm3210/Libraries/SConscript
index 2fe127941d..73e242f71b 100644
--- a/bsp/stm3210/Libraries/SConscript
+++ b/bsp/stm3210/Libraries/SConscript
@@ -1,9 +1,9 @@
-Import('env')
+import rtconfig
Import('RTT_ROOT')
-Import('projects')
+from building import *
# The set of source files associated with this SConscript file.
-src_local = Split("""
+src = Split("""
CMSIS/Core/CM3/core_cm3.c
CMSIS/Core/CM3/system_stm32f10x.c
STM32F10x_StdPeriph_Driver/src/stm32f10x_crc.c
@@ -33,20 +33,7 @@ STM32F10x_StdPeriph_Driver/src/misc.c
path = [RTT_ROOT + '/bsp/stm3210/Libraries/STM32F10x_StdPeriph_Driver/inc',
RTT_ROOT + '/bsp/stm3210/Libraries/CMSIS/Core/CM3']
-# group definitions
-group = {}
-group['name'] = 'STM32_StdPeriph'
-group['CCFLAGS'] = ''
-group['CPPPATH'] = path
-group['CPPDEFINES'] = []
-group['LINKFLAGS'] = ''
-group['src'] = File(src_local)
+CPPDEFINES = ['USE_STDPERIPH_DRIVER', rtconfig.STM32_TYPE]
+group = DefineGroup('STM32_StdPeriph', src, depend = [''], CPPPATH = path)
-# add group to project list
-projects.append(group)
-
-env.Append(CPPPATH = path)
-
-obj = env.Object(src_local)
-
-Return('obj')
+Return('group')
diff --git a/bsp/stm3210/SConscript b/bsp/stm3210/SConscript
index 47f884cbe9..c96e2f9a80 100644
--- a/bsp/stm3210/SConscript
+++ b/bsp/stm3210/SConscript
@@ -1,41 +1,25 @@
-Import('env')
-Import('projects')
+import rtconfig
Import('RTT_ROOT')
-Import('rtconfig')
-
-# group definitions
-group = {}
-group['name'] = 'Startup'
-group['CCFLAGS'] = ''
-group['CPPPATH'] = [RTT_ROOT + '/bsp/stm3210']
-group['CPPDEFINES'] = ['USE_STDPERIPH_DRIVER', rtconfig.STM32_TYPE]
-group['LINKFLAGS'] = ''
+from building import *
src_bsp = ['application.c', 'startup.c', 'board.c', 'stm32f10x_it.c']
src_drv = ['rtc.c', 'usart.c', 'led.c']
-if rtconfig.RT_USING_DFS:
+if GetDepend('RT_USING_DFS'):
if rtconfig.STM32_TYPE == 'STM32F10X_HD':
src_drv += ['sdcard.c']
else:
src_drv += ['msd.c']
-if rtconfig.RT_USING_LWIP:
+if GetDepend('RT_USING_LWIP'):
if rtconfig.STM32_TYPE == 'STM32F10X_CL':
src_drv += ['stm32_eth.c']
else:
src_drv += ['enc28j60.c']
-group['src'] = File(src_bsp + src_drv)
-
-# 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'])
+src = src_bsp + src_drv
+CPPPATH = [RTT_ROOT + '/bsp/stm3210']
+CPPDEFINES = ['USE_STDPERIPH_DRIVER', rtconfig.STM32_TYPE]
+group = DefineGroup('Startup', src, depend = [''], CPPPATH = CPPPATH, CPPDEFINES = CPPDEFINES)
-Return('obj')
+Return('group')
diff --git a/bsp/stm3210/SConstruct b/bsp/stm3210/SConstruct
index 38e0bed6d0..3ba4a0249d 100644
--- a/bsp/stm3210/SConstruct
+++ b/bsp/stm3210/SConstruct
@@ -4,18 +4,9 @@ import rtconfig
RTT_ROOT = os.path.normpath(os.getcwd() + '/../..')
sys.path = sys.path + [os.path.join(RTT_ROOT, 'tools')]
-import mdk
+from building import *
-target = 'rtthread-stm32'
-projects = []
-
-AddOption('--target',
- dest='target',
- type='string',
- help='set target project: mdk')
-
-if GetOption('target'):
- SetOption('no_exec', 1)
+TARGET = 'rtthread-stm32.' + rtconfig.TARGET_EXT
env = Environment(tools = ['mingw'],
AS = rtconfig.AS, ASFLAGS = rtconfig.AFLAGS,
@@ -24,28 +15,17 @@ env = Environment(tools = ['mingw'],
LINK = rtconfig.LINK, LINKFLAGS = rtconfig.LFLAGS)
env.PrependENVPath('PATH', rtconfig.EXEC_PATH)
-Export('env')
Export('RTT_ROOT')
Export('rtconfig')
-Export('projects')
-# kernel building script
-objs = SConscript(RTT_ROOT + '/src/SConscript', variant_dir='build/src', duplicate=0)
-# arch building script
-objs = objs + SConscript(RTT_ROOT + '/libcpu/SConscript', variant_dir='build/libcpu', duplicate=0)
-# STM32 firemare library building script
-objs = objs + SConscript(RTT_ROOT + '/bsp/stm3210/Libraries/SConscript', variant_dir='build/Libraries', duplicate=0)
+# prepare building environment
+objs = PrepareBuilding(env, RTT_ROOT)
-# component script
-Repository(RTT_ROOT)
-objs = objs + SConscript('components/SConscript')
-
-# board build script
-objs = objs + SConscript('SConscript', variant_dir='build/bsp', duplicate=0)
+# STM32 firemare library building script
+objs = objs + SConscript(RTT_ROOT + '/bsp/stm3210/Libraries/SConscript', variant_dir='bsp/Libraries', duplicate=0)
-TARGET = target + '.' + rtconfig.TARGET_EXT
+# build program
env.Program(TARGET, objs)
-env.AddPostAction(TARGET, rtconfig.POST_ACTION)
-if GetOption('target') == 'mdk':
- mdk.MDKProject('project.Uv2', projects)
+# end building
+EndBuilding(TARGET)
diff --git a/bsp/stm3210/project.Uv2 b/bsp/stm3210/project.Uv2
index 698018cefb..292e2e263e 100644
--- a/bsp/stm3210/project.Uv2
+++ b/bsp/stm3210/project.Uv2
@@ -3,83 +3,68 @@
Target (RT-Thread STM32), 0x0004 // Tools: 'ARM-ADS'
+Group (Startup)
Group (Kernel)
Group (STM32)
-Group (STM32_StdPeriph)
-Group (finsh)
Group (Filesystem)
+Group (finsh)
Group (LwIP)
-Group (Startup)
+Group (STM32_StdPeriph)
-File 1,1,<..\..\src\clock.c><clock.c>
-File 1,1,<..\..\src\device.c><device.c>
-File 1,1,<..\..\src\idle.c><idle.c>
-File 1,1,<..\..\src\ipc.c><ipc.c>
-File 1,1,<..\..\src\irq.c><irq.c>
-File 1,1,<..\..\src\kservice.c><kservice.c>
-File 1,1,<..\..\src\mem.c><mem.c>
-File 1,1,<..\..\src\mempool.c><mempool.c>
-File 1,1,<..\..\src\module.c><module.c>
-File 1,1,<..\..\src\object.c><object.c>
-File 1,1,<..\..\src\rtm.c><rtm.c>
-File 1,1,<..\..\src\scheduler.c><scheduler.c>
-File 1,1,<..\..\src\slab.c><slab.c>
-File 1,1,<..\..\src\thread.c><thread.c>
-File 1,1,<..\..\src\timer.c><timer.c>
-File 2,1,<..\..\libcpu\arm\stm32\cpu.c><cpu.c>
-File 2,1,<..\..\libcpu\arm\stm32\fault.c><fault.c>
-File 2,1,<..\..\libcpu\arm\stm32\interrupt.c><interrupt.c>
-File 2,1,<..\..\libcpu\arm\stm32\serial.c><serial.c>
-File 2,1,<..\..\libcpu\arm\stm32\stack.c><stack.c>
-File 2,2,<..\..\libcpu\arm\stm32\context_rvds.S><context_rvds.S>
-File 2,2,<..\..\libcpu\arm\stm32\fault_rvds.S><fault_rvds.S>
-File 2,2,<..\..\libcpu\arm\stm32\start_rvds.S><start_rvds.S>
-File 2,1,<..\..\libcpu\arm\common\backtrace.c><backtrace.c>
-File 2,1,<..\..\libcpu\arm\common\div0.c><div0.c>
-File 2,1,<..\..\libcpu\arm\common\showmem.c><showmem.c>
-File 3,1,<Libraries\CMSIS\Core\CM3\core_cm3.c><core_cm3.c>
-File 3,1,<Libraries\CMSIS\Core\CM3\system_stm32f10x.c><system_stm32f10x.c>
-File 3,1,<Libraries\STM32F10x_StdPeriph_Driver\src\stm32f10x_crc.c><stm32f10x_crc.c>
-File 3,1,<Libraries\STM32F10x_StdPeriph_Driver\src\stm32f10x_rcc.c><stm32f10x_rcc.c>
-File 3,1,<Libraries\STM32F10x_StdPeriph_Driver\src\stm32f10x_wwdg.c><stm32f10x_wwdg.c>
-File 3,1,<Libraries\STM32F10x_StdPeriph_Driver\src\stm32f10x_pwr.c><stm32f10x_pwr.c>
-File 3,1,<Libraries\STM32F10x_StdPeriph_Driver\src\stm32f10x_exti.c><stm32f10x_exti.c>
-File 3,1,<Libraries\STM32F10x_StdPeriph_Driver\src\stm32f10x_bkp.c><stm32f10x_bkp.c>
-File 3,1,<Libraries\STM32F10x_StdPeriph_Driver\src\stm32f10x_i2c.c><stm32f10x_i2c.c>
-File 3,1,<Libraries\STM32F10x_StdPeriph_Driver\src\stm32f10x_adc.c><stm32f10x_adc.c>
-File 3,1,<Libraries\STM32F10x_StdPeriph_Driver\src\stm32f10x_dac.c><stm32f10x_dac.c>
-File 3,1,<Libraries\STM32F10x_StdPeriph_Driver\src\stm32f10x_rtc.c><stm32f10x_rtc.c>
-File 3,1,<Libraries\STM32F10x_StdPeriph_Driver\src\stm32f10x_fsmc.c><stm32f10x_fsmc.c>
-File 3,1,<Libraries\STM32F10x_StdPeriph_Driver\src\stm32f10x_tim.c><stm32f10x_tim.c>
-File 3,1,<Libraries\STM32F10x_StdPeriph_Driver\src\stm32f10x_iwdg.c><stm32f10x_iwdg.c>
-File 3,1,<Libraries\STM32F10x_StdPeriph_Driver\src\stm32f10x_spi.c><stm32f10x_spi.c>
-File 3,1,<Libraries\STM32F10x_StdPeriph_Driver\src\stm32f10x_flash.c><stm32f10x_flash.c>
-File 3,1,<Libraries\STM32F10x_StdPeriph_Driver\src\stm32f10x_sdio.c><stm32f10x_sdio.c>
-File 3,1,<Libraries\STM32F10x_StdPeriph_Driver\src\stm32f10x_gpio.c><stm32f10x_gpio.c>
-File 3,1,<Libraries\STM32F10x_StdPeriph_Driver\src\stm32f10x_usart.c><stm32f10x_usart.c>
-File 3,1,<Libraries\STM32F10x_StdPeriph_Driver\src\stm32f10x_dbgmcu.c><stm32f10x_dbgmcu.c>
-File 3,1,<Libraries\STM32F10x_StdPeriph_Driver\src\stm32f10x_dma.c><stm32f10x_dma.c>
-File 3,1,<Libraries\STM32F10x_StdPeriph_Driver\src\stm32f10x_can.c><stm32f10x_can.c>
-File 3,1,<Libraries\STM32F10x_StdPeriph_Driver\src\misc.c><misc.c>
-File 4,1,<..\..\components\finsh\cmd.c><cmd.c>
-File 4,1,<..\..\components\finsh\finsh_compiler.c><finsh_compiler.c>
-File 4,1,<..\..\components\finsh\finsh_error.c><finsh_error.c>
-File 4,1,<..\..\components\finsh\finsh_heap.c><finsh_heap.c>
-File 4,1,<..\..\components\finsh\finsh_init.c><finsh_init.c>
-File 4,1,<..\..\components\finsh\finsh_node.c><finsh_node.c>
-File 4,1,<..\..\components\finsh\finsh_ops.c><finsh_ops.c>
-File 4,1,<..\..\components\finsh\finsh_parser.c><finsh_parser.c>
-File 4,1,<..\..\components\finsh\finsh_token.c><finsh_token.c>
-File 4,1,<..\..\components\finsh\finsh_var.c><finsh_var.c>
-File 4,1,<..\..\components\finsh\finsh_vm.c><finsh_vm.c>
-File 4,1,<..\..\components\finsh\shell.c><shell.c>
-File 4,1,<..\..\components\finsh\symbol.c><symbol.c>
-File 5,1,<..\..\components\dfs\src\dfs.c><dfs.c>
-File 5,1,<..\..\components\dfs\src\dfs_fs.c><dfs_fs.c>
-File 5,1,<..\..\components\dfs\src\dfs_file.c><dfs_file.c>
-File 5,1,<..\..\components\dfs\src\dfs_posix.c><dfs_posix.c>
-File 5,1,<..\..\components\dfs\filesystems\elmfat\dfs_elm.c><dfs_elm.c>
-File 5,1,<..\..\components\dfs\filesystems\elmfat\ff.c><ff.c>
+File 1,1,<.\application.c><application.c>
+File 1,1,<.\startup.c><startup.c>
+File 1,1,<.\board.c><board.c>
+File 1,1,<.\stm32f10x_it.c><stm32f10x_it.c>
+File 1,1,<.\rtc.c><rtc.c>
+File 1,1,<.\usart.c><usart.c>
+File 1,1,<.\led.c><led.c>
+File 1,1,<.\sdcard.c><sdcard.c>
+File 1,1,<.\enc28j60.c><enc28j60.c>
+File 2,1,<..\..\src\clock.c><clock.c>
+File 2,1,<..\..\src\device.c><device.c>
+File 2,1,<..\..\src\idle.c><idle.c>
+File 2,1,<..\..\src\ipc.c><ipc.c>
+File 2,1,<..\..\src\irq.c><irq.c>
+File 2,1,<..\..\src\kservice.c><kservice.c>
+File 2,1,<..\..\src\mem.c><mem.c>
+File 2,1,<..\..\src\mempool.c><mempool.c>
+File 2,1,<..\..\src\module.c><module.c>
+File 2,1,<..\..\src\object.c><object.c>
+File 2,1,<..\..\src\rtm.c><rtm.c>
+File 2,1,<..\..\src\scheduler.c><scheduler.c>
+File 2,1,<..\..\src\slab.c><slab.c>
+File 2,1,<..\..\src\thread.c><thread.c>
+File 2,1,<..\..\src\timer.c><timer.c>
+File 3,1,<..\..\libcpu\arm\stm32\cpu.c><cpu.c>
+File 3,1,<..\..\libcpu\arm\stm32\fault.c><fault.c>
+File 3,1,<..\..\libcpu\arm\stm32\interrupt.c><interrupt.c>
+File 3,1,<..\..\libcpu\arm\stm32\serial.c><serial.c>
+File 3,1,<..\..\libcpu\arm\stm32\stack.c><stack.c>
+File 3,2,<..\..\libcpu\arm\stm32\context_rvds.S><context_rvds.S>
+File 3,2,<..\..\libcpu\arm\stm32\fault_rvds.S><fault_rvds.S>
+File 3,2,<..\..\libcpu\arm\stm32\start_rvds.S><start_rvds.S>
+File 3,1,<..\..\libcpu\arm\common\backtrace.c><backtrace.c>
+File 3,1,<..\..\libcpu\arm\common\div0.c><div0.c>
+File 3,1,<..\..\libcpu\arm\common\showmem.c><showmem.c>
+File 4,1,<..\..\components\dfs\src\dfs.c><dfs.c>
+File 4,1,<..\..\components\dfs\src\dfs_fs.c><dfs_fs.c>
+File 4,1,<..\..\components\dfs\src\dfs_file.c><dfs_file.c>
+File 4,1,<..\..\components\dfs\src\dfs_posix.c><dfs_posix.c>
+File 4,1,<..\..\components\dfs\filesystems\elmfat\dfs_elm.c><dfs_elm.c>
+File 4,1,<..\..\components\dfs\filesystems\elmfat\ff.c><ff.c>
+File 5,1,<..\..\components\finsh\cmd.c><cmd.c>
+File 5,1,<..\..\components\finsh\finsh_compiler.c><finsh_compiler.c>
+File 5,1,<..\..\components\finsh\finsh_error.c><finsh_error.c>
+File 5,1,<..\..\components\finsh\finsh_heap.c><finsh_heap.c>
+File 5,1,<..\..\components\finsh\finsh_init.c><finsh_init.c>
+File 5,1,<..\..\components\finsh\finsh_node.c><finsh_node.c>
+File 5,1,<..\..\components\finsh\finsh_ops.c><finsh_ops.c>
+File 5,1,<..\..\components\finsh\finsh_parser.c><finsh_parser.c>
+File 5,1,<..\..\components\finsh\finsh_token.c><finsh_token.c>
+File 5,1,<..\..\components\finsh\finsh_var.c><finsh_var.c>
+File 5,1,<..\..\components\finsh\finsh_vm.c><finsh_vm.c>
+File 5,1,<..\..\components\finsh\shell.c><shell.c>
+File 5,1,<..\..\components\finsh\symbol.c><symbol.c>
File 6,1,<..\..\components\net\lwip\src\api\api_lib.c><api_lib.c>
File 6,1,<..\..\components\net\lwip\src\api\api_msg.c><api_msg.c>
File 6,1,<..\..\components\net\lwip\src\api\err.c><err.c>
@@ -134,17 +119,30 @@ File 6,1,<..\..\components\net\lwip\src\netif\ppp\ppp.c><ppp.c>
File 6,1,<..\..\components\net\lwip\src\netif\ppp\ppp_oe.c><ppp_oe.c>
File 6,1,<..\..\components\net\lwip\src\netif\ppp\randm.c><randm.c>
File 6,1,<..\..\components\net\lwip\src\netif\ppp\vj.c><vj.c>
-File 7,1,<.\application.c><application.c>
-File 7,1,<.\startup.c><startup.c>
-File 7,1,<.\board.c><board.c>
-File 7,1,<.\stm32f10x_it.c><stm32f10x_it.c>
-File 7,1,<.\rtc.c><rtc.c>
-File 7,1,<.\usart.c><usart.c>
-File 7,1,<.\led.c><led.c>
-File 7,1,<.\sdcard.c><sdcard.c>
-File 7,1,<.\enc28j60.c><enc28j60.c>
-
-
+File 7,1,<Libraries\CMSIS\Core\CM3\core_cm3.c><core_cm3.c>
+File 7,1,<Libraries\CMSIS\Core\CM3\system_stm32f10x.c><system_stm32f10x.c>
+File 7,1,<Libraries\STM32F10x_StdPeriph_Driver\src\stm32f10x_crc.c><stm32f10x_crc.c>
+File 7,1,<Libraries\STM32F10x_StdPeriph_Driver\src\stm32f10x_rcc.c><stm32f10x_rcc.c>
+File 7,1,<Libraries\STM32F10x_StdPeriph_Driver\src\stm32f10x_wwdg.c><stm32f10x_wwdg.c>
+File 7,1,<Libraries\STM32F10x_StdPeriph_Driver\src\stm32f10x_pwr.c><stm32f10x_pwr.c>
+File 7,1,<Libraries\STM32F10x_StdPeriph_Driver\src\stm32f10x_exti.c><stm32f10x_exti.c>
+File 7,1,<Libraries\STM32F10x_StdPeriph_Driver\src\stm32f10x_bkp.c><stm32f10x_bkp.c>
+File 7,1,<Libraries\STM32F10x_StdPeriph_Driver\src\stm32f10x_i2c.c><stm32f10x_i2c.c>
+File 7,1,<Libraries\STM32F10x_StdPeriph_Driver\src\stm32f10x_adc.c><stm32f10x_adc.c>
+File 7,1,<Libraries\STM32F10x_StdPeriph_Driver\src\stm32f10x_dac.c><stm32f10x_dac.c>
+File 7,1,<Libraries\STM32F10x_StdPeriph_Driver\src\stm32f10x_rtc.c><stm32f10x_rtc.c>
+File 7,1,<Libraries\STM32F10x_StdPeriph_Driver\src\stm32f10x_fsmc.c><stm32f10x_fsmc.c>
+File 7,1,<Libraries\STM32F10x_StdPeriph_Driver\src\stm32f10x_tim.c><stm32f10x_tim.c>
+File 7,1,<Libraries\STM32F10x_StdPeriph_Driver\src\stm32f10x_iwdg.c><stm32f10x_iwdg.c>
+File 7,1,<Libraries\STM32F10x_StdPeriph_Driver\src\stm32f10x_spi.c><stm32f10x_spi.c>
+File 7,1,<Libraries\STM32F10x_StdPeriph_Driver\src\stm32f10x_flash.c><stm32f10x_flash.c>
+File 7,1,<Libraries\STM32F10x_StdPeriph_Driver\src\stm32f10x_sdio.c><stm32f10x_sdio.c>
+File 7,1,<Libraries\STM32F10x_StdPeriph_Driver\src\stm32f10x_gpio.c><stm32f10x_gpio.c>
+File 7,1,<Libraries\STM32F10x_StdPeriph_Driver\src\stm32f10x_usart.c><stm32f10x_usart.c>
+File 7,1,<Libraries\STM32F10x_StdPeriph_Driver\src\stm32f10x_dbgmcu.c><stm32f10x_dbgmcu.c>
+File 7,1,<Libraries\STM32F10x_StdPeriph_Driver\src\stm32f10x_dma.c><stm32f10x_dma.c>
+File 7,1,<Libraries\STM32F10x_StdPeriph_Driver\src\stm32f10x_can.c><stm32f10x_can.c>
+File 7,1,<Libraries\STM32F10x_StdPeriph_Driver\src\misc.c><misc.c>
Options 1,0,0 // Target 'RT-Thread STM32'
@@ -205,7 +203,7 @@ Options 1,0,0 // Target 'RT-Thread STM32'
ADSCMISC ()
ADSCDEFN (STM32F10X_HD, USE_STDPERIPH_DRIVER)
ADSCUDEF ()
- ADSCINCD (Libraries\CMSIS\Core\CM3;Libraries\STM32F10x_StdPeriph_Driver\inc;..\..\components\dfs;..\..\components\finsh;..\..\components\net\lwip\src\include;.;..\..\components\net\lwip\src\include\ipv4;..\..\include;..\..\components\net\lwip\src\arch\include;..\..\components\dfs\include;..\..\components\net\lwip\src;..\..\components\net\lwip\src\netif\ppp;..\..\libcpu\arm\stm32;..\..\components\net\lwip\src\include\netif)
+ ADSCINCD (Libraries\CMSIS\Core\CM3;Libraries\STM32F10x_StdPeriph_Driver\inc;..\..\components\dfs;..\..\components\finsh;..\..\components\net\lwip\src\include;.;..\..\components\net\lwip\src\include\ipv4;..\..\include;..\..\components\net\lwip\src\arch\include;..\..\components\dfs\include;..\..\components\net\lwip\src;..\..\libcpu\arm\common;..\..\components\net\lwip\src\netif\ppp;..\..\libcpu\arm\stm32;..\..\components\net\lwip\src\include\netif)
ADSASFLG { 1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 }
ADSAMISC ()
ADSADEFN ()
diff --git a/bsp/stm3210/rtconfig.py b/bsp/stm3210/rtconfig.py
index 5887d97ca9..4050e7074c 100644
--- a/bsp/stm3210/rtconfig.py
+++ b/bsp/stm3210/rtconfig.py
@@ -1,47 +1,3 @@
-import SCons.cpp
-
-# component options
-
-# make all component false
-RT_USING_FINSH = False
-RT_USING_DFS = False
-RT_USING_DFS_ELMFAT = False
-RT_USING_DFS_YAFFS2 = False
-RT_USING_LWIP = False
-RT_USING_WEBSERVER = False
-RT_USING_RTGUI = False
-
-# parse rtconfig.h to get used component
-PreProcessor = SCons.cpp.PreProcessor()
-f = file('rtconfig.h', 'r')
-contents = f.read()
-f.close()
-PreProcessor.process_contents(contents)
-rtconfig_ns = PreProcessor.cpp_namespace
-
-# finsh shell options
-if rtconfig_ns.has_key('RT_USING_FINSH'):
- RT_USING_FINSH = True
-
-# device virtual filesystem options
-if rtconfig_ns.has_key('RT_USING_DFS'):
- RT_USING_DFS = True
-
- if rtconfig_ns.has_key('RT_USING_DFS_ELMFAT'):
- RT_USING_DFS_ELMFAT = True
- if rtconfig_ns.has_key('RT_USING_DFS_YAFFS2'):
- RT_USING_DFS_YAFFS2 = True
-
-# lwip options
-if rtconfig_ns.has_key('RT_USING_LWIP'):
- RT_USING_LWIP = True
- if rtconfig_ns.has_key('RT_USING_WEBSERVER'):
- RT_USING_WEBSERVER = True
-
-# rtgui options
-if rtconfig_ns.has_key('RT_USING_RTGUI'):
- RT_USING_RTGUI = True
-
# toolchains options
ARCH='arm'
CPU='stm32'
@@ -83,7 +39,6 @@ if PLATFORM == 'gcc':
else:
CFLAGS += ' -O2'
- RT_USING_MINILIBC = True
POST_ACTION = OBJCPY + ' -O binary $TARGET rtthread.bin\n' + SIZE + ' $TARGET \n'
elif PLATFORM == 'armcc':
@@ -110,7 +65,6 @@ elif PLATFORM == 'armcc':
else:
CFLAGS += ' -O2'
- RT_USING_MINILIBC = False
POST_ACTION = 'fromelf --bin $TARGET --output rtthread.bin \nfromelf -z $TARGET'
elif PLATFORM == 'iar':
@@ -128,5 +82,4 @@ elif PLATFORM == 'iar':
LFLAGS = ' --config stm32f10x_flash.icf'
EXEC_PATH += '/arm/bin/'
- RT_USING_MINILIBC = False
POST_ACTION = ''
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')
diff --git a/examples/gui/SConscript b/examples/gui/SConscript
index babecec5b7..39c967123d 100644
--- a/examples/gui/SConscript
+++ b/examples/gui/SConscript
@@ -1,5 +1,4 @@
-Import('env')
-Import('projects')
+from building import *
src = Split("""
demo_view_dc_buffer.c
@@ -32,22 +31,6 @@ gui_init.c
mywidget.c
""")
-group = {}
-group['name'] = 'GUI demo'
-group['src'] = File(src)
-group['CCFLAGS'] = ''
-group['CPPPATH'] = ['']
-group['CPPDEFINES'] = ''
-group['LINKFLAGS'] = ''
+group = DefineGroup('gui_examples', src, depend = ['RTGUI_USING_EXAMPLES'])
-# 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/examples/kernel/SConscript b/examples/kernel/SConscript
index 7ecb22c991..3e620ae8c1 100644
--- a/examples/kernel/SConscript
+++ b/examples/kernel/SConscript
@@ -1,6 +1,6 @@
-Import('env')
+from building import *
-src_local = Split("""
+src = Split("""
tc_comm.c
thread_static.c
thread_dynamic.c
@@ -32,8 +32,6 @@ heap_realloc.c
memp_simple.c
""")
-# The set of source files associated with this SConscript file.
-obj = env.Object(src_local)
-env.Append(CPPDEFINES='RT_USING_TC')
+group = DefineGroup('examples', src, depend = ['RT_USING_TC'])
-Return('obj')
+Return('group')
diff --git a/examples/libc/SConscript b/examples/libc/SConscript
index af43df3ddb..6112f8b3c0 100644
--- a/examples/libc/SConscript
+++ b/examples/libc/SConscript
@@ -1,8 +1,6 @@
-Import('env')
+from building import *
-src_local = Glob('*.c')
+src = Glob('*.c')
+group = DefineGroup('libc_test', src, depend = ['RT_USING_NEWLIB', 'RT_USING_PTHREADS', 'RT_USING_LIBC_TEST'])
-# The set of source files associated with this SConscript file.
-obj = env.Object(src_local)
-
-Return('obj')
+Return('group')
diff --git a/libcpu/SConscript b/libcpu/SConscript
index bd854aa5f7..9b5d30e046 100644
--- a/libcpu/SConscript
+++ b/libcpu/SConscript
@@ -1,34 +1,21 @@
-Import('env')
-Import('rtconfig')
Import('RTT_ROOT')
-Import('projects')
+Import('rtconfig')
+from building import *
comm = rtconfig.ARCH + '/common'
path = rtconfig.ARCH + '/' + rtconfig.CPU
# The set of source files associated with this SConscript file.
if rtconfig.PLATFORM == 'armcc':
- src_local = Glob(path + '/*.c') + Glob(path + '/*_rvds.S') + Glob(comm + '/*.c')
+ src = Glob(path + '/*.c') + Glob(path + '/*_rvds.S') + Glob(comm + '/*.c')
if rtconfig.PLATFORM == 'gcc':
- src_local = Glob(path + '/*.c') + Glob(path + '/*_gcc.S') + Glob(comm + '/*.c') + Glob(path + '/*_init.S')
+ src = Glob(path + '/*.c') + Glob(path + '/*_gcc.S') + Glob(comm + '/*.c') + Glob(path + '/*_init.S')
if rtconfig.PLATFORM == 'iar':
- src_local = Glob(path + '/*.c') + Glob(path + '/*_iar.S') + Glob(comm + '/*.c')
-
-# group definitions
-group = {}
-group['name'] = rtconfig.CPU.upper()
-group['src'] = File(src_local)
-group['CCFLAGS'] = ''
-group['CPPPATH'] = [RTT_ROOT + '/libcpu/' + rtconfig.ARCH + '/' + rtconfig.CPU, RTT_ROOT + '/libcpu/' + rtconfig.ARCH + '/common']
-group['CPPDEFINES'] = ''
-group['LINKFLAGS'] = ''
-
-# add group to project list
-projects.append(group)
+ src = Glob(path + '/*.c') + Glob(path + '/*_iar.S') + Glob(comm + '/*.c')
-env.Append(CPPPATH = group['CPPPATH'])
-obj = env.Object(group['src'])
+CPPPATH = [RTT_ROOT + '/libcpu/' + rtconfig.ARCH + '/' + rtconfig.CPU, RTT_ROOT + '/libcpu/' + rtconfig.ARCH + '/common']
+group = DefineGroup(rtconfig.CPU.upper(), src, depend = [''], CPPPATH = CPPPATH)
-Return('obj')
+Return('group')
diff --git a/src/SConscript b/src/SConscript
index bff1aef271..c9ae828f9c 100644
--- a/src/SConscript
+++ b/src/SConscript
@@ -1,23 +1,8 @@
-Import('env')
Import('RTT_ROOT')
-Import('projects')
+from building import *
-# The set of source files associated with this SConscript file.
-src_local = Glob('*.c')
+src = Glob('*.c')
+CPPPATH = [RTT_ROOT + '/include']
+group = DefineGroup('Kernel', src, depend = [''], CPPPATH = CPPPATH)
-# group definitions
-group = {}
-group['name'] = 'Kernel'
-group['src'] = File(src_local)
-group['CCFLAGS'] = ''
-group['CPPPATH'] = [RTT_ROOT + '/include']
-group['CPPDEFINES'] = ''
-group['LINKFLAGS'] = ''
-
-# add group to project list
-projects.append(group)
-
-env.Append(CPPPATH = group['CPPPATH'])
-obj = env.Object(group['src'])
-
-Return('obj')
+Return('group')
diff --git a/src/ipc.c b/src/ipc.c
index 15a2f99b2f..a8cdb42e85 100644
--- a/src/ipc.c
+++ b/src/ipc.c
@@ -453,7 +453,11 @@ rt_err_t rt_sem_control(rt_sem_t sem, rt_uint8_t cmd, void* arg)
RT_ASSERT(sem != RT_NULL);
if (cmd == RT_IPC_CMD_RESET)
- {
+ {
+ rt_uint32_t value;
+
+ /* get value */
+ value = (rt_uint32_t)arg;
/* disable interrupt */
level = rt_hw_interrupt_disable();
@@ -461,7 +465,7 @@ rt_err_t rt_sem_control(rt_sem_t sem, rt_uint8_t cmd, void* arg)
rt_ipc_object_resume_all(&sem->parent);
/* set new value */
- sem->value = (rt_uint16_t)arg;
+ sem->value = (rt_uint16_t)value;
/* enable interrupt */
rt_hw_interrupt_enable(level);
diff --git a/tools/building.py b/tools/building.py
new file mode 100644
index 0000000000..cb05ba0b69
--- /dev/null
+++ b/tools/building.py
@@ -0,0 +1,334 @@
+import os
+import string
+from SCons.Script import *
+
+BuildOptions = {}
+Projects = []
+Rtt_Root = ''
+Env = None
+
+def _get_filetype(fn):
+ if fn.rfind('.c') != -1 or fn.rfind('.C') != -1 or fn.rfind('.cpp') != -1:
+ return 1
+
+ # assimble file type
+ if fn.rfind('.s') != -1 or fn.rfind('.S') != -1:
+ return 2
+
+ # header type
+ if fn.rfind('.h') != -1:
+ return 5
+
+ # other filetype
+ return 5
+
+def splitall(loc):
+ """
+ Return a list of the path components in loc. (Used by relpath_).
+
+ The first item in the list will be either ``os.curdir``, ``os.pardir``, empty,
+ or the root directory of loc (for example, ``/`` or ``C:\\).
+
+ The other items in the list will be strings.
+
+ Adapted from *path.py* by Jason Orendorff.
+ """
+ parts = []
+ while loc != os.curdir and loc != os.pardir:
+ prev = loc
+ loc, child = os.path.split(prev)
+ if loc == prev:
+ break
+ parts.append(child)
+ parts.append(loc)
+ parts.reverse()
+ return parts
+
+def _make_path_relative(origin, dest):
+ """
+ Return the relative path between origin and dest.
+
+ If it's not possible return dest.
+
+
+ If they are identical return ``os.curdir``
+
+ Adapted from `path.py <http://www.jorendorff.com/articles/python/path/>`_ by Jason Orendorff.
+ """
+ origin = os.path.abspath(origin).replace('\\', '/')
+ dest = os.path.abspath(dest).replace('\\', '/')
+ #
+ orig_list = splitall(os.path.normcase(origin))
+ # Don't normcase dest! We want to preserve the case.
+ dest_list = splitall(dest)
+ #
+ if orig_list[0] != os.path.normcase(dest_list[0]):
+ # Can't get here from there.
+ return dest
+ #
+ # Find the location where the two paths start to differ.
+ i = 0
+ for start_seg, dest_seg in zip(orig_list, dest_list):
+ if start_seg != os.path.normcase(dest_seg):
+ break
+ i += 1
+ #
+ # Now i is the point where the two paths diverge.
+ # Need a certain number of "os.pardir"s to work up
+ # from the origin to the point of divergence.
+ segments = [os.pardir] * (len(orig_list) - i)
+ # Need to add the diverging part of dest_list.
+ segments += dest_list[i:]
+ if len(segments) == 0:
+ # If they happen to be identical, use os.curdir.
+ return os.curdir
+ else:
+ # return os.path.join(*segments).replace('\\', '/')
+ return os.path.join(*segments)
+
+def MDKProject(target, script):
+ template = file('template.uV2', "rb")
+ lines = template.readlines()
+
+ project = file(target, "wb")
+ project_path = os.path.dirname(os.path.abspath(target))
+
+ line_index = 5
+ # write group
+ for group in script:
+ lines.insert(line_index, 'Group (%s)\r\n' % group['name'])
+ line_index += 1
+
+ lines.insert(line_index, '\r\n')
+ line_index += 1
+
+ # write file
+
+ CPPPATH = []
+ CPPDEFINES = []
+ LINKFLAGS = ''
+ CCFLAGS = ''
+
+ # number of groups
+ group_index = 1
+ for group in script:
+ # print group['name']
+
+ # get each include path
+ if group.has_key('CPPPATH') and group['CPPPATH']:
+ if CPPPATH:
+ CPPPATH += group['CPPPATH']
+ else:
+ CPPPATH += group['CPPPATH']
+
+ # get each group's definitions
+ if group.has_key('CPPDEFINES') and group['CPPDEFINES']:
+ if CPPDEFINES:
+ CPPDEFINES += ';' + group['CPPDEFINES']
+ else:
+ CPPDEFINES += group['CPPDEFINES']
+
+ # get each group's link flags
+ if group.has_key('LINKFLAGS') and group['LINKFLAGS']:
+ if LINKFLAGS:
+ LINKFLAGS += ' ' + group['LINKFLAGS']
+ else:
+ LINKFLAGS += group['LINKFLAGS']
+
+ # generate file items
+ for node in group['src']:
+ fn = node.rfile()
+ name = fn.name
+ path = os.path.dirname(fn.abspath)
+ path = _make_path_relative(project_path, path)
+ path = os.path.join(path, name)
+ lines.insert(line_index, 'File %d,%d,<%s><%s>\r\n'
+ % (group_index, _get_filetype(name), path, name))
+ line_index += 1
+
+ group_index = group_index + 1
+
+ lines.insert(line_index, '\r\n')
+ line_index += 1
+
+ # remove repeat path
+ paths = set()
+ for path in CPPPATH:
+ inc = _make_path_relative(project_path, os.path.normpath(path))
+ paths.add(inc) #.replace('\\', '/')
+
+ paths = [i for i in paths]
+ CPPPATH = string.join(paths, ';')
+
+ definitions = [i for i in set(CPPDEFINES)]
+ CPPDEFINES = string.join(definitions, ', ')
+
+ while line_index < len(lines):
+ if lines[line_index].startswith(' ADSCINCD '):
+ lines[line_index] = ' ADSCINCD (' + CPPPATH + ')\r\n'
+
+ if lines[line_index].startswith(' ADSLDMC ('):
+ lines[line_index] = ' ADSLDMC (' + LINKFLAGS + ')\r\n'
+
+ if lines[line_index].startswith(' ADSCDEFN ('):
+ lines[line_index] = ' ADSCDEFN (' + CPPDEFINES + ')\r\n'
+
+ line_index += 1
+
+ # write project
+ for line in lines:
+ project.write(line)
+
+ project.close()
+
+def BuilderProject(target, script):
+ project = file(target, "wb")
+ project_path = os.path.dirname(os.path.abspath(target))
+
+ # write file
+
+ CPPPATH = []
+ CPPDEFINES = []
+ LINKFLAGS = ''
+ CCFLAGS = ''
+
+ # number of groups
+ group_index = 1
+ for group in script:
+ # print group['name']
+
+ # generate file items
+ for node in group['src']:
+ fn = node.rfile()
+ name = fn.name
+ path = os.path.dirname(fn.abspath)
+ path = _make_path_relative(project_path, path)
+ path = os.path.join(path, name)
+ project.write('%s\r\n' % path)
+
+ group_index = group_index + 1
+
+ project.close()
+
+class Win32Spawn:
+ def spawn(self, sh, escape, cmd, args, env):
+ import subprocess
+
+ newargs = string.join(args[1:], ' ')
+ cmdline = cmd + " " + newargs
+ startupinfo = subprocess.STARTUPINFO()
+ startupinfo.dwFlags |= subprocess.STARTF_USESHOWWINDOW
+ proc = subprocess.Popen(cmdline, stdin=subprocess.PIPE, stdout=subprocess.PIPE,
+ stderr=subprocess.PIPE, startupinfo=startupinfo, shell = False)
+ data, err = proc.communicate()
+ rv = proc.wait()
+ if rv:
+ print "====="
+ print err
+ print "====="
+ return rv
+
+def PrepareBuilding(env, root_directory):
+ import SCons.cpp
+ import rtconfig
+
+ global BuildOptions
+ global Projects
+ global Env
+ global Rtt_Root
+
+ Env = env
+ Rtt_Root = root_directory
+
+ # patch for win32 spawn
+ if env['PLATFORM'] == 'win32' and rtconfig.PLATFORM == 'gcc':
+ win32_spawn = Win32Spawn()
+ win32_spawn.env = env
+ env['SPAWN'] = win32_spawn.spawn
+
+ # add program path
+ env.PrependENVPath('PATH', rtconfig.EXEC_PATH)
+
+ # parse rtconfig.h to get used component
+ PreProcessor = SCons.cpp.PreProcessor()
+ f = file('rtconfig.h', 'r')
+ contents = f.read()
+ f.close()
+ PreProcessor.process_contents(contents)
+ BuildOptions = PreProcessor.cpp_namespace
+
+ if (GetDepend('RT_USING_NEWLIB') == False) and rtconfig.PLATFORM == 'gcc':
+ AddDepend('RT_USING_MINILIBC')
+
+ # add target option
+ AddOption('--target',
+ dest='target',
+ type='string',
+ help='set target project: mdk')
+
+ if GetOption('target'):
+ SetOption('no_exec', 1)
+
+ # board build script
+ objs = SConscript('SConscript', variant_dir='bsp', duplicate=0)
+ Repository(Rtt_Root)
+ # include kernel
+ objs.append(SConscript('src/SConscript'))
+ # include libcpu
+ objs.append(SConscript('libcpu/SConscript'))
+ # include components
+ objs.append(SConscript('components/SConscript'))
+
+ return objs
+
+def GetDepend(depend):
+ building = True
+ if type(depend) == type('str'):
+ if not BuildOptions.has_key(depend):
+ building = False
+
+ return building
+
+ # for list type depend
+ for item in depend:
+ if item != '':
+ if not BuildOptions.has_key(item):
+ building = False
+
+ return building
+
+def AddDepend(option):
+ BuildOptions[option] = 1
+
+def DefineGroup(name, src, depend, **parameters):
+ global Env
+ if not GetDepend(depend):
+ return []
+
+ group = parameters
+ group['name'] = name
+ if type(src) == type(['src1', 'str2']):
+ group['src'] = File(src)
+ else:
+ group['src'] = src
+
+ Projects.append(group)
+
+ if group.has_key('CCFLAGS'):
+ Env.Append(CCFLAGS = group['CCFLAGS'])
+ if group.has_key('CPPPATH'):
+ Env.Append(CPPPATH = group['CPPPATH'])
+ if group.has_key('CPPDEFINES'):
+ Env.Append(CPPDEFINES = group['CPPDEFINES'])
+ if group.has_key('LINKFLAGS'):
+ Env.Append(LINKFLAGS = group['LINKFLAGS'])
+
+ objs = Env.Object(group['src'])
+ return objs
+
+def EndBuilding(target):
+ import rtconfig
+ Env.AddPostAction(target, rtconfig.POST_ACTION)
+
+ if GetOption('target') == 'mdk':
+ MDKProject('project.uV2', Projects)