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("."))
|
||||
|
||||
|
||||
UPDATE_WHITELIST = (
|
||||
"application",
|
||||
"header",
|
||||
)
|
||||
|
||||
|
||||
def build_project(src_paths, build_path, target, toolchain_name,
|
||||
libraries_paths=None, linker_script=None, clean=False,
|
||||
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
|
||||
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 = [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]
|
||||
res = "%s.%s" % (join(build_path, name),
|
||||
getattr(toolchain.target, "OUTPUT_EXT", "bin"))
|
||||
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:
|
||||
res, _ = toolchain.link_program(resources, build_path, name)
|
||||
res = (res, None)
|
||||
|
||||
memap_instance = getattr(toolchain, 'memap_instance', None)
|
||||
memap_table = ''
|
||||
|
|
|
@ -273,23 +273,28 @@ if __name__ == '__main__':
|
|||
build_dir = options.build_dir
|
||||
|
||||
try:
|
||||
bin_file = build_project(test.source_dir, build_dir, mcu, toolchain,
|
||||
set(test.dependencies),
|
||||
linker_script=options.linker_script,
|
||||
clean=options.clean,
|
||||
notify=notify,
|
||||
report=build_data_blob,
|
||||
macros=options.macros,
|
||||
jobs=options.jobs,
|
||||
name=options.artifact_name,
|
||||
app_config=options.app_config,
|
||||
inc_dirs=[dirname(MBED_LIBRARIES)],
|
||||
build_profile=extract_profile(parser,
|
||||
options,
|
||||
toolchain),
|
||||
stats_depth=options.stats_depth,
|
||||
ignore=options.ignore)
|
||||
print('Image: %s'% bin_file)
|
||||
bin_file, update_file = build_project(
|
||||
test.source_dir,
|
||||
build_dir,
|
||||
mcu,
|
||||
toolchain,
|
||||
set(test.dependencies),
|
||||
linker_script=options.linker_script,
|
||||
clean=options.clean,
|
||||
notify=notify,
|
||||
report=build_data_blob,
|
||||
macros=options.macros,
|
||||
jobs=options.jobs,
|
||||
name=options.artifact_name,
|
||||
app_config=options.app_config,
|
||||
inc_dirs=[dirname(MBED_LIBRARIES)],
|
||||
build_profile=extract_profile(parser, options, toolchain),
|
||||
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:
|
||||
# Simple copy to the mbed disk
|
||||
|
|
Loading…
Reference in New Issue