Skip to content

Commit 43cf16d

Browse files
author
Cruz Monrreal
authored
Merge pull request #8167 from JammuKekkonen/change_update_format_to_binary
Change update file format to binary for all targets
2 parents 866018b + 49572d5 commit 43cf16d

File tree

3 files changed

+11
-10
lines changed

3 files changed

+11
-10
lines changed

tools/build_api.py

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@
3636
from .arm_pack_manager import Cache
3737
from .utils import (mkdir, run_cmd, run_cmd_ext, NotSupportedException,
3838
ToolException, InvalidReleaseTargetException,
39-
intelhex_offset, integer)
39+
intelhex_offset, integer, generate_update_filename)
4040
from .paths import (MBED_CMSIS_PATH, MBED_TARGETS_PATH, MBED_LIBRARIES,
4141
MBED_HEADER, MBED_DRIVERS, MBED_PLATFORM, MBED_HAL,
4242
MBED_CONFIG_FILE, MBED_LIBRARIES_DRIVERS,
@@ -550,10 +550,7 @@ def build_project(src_paths, build_path, target, toolchain_name,
550550
r for r in region_list if r.name in UPDATE_WHITELIST
551551
]
552552
if update_regions:
553-
update_res = "%s_update.%s" % (
554-
join(build_path, name),
555-
getattr(toolchain.target, "OUTPUT_EXT", "bin")
556-
)
553+
update_res = join(build_path, generate_update_filename(name, toolchain.target))
557554
merge_region_list(update_regions, update_res, notify)
558555
res = (res, update_res)
559556
else:

tools/device_management.py

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,8 @@
3131
import colorama
3232
colorama.init()
3333

34+
from utils import (generate_update_filename)
35+
3436

3537
LOG = logging.getLogger(__name__)
3638
LOG_FORMAT = '[%(levelname)s] %(asctime)s - %(name)s - %(message)s'
@@ -78,10 +80,7 @@ def inner(options):
7880
sources = options.source_dir or ['.']
7981
config = Config(mcus[0], sources)
8082
app_name = config.name or basename(abspath(sources[0]))
81-
output_ext = getattr(config.target, "OUTPUT_EXT", "bin")
82-
payload_name = join(options.build, "{}_application.{}".format(
83-
app_name, output_ext
84-
))
83+
payload_name = join(options.build, generate_update_filename(app_name, config.target))
8584
options.payload = open(payload_name, "rb")
8685
return func(options)
8786
return inner

tools/utils.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -544,10 +544,15 @@ def intelhex_offset(filename, offset):
544544
% filename)
545545
return ih
546546

547-
548547
def integer(maybe_string, base):
549548
"""Make an integer of a number or a string"""
550549
if isinstance(maybe_string, int):
551550
return maybe_string
552551
else:
553552
return int(maybe_string, base)
553+
554+
def generate_update_filename(name, target):
555+
return "%s_update.%s" % (
556+
name,
557+
getattr(target, "OUTPUT_EXT_UPDATE", "bin")
558+
)

0 commit comments

Comments
 (0)