zephyr/scripts/meta/west/runner/xtensa.py
Marti Bolivar 9e7d16acd9 scripts: make runner a west subpackage
This is a stepping-stone to adding runner functionality into west
itself.

Since all of the runner tools assume a Zephyr build directory layout,
this doesn't put anything generic into a Zephyr-specific tool.

Make minimal adjustments to zephyr_flash_debug.py to keep existing
build system targets working unmodified.

Signed-off-by: Marti Bolivar <marti@opensourcefoundries.com>
2018-05-19 07:01:39 +03:00

41 lines
1.1 KiB
Python

# Copyright (c) 2017 Linaro Limited.
#
# SPDX-License-Identifier: Apache-2.0
'''Runner for debugging with xt-gdb.'''
from os import path
from .core import ZephyrBinaryRunner, RunnerCaps
class XtensaBinaryRunner(ZephyrBinaryRunner):
'''Runner front-end for xt-gdb.'''
def __init__(self, gdb, elf_name, debug=False):
super(XtensaBinaryRunner, self).__init__(debug=debug)
self.gdb_cmd = [gdb]
self.elf_name = elf_name
@classmethod
def name(cls):
return 'xtensa'
@classmethod
def capabilities(cls):
return RunnerCaps(commands={'debug'})
@classmethod
def do_add_parser(cls, parser):
parser.add_argument('--xcc-tools', required=True,
help='path to XTensa tools')
@classmethod
def create_from_args(command, args):
xt_gdb = path.join(args.xcc_tools, 'bin', 'xt-gdb')
return XtensaBinaryRunner(xt_gdb, args.kernel_elf, args.verbose)
def do_run(self, command, **kwargs):
gdb_cmd = (self.gdb_cmd + [self.elf_name])
self.check_call(gdb_cmd)