Update to the latest west. This includes a new 'attach' command. There are also multi-repo commands, but those won't get exposed to the user unless they install Zephyr using "west init" + "west fetch" (and not, say, "git clone"). Replace the launchers; they now detect whether zephyr is part of a multi-repo installation, and run the west code in its own repository if that is the case. This also requires an update to: - the flash/debug CMakeLists.txt, as the new west package is no longer executable as a module and must have its main script run by the interpreter instead. - the documentation, to reflect a rename and with a hack to fix the automodule directive in flash-debug.rst for now Signed-off-by: Marti Bolivar <marti@foundries.io>
70 lines
2.1 KiB
Python
70 lines
2.1 KiB
Python
# Copyright (c) 2018 Open Source Foundries Limited.
|
|
#
|
|
# SPDX-License-Identifier: Apache-2.0
|
|
|
|
'''west "debug" and "debugserver" commands.'''
|
|
|
|
from textwrap import dedent
|
|
|
|
from commands.run_common import desc_common, add_parser_common, do_run_common
|
|
from commands import WestCommand
|
|
|
|
|
|
class Debug(WestCommand):
|
|
|
|
def __init__(self):
|
|
super(Debug, self).__init__(
|
|
'debug',
|
|
dedent('''
|
|
Connect to the board, program the flash, and start a
|
|
debugging session.\n\n''') +
|
|
desc_common('debug'),
|
|
accepts_unknown_args=True)
|
|
|
|
def do_add_parser(self, parser_adder):
|
|
return add_parser_common(parser_adder, self)
|
|
|
|
def do_run(self, my_args, runner_args):
|
|
do_run_common(self, my_args, runner_args,
|
|
'ZEPHYR_BOARD_DEBUG_RUNNER')
|
|
|
|
|
|
class DebugServer(WestCommand):
|
|
|
|
def __init__(self):
|
|
super(DebugServer, self).__init__(
|
|
'debugserver',
|
|
dedent('''
|
|
Connect to the board and accept debug networking connections.
|
|
|
|
The debug server binds to a known port, and allows client software
|
|
started elsewhere to connect to it and debug the running
|
|
Zephyr image.\n\n''') +
|
|
desc_common('debugserver'),
|
|
accepts_unknown_args=True)
|
|
|
|
def do_add_parser(self, parser_adder):
|
|
return add_parser_common(parser_adder, self)
|
|
|
|
def do_run(self, my_args, runner_args):
|
|
do_run_common(self, my_args, runner_args,
|
|
'ZEPHYR_BOARD_DEBUG_RUNNER')
|
|
|
|
class Attach(WestCommand):
|
|
|
|
def __init__(self):
|
|
super(Attach, self).__init__(
|
|
'attach',
|
|
dedent('''
|
|
Connect to the board without programming the flash, and
|
|
start a debugging session.\n\n''') +
|
|
desc_common('attach'),
|
|
accepts_unknown_args=True)
|
|
|
|
def do_add_parser(self, parser_adder):
|
|
return add_parser_common(parser_adder, self)
|
|
|
|
def do_run(self, my_args, runner_args):
|
|
do_run_common(self, my_args, runner_args,
|
|
'ZEPHYR_BOARD_DEBUG_RUNNER')
|