Skip to content

Commit bdf13cb

Browse files
authored
Merge pull request #4061 from theotherjimmy/better-bootloader-warning
Improve error messages for bootloader build errors
2 parents f06efa2 + 9bc054a commit bdf13cb

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

tools/config.py

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -479,7 +479,15 @@ def regions(self):
479479
"""Generate a list of regions from the config"""
480480
if not self.target.bootloader_supported:
481481
raise ConfigException("Bootloader not supported on this target.")
482-
cmsis_part = Cache(False, False).index[self.target.device_name]
482+
if not hasattr(self.target, "device_name"):
483+
raise ConfigException("Bootloader not supported on this target: "
484+
"targets.json `device_name` not specified.")
485+
cache = Cache(False, False)
486+
if self.target.device_name not in cache.index:
487+
raise ConfigException("Bootloader not supported on this target: "
488+
"targets.json `device_name` not found in "
489+
"arm_pack_manager index.")
490+
cmsis_part = cache.index[self.target.device_name]
483491
start = 0
484492
target_overrides = self.app_config_data['target_overrides'].get(
485493
self.target.name, {})

0 commit comments

Comments
 (0)