Skip to content

Commit

Permalink
Merge pull request #8250 from theotherjimmy/fix-7723
Browse files Browse the repository at this point in the history
Tools: Don't traceback on missing linker script
  • Loading branch information
Cruz Monrreal committed Oct 22, 2018
2 parents c40d860 + aa5d2af commit 46d717c
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
2 changes: 2 additions & 0 deletions tools/build_api.py
Expand Up @@ -532,6 +532,8 @@ def build_project(src_paths, build_path, target, toolchain_name,
# Change linker script if specified
if linker_script is not None:
resources.add_file_ref(linker_script, linker_script)
if not resources.get_file_refs(FileType.LD_SCRIPT):
raise NotSupportedException("No Linker Script found")

# Compile Sources
objects = toolchain.compile_sources(resources, sorted(resources.get_file_paths(FileType.INC_DIR)))
Expand Down
7 changes: 5 additions & 2 deletions tools/toolchains/__init__.py
Expand Up @@ -622,8 +622,11 @@ def link_program(self, r, tmp_path, name):
objects = sorted(set(r.get_file_paths(FileType.OBJECT)))
config_file = ([self.config.app_config_location]
if self.config.app_config_location else [])
linker_script = [path for _, path in r.get_file_refs(FileType.LD_SCRIPT)
if path.endswith(self.LINKER_EXT)][-1]
try:
linker_script = [path for _, path in r.get_file_refs(FileType.LD_SCRIPT)
if path.endswith(self.LINKER_EXT)][-1]
except IndexError:
raise NotSupportedException("No linker script found")
lib_dirs = r.get_file_paths(FileType.LIB_DIR)
libraries = [l for l in r.get_file_paths(FileType.LIB)
if l.endswith(self.LIBRARY_EXT)]
Expand Down

0 comments on commit 46d717c

Please sign in to comment.