mirror of https://github.com/ARMmbed/mbed-os.git
Fix remaining issues in targets.py
parent
3f9bedbdd9
commit
7b7ca84ab3
|
@ -110,7 +110,7 @@ class Target(object):
|
||||||
parent's parent at level 2 and so on)
|
parent's parent at level 2 and so on)
|
||||||
"""
|
"""
|
||||||
# the resolution order can't contain duplicate target names
|
# the resolution order can't contain duplicate target names
|
||||||
if not target_name in [l[0] for l in order]:
|
if target_name not in [l[0] for l in order]:
|
||||||
order.append((target_name, level))
|
order.append((target_name, level))
|
||||||
parents = self.get_json_target_data()[target_name].get("inherits", [])
|
parents = self.get_json_target_data()[target_name].get("inherits", [])
|
||||||
for par in parents:
|
for par in parents:
|
||||||
|
@ -186,7 +186,7 @@ class Target(object):
|
||||||
else:
|
else:
|
||||||
name_def_map[crtv] = crtv
|
name_def_map[crtv] = crtv
|
||||||
for element in data[attrname + "_remove"]:
|
for element in data[attrname + "_remove"]:
|
||||||
if not element in name_def_map:
|
if element not in name_def_map:
|
||||||
raise ValueError(
|
raise ValueError(
|
||||||
("Unable to remove '%s' in '%s.%s' since "
|
("Unable to remove '%s' in '%s.%s' since "
|
||||||
% (element, self.name, attrname)) +
|
% (element, self.name, attrname)) +
|
||||||
|
@ -277,7 +277,7 @@ class Target(object):
|
||||||
labels = [self.name] + CORE_LABELS[self.core] + self.extra_labels
|
labels = [self.name] + CORE_LABELS[self.core] + self.extra_labels
|
||||||
# Automatically define UVISOR_UNSUPPORTED if the target doesn't
|
# Automatically define UVISOR_UNSUPPORTED if the target doesn't
|
||||||
# specifically define UVISOR_SUPPORTED
|
# specifically define UVISOR_SUPPORTED
|
||||||
if not "UVISOR_SUPPORTED" in labels:
|
if "UVISOR_SUPPORTED" not in labels:
|
||||||
labels.append("UVISOR_UNSUPPORTED")
|
labels.append("UVISOR_UNSUPPORTED")
|
||||||
return labels
|
return labels
|
||||||
|
|
||||||
|
@ -357,7 +357,8 @@ class LPC4088Code(object):
|
||||||
outbin.write(data)
|
outbin.write(data)
|
||||||
outbin.write('\xFF' * (512*1024 - len(data)))
|
outbin.write('\xFF' * (512*1024 - len(data)))
|
||||||
partf.close()
|
partf.close()
|
||||||
# Read and append the second part (external flash) in chunks of fixed size
|
# Read and append the second part (external flash) in chunks of fixed
|
||||||
|
# size
|
||||||
chunksize = 128 * 1024
|
chunksize = 128 * 1024
|
||||||
partf = open(os.path.join(binf, "ER_IROM2"), "rb")
|
partf = open(os.path.join(binf, "ER_IROM2"), "rb")
|
||||||
while True:
|
while True:
|
||||||
|
@ -389,7 +390,7 @@ class TEENSY3_1Code(object):
|
||||||
class MTSCode(object):
|
class MTSCode(object):
|
||||||
"""Generic MTS code"""
|
"""Generic MTS code"""
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def _combine_bins_helper(target_name, t_self, resources, elf, binf):
|
def _combine_bins_helper(target_name, binf):
|
||||||
"""combine bins with the bootloader for a particular target"""
|
"""combine bins with the bootloader for a particular target"""
|
||||||
loader = os.path.join(TOOLS_BOOTLOADERS, target_name, "bootloader.bin")
|
loader = os.path.join(TOOLS_BOOTLOADERS, target_name, "bootloader.bin")
|
||||||
target = binf + ".tmp"
|
target = binf + ".tmp"
|
||||||
|
@ -418,19 +419,17 @@ class MTSCode(object):
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def combine_bins_mts_dot(t_self, resources, elf, binf):
|
def combine_bins_mts_dot(t_self, resources, elf, binf):
|
||||||
"""A hook for the MTS MDOT"""
|
"""A hook for the MTS MDOT"""
|
||||||
MTSCode._combine_bins_helper("MTS_MDOT_F411RE", t_self, resources, elf,
|
MTSCode._combine_bins_helper("MTS_MDOT_F411RE", binf)
|
||||||
binf)
|
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def combine_bins_mts_dragonfly(t_self, resources, elf, binf):
|
def combine_bins_mts_dragonfly(t_self, resources, elf, binf):
|
||||||
"""A hoof for the MTS Dragonfly"""
|
"""A hoof for the MTS Dragonfly"""
|
||||||
MTSCode._combine_bins_helper("MTS_DRAGONFLY_F411RE", t_self, resources,
|
MTSCode._combine_bins_helper("MTS_DRAGONFLY_F411RE", binf)
|
||||||
elf, binf)
|
|
||||||
|
|
||||||
class MCU_NRF51Code(object):
|
class MCU_NRF51Code(object):
|
||||||
"""NRF51 Hooks"""
|
"""NRF51 Hooks"""
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def binary_hook(t_self, resources, elf, binf):
|
def binary_hook(t_self, resources, _, binf):
|
||||||
"""Hook that merges the soft device with the bin file"""
|
"""Hook that merges the soft device with the bin file"""
|
||||||
# Scan to find the actual paths of soft device
|
# Scan to find the actual paths of soft device
|
||||||
sdf = None
|
sdf = None
|
||||||
|
@ -519,9 +518,9 @@ def set_targets_json_location(location=None):
|
||||||
# re-initialization does not create new variables, it keeps the old ones
|
# re-initialization does not create new variables, it keeps the old ones
|
||||||
# instead. This ensures compatibility with code that does
|
# instead. This ensures compatibility with code that does
|
||||||
# "from tools.targets import TARGET_NAMES"
|
# "from tools.targets import TARGET_NAMES"
|
||||||
TARGETS[:] = [Target.get_target(name) for name, value
|
TARGETS[:] = [Target.get_target(target) for target, obj
|
||||||
in Target.get_json_target_data().items()
|
in Target.get_json_target_data().items()
|
||||||
if value.get("public", True)]
|
if obj.get("public", True)]
|
||||||
TARGET_MAP.clear()
|
TARGET_MAP.clear()
|
||||||
TARGET_MAP.update(dict([(target.name, target) for target in TARGETS]))
|
TARGET_MAP.update(dict([(target.name, target) for target in TARGETS]))
|
||||||
TARGET_NAMES[:] = TARGET_MAP.keys()
|
TARGET_NAMES[:] = TARGET_MAP.keys()
|
||||||
|
|
Loading…
Reference in New Issue