[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 @staticmethod
def binary_hook(t_self, resources, elf, binf): def binary_hook(t_self, resources, elf, binf):
for hexf in resources.hex_files: for hexf in resources.hex_files:
found = False
for softdeviceAndOffsetEntry in NRF51822.EXPECTED_SOFTDEVICES_WITH_OFFSETS: for softdeviceAndOffsetEntry in NRF51822.EXPECTED_SOFTDEVICES_WITH_OFFSETS:
if hexf.find(softdeviceAndOffsetEntry['name']) != -1: if hexf.find(softdeviceAndOffsetEntry['name']) != -1:
found = True
break break
if found:
break
else: else:
t_self.debug("Hex file not found. Aborting.") t_self.debug("Hex file not found. Aborting.")
return return
# Merge user code with softdevice # Merge user code with softdevice
t_self.debug("Patching Hex file %s" % softdeviceAndOffsetEntry['name'])
from intelhex import IntelHex from intelhex import IntelHex
binh = IntelHex() binh = IntelHex()
binh.loadbin(binf, offset=softdeviceAndOffsetEntry['offset']) binh.loadbin(binf, offset=softdeviceAndOffsetEntry['offset'])