Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Change update file format to binary for all targets #8167

Merged
merged 1 commit into from
Oct 8, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 2 additions & 5 deletions tools/build_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@
from .arm_pack_manager import Cache
from .utils import (mkdir, run_cmd, run_cmd_ext, NotSupportedException,
ToolException, InvalidReleaseTargetException,
intelhex_offset, integer)
intelhex_offset, integer, generate_update_filename)
from .paths import (MBED_CMSIS_PATH, MBED_TARGETS_PATH, MBED_LIBRARIES,
MBED_HEADER, MBED_DRIVERS, MBED_PLATFORM, MBED_HAL,
MBED_CONFIG_FILE, MBED_LIBRARIES_DRIVERS,
Expand Down Expand Up @@ -550,10 +550,7 @@ def build_project(src_paths, build_path, target, toolchain_name,
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")
)
update_res = join(build_path, generate_update_filename(name, toolchain.target))
merge_region_list(update_regions, update_res, notify)
res = (res, update_res)
else:
Expand Down
7 changes: 3 additions & 4 deletions tools/device_management.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,8 @@
import colorama
colorama.init()

from utils import (generate_update_filename)


LOG = logging.getLogger(__name__)
LOG_FORMAT = '[%(levelname)s] %(asctime)s - %(name)s - %(message)s'
Expand Down Expand Up @@ -69,10 +71,7 @@ def inner(options):
sources = options.source_dir or ['.']
config = Config(mcus[0], sources)
app_name = config.name or basename(abspath(sources[0]))
output_ext = getattr(config.target, "OUTPUT_EXT", "bin")
payload_name = join(options.build, "{}_application.{}".format(
app_name, output_ext
))
payload_name = join(options.build, generate_update_filename(app_name, config.target))
options.payload = open(payload_name, "rb")
return func(options)
return inner
Expand Down
7 changes: 6 additions & 1 deletion tools/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -544,10 +544,15 @@ def intelhex_offset(filename, offset):
% filename)
return ih


def integer(maybe_string, base):
"""Make an integer of a number or a string"""
if isinstance(maybe_string, int):
return maybe_string
else:
return int(maybe_string, base)

def generate_update_filename(name, target):
return "%s_update.%s" % (
name,
getattr(target, "OUTPUT_EXT_UPDATE", "bin")
)