zephyr/scripts/west_commands/flash.py
Grzegorz Swiderski 05d7769073 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-27 17:49:12 +02:00

34 lines
1.1 KiB
Python

# Copyright (c) 2018 Open Source Foundries Limited.
# Copyright 2019 Foundries.io
# Copyright (c) 2020 Nordic Semiconductor ASA
#
# SPDX-License-Identifier: Apache-2.0
'''west "flash" command'''
from west.commands import WestCommand
from run_common import add_parser_common, do_run_common, get_build_dir
from build_helpers import load_domains
class Flash(WestCommand):
def __init__(self):
super(Flash, self).__init__(
'flash',
# Keep this in sync with the string in west-commands.yml.
'flash and run a binary on a board',
"Permanently reprogram a board's flash with a new binary.",
accepts_unknown_args=True)
self.runner_key = 'flash-runner' # in runners.yaml
def do_add_parser(self, parser_adder):
return add_parser_common(self, parser_adder)
def do_run(self, my_args, runner_args):
build_dir = get_build_dir(my_args)
domains = load_domains(build_dir).get_domains(my_args.domain,
default_flash_order=True)
do_run_common(self, my_args, runner_args, domains=domains)