@@ -938,7 +938,7 @@ class NRF51822(Target):
938938 'offset' : 0x14000
939939 }
940940 ]
941- EXPECTED_BOOTLOADER_FILENAME = "nrf51822_bootloader.hex"
941+ OVERRIDE_BOOTLOADER_FILENAME = "nrf51822_bootloader.hex"
942942 OUTPUT_EXT = 'hex'
943943 MERGE_SOFT_DEVICE = True
944944 MERGE_BOOTLOADER = False
@@ -965,21 +965,29 @@ def binary_hook(t_self, resources, elf, binf):
965965 # Scan to find the actual paths of soft device and bootloader files
966966 sdf = None
967967 blf = None
968- for hexf in resources . hex_files :
969- for softdeviceAndOffsetEntry in t_self . target . EXPECTED_SOFTDEVICES_WITH_OFFSETS :
968+ for softdeviceAndOffsetEntry in t_self . target . EXPECTED_SOFTDEVICES_WITH_OFFSETS :
969+ for hexf in resources . hex_files :
970970 if hexf .find (softdeviceAndOffsetEntry ['name' ]) != - 1 :
971971 sdf = hexf
972972 t_self .debug ("SoftDevice file found %s." % softdeviceAndOffsetEntry ['name' ])
973973
974974 # Look for bootloader file that matches this soft device
975975 if t_self .target .MERGE_BOOTLOADER is True :
976976 for hexf in resources .hex_files :
977- if hexf .find (softdeviceAndOffsetEntry ['boot' ]) != - 1 :
977+ if hexf .find (t_self .target .OVERRIDE_BOOTLOADER_FILENAME ) != - 1 :
978+ t_self .debug ("Bootloader file found %s." % t_self .target .OVERRIDE_BOOTLOADER_FILENAME )
979+ blf = hexf
980+ break
981+ elif hexf .find (softdeviceAndOffsetEntry ['boot' ]) != - 1 :
978982 t_self .debug ("Bootloader file found %s." % softdeviceAndOffsetEntry ['boot' ])
979983 blf = hexf
980984 break
981985 break
982986
987+ if sdf is not None : break
988+
989+ if sdf is not None : break
990+
983991 if sdf is None :
984992 t_self .debug ("Hex file not found. Aborting." )
985993 return
@@ -995,7 +1003,7 @@ def binary_hook(t_self, resources, elf, binf):
9951003 binh .merge (sdh )
9961004
9971005 if t_self .target .MERGE_BOOTLOADER is True and blf is not None :
998- t_self .debug ("Merge BootLoader file %s" % t_self . target . EXPECTED_BOOTLOADER_FILENAME )
1006+ t_self .debug ("Merge BootLoader file %s" % blf )
9991007 blh = IntelHex (blf )
10001008 binh .merge (blh )
10011009
0 commit comments