mirror of https://github.com/ARMmbed/mbed-os.git
Create update images with managed bl mode
parent
4bcca894ae
commit
69203d30f1
|
@ -446,6 +446,12 @@ def merge_region_list(region_list, destination, notify, padding=b'\xFF'):
|
||||||
merged.tofile(destination, format=format.strip("."))
|
merged.tofile(destination, format=format.strip("."))
|
||||||
|
|
||||||
|
|
||||||
|
UPDATE_WHITELIST = (
|
||||||
|
"application",
|
||||||
|
"header",
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
def build_project(src_paths, build_path, target, toolchain_name,
|
def build_project(src_paths, build_path, target, toolchain_name,
|
||||||
libraries_paths=None, linker_script=None, clean=False,
|
libraries_paths=None, linker_script=None, clean=False,
|
||||||
notify=None, name=None, macros=None, inc_dirs=None, jobs=1,
|
notify=None, name=None, macros=None, inc_dirs=None, jobs=1,
|
||||||
|
@ -532,15 +538,28 @@ def build_project(src_paths, build_path, target, toolchain_name,
|
||||||
|
|
||||||
# Link Program
|
# Link Program
|
||||||
if toolchain.config.has_regions:
|
if toolchain.config.has_regions:
|
||||||
res, _ = toolchain.link_program(resources, build_path, name + "_application")
|
binary, _ = toolchain.link_program(resources, build_path, name + "_application")
|
||||||
region_list = list(toolchain.config.regions)
|
region_list = list(toolchain.config.regions)
|
||||||
region_list = [r._replace(filename=res) if r.active else r
|
region_list = [r._replace(filename=binary) if r.active else r
|
||||||
for r in region_list]
|
for r in region_list]
|
||||||
res = "%s.%s" % (join(build_path, name),
|
res = "%s.%s" % (join(build_path, name),
|
||||||
getattr(toolchain.target, "OUTPUT_EXT", "bin"))
|
getattr(toolchain.target, "OUTPUT_EXT", "bin"))
|
||||||
merge_region_list(region_list, res, notify)
|
merge_region_list(region_list, res, notify)
|
||||||
|
update_regions = [
|
||||||
|
r for r in region_list if r.name in UPDATE_WHITELIST
|
||||||
|
]
|
||||||
|
if update_regions:
|
||||||
|
update_res = "%s_update.%s" % (
|
||||||
|
join(build_path, name),
|
||||||
|
getattr(toolchain.target, "OUTPUT_EXT", "bin")
|
||||||
|
)
|
||||||
|
merge_region_list(update_regions, update_res, notify)
|
||||||
|
res = (res, update_res)
|
||||||
|
else:
|
||||||
|
res = (res, None)
|
||||||
else:
|
else:
|
||||||
res, _ = toolchain.link_program(resources, build_path, name)
|
res, _ = toolchain.link_program(resources, build_path, name)
|
||||||
|
res = (res, None)
|
||||||
|
|
||||||
memap_instance = getattr(toolchain, 'memap_instance', None)
|
memap_instance = getattr(toolchain, 'memap_instance', None)
|
||||||
memap_table = ''
|
memap_table = ''
|
||||||
|
|
|
@ -273,7 +273,11 @@ if __name__ == '__main__':
|
||||||
build_dir = options.build_dir
|
build_dir = options.build_dir
|
||||||
|
|
||||||
try:
|
try:
|
||||||
bin_file = build_project(test.source_dir, build_dir, mcu, toolchain,
|
bin_file, update_file = build_project(
|
||||||
|
test.source_dir,
|
||||||
|
build_dir,
|
||||||
|
mcu,
|
||||||
|
toolchain,
|
||||||
set(test.dependencies),
|
set(test.dependencies),
|
||||||
linker_script=options.linker_script,
|
linker_script=options.linker_script,
|
||||||
clean=options.clean,
|
clean=options.clean,
|
||||||
|
@ -284,12 +288,13 @@ if __name__ == '__main__':
|
||||||
name=options.artifact_name,
|
name=options.artifact_name,
|
||||||
app_config=options.app_config,
|
app_config=options.app_config,
|
||||||
inc_dirs=[dirname(MBED_LIBRARIES)],
|
inc_dirs=[dirname(MBED_LIBRARIES)],
|
||||||
build_profile=extract_profile(parser,
|
build_profile=extract_profile(parser, options, toolchain),
|
||||||
options,
|
|
||||||
toolchain),
|
|
||||||
stats_depth=options.stats_depth,
|
stats_depth=options.stats_depth,
|
||||||
ignore=options.ignore)
|
ignore=options.ignore
|
||||||
print('Image: %s'% bin_file)
|
)
|
||||||
|
if update_file:
|
||||||
|
print('Update Image: %s' % update_file)
|
||||||
|
print('Image: %s' % bin_file)
|
||||||
|
|
||||||
if options.disk:
|
if options.disk:
|
||||||
# Simple copy to the mbed disk
|
# Simple copy to the mbed disk
|
||||||
|
|
Loading…
Reference in New Issue