commit
fdc350b763
|
@ -112,6 +112,35 @@ class Win32Spawn:
|
||||||
|
|
||||||
return proc.wait()
|
return proc.wait()
|
||||||
|
|
||||||
|
# auto fix the 'RTT_CC' and 'RTT_EXEC_PATH'
|
||||||
|
# when using 'scons --target=cc' the 'RTT_CC' will set to 'cc'
|
||||||
|
# it will fix the the 'rtconfig.EXEC_PATH' when get it failed.
|
||||||
|
# NOTE: this function will changed your env. Please backup the env before used it.
|
||||||
|
def AutoFixRttCCAndExecPath():
|
||||||
|
import rtconfig
|
||||||
|
target_option = None
|
||||||
|
|
||||||
|
# get --target=cc option
|
||||||
|
if len(sys.argv) > 1:
|
||||||
|
option = sys.argv[1].split('=')
|
||||||
|
if len(option) > 1 and option[0] == '--target':
|
||||||
|
target_option = option[1]
|
||||||
|
|
||||||
|
# force change the 'RTT_CC' when using 'scons --target=cc'
|
||||||
|
if target_option:
|
||||||
|
if target_option == 'mdk' or target_option == 'mdk4' or target_option == 'mdk5':
|
||||||
|
os.environ['RTT_CC'] = 'keil'
|
||||||
|
elif target_option == 'iar':
|
||||||
|
os.environ['RTT_CC'] = 'iar'
|
||||||
|
|
||||||
|
# auto change the 'RTT_EXEC_PATH' when 'rtconfig.EXEC_PATH' get failed
|
||||||
|
reload(rtconfig)
|
||||||
|
if not os.path.exists(rtconfig.EXEC_PATH):
|
||||||
|
if os.environ['RTT_EXEC_PATH']:
|
||||||
|
# del the 'RTT_EXEC_PATH' and using the 'EXEC_PATH' setting on rtconfig.py
|
||||||
|
del os.environ['RTT_EXEC_PATH']
|
||||||
|
reload(rtconfig)
|
||||||
|
|
||||||
def PrepareBuilding(env, root_directory, has_libcpu=False, remove_components = []):
|
def PrepareBuilding(env, root_directory, has_libcpu=False, remove_components = []):
|
||||||
import SCons.cpp
|
import SCons.cpp
|
||||||
import rtconfig
|
import rtconfig
|
||||||
|
@ -130,6 +159,9 @@ def PrepareBuilding(env, root_directory, has_libcpu=False, remove_components = [
|
||||||
|
|
||||||
sys.path = sys.path + [os.path.join(Rtt_Root, 'tools')]
|
sys.path = sys.path + [os.path.join(Rtt_Root, 'tools')]
|
||||||
|
|
||||||
|
# auto fix the 'RTT_CC' and 'RTT_EXEC_PATH'
|
||||||
|
AutoFixRttCCAndExecPath()
|
||||||
|
|
||||||
# add compability with Keil MDK 4.6 which changes the directory of armcc.exe
|
# add compability with Keil MDK 4.6 which changes the directory of armcc.exe
|
||||||
if rtconfig.PLATFORM == 'armcc':
|
if rtconfig.PLATFORM == 'armcc':
|
||||||
if not os.path.isfile(os.path.join(rtconfig.EXEC_PATH, 'armcc.exe')):
|
if not os.path.isfile(os.path.join(rtconfig.EXEC_PATH, 'armcc.exe')):
|
||||||
|
@ -710,17 +742,7 @@ def DoBuilding(target, objects):
|
||||||
|
|
||||||
EndBuilding(target, program)
|
EndBuilding(target, program)
|
||||||
|
|
||||||
def EndBuilding(target, program = None):
|
def GenTargetProject(program = None):
|
||||||
import rtconfig
|
|
||||||
|
|
||||||
Env['target'] = program
|
|
||||||
Env['project'] = Projects
|
|
||||||
|
|
||||||
Env.AddPostAction(target, rtconfig.POST_ACTION)
|
|
||||||
# Add addition clean files
|
|
||||||
Clean(target, 'cconfig.h')
|
|
||||||
Clean(target, 'rtua.py')
|
|
||||||
Clean(target, 'rtua.pyc')
|
|
||||||
|
|
||||||
if GetOption('target') == 'mdk':
|
if GetOption('target') == 'mdk':
|
||||||
from keil import MDKProject
|
from keil import MDKProject
|
||||||
|
@ -777,27 +799,47 @@ def EndBuilding(target, program = None):
|
||||||
from cdk import CDKProject
|
from cdk import CDKProject
|
||||||
CDKProject('project.cdkproj', Projects)
|
CDKProject('project.cdkproj', Projects)
|
||||||
|
|
||||||
|
def EndBuilding(target, program = None):
|
||||||
|
import rtconfig
|
||||||
|
|
||||||
|
need_exit = False
|
||||||
|
|
||||||
|
Env['target'] = program
|
||||||
|
Env['project'] = Projects
|
||||||
|
|
||||||
|
Env.AddPostAction(target, rtconfig.POST_ACTION)
|
||||||
|
# Add addition clean files
|
||||||
|
Clean(target, 'cconfig.h')
|
||||||
|
Clean(target, 'rtua.py')
|
||||||
|
Clean(target, 'rtua.pyc')
|
||||||
|
|
||||||
|
if GetOption('target'):
|
||||||
|
GenTargetProject(program)
|
||||||
|
|
||||||
BSP_ROOT = Dir('#').abspath
|
BSP_ROOT = Dir('#').abspath
|
||||||
if GetOption('copy') and program != None:
|
if GetOption('copy') and program != None:
|
||||||
from mkdist import MakeCopy
|
from mkdist import MakeCopy
|
||||||
MakeCopy(program, BSP_ROOT, Rtt_Root, Env)
|
MakeCopy(program, BSP_ROOT, Rtt_Root, Env)
|
||||||
exit(0)
|
need_exit = True
|
||||||
if GetOption('copy-header') and program != None:
|
if GetOption('copy-header') and program != None:
|
||||||
from mkdist import MakeCopyHeader
|
from mkdist import MakeCopyHeader
|
||||||
MakeCopyHeader(program, BSP_ROOT, Rtt_Root, Env)
|
MakeCopyHeader(program, BSP_ROOT, Rtt_Root, Env)
|
||||||
exit(0)
|
need_exit = True
|
||||||
if GetOption('make-dist') and program != None:
|
if GetOption('make-dist') and program != None:
|
||||||
from mkdist import MkDist
|
from mkdist import MkDist
|
||||||
MkDist(program, BSP_ROOT, Rtt_Root, Env)
|
MkDist(program, BSP_ROOT, Rtt_Root, Env)
|
||||||
exit(0)
|
need_exit = True
|
||||||
if GetOption('cscope'):
|
if GetOption('cscope'):
|
||||||
from cscope import CscopeDatabase
|
from cscope import CscopeDatabase
|
||||||
CscopeDatabase(Projects)
|
CscopeDatabase(Projects)
|
||||||
|
|
||||||
if not GetOption('help') and not GetOption('target'):
|
if not GetOption('help') and not GetOption('target'):
|
||||||
if not os.path.exists(rtconfig.EXEC_PATH):
|
if not os.path.exists(rtconfig.EXEC_PATH):
|
||||||
print "Error: Toolchain path (%s) is not exist, please check 'EXEC_PATH' in path or rtconfig.py." % rtconfig.EXEC_PATH
|
print "Error: the toolchain path (%s) is not exist, please check 'EXEC_PATH' in path or rtconfig.py." % rtconfig.EXEC_PATH
|
||||||
sys.exit(1)
|
need_exit = True
|
||||||
|
|
||||||
|
if need_exit:
|
||||||
|
exit(0)
|
||||||
|
|
||||||
def SrcRemove(src, remove):
|
def SrcRemove(src, remove):
|
||||||
if not src:
|
if not src:
|
||||||
|
|
|
@ -164,7 +164,7 @@ def IARVersion():
|
||||||
def IARPath():
|
def IARPath():
|
||||||
import rtconfig
|
import rtconfig
|
||||||
|
|
||||||
# set environ
|
# backup environ
|
||||||
old_environ = os.environ
|
old_environ = os.environ
|
||||||
os.environ['RTT_CC'] = 'iar'
|
os.environ['RTT_CC'] = 'iar'
|
||||||
reload(rtconfig)
|
reload(rtconfig)
|
||||||
|
@ -183,7 +183,7 @@ def IARVersion():
|
||||||
if os.path.exists(path):
|
if os.path.exists(path):
|
||||||
cmd = os.path.join(path, 'iccarm.exe')
|
cmd = os.path.join(path, 'iccarm.exe')
|
||||||
else:
|
else:
|
||||||
print('Get IAR version error. Please update IAR installation path in rtconfig.h!')
|
print('Error: get IAR version failed. Please update the IAR installation path in rtconfig.py!')
|
||||||
return "0.0"
|
return "0.0"
|
||||||
|
|
||||||
child = subprocess.Popen([cmd, '--version'], stdout=subprocess.PIPE, stderr=subprocess.PIPE, shell=True)
|
child = subprocess.Popen([cmd, '--version'], stdout=subprocess.PIPE, stderr=subprocess.PIPE, shell=True)
|
||||||
|
|
Loading…
Reference in New Issue