mirror of https://github.com/ARMmbed/mbed-os.git
Merge pull request #6017 from theotherjimmy/bl-nonzero-rom
Correct auto-sizing last region of blpull/6042/head
commit
e9fddb6eee
|
@ -570,6 +570,7 @@ class Config(object):
|
||||||
|
|
||||||
def _generate_bootloader_build(self, rom_start, rom_size):
|
def _generate_bootloader_build(self, rom_start, rom_size):
|
||||||
start = rom_start
|
start = rom_start
|
||||||
|
rom_end = rom_start + rom_size
|
||||||
if self.target.bootloader_img:
|
if self.target.bootloader_img:
|
||||||
if isabs(self.target.bootloader_img):
|
if isabs(self.target.bootloader_img):
|
||||||
filename = self.target.bootloader_img
|
filename = self.target.bootloader_img
|
||||||
|
@ -592,10 +593,10 @@ class Config(object):
|
||||||
new_size = Config._align_floor(start + new_size, self.sectors) - start
|
new_size = Config._align_floor(start + new_size, self.sectors) - start
|
||||||
yield Region("application", start, new_size, True, None)
|
yield Region("application", start, new_size, True, None)
|
||||||
start += new_size
|
start += new_size
|
||||||
yield Region("post_application", start, rom_size - start,
|
yield Region("post_application", start, rom_end - start,
|
||||||
False, None)
|
False, None)
|
||||||
else:
|
else:
|
||||||
yield Region("application", start, rom_size - start,
|
yield Region("application", start, rom_end - start,
|
||||||
True, None)
|
True, None)
|
||||||
if start > rom_start + rom_size:
|
if start > rom_start + rom_size:
|
||||||
raise ConfigException("Not enough memory on device to fit all "
|
raise ConfigException("Not enough memory on device to fit all "
|
||||||
|
|
|
@ -174,3 +174,25 @@ def test_init_override_app_config(target):
|
||||||
|
|
||||||
mock_json_file_to_dict.assert_any_call(app_config)
|
mock_json_file_to_dict.assert_any_call(app_config)
|
||||||
assert config.app_config_data == mock_return
|
assert config.app_config_data == mock_return
|
||||||
|
|
||||||
|
@pytest.mark.parametrize("target", ["K64F", "UBLOX_EVK_ODIN_W2"])
|
||||||
|
@pytest.mark.parametrize("overrides", [
|
||||||
|
{},
|
||||||
|
{"restrict_size": "0x200"},
|
||||||
|
{"mbed_app_start": "0x200"}
|
||||||
|
])
|
||||||
|
def test_basic_regions(target, overrides):
|
||||||
|
"""
|
||||||
|
Test that the region lists are sane with various configurations
|
||||||
|
"""
|
||||||
|
set_targets_json_location()
|
||||||
|
config = Config(target)
|
||||||
|
for o, v in overrides.items():
|
||||||
|
setattr(config.target, o, v)
|
||||||
|
try:
|
||||||
|
if config.has_regions:
|
||||||
|
regions = list(config.regions)
|
||||||
|
for r in regions:
|
||||||
|
assert r.size >= 0
|
||||||
|
except ConfigException:
|
||||||
|
pass
|
||||||
|
|
Loading…
Reference in New Issue