2019-01-23 16:31:06 +01:00
|
|
|
# Copyright (c) 2018 Open Source Foundries Limited.
|
|
|
|
# Copyright 2019 Foundries.io
|
2020-02-10 15:40:29 +01:00
|
|
|
# Copyright (c) 2020 Nordic Semiconductor ASA
|
2019-01-23 16:31:06 +01:00
|
|
|
#
|
|
|
|
# SPDX-License-Identifier: Apache-2.0
|
|
|
|
|
|
|
|
'''west "flash" command'''
|
|
|
|
|
|
|
|
from west.commands import WestCommand
|
|
|
|
|
2021-11-22 10:29:56 +01:00
|
|
|
from run_common import add_parser_common, do_run_common, get_build_dir
|
|
|
|
from build_helpers import load_domains
|
2019-01-23 16:31:06 +01:00
|
|
|
|
|
|
|
|
|
|
|
class Flash(WestCommand):
|
|
|
|
|
|
|
|
def __init__(self):
|
|
|
|
super(Flash, self).__init__(
|
|
|
|
'flash',
|
2019-01-28 18:45:02 +01:00
|
|
|
# Keep this in sync with the string in west-commands.yml.
|
2019-01-23 16:31:06 +01:00
|
|
|
'flash and run a binary on a board',
|
2020-06-25 21:58:58 +02:00
|
|
|
"Permanently reprogram a board's flash with a new binary.",
|
2019-01-23 16:31:06 +01:00
|
|
|
accepts_unknown_args=True)
|
2020-02-10 15:40:29 +01:00
|
|
|
self.runner_key = 'flash-runner' # in runners.yaml
|
2019-01-23 16:31:06 +01:00
|
|
|
|
|
|
|
def do_add_parser(self, parser_adder):
|
2020-02-10 15:40:29 +01:00
|
|
|
return add_parser_common(self, parser_adder)
|
2019-01-23 16:31:06 +01:00
|
|
|
|
|
|
|
def do_run(self, my_args, runner_args):
|
2021-11-22 10:29:56 +01:00
|
|
|
build_dir = get_build_dir(my_args)
|
sysbuild: Do not exclude images from domains.yaml
The recent support for BUILD_ONLY images was implemented by excluding
them from `domains.yaml`, in order to crudely prevent them from being
picked up by `west flash`. Arguably, this is incorrect or unexpected,
because the sysbuild documentation defines a "domain" as:
Every Zephyr CMake build system managed by sysbuild.
Another consequence is that, given a build-only `<image>`, this makes it
impossible to pass `--domain <image>` to `west flash`, `west debug`, and
ironically `west build`.
To fix that, `domains.yaml` should again represent all domains, and the
build-only ones should be indicated in another way. Enter `flash_order`:
a new top-level key in the domains YAML schema. It contains the default
sequence of images used by `west flash`, where the build-only images are
excluded, and the order is influenced by `sysbuild_add_dependencies()`.
Signed-off-by: Grzegorz Swiderski <grzegorz.swiderski@nordicsemi.no>
2023-09-25 12:45:10 +02:00
|
|
|
domains = load_domains(build_dir).get_domains(my_args.domain,
|
|
|
|
default_flash_order=True)
|
2021-11-22 10:29:56 +01:00
|
|
|
do_run_common(self, my_args, runner_args, domains=domains)
|