IOTBTOOL-349: Correct handling of spaces in project name.

This fixes an issue where a space in the name of a project would cause a link failure
pull/11456/head
Mark Edgeworth 2019-09-11 11:22:56 +01:00
parent 5e693778f4
commit 6f37fd91a8
1 changed files with 14 additions and 10 deletions

View File

@ -733,13 +733,17 @@ class mbedToolchain:
new_path = join(tmp_path, head) new_path = join(tmp_path, head)
mkdir(new_path) mkdir(new_path)
# The output file names are derived from the project name, but this can have spaces in it which
# messes-up later processing. Replace any spaces in the derived names with '_'
tail = tail.replace(" ", "_")
# Absolute path of the final linked file # Absolute path of the final linked file
if self.config.has_regions: if self.config.has_regions:
elf = join(tmp_path, name + '_application.elf') elf = join(tmp_path, tail + '_application.elf')
mapfile = join(tmp_path, name + '_application.map') mapfile = join(tmp_path, tail + '_application.map')
else: else:
elf = join(tmp_path, name + '.elf') elf = join(tmp_path, tail + '.elf')
mapfile = join(tmp_path, name + '.map') mapfile = join(tmp_path, tail + '.map')
objects = sorted(set(r.get_file_paths(FileType.OBJECT))) objects = sorted(set(r.get_file_paths(FileType.OBJECT)))
config_file = ([self.config.app_config_location] config_file = ([self.config.app_config_location]
@ -768,21 +772,21 @@ class mbedToolchain:
if exists(old_mapfile): if exists(old_mapfile):
remove(old_mapfile) remove(old_mapfile)
rename(mapfile, old_mapfile) rename(mapfile, old_mapfile)
self.progress("link", name) self.progress("link", tail)
self.link(elf, objects, libraries, lib_dirs, linker_script) self.link(elf, objects, libraries, lib_dirs, linker_script)
if self.config.has_regions: if self.config.has_regions:
filename = "{}_application.{}".format(name, ext) filename = "{}_application.{}".format(tail, ext)
else: else:
filename = "{}.{}".format(name, ext) filename = "{}.{}".format(tail, ext)
full_path = join(tmp_path, filename) full_path = join(tmp_path, filename)
if ext != 'elf': if ext != 'elf':
if full_path and self.need_update(full_path, [elf]): if full_path and self.need_update(full_path, [elf]):
self.progress("elf2bin", name) self.progress("elf2bin", tail)
self.binary(r, elf, full_path) self.binary(r, elf, full_path)
if self.config.has_regions: if self.config.has_regions:
full_path, updatable = self._do_region_merge( full_path, updatable = self._do_region_merge(
name, full_path, ext tail, full_path, ext
) )
else: else:
updatable = None updatable = None
@ -794,7 +798,7 @@ class mbedToolchain:
self._get_toolchain_labels() self._get_toolchain_labels()
) )
if post_build_hook: if post_build_hook:
self.progress("post-build", name) self.progress("post-build", tail)
post_build_hook(self, r, elf, full_path) post_build_hook(self, r, elf, full_path)
# Initialize memap and process map file. This doesn't generate output. # Initialize memap and process map file. This doesn't generate output.
self.mem_stats(mapfile) self.mem_stats(mapfile)