This commit extends the west commands build, flash, and debug to support --domain when having multiple domains (images) defined in a domains.yaml build file. The domains.yaml uses the following yaml format to specify the build directory of each domain in the multi image build: > default: <domain-n> > domains: > <domain-1>: > build_dir: <build_dir-domain-1> > <domain-2>: > build_dir: <build_dir-domain-2> > ... `west <build|flash|debug>` has been extended to support `--domain <domain>`. `west build` calls CMake to create the build system, and if `--domain` is given, then the build tool will be invoked afterwards for the specified domain. `west flash` will default flash all domains, but `--domain <domain>` argument can be used to select a specific domain to flash, for example: > west flash --domain mcuboot `west debug` only a single domain can be debugged at any given time. If `--domain` is not specified, then the default domain specified in the domains.yml file will be used. Users can still select a different domain, for example with: > west debug --domain mcuboot Signed-off-by: Torsten Rasmussen <Torsten.Rasmussen@nordicsemi.no>
32 lines
1 KiB
Python
32 lines
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)
|
|
do_run_common(self, my_args, runner_args, domains=domains)
|