diff --git a/bsp/qemu-vexpress-a9/rtconfig.py b/bsp/qemu-vexpress-a9/rtconfig.py index 5d3b9842e8..5aa123823b 100644 --- a/bsp/qemu-vexpress-a9/rtconfig.py +++ b/bsp/qemu-vexpress-a9/rtconfig.py @@ -37,8 +37,7 @@ BUILD = 'debug' LINK_SCRIPT = 'link.lds' if PLATFORM == 'gcc': - # toolchains - PREFIX = os.getenv('RTT_CC_PREFIX') or 'arm-none-eabi-' + PREFIX = os.getenv('RTT_EXEC_PREFIX') or 'arm-none-eabi-' CC = PREFIX + 'gcc' CXX = PREFIX + 'g++' AS = PREFIX + 'gcc' @@ -76,5 +75,4 @@ if PLATFORM == 'gcc': M_POST_ACTION = STRIP + ' -R .hash $TARGET\n' + SIZE + ' $TARGET \n' DUMP_ACTION = OBJDUMP + ' -D -S $TARGET > rtt.asm\n' - POST_ACTION = OBJCPY + ' -O binary $TARGET rtthread.bin\n' +\ - SIZE + ' $TARGET \n' + POST_ACTION = OBJCPY + ' -O binary $TARGET rtthread.bin\n' + SIZE + ' $TARGET \n' diff --git a/tools/building.py b/tools/building.py index f471e3cb12..a8a24868ac 100644 --- a/tools/building.py +++ b/tools/building.py @@ -124,27 +124,28 @@ class Win32Spawn: # generate cconfig.h file def GenCconfigFile(env, BuildOptions): - if rtconfig.PLATFORM in ['gcc']: - contents = '' - if not os.path.isfile('cconfig.h'): - import gcc - gcc.GenerateGCCConfig(rtconfig) + # if rtconfig.PLATFORM in ['gcc']: + # contents = '' + # if not os.path.isfile('cconfig.h'): + # import gcc + # gcc.GenerateGCCConfig(rtconfig) - # try again - if os.path.isfile('cconfig.h'): - f = open('cconfig.h', 'r') - if f: - contents = f.read() - f.close() + # # try again + # if os.path.isfile('cconfig.h'): + # f = open('cconfig.h', 'r') + # if f: + # contents = f.read() + # f.close() - prep = PatchedPreProcessor() - prep.process_contents(contents) - options = prep.cpp_namespace + # prep = PatchedPreProcessor() + # prep.process_contents(contents) + # options = prep.cpp_namespace - BuildOptions.update(options) + # BuildOptions.update(options) - # add HAVE_CCONFIG_H definition - env.AppendUnique(CPPDEFINES = ['HAVE_CCONFIG_H']) + # # add HAVE_CCONFIG_H definition + # env.AppendUnique(CPPDEFINES = ['HAVE_CCONFIG_H']) + pass def PrepareBuilding(env, root_directory, has_libcpu=False, remove_components = []): @@ -202,22 +203,36 @@ def PrepareBuilding(env, root_directory, has_libcpu=False, remove_components = [ rtconfig.CROSS_TOOL, rtconfig.PLATFORM = tgt_dict[tgt_name] # replace the 'RTT_CC' to 'CROSS_TOOL' os.environ['RTT_CC'] = rtconfig.CROSS_TOOL - utils.ReloadModule(rtconfig) except KeyError: print('Unknow target: '+ tgt_name+'. Avaible targets: ' +', '.join(tgt_dict.keys())) sys.exit(1) + exec_prefix = GetOption('exec-prefix') + if exec_prefix: + os.environ['RTT_EXEC_PREFIX'] = exec_prefix + # auto change the 'RTT_EXEC_PATH' when 'rtconfig.EXEC_PATH' get failed if not os.path.exists(rtconfig.EXEC_PATH): if 'RTT_EXEC_PATH' in os.environ: # del the 'RTT_EXEC_PATH' and using the 'EXEC_PATH' setting on rtconfig.py del os.environ['RTT_EXEC_PATH'] - utils.ReloadModule(rtconfig) exec_path = GetOption('exec-path') if exec_path: os.environ['RTT_EXEC_PATH'] = exec_path - utils.ReloadModule(rtconfig) + + utils.ReloadModule(rtconfig) # update environment variables to rtconfig.py + + # some env variables have loaded in SConsctruct Environment() before re-load rtconfig.py; + # after update rtconfig.py's variables, those env variables need to synchronize + if exec_prefix: + env['CC'] = rtconfig.CC + env['CXX'] = rtconfig.CXX + env['AS'] = rtconfig.AS + env['AR'] = rtconfig.AR + env['LINK'] = rtconfig.LINK + if exec_path: + env.PrependENVPath('PATH', rtconfig.EXEC_PATH) # add compability with Keil MDK 4.6 which changes the directory of armcc.exe if rtconfig.PLATFORM in ['armcc', 'armclang']: @@ -313,12 +328,11 @@ def PrepareBuilding(env, root_directory, has_libcpu=False, remove_components = [ if GetOption('pyconfig_silent'): from menuconfig import guiconfig_silent - guiconfig_silent(Rtt_Root) exit(0) + elif GetOption('pyconfig'): from menuconfig import guiconfig - guiconfig(Rtt_Root) exit(0) diff --git a/tools/options.py b/tools/options.py index db5f52f632..076f648ef8 100644 --- a/tools/options.py +++ b/tools/options.py @@ -85,6 +85,10 @@ def AddOptions(): dest = 'target', type = 'string', help = 'set target project: mdk/mdk4/mdk5/iar/vs/vsc/ua/cdk/ses/makefile/eclipse/codelite/cmake') + AddOption('--exec-prefix', + dest = 'exec-prefix', + type = 'string', + help = 'set RTT_EXEC_PREFIX temperately') AddOption('--exec-path', dest = 'exec-path', type = 'string', diff --git a/tools/utils.py b/tools/utils.py index 0fa2aefcde..2d88176417 100644 --- a/tools/utils.py +++ b/tools/utils.py @@ -291,5 +291,3 @@ def ReloadModule(module): importlib.reload(module) else: reload(module) - - return