Skip to content

Tools: Don't traceback on missing linker script #8250

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 2 commits into from
Oct 22, 2018
Merged
Show file tree
Hide file tree
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
2 changes: 2 additions & 0 deletions tools/build_api.py
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
Expand Up @@ -620,8 +620,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