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
pull/7133/head
ccli8 2018-06-05 15:08:50 +08:00
parent 4fcaa56b77
commit 0cee003bd9
1 changed files with 13 additions and 0 deletions

View File

@ -575,6 +575,19 @@ class Config(object):
except KeyError:
raise ConfigException("Not enough information in CMSIS packs to "
"build a bootloader project")
# Override rom_start/rom_size
#
# This is usually done for a target which:
# 1. Doesn't support CMSIS pack, or
# 2. Supports TrustZone and user needs to change its flash partition
rom_start_override = getattr(self.target, "mbed_rom_start", False)
if rom_start_override:
rom_start = int(rom_start_override, 0)
rom_size_override = getattr(self.target, "mbed_rom_size", False)
if rom_size_override:
rom_size = int(rom_size_override, 0)
if self.target.bootloader_img or self.target.restrict_size:
return self._generate_bootloader_build(rom_start, rom_size)
elif self.target.mbed_app_start or self.target.mbed_app_size: