tools, NRF51-post-build: Use paths to hex files

### Description

The NRF51 post build hook finds it's hex files using the Resources
object. This PR fixes the corner case where the hex files within a
project have a name!=path (This really only happens online).

### Pull request type

    [x] Fix
    [ ] Refactor
    [ ] Target update
    [ ] Functionality change
    [ ] Breaking change
pull/8275/head
Jimmy Brisson 2018-09-27 14:44:19 -05:00
parent 6b85ec7c57
commit 080c72bb47
1 changed files with 3 additions and 2 deletions

View File

@ -25,6 +25,7 @@ import sys
from copy import copy from copy import copy
from inspect import getmro from inspect import getmro
from collections import namedtuple, Mapping from collections import namedtuple, Mapping
from tools.resources import FileType
from tools.targets.LPC import patch from tools.targets.LPC import patch
from tools.paths import TOOLS_BOOTLOADERS from tools.paths import TOOLS_BOOTLOADERS
from tools.utils import json_file_to_dict from tools.utils import json_file_to_dict
@ -481,7 +482,7 @@ class MCU_NRF51Code(object):
sdf = None sdf = None
for softdevice_and_offset_entry\ for softdevice_and_offset_entry\
in t_self.target.EXPECTED_SOFTDEVICES_WITH_OFFSETS: in t_self.target.EXPECTED_SOFTDEVICES_WITH_OFFSETS:
for hexf in resources.hex_files: for hexf in resources.get_file_paths(FileType.HEX):
if hexf.find(softdevice_and_offset_entry['name']) != -1: if hexf.find(softdevice_and_offset_entry['name']) != -1:
t_self.notify.debug("SoftDevice file found %s." t_self.notify.debug("SoftDevice file found %s."
% softdevice_and_offset_entry['name']) % softdevice_and_offset_entry['name'])
@ -500,7 +501,7 @@ class MCU_NRF51Code(object):
# override image # override image
blf = None blf = None
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.get_file_paths(FileType.HEX):
if hexf.find(t_self.target.OVERRIDE_BOOTLOADER_FILENAME) != -1: if hexf.find(t_self.target.OVERRIDE_BOOTLOADER_FILENAME) != -1:
t_self.notify.debug("Bootloader file found %s." t_self.notify.debug("Bootloader file found %s."
% t_self.target.OVERRIDE_BOOTLOADER_FILENAME) % t_self.target.OVERRIDE_BOOTLOADER_FILENAME)