Skip to content

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

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 3 commits into from
Sep 19, 2019
Merged
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
26 changes: 15 additions & 11 deletions tools/toolchains/mbed_toolchain.py
Original file line number Diff line number Diff line change
Expand Up @@ -733,13 +733,17 @@ def link_program(self, r, tmp_path, name):
new_path = join(tmp_path, head)
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
if self.config.has_regions:
elf = join(tmp_path, name + '_application.elf')
mapfile = join(tmp_path, name + '_application.map')
elf = join(new_path, tail + '_application.elf')
mapfile = join(new_path, tail + '_application.map')
else:
elf = join(tmp_path, name + '.elf')
mapfile = join(tmp_path, name + '.map')
elf = join(new_path, tail + '.elf')
mapfile = join(new_path, tail + '.map')

objects = sorted(set(r.get_file_paths(FileType.OBJECT)))
config_file = ([self.config.app_config_location]
Expand Down Expand Up @@ -768,21 +772,21 @@ def link_program(self, r, tmp_path, name):
if exists(old_mapfile):
remove(old_mapfile)
rename(mapfile, old_mapfile)
self.progress("link", name)
self.progress("link", tail)
self.link(elf, objects, libraries, lib_dirs, linker_script)

if self.config.has_regions:
filename = "{}_application.{}".format(name, ext)
filename = "{}_application.{}".format(tail, ext)
else:
filename = "{}.{}".format(name, ext)
full_path = join(tmp_path, filename)
filename = "{}.{}".format(tail, ext)
full_path = join(new_path, filename)
if ext != '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)
if self.config.has_regions:
full_path, updatable = self._do_region_merge(
name, full_path, ext
tail, full_path, ext
)
else:
updatable = None
Expand All @@ -794,7 +798,7 @@ def link_program(self, r, tmp_path, name):
self._get_toolchain_labels()
)
if post_build_hook:
self.progress("post-build", name)
self.progress("post-build", tail)
post_build_hook(self, r, elf, full_path)
# Initialize memap and process map file. This doesn't generate output.
self.mem_stats(mapfile)
Expand Down