mirror of https://github.com/ARMmbed/mbed-os.git
Merge pull request #7567 from theotherjimmy/managed-update-image
Tools: Generate update images with managed bl modepull/7632/head
commit
8755e56fd6
|
|
@ -448,6 +448,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,
|
||||||
|
|
@ -534,15 +540,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 = ''
|
||||||
|
|
@ -570,8 +589,8 @@ def build_project(src_paths, build_path, target, toolchain_name,
|
||||||
cur_result["result"] = "OK"
|
cur_result["result"] = "OK"
|
||||||
cur_result["memory_usage"] = (memap_instance.mem_report
|
cur_result["memory_usage"] = (memap_instance.mem_report
|
||||||
if memap_instance is not None else None)
|
if memap_instance is not None else None)
|
||||||
cur_result["bin"] = res
|
cur_result["bin"] = res[0]
|
||||||
cur_result["elf"] = splitext(res)[0] + ".elf"
|
cur_result["elf"] = splitext(res[0])[0] + ".elf"
|
||||||
cur_result.update(toolchain.report)
|
cur_result.update(toolchain.report)
|
||||||
|
|
||||||
add_result_to_report(report, cur_result)
|
add_result_to_report(report, cur_result)
|
||||||
|
|
|
||||||
|
|
@ -273,23 +273,28 @@ 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(
|
||||||
set(test.dependencies),
|
test.source_dir,
|
||||||
linker_script=options.linker_script,
|
build_dir,
|
||||||
clean=options.clean,
|
mcu,
|
||||||
notify=notify,
|
toolchain,
|
||||||
report=build_data_blob,
|
set(test.dependencies),
|
||||||
macros=options.macros,
|
linker_script=options.linker_script,
|
||||||
jobs=options.jobs,
|
clean=options.clean,
|
||||||
name=options.artifact_name,
|
notify=notify,
|
||||||
app_config=options.app_config,
|
report=build_data_blob,
|
||||||
inc_dirs=[dirname(MBED_LIBRARIES)],
|
macros=options.macros,
|
||||||
build_profile=extract_profile(parser,
|
jobs=options.jobs,
|
||||||
options,
|
name=options.artifact_name,
|
||||||
toolchain),
|
app_config=options.app_config,
|
||||||
stats_depth=options.stats_depth,
|
inc_dirs=[dirname(MBED_LIBRARIES)],
|
||||||
ignore=options.ignore)
|
build_profile=extract_profile(parser, options, toolchain),
|
||||||
print('Image: %s'% bin_file)
|
stats_depth=options.stats_depth,
|
||||||
|
ignore=options.ignore
|
||||||
|
)
|
||||||
|
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
|
||||||
|
|
|
||||||
|
|
@ -2174,7 +2174,7 @@ def build_test_worker(*args, **kwargs):
|
||||||
del kwargs['toolchain_paths']
|
del kwargs['toolchain_paths']
|
||||||
|
|
||||||
try:
|
try:
|
||||||
bin_file = build_project(*args, **kwargs)
|
bin_file, _ = build_project(*args, **kwargs)
|
||||||
ret['result'] = True
|
ret['result'] = True
|
||||||
ret['bin_file'] = bin_file
|
ret['bin_file'] = bin_file
|
||||||
ret['kwargs'] = kwargs
|
ret['kwargs'] = kwargs
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue