board: arc: Switch to generic OpenOCD runner

We used to use "em-starterkit" runner for ARC which is
basically heavy-modified "openocd" runner tweaked to
use GDB for loading and starting Elf files.

Now when loading and running Elf files is possible with generic
"openocd" runner we may us it. So we switch and get rid of
"em-starterkit" as well since we no longer need it.

Signed-off-by: Alexey Brodkin <abrodkin@synopsys.com>
This commit is contained in:
Alexey Brodkin 2020-02-07 12:28:32 +03:00 committed by Johan Hedberg
commit 5bd2857c73
8 changed files with 5 additions and 128 deletions

View file

@ -1,6 +1,3 @@
# SPDX-License-Identifier: Apache-2.0
# TODO: can this board just use the usual openocd runner?
board_set_flasher_ifnset(em-starterkit)
board_set_debugger_ifnset(em-starterkit)
board_finalize_runner_args(em-starterkit)
include(${ZEPHYR_BASE}/boards/common/openocd.board.cmake)

View file

@ -1,6 +1,3 @@
# SPDX-License-Identifier: Apache-2.0
# TODO: can this board just use the usual openocd runner?
set(BOARD_FLASH_RUNNER em-starterkit)
set(BOARD_DEBUG_RUNNER em-starterkit)
board_finalize_runner_args(em-starterkit)
include(${ZEPHYR_BASE}/boards/common/openocd.board.cmake)

View file

@ -1,6 +1,3 @@
# SPDX-License-Identifier: Apache-2.0
# TODO: can this board just use the usual openocd runner?
set(BOARD_FLASH_RUNNER em-starterkit)
set(BOARD_DEBUG_RUNNER em-starterkit)
board_finalize_runner_args(em-starterkit)
include(${ZEPHYR_BASE}/boards/common/openocd.board.cmake)

View file

@ -1,6 +1,3 @@
# SPDX-License-Identifier: Apache-2.0
# TODO: can this board just use the usual openocd runner?
board_set_flasher_ifnset(em-starterkit)
board_set_debugger_ifnset(em-starterkit)
board_finalize_runner_args(em-starterkit)
include(${ZEPHYR_BASE}/boards/common/openocd.board.cmake)

View file

@ -11,7 +11,6 @@ from runners.core import ZephyrBinaryRunner, MissingProgram
# Explicitly silence the unused import warning.
# flake8: noqa: F401
# Keep this list sorted by runner name.
from runners import arc
from runners import blackmagicprobe
from runners import bossac
from runners import dediprog

View file

@ -1,108 +0,0 @@
# Copyright (c) 2017 Linaro Limited.
# Copyright (c) 2017 Open Source Foundries Limited.
#
# SPDX-License-Identifier: Apache-2.0
'''ARC architecture-specific runners.'''
from os import path
from runners.core import ZephyrBinaryRunner
DEFAULT_ARC_TCL_PORT = 6333
DEFAULT_ARC_TELNET_PORT = 4444
DEFAULT_ARC_GDB_PORT = 3333
class EmStarterKitBinaryRunner(ZephyrBinaryRunner):
'''Runner front-end for the EM Starterkit board, using openocd.'''
# This unusual 'flash' implementation matches the original shell script.
#
# It works by starting a GDB server in a separate session, connecting a
# client to it to load the program, and running 'continue' within the
# client to execute the application.
#
def __init__(self, cfg,
tui=False, tcl_port=DEFAULT_ARC_TCL_PORT,
telnet_port=DEFAULT_ARC_TELNET_PORT,
gdb_port=DEFAULT_ARC_GDB_PORT):
super(EmStarterKitBinaryRunner, self).__init__(cfg)
self.gdb_cmd = [cfg.gdb] + (['-tui'] if tui else [])
search_args = []
if cfg.openocd_search is not None:
search_args = ['-s', cfg.openocd_search]
self.openocd_cmd = [cfg.openocd or 'openocd'] + search_args
self.tcl_port = tcl_port
self.telnet_port = telnet_port
self.gdb_port = gdb_port
@classmethod
def name(cls):
return 'em-starterkit'
@classmethod
def do_add_parser(cls, parser):
parser.add_argument('--tui', default=False, action='store_true',
help='if given, GDB uses -tui')
parser.add_argument('--tcl-port', default=DEFAULT_ARC_TCL_PORT,
help='openocd TCL port, defaults to 6333')
parser.add_argument('--telnet-port', default=DEFAULT_ARC_TELNET_PORT,
help='openocd telnet port, defaults to 4444')
parser.add_argument('--gdb-port', default=DEFAULT_ARC_GDB_PORT,
help='openocd gdb port, defaults to 3333')
@classmethod
def create(cls, cfg, args):
if cfg.gdb is None:
raise ValueError('--gdb not provided at command line')
return EmStarterKitBinaryRunner(
cfg,
tui=args.tui, tcl_port=args.tcl_port, telnet_port=args.telnet_port,
gdb_port=args.gdb_port)
def do_run(self, command, **kwargs):
self.require(self.openocd_cmd[0])
kwargs['openocd-cfg'] = path.join(self.cfg.board_dir, 'support',
'openocd.cfg')
if command in {'flash', 'debug'}:
self.flash_debug(command, **kwargs)
else:
self.debugserver(**kwargs)
def flash_debug(self, command, **kwargs):
self.require(self.gdb_cmd[0])
config = kwargs['openocd-cfg']
server_cmd = (self.openocd_cmd +
['-f', config] +
['-c', 'tcl_port {}'.format(self.tcl_port),
'-c', 'telnet_port {}'.format(self.telnet_port),
'-c', 'gdb_port {}'.format(self.gdb_port),
'-c', 'init',
'-c', 'targets',
'-c', 'halt'])
continue_arg = []
if command == 'flash':
continue_arg = ['-ex', 'set confirm off', '-ex', 'monitor resume',
'-ex', 'quit']
gdb_cmd = (self.gdb_cmd +
['-ex', 'target remote :{}'.format(self.gdb_port),
'-ex', 'load'] +
continue_arg +
[self.cfg.elf_file])
self.run_server_and_client(server_cmd, gdb_cmd)
def debugserver(self, **kwargs):
config = kwargs['openocd-cfg']
cmd = (self.openocd_cmd +
['-f', config,
'-c', 'init',
'-c', 'targets',
'-c', 'reset halt'])
self.check_call(cmd)

View file

@ -358,8 +358,7 @@ class ZephyrBinaryRunner(abc.ABC):
When choosing a name, pick something short and lowercase,
based on the name of the tool (like openocd, jlink, etc.) or
the target architecture/board (like xtensa, em-starterkit,
etc.).'''
the target architecture/board (like xtensa etc.).'''
@classmethod
def capabilities(cls):

View file

@ -19,7 +19,6 @@ def test_runner_imports():
'bossac',
'dediprog',
'dfu-util',
'em-starterkit',
'esp32',
'hifive1',
'intel_s1000',