Skip to content

Commit 7f0ed3b

Browse files
Merge pull request #4136 from theotherjimmy/bootlader-exists
Error when bootloader is specified but does not exist
2 parents d123ee1 + 8048ec3 commit 7f0ed3b

File tree

4 files changed

+18
-1
lines changed

4 files changed

+18
-1
lines changed

tools/build_api.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -145,6 +145,8 @@ def get_config(src_paths, target, toolchain_name):
145145

146146
prev_features = features
147147
toolchain.config.validate_config()
148+
if toolchain.config.has_regions:
149+
_ = list(toolchain.config.regions)
148150

149151
cfg, macros = toolchain.config.get_config_data()
150152
features = toolchain.config.get_features()

tools/config/__init__.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717

1818
from copy import deepcopy
1919
import os
20-
from os.path import dirname, abspath
20+
from os.path import dirname, abspath, exists
2121
import sys
2222
from collections import namedtuple
2323
from os.path import splitext
@@ -506,6 +506,8 @@ def regions(self):
506506
"build a bootloader project")
507507
if 'target.bootloader_img' in target_overrides:
508508
filename = target_overrides['target.bootloader_img']
509+
if not exists(filename):
510+
raise ConfigException("Bootloader %s not found" % filename)
509511
part = intelhex_offset(filename, offset=rom_start)
510512
if part.minaddr() != rom_start:
511513
raise ConfigException("bootloader executable does not "
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
{
2+
"target_overrides": {
3+
"K64F": {
4+
"target.bootloader_img": "does_not_exists.bin"
5+
}
6+
}
7+
}
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
expected_results = {
2+
"K64F": {
3+
"desc": "error when bootloader not found",
4+
"exception_msg": "not found"
5+
}
6+
}

0 commit comments

Comments
 (0)