From 099062de782913dc911e2fadf889291aafbeeeb8 Mon Sep 17 00:00:00 2001 From: ArdaFu Date: Mon, 4 Jun 2018 14:18:31 +0800 Subject: [PATCH] [tools][building] Add ASFLAGS in DefineGroup. --- libcpu/SConscript | 6 +++++- tools/building.py | 17 +++++++++++++++-- 2 files changed, 20 insertions(+), 3 deletions(-) diff --git a/libcpu/SConscript b/libcpu/SConscript index 0d00976092..a3404e0101 100644 --- a/libcpu/SConscript +++ b/libcpu/SConscript @@ -4,6 +4,7 @@ from building import * comm = rtconfig.ARCH + '/common' path = rtconfig.ARCH + '/' + rtconfig.CPU +AFLAGS = '' # The set of source files associated with this SConscript file. if rtconfig.PLATFORM == 'armcc': @@ -21,7 +22,10 @@ if rtconfig.PLATFORM == 'cl': if rtconfig.PLATFORM == 'mingw': src = Glob(path + '/*.c') +if rtconfig.PLATFORM == 'armcc' and rtconfig.ARCH == 'arm' and rtconfig.CPU == 'arm926': + ASFLAGS = ' --cpreproc' + CPPPATH = [RTT_ROOT + '/libcpu/' + rtconfig.ARCH + '/' + rtconfig.CPU, RTT_ROOT + '/libcpu/' + rtconfig.ARCH + '/common'] -group = DefineGroup(rtconfig.CPU.upper(), src, depend = [''], CPPPATH = CPPPATH) +group = DefineGroup(rtconfig.CPU.upper(), src, depend = [''], CPPPATH = CPPPATH, ASFLAGS = ASFLAGS) Return('group') diff --git a/tools/building.py b/tools/building.py index c727591bb0..31dc4dae1d 100644 --- a/tools/building.py +++ b/tools/building.py @@ -487,6 +487,11 @@ def MergeGroup(src_group, group): src_group['CPPDEFINES'] = src_group['CPPDEFINES'] + group['CPPDEFINES'] else: src_group['CPPDEFINES'] = group['CPPDEFINES'] + if group.has_key('ASFLAGS'): + if src_group.has_key('ASFLAGS'): + src_group['ASFLAGS'] = src_group['ASFLAGS'] + group['ASFLAGS'] + else: + src_group['ASFLAGS'] = group['ASFLAGS'] # for local CCFLAGS/CPPPATH/CPPDEFINES if group.has_key('LOCAL_CCFLAGS'): @@ -520,6 +525,11 @@ def MergeGroup(src_group, group): src_group['LIBPATH'] = src_group['LIBPATH'] + group['LIBPATH'] else: src_group['LIBPATH'] = group['LIBPATH'] + if group.has_key('LOCAL_ASFLAGS'): + if src_group.has_key('LOCAL_ASFLAGS'): + src_group['LOCAL_ASFLAGS'] = src_group['LOCAL_ASFLAGS'] + group['LOCAL_ASFLAGS'] + else: + src_group['LOCAL_ASFLAGS'] = group['LOCAL_ASFLAGS'] def DefineGroup(name, src, depend, **parameters): global Env @@ -550,6 +560,8 @@ def DefineGroup(name, src, depend, **parameters): Env.AppendUnique(CPPDEFINES = group['CPPDEFINES']) if group.has_key('LINKFLAGS'): Env.AppendUnique(LINKFLAGS = group['LINKFLAGS']) + if group.has_key('ASFLAGS'): + Env.AppendUnique(ASFLAGS = group['ASFLAGS']) # check whether to clean up library if GetOption('cleanlib') and os.path.exists(os.path.join(group['path'], GroupLibFullName(name, Env))): @@ -645,13 +657,14 @@ def DoBuilding(target, objects): # handle local group def local_group(group, objects): - if group.has_key('LOCAL_CCFLAGS') or group.has_key('LOCAL_CPPPATH') or group.has_key('LOCAL_CPPDEFINES'): + if group.has_key('LOCAL_CCFLAGS') or group.has_key('LOCAL_CPPPATH') or group.has_key('LOCAL_CPPDEFINES') or group.has_key('LOCAL_ASFLAGS'): CCFLAGS = Env.get('CCFLAGS', '') + group.get('LOCAL_CCFLAGS', '') CPPPATH = Env.get('CPPPATH', ['']) + group.get('LOCAL_CPPPATH', ['']) CPPDEFINES = Env.get('CPPDEFINES', ['']) + group.get('LOCAL_CPPDEFINES', ['']) + ASFLAGS = Env.get('ASFLAGS', '') + group.get('LOCAL_ASFLAGS', '') for source in group['src']: - objects.append(Env.Object(source, CCFLAGS = CCFLAGS, + objects.append(Env.Object(source, CCFLAGS = CCFLAGS, ASFLAGS = ASFLAGS, CPPPATH = CPPPATH, CPPDEFINES = CPPDEFINES)) return True