mirror of https://github.com/ARMmbed/mbed-os.git
Merge pull request #3534 from sarahmarshy/export-debug
Turn on debugging by default when exporting. Remove optimizations for IAR and Uvisionpull/3423/merge
commit
04a31f3b39
|
|
@ -89,16 +89,15 @@ class IAR(Exporter):
|
||||||
self.resources.c_sources + self.resources.cpp_sources + \
|
self.resources.c_sources + self.resources.cpp_sources + \
|
||||||
self.resources.objects + self.resources.libraries
|
self.resources.objects + self.resources.libraries
|
||||||
flags = self.flags
|
flags = self.flags
|
||||||
flags['c_flags'] = list(set(flags['common_flags']
|
c_flags = list(set(flags['common_flags']
|
||||||
+ flags['c_flags']
|
+ flags['c_flags']
|
||||||
+ flags['cxx_flags']))
|
+ flags['cxx_flags']))
|
||||||
if '--vla' in flags['c_flags']:
|
# Flags set in template to be set by user in IDE
|
||||||
flags['c_flags'].remove('--vla')
|
template = ["--vla", "--no_static_destruction"]
|
||||||
if '--no_static_destruction' in flags['c_flags']:
|
# Flag invalid if set in template
|
||||||
flags['c_flags'].remove('--no_static_destruction')
|
# Optimizations are also set in template
|
||||||
#Optimizations
|
invalid_flag = lambda x: x in template or re.match("-O(\d|time|n)", x)
|
||||||
if '-Oh' in flags['c_flags']:
|
flags['c_flags'] = [flag for flag in c_flags if not invalid_flag(flag)]
|
||||||
flags['c_flags'].remove('-Oh')
|
|
||||||
|
|
||||||
try:
|
try:
|
||||||
debugger = DeviceCMSIS(self.target).debug.replace('-','').upper()
|
debugger = DeviceCMSIS(self.target).debug.replace('-','').upper()
|
||||||
|
|
|
||||||
|
|
@ -155,27 +155,19 @@ class Uvision(Exporter):
|
||||||
def format_flags(self):
|
def format_flags(self):
|
||||||
"""Format toolchain flags for Uvision"""
|
"""Format toolchain flags for Uvision"""
|
||||||
flags = copy.deepcopy(self.flags)
|
flags = copy.deepcopy(self.flags)
|
||||||
|
# to be preprocessed with armcc
|
||||||
asm_flag_string = '--cpreproc --cpreproc_opts=-D__ASSERT_MSG,' + \
|
asm_flag_string = '--cpreproc --cpreproc_opts=-D__ASSERT_MSG,' + \
|
||||||
",".join(flags['asm_flags'])
|
",".join(flags['asm_flags'])
|
||||||
# asm flags only, common are not valid within uvision project,
|
|
||||||
# they are armcc specific
|
|
||||||
flags['asm_flags'] = asm_flag_string
|
flags['asm_flags'] = asm_flag_string
|
||||||
# cxx flags included, as uvision have them all in one tab
|
# All non-asm flags are in one template field
|
||||||
flags['c_flags'] = list(set(['-D__ASSERT_MSG']
|
c_flags = list(set(flags['c_flags'] + flags['cxx_flags'] +flags['common_flags']))
|
||||||
+ flags['common_flags']
|
# These flags are in template to be set by user i n IDE
|
||||||
+ flags['c_flags']
|
template = ["--no_vla", "--cpp", "--c99"]
|
||||||
+ flags['cxx_flags']))
|
# Flag is invalid if set in template
|
||||||
# not compatible with c99 flag set in the template
|
# Optimizations are also set in the template
|
||||||
try: flags['c_flags'].remove("--c99")
|
invalid_flag = lambda x: x in template or re.match("-O(\d|time)", x)
|
||||||
except ValueError: pass
|
flags['c_flags'] = [flag for flag in c_flags if not invalid_flag(flag)]
|
||||||
# cpp is not required as it's implicit for cpp files
|
flags['c_flags'] = " ".join(flags['c_flags'])
|
||||||
try: flags['c_flags'].remove("--cpp")
|
|
||||||
except ValueError: pass
|
|
||||||
# we want no-vla for only cxx, but it's also applied for C in IDE,
|
|
||||||
# thus we remove it
|
|
||||||
try: flags['c_flags'].remove("--no_vla")
|
|
||||||
except ValueError: pass
|
|
||||||
flags['c_flags'] =" ".join(flags['c_flags'])
|
|
||||||
return flags
|
return flags
|
||||||
|
|
||||||
def format_src(self, srcs):
|
def format_src(self, srcs):
|
||||||
|
|
|
||||||
|
|
@ -351,7 +351,7 @@
|
||||||
</ArmAdsMisc>
|
</ArmAdsMisc>
|
||||||
<Cads>
|
<Cads>
|
||||||
<interw>0</interw>
|
<interw>0</interw>
|
||||||
<Optim>2</Optim>
|
<Optim>1</Optim>
|
||||||
<oTime>0</oTime>
|
<oTime>0</oTime>
|
||||||
<SplitLS>0</SplitLS>
|
<SplitLS>0</SplitLS>
|
||||||
<OneElfS>0</OneElfS>
|
<OneElfS>0</OneElfS>
|
||||||
|
|
|
||||||
|
|
@ -100,7 +100,7 @@ def list_profiles():
|
||||||
"""
|
"""
|
||||||
return [fn.replace(".json", "") for fn in listdir(join(dirname(__file__), "profiles")) if fn.endswith(".json")]
|
return [fn.replace(".json", "") for fn in listdir(join(dirname(__file__), "profiles")) if fn.endswith(".json")]
|
||||||
|
|
||||||
def extract_profile(parser, options, toolchain):
|
def extract_profile(parser, options, toolchain, fallback="default"):
|
||||||
"""Extract a Toolchain profile from parsed options
|
"""Extract a Toolchain profile from parsed options
|
||||||
|
|
||||||
Positional arguments:
|
Positional arguments:
|
||||||
|
|
@ -110,7 +110,7 @@ def extract_profile(parser, options, toolchain):
|
||||||
"""
|
"""
|
||||||
profile = {'c': [], 'cxx': [], 'ld': [], 'common': [], 'asm': []}
|
profile = {'c': [], 'cxx': [], 'ld': [], 'common': [], 'asm': []}
|
||||||
filenames = options.profile or [join(dirname(__file__), "profiles",
|
filenames = options.profile or [join(dirname(__file__), "profiles",
|
||||||
"default.json")]
|
fallback + ".json")]
|
||||||
for filename in filenames:
|
for filename in filenames:
|
||||||
contents = load(open(filename))
|
contents = load(open(filename))
|
||||||
try:
|
try:
|
||||||
|
|
|
||||||
|
|
@ -235,7 +235,7 @@ def main():
|
||||||
exporter, toolchain_name = get_exporter_toolchain(options.ide)
|
exporter, toolchain_name = get_exporter_toolchain(options.ide)
|
||||||
if options.mcu not in exporter.TARGETS:
|
if options.mcu not in exporter.TARGETS:
|
||||||
args_error(parser, "%s not supported by %s"%(options.mcu,options.ide))
|
args_error(parser, "%s not supported by %s"%(options.mcu,options.ide))
|
||||||
profile = extract_profile(parser, options, toolchain_name)
|
profile = extract_profile(parser, options, toolchain_name, fallback="debug")
|
||||||
if options.clean:
|
if options.clean:
|
||||||
rmtree(BUILD_DIR)
|
rmtree(BUILD_DIR)
|
||||||
export(options.mcu, options.ide, build=options.build,
|
export(options.mcu, options.ide, build=options.build,
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue