2009-10-15 17:49:14 +08:00
|
|
|
import os
|
2010-04-19 06:16:50 +08:00
|
|
|
import sys
|
2009-10-15 17:49:14 +08:00
|
|
|
import rtconfig
|
|
|
|
|
|
|
|
RTT_ROOT = os.path.normpath(os.getcwd() + '/../..')
|
2010-04-19 06:16:50 +08:00
|
|
|
sys.path = sys.path + [os.path.join(RTT_ROOT, 'tools')]
|
|
|
|
import mdk
|
2009-10-15 17:49:14 +08:00
|
|
|
|
2010-04-19 06:16:50 +08:00
|
|
|
target = 'rtthread-stm32'
|
|
|
|
projects = []
|
2009-10-15 17:49:14 +08:00
|
|
|
|
2010-04-19 07:48:59 +08:00
|
|
|
AddOption('--target',
|
|
|
|
dest='target',
|
|
|
|
type='string',
|
|
|
|
help='set target project: mdk')
|
|
|
|
|
|
|
|
if GetOption('target'):
|
|
|
|
SetOption('no_exec', 1)
|
|
|
|
|
2009-10-22 17:44:08 +08:00
|
|
|
env = Environment(tools = ['mingw'],
|
|
|
|
AS = rtconfig.AS, ASFLAGS = rtconfig.AFLAGS,
|
|
|
|
CC = rtconfig.CC, CCFLAGS = rtconfig.CFLAGS,
|
|
|
|
AR = rtconfig.AR, ARFLAGS = '-rc',
|
|
|
|
LINK = rtconfig.LINK, LINKFLAGS = rtconfig.LFLAGS)
|
|
|
|
env.PrependENVPath('PATH', rtconfig.EXEC_PATH)
|
2009-10-15 17:49:14 +08:00
|
|
|
|
|
|
|
Export('env')
|
|
|
|
Export('RTT_ROOT')
|
|
|
|
Export('rtconfig')
|
2010-04-19 06:16:50 +08:00
|
|
|
Export('projects')
|
2009-10-15 17:49:14 +08:00
|
|
|
|
2010-04-19 06:16:50 +08:00
|
|
|
# kernel building script
|
2009-10-15 17:49:14 +08:00
|
|
|
objs = SConscript(RTT_ROOT + '/src/SConscript', variant_dir='build/src', duplicate=0)
|
2010-04-19 06:16:50 +08:00
|
|
|
# arch building script
|
2009-10-15 17:49:14 +08:00
|
|
|
objs = objs + SConscript(RTT_ROOT + '/libcpu/SConscript', variant_dir='build/libcpu', duplicate=0)
|
2010-04-19 06:16:50 +08:00
|
|
|
# STM32 firemare library building script
|
2009-10-15 17:49:14 +08:00
|
|
|
objs = objs + SConscript(RTT_ROOT + '/bsp/stm3210/Libraries/SConscript', variant_dir='build/Libraries', duplicate=0)
|
|
|
|
|
2010-04-19 06:16:50 +08:00
|
|
|
# component script
|
|
|
|
Repository(RTT_ROOT)
|
|
|
|
objs = objs + SConscript('components/SConscript')
|
2009-10-15 17:49:14 +08:00
|
|
|
|
2010-04-19 06:16:50 +08:00
|
|
|
# board build script
|
|
|
|
objs = objs + SConscript('SConscript', variant_dir='build/bsp', duplicate=0)
|
2009-10-15 17:49:14 +08:00
|
|
|
|
2009-10-22 17:44:08 +08:00
|
|
|
TARGET = target + '.' + rtconfig.TARGET_EXT
|
|
|
|
env.Program(TARGET, objs)
|
|
|
|
env.AddPostAction(TARGET, rtconfig.POST_ACTION)
|
2010-04-19 06:16:50 +08:00
|
|
|
|
2010-04-19 07:48:59 +08:00
|
|
|
if GetOption('target') == 'mdk':
|
|
|
|
mdk.MDKProject('project_2.uV2', projects)
|