This patch introduces a West runner for flashing and debugging with Lauterbach TRACE32 debuggers. The runner consists of a wrapper around TRACE32 software, and allows a Zephyr board to execute a custom start-up script (Practice Script) for the different commands supported, including the ability to pass extra arguments from CMake. Is up to the board using this runner to define the actions performed on each command. The `debug` command launches TRACE32 GUI to allow debug the Zephyr application, while the `flash` command hides the GUI and executes the start-up script in a background process. Signed-off-by: Manuel Arguelles <manuel.arguelles@nxp.com>
67 lines
1.8 KiB
Python
67 lines
1.8 KiB
Python
# Copyright (c) 2017 Linaro Limited.
|
|
#
|
|
# SPDX-License-Identifier: Apache-2.0
|
|
|
|
import importlib
|
|
import logging
|
|
|
|
from runners.core import ZephyrBinaryRunner, MissingProgram
|
|
|
|
_logger = logging.getLogger('runners')
|
|
|
|
def _import_runner_module(runner_name):
|
|
try:
|
|
importlib.import_module(f'runners.{runner_name}')
|
|
except ImportError as ie:
|
|
# Runners are supposed to gracefully handle failures when they
|
|
# import anything outside of stdlib, but they sometimes do
|
|
# not. Catch ImportError to handle this.
|
|
_logger.warning(f'The module for runner "{runner_name}" '
|
|
f'could not be imported ({ie}). This most likely '
|
|
'means it is not handling its dependencies properly. '
|
|
'Please report this to the zephyr developers.')
|
|
|
|
# We import these here to ensure the ZephyrBinaryRunner subclasses are
|
|
# defined; otherwise, ZephyrBinaryRunner.get_runners() won't work.
|
|
|
|
_names = [
|
|
'blackmagicprobe',
|
|
'bossac',
|
|
'canopen_program',
|
|
'dediprog',
|
|
'dfu',
|
|
'esp32',
|
|
'ezflashcli',
|
|
'gd32isp',
|
|
'hifive1',
|
|
'intel_adsp',
|
|
'intel_cyclonev',
|
|
'jlink',
|
|
'mdb',
|
|
'misc',
|
|
'nios2',
|
|
'nrfjprog',
|
|
'nsim',
|
|
'openocd',
|
|
'pyocd',
|
|
'qemu',
|
|
'spi_burn',
|
|
'stm32cubeprogrammer',
|
|
'stm32flash',
|
|
'trace32',
|
|
'xtensa',
|
|
# Keep this list sorted by runner name; don't add to the end.
|
|
]
|
|
|
|
for _name in _names:
|
|
_import_runner_module(_name)
|
|
|
|
def get_runner_cls(runner):
|
|
'''Get a runner's class object, given its name.'''
|
|
for cls in ZephyrBinaryRunner.get_runners():
|
|
if cls.name() == runner:
|
|
return cls
|
|
raise ValueError('unknown runner "{}"'.format(runner))
|
|
|
|
__all__ = ['ZephyrBinaryRunner', 'get_runner_cls']
|