Skip to content

Commit 46d717c

Browse files
author
Cruz Monrreal
authored
Merge pull request #8250 from theotherjimmy/fix-7723
Tools: Don't traceback on missing linker script
2 parents c40d860 + aa5d2af commit 46d717c

File tree

2 files changed

+7
-2
lines changed

2 files changed

+7
-2
lines changed

tools/build_api.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -532,6 +532,8 @@ def build_project(src_paths, build_path, target, toolchain_name,
532532
# Change linker script if specified
533533
if linker_script is not None:
534534
resources.add_file_ref(linker_script, linker_script)
535+
if not resources.get_file_refs(FileType.LD_SCRIPT):
536+
raise NotSupportedException("No Linker Script found")
535537

536538
# Compile Sources
537539
objects = toolchain.compile_sources(resources, sorted(resources.get_file_paths(FileType.INC_DIR)))

tools/toolchains/__init__.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -622,8 +622,11 @@ def link_program(self, r, tmp_path, name):
622622
objects = sorted(set(r.get_file_paths(FileType.OBJECT)))
623623
config_file = ([self.config.app_config_location]
624624
if self.config.app_config_location else [])
625-
linker_script = [path for _, path in r.get_file_refs(FileType.LD_SCRIPT)
626-
if path.endswith(self.LINKER_EXT)][-1]
625+
try:
626+
linker_script = [path for _, path in r.get_file_refs(FileType.LD_SCRIPT)
627+
if path.endswith(self.LINKER_EXT)][-1]
628+
except IndexError:
629+
raise NotSupportedException("No linker script found")
627630
lib_dirs = r.get_file_paths(FileType.LIB_DIR)
628631
libraries = [l for l in r.get_file_paths(FileType.LIB)
629632
if l.endswith(self.LIBRARY_EXT)]

0 commit comments

Comments
 (0)