Skip to content

[tools] Fixed iterating through the available hex files #406

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 1 commit into from
Jul 17, 2014
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
5 changes: 5 additions & 0 deletions workspace_tools/targets.py
Original file line number Diff line number Diff line change
Expand Up @@ -431,14 +431,19 @@ def init_hooks(self, hook, toolchain_name):
@staticmethod
def binary_hook(t_self, resources, elf, binf):
for hexf in resources.hex_files:
found = False
for softdeviceAndOffsetEntry in NRF51822.EXPECTED_SOFTDEVICES_WITH_OFFSETS:
if hexf.find(softdeviceAndOffsetEntry['name']) != -1:
found = True
break
if found:
break
else:
t_self.debug("Hex file not found. Aborting.")
return

# Merge user code with softdevice
t_self.debug("Patching Hex file %s" % softdeviceAndOffsetEntry['name'])
from intelhex import IntelHex
binh = IntelHex()
binh.loadbin(binf, offset=softdeviceAndOffsetEntry['offset'])
Expand Down