Support multiple SoftDevices for NRF51822 based platforms

pull/1256/head
Mihail Stoyanov 2015-07-22 15:08:46 +03:00
parent 49dbe0c6cc
commit 9cc84bb8c4
1 changed files with 13 additions and 5 deletions

View File

@ -938,7 +938,7 @@ class NRF51822(Target):
'offset' : 0x14000 'offset' : 0x14000
} }
] ]
EXPECTED_BOOTLOADER_FILENAME = "nrf51822_bootloader.hex" OVERRIDE_BOOTLOADER_FILENAME = "nrf51822_bootloader.hex"
OUTPUT_EXT = 'hex' OUTPUT_EXT = 'hex'
MERGE_SOFT_DEVICE = True MERGE_SOFT_DEVICE = True
MERGE_BOOTLOADER = False MERGE_BOOTLOADER = False
@ -965,8 +965,8 @@ class NRF51822(Target):
# Scan to find the actual paths of soft device and bootloader files # Scan to find the actual paths of soft device and bootloader files
sdf = None sdf = None
blf = None blf = None
for hexf in resources.hex_files:
for softdeviceAndOffsetEntry in t_self.target.EXPECTED_SOFTDEVICES_WITH_OFFSETS: for softdeviceAndOffsetEntry in t_self.target.EXPECTED_SOFTDEVICES_WITH_OFFSETS:
for hexf in resources.hex_files:
if hexf.find(softdeviceAndOffsetEntry['name']) != -1: if hexf.find(softdeviceAndOffsetEntry['name']) != -1:
sdf = hexf sdf = hexf
t_self.debug("SoftDevice file found %s." % softdeviceAndOffsetEntry['name']) t_self.debug("SoftDevice file found %s." % softdeviceAndOffsetEntry['name'])
@ -974,12 +974,20 @@ class NRF51822(Target):
# Look for bootloader file that matches this soft device # Look for bootloader file that matches this soft device
if t_self.target.MERGE_BOOTLOADER is True: if t_self.target.MERGE_BOOTLOADER is True:
for hexf in resources.hex_files: for hexf in resources.hex_files:
if hexf.find(softdeviceAndOffsetEntry['boot']) != -1: if hexf.find(t_self.target.OVERRIDE_BOOTLOADER_FILENAME) != -1:
t_self.debug("Bootloader file found %s." % t_self.target.OVERRIDE_BOOTLOADER_FILENAME)
blf = hexf
break
elif hexf.find(softdeviceAndOffsetEntry['boot']) != -1:
t_self.debug("Bootloader file found %s." % softdeviceAndOffsetEntry['boot']) t_self.debug("Bootloader file found %s." % softdeviceAndOffsetEntry['boot'])
blf = hexf blf = hexf
break break
break break
if sdf is not None: break
if sdf is not None: break
if sdf is None: if sdf is None:
t_self.debug("Hex file not found. Aborting.") t_self.debug("Hex file not found. Aborting.")
return return
@ -995,7 +1003,7 @@ class NRF51822(Target):
binh.merge(sdh) binh.merge(sdh)
if t_self.target.MERGE_BOOTLOADER is True and blf is not None: if t_self.target.MERGE_BOOTLOADER is True and blf is not None:
t_self.debug("Merge BootLoader file %s" % t_self.target.EXPECTED_BOOTLOADER_FILENAME) t_self.debug("Merge BootLoader file %s" % blf)
blh = IntelHex(blf) blh = IntelHex(blf)
binh.merge(blh) binh.merge(blh)