[tools] Fixed iterating through the available hex files

pull/406/head
0xc0170 2014-07-17 15:14:22 +02:00
parent 0e24b53599
commit e2a080bd79
1 changed files with 5 additions and 0 deletions

View File

@ -431,14 +431,19 @@ class NRF51822(Target):
@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'])