diff --git a/bsp/jz47xx/SConscript b/bsp/jz47xx/SConscript index a3ff4c0a51..e4d3dd791a 100644 --- a/bsp/jz47xx/SConscript +++ b/bsp/jz47xx/SConscript @@ -1,29 +1,12 @@ -Import('env') -Import('projects') +import rtconfig Import('RTT_ROOT') -Import('rtconfig') - -# group definitions -group = {} -group['name'] = 'Startup' -group['CCFLAGS'] = '' -group['CPPPATH'] = [RTT_ROOT + '/bsp/jz47xx'] -group['CPPDEFINES'] = [] -group['LINKFLAGS'] = '' +from building import * src_bsp = ['application.c', 'startup.c', 'board.c'] src_drv = ['uart.c'] -group['src'] = File(src_bsp + src_drv) +src = File(src_bsp + src_drv) +CPPPATH = Dir('#') +group = DefineGroup('Startup', src, depend = [''], 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']) - -obj = env.Object(group['src']) - -Return('obj') +Return('group') diff --git a/bsp/jz47xx/SConstruct b/bsp/jz47xx/SConstruct index 21e393cf98..8922b1a466 100644 --- a/bsp/jz47xx/SConstruct +++ b/bsp/jz47xx/SConstruct @@ -2,12 +2,15 @@ import os import sys import rtconfig -RTT_ROOT = os.path.normpath(os.getcwd() + '/../..') -sys.path = sys.path + [os.path.join(RTT_ROOT, 'tools')] -import mdk +if os.getenv('RTT_ROOT'): + RTT_ROOT = os.getenv('RTT_ROOT') +else: + RTT_ROOT = os.path.normpath(os.getcwd() + '/../..') -target = 'rtthread-jz47xx' -projects = [] +sys.path = sys.path + [os.path.join(RTT_ROOT, 'tools')] +from building import * + +TARGET = 'rtthread-jz47xx.' + rtconfig.TARGET_EXT env = Environment(tools = ['mingw'], AS = rtconfig.AS, ASFLAGS = rtconfig.AFLAGS, @@ -16,23 +19,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) - -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/jz47xx/rtconfig.py b/bsp/jz47xx/rtconfig.py index 53d59e4f2b..ea679a279e 100644 --- a/bsp/jz47xx/rtconfig.py +++ b/bsp/jz47xx/rtconfig.py @@ -1,56 +1,6 @@ -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 - # toolchains options -ARCH='mips' -CPU='jz47xx' - +ARCH = 'mips' +CPU = 'jz47xx' CROSS_TOOL = 'gcc' PLATFORM = 'gcc' EXEC_PATH = 'E:/Program Files/CodeSourcery/Sourcery G++ Lite/bin'