Skip to content

Commit 0cee003

Browse files
committed
Fix flash start/size in bootloader related build
This fix relies on target configuration options (mbed_rom_start/mbed_rom_size) defined to override CMSIS pack or no CMSIS pack. This is useful for a target which: 1. Doesn't support CMSIS pack, or 2. Supports TrustZone and user needs to change its flash partition
1 parent 4fcaa56 commit 0cee003

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

tools/config/__init__.py

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -575,6 +575,19 @@ def regions(self):
575575
except KeyError:
576576
raise ConfigException("Not enough information in CMSIS packs to "
577577
"build a bootloader project")
578+
579+
# Override rom_start/rom_size
580+
#
581+
# This is usually done for a target which:
582+
# 1. Doesn't support CMSIS pack, or
583+
# 2. Supports TrustZone and user needs to change its flash partition
584+
rom_start_override = getattr(self.target, "mbed_rom_start", False)
585+
if rom_start_override:
586+
rom_start = int(rom_start_override, 0)
587+
rom_size_override = getattr(self.target, "mbed_rom_size", False)
588+
if rom_size_override:
589+
rom_size = int(rom_size_override, 0)
590+
578591
if self.target.bootloader_img or self.target.restrict_size:
579592
return self._generate_bootloader_build(rom_start, rom_size)
580593
elif self.target.mbed_app_start or self.target.mbed_app_size:

0 commit comments

Comments
 (0)