Skip to content

Turn on debugging by default when exporting. Remove optimizations for IAR and Uvision #3534

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Jan 16, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 7 additions & 8 deletions tools/export/iar/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -89,16 +89,15 @@ def generate(self):
self.resources.c_sources + self.resources.cpp_sources + \
self.resources.objects + self.resources.libraries
flags = self.flags
flags['c_flags'] = list(set(flags['common_flags']
c_flags = list(set(flags['common_flags']
+ flags['c_flags']
+ flags['cxx_flags']))
if '--vla' in flags['c_flags']:
flags['c_flags'].remove('--vla')
if '--no_static_destruction' in flags['c_flags']:
flags['c_flags'].remove('--no_static_destruction')
#Optimizations
if '-Oh' in flags['c_flags']:
flags['c_flags'].remove('-Oh')
# Flags set in template to be set by user in IDE
template = ["--vla", "--no_static_destruction"]
# Flag invalid if set in template
# Optimizations are also set in template
invalid_flag = lambda x: x in template or re.match("-O(\d|time|n)", x)
flags['c_flags'] = [flag for flag in c_flags if not invalid_flag(flag)]

try:
debugger = DeviceCMSIS(self.target).debug.replace('-','').upper()
Expand Down
28 changes: 10 additions & 18 deletions tools/export/uvision/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -155,27 +155,19 @@ def uv_files(self, files):
def format_flags(self):
"""Format toolchain flags for Uvision"""
flags = copy.deepcopy(self.flags)
# to be preprocessed with armcc
asm_flag_string = '--cpreproc --cpreproc_opts=-D__ASSERT_MSG,' + \
",".join(flags['asm_flags'])
# asm flags only, common are not valid within uvision project,
# they are armcc specific
flags['asm_flags'] = asm_flag_string
# cxx flags included, as uvision have them all in one tab
flags['c_flags'] = list(set(['-D__ASSERT_MSG']
+ flags['common_flags']
+ flags['c_flags']
+ flags['cxx_flags']))
# not compatible with c99 flag set in the template
try: flags['c_flags'].remove("--c99")
except ValueError: pass
# cpp is not required as it's implicit for cpp files
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'])
# All non-asm flags are in one template field
c_flags = list(set(flags['c_flags'] + flags['cxx_flags'] +flags['common_flags']))
# These flags are in template to be set by user i n IDE
template = ["--no_vla", "--cpp", "--c99"]
# Flag is invalid if set in template
# Optimizations are also set in the template
invalid_flag = lambda x: x in template or re.match("-O(\d|time)", x)
flags['c_flags'] = [flag for flag in c_flags if not invalid_flag(flag)]
flags['c_flags'] = " ".join(flags['c_flags'])
return flags

def format_src(self, srcs):
Expand Down
2 changes: 1 addition & 1 deletion tools/export/uvision/uvision.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -351,7 +351,7 @@
</ArmAdsMisc>
<Cads>
<interw>0</interw>
<Optim>2</Optim>
<Optim>1</Optim>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

a reason for this? shall be a separate commit?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Turns off optimizations by default.

<oTime>0</oTime>
<SplitLS>0</SplitLS>
<OneElfS>0</OneElfS>
Expand Down
4 changes: 2 additions & 2 deletions tools/options.py
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ def list_profiles():
"""
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

Positional arguments:
Expand All @@ -110,7 +110,7 @@ def extract_profile(parser, options, toolchain):
"""
profile = {'c': [], 'cxx': [], 'ld': [], 'common': [], 'asm': []}
filenames = options.profile or [join(dirname(__file__), "profiles",
"default.json")]
fallback + ".json")]
for filename in filenames:
contents = load(open(filename))
try:
Expand Down
2 changes: 1 addition & 1 deletion tools/project.py
Original file line number Diff line number Diff line change
Expand Up @@ -237,7 +237,7 @@ def main():
exporter, toolchain_name = get_exporter_toolchain(options.ide)
if options.mcu not in exporter.TARGETS:
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:
rmtree(BUILD_DIR)
export(options.mcu, options.ide, build=options.build,
Expand Down