Merge pull request #8250 from theotherjimmy/fix-7723

Tools: Don't traceback on missing linker script
pull/8495/head
Cruz Monrreal 2018-10-22 11:30:50 -05:00 committed by GitHub
commit 46d717cf18
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 7 additions and 2 deletions

View File

@ -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)))

View File

@ -622,8 +622,11 @@ class mbedToolchain:
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)]