runners: pyocd: add --tool-opt parameter
add --tool-opt to support more pyocd parameter Signed-off-by: Frank Li <lgl88911@163.com>
This commit is contained in:
parent
c0d31bf02b
commit
59208ac13b
2 changed files with 24 additions and 7 deletions
|
@ -21,7 +21,7 @@ class PyOcdBinaryRunner(ZephyrBinaryRunner):
|
||||||
flash_addr=0x0, flash_opts=None,
|
flash_addr=0x0, flash_opts=None,
|
||||||
gdb_port=DEFAULT_PYOCD_GDB_PORT,
|
gdb_port=DEFAULT_PYOCD_GDB_PORT,
|
||||||
telnet_port=DEFAULT_PYOCD_TELNET_PORT, tui=False,
|
telnet_port=DEFAULT_PYOCD_TELNET_PORT, tui=False,
|
||||||
board_id=None, daparg=None, frequency=None):
|
board_id=None, daparg=None, frequency=None, tool_opt=None):
|
||||||
super(PyOcdBinaryRunner, self).__init__(cfg)
|
super(PyOcdBinaryRunner, self).__init__(cfg)
|
||||||
|
|
||||||
self.target_args = ['-t', target]
|
self.target_args = ['-t', target]
|
||||||
|
@ -50,6 +50,11 @@ class PyOcdBinaryRunner(ZephyrBinaryRunner):
|
||||||
frequency_args = ['-f', frequency]
|
frequency_args = ['-f', frequency]
|
||||||
self.frequency_args = frequency_args
|
self.frequency_args = frequency_args
|
||||||
|
|
||||||
|
tool_opt_args = []
|
||||||
|
if tool_opt is not None:
|
||||||
|
tool_opt_args = [tool_opt]
|
||||||
|
self.tool_opt_args = tool_opt_args
|
||||||
|
|
||||||
self.flash_extra = flash_opts if flash_opts else []
|
self.flash_extra = flash_opts if flash_opts else []
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
|
@ -85,6 +90,9 @@ class PyOcdBinaryRunner(ZephyrBinaryRunner):
|
||||||
help='if given, GDB uses -tui')
|
help='if given, GDB uses -tui')
|
||||||
parser.add_argument('--board-id',
|
parser.add_argument('--board-id',
|
||||||
help='ID of board to flash, default is to prompt')
|
help='ID of board to flash, default is to prompt')
|
||||||
|
parser.add_argument('--tool-opt',
|
||||||
|
help='''Additional options for pyocd Commander,
|
||||||
|
e.g. \'--script=user.py\' ''')
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def create(cls, cfg, args):
|
def create(cls, cfg, args):
|
||||||
|
@ -97,7 +105,8 @@ class PyOcdBinaryRunner(ZephyrBinaryRunner):
|
||||||
flash_addr=flash_addr, flash_opts=args.flash_opt,
|
flash_addr=flash_addr, flash_opts=args.flash_opt,
|
||||||
gdb_port=args.gdb_port, telnet_port=args.telnet_port, tui=args.tui,
|
gdb_port=args.gdb_port, telnet_port=args.telnet_port, tui=args.tui,
|
||||||
board_id=args.board_id, daparg=args.daparg,
|
board_id=args.board_id, daparg=args.daparg,
|
||||||
frequency=args.frequency)
|
frequency=args.frequency,
|
||||||
|
tool_opt=args.tool_opt)
|
||||||
|
|
||||||
daparg = os.environ.get('PYOCD_DAPARG')
|
daparg = os.environ.get('PYOCD_DAPARG')
|
||||||
if not ret.daparg_args and daparg:
|
if not ret.daparg_args and daparg:
|
||||||
|
@ -139,6 +148,7 @@ class PyOcdBinaryRunner(ZephyrBinaryRunner):
|
||||||
self.target_args +
|
self.target_args +
|
||||||
self.board_args +
|
self.board_args +
|
||||||
self.frequency_args +
|
self.frequency_args +
|
||||||
|
self.tool_opt_args +
|
||||||
self.flash_extra +
|
self.flash_extra +
|
||||||
[fname])
|
[fname])
|
||||||
|
|
||||||
|
@ -156,7 +166,8 @@ class PyOcdBinaryRunner(ZephyrBinaryRunner):
|
||||||
self.port_args() +
|
self.port_args() +
|
||||||
self.target_args +
|
self.target_args +
|
||||||
self.board_args +
|
self.board_args +
|
||||||
self.frequency_args)
|
self.frequency_args +
|
||||||
|
self.tool_opt_args)
|
||||||
|
|
||||||
if command == 'debugserver':
|
if command == 'debugserver':
|
||||||
self.log_gdbserver_message()
|
self.log_gdbserver_message()
|
||||||
|
|
|
@ -25,6 +25,7 @@ TEST_TARGET = 'test-target'
|
||||||
TEST_FLASH_OPTS = ['--test-flash', 'args']
|
TEST_FLASH_OPTS = ['--test-flash', 'args']
|
||||||
TEST_GDB_PORT = 1
|
TEST_GDB_PORT = 1
|
||||||
TEST_TELNET_PORT = 2
|
TEST_TELNET_PORT = 2
|
||||||
|
TEST_TOOL_OPT = 'test-opt'
|
||||||
|
|
||||||
TEST_ALL_KWARGS = {
|
TEST_ALL_KWARGS = {
|
||||||
'pyocd': TEST_PYOCD,
|
'pyocd': TEST_PYOCD,
|
||||||
|
@ -36,6 +37,7 @@ TEST_ALL_KWARGS = {
|
||||||
'board_id': TEST_BOARD_ID,
|
'board_id': TEST_BOARD_ID,
|
||||||
'frequency': TEST_FREQUENCY,
|
'frequency': TEST_FREQUENCY,
|
||||||
'daparg': TEST_DAPARG,
|
'daparg': TEST_DAPARG,
|
||||||
|
'tool_opt': TEST_TOOL_OPT,
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_DEF_KWARGS = {}
|
TEST_DEF_KWARGS = {}
|
||||||
|
@ -48,7 +50,8 @@ TEST_ALL_PARAMS = (['--target', TEST_TARGET,
|
||||||
['--gdb-port', str(TEST_GDB_PORT),
|
['--gdb-port', str(TEST_GDB_PORT),
|
||||||
'--telnet-port', str(TEST_TELNET_PORT),
|
'--telnet-port', str(TEST_TELNET_PORT),
|
||||||
'--board-id', TEST_BOARD_ID,
|
'--board-id', TEST_BOARD_ID,
|
||||||
'--frequency', str(TEST_FREQUENCY)])
|
'--frequency', str(TEST_FREQUENCY),
|
||||||
|
'--tool-opt', TEST_TOOL_OPT])
|
||||||
|
|
||||||
TEST_DEF_PARAMS = ['--target', TEST_TARGET]
|
TEST_DEF_PARAMS = ['--target', TEST_TARGET]
|
||||||
|
|
||||||
|
@ -69,7 +72,8 @@ FLASH_ALL_EXPECTED_CALL = ([TEST_PYOCD,
|
||||||
'-e', 'sector',
|
'-e', 'sector',
|
||||||
'-a', hex(TEST_ADDR), '-da', TEST_DAPARG,
|
'-a', hex(TEST_ADDR), '-da', TEST_DAPARG,
|
||||||
'-t', TEST_TARGET, '-u', TEST_BOARD_ID,
|
'-t', TEST_TARGET, '-u', TEST_BOARD_ID,
|
||||||
'-f', TEST_FREQUENCY] +
|
'-f', TEST_FREQUENCY,
|
||||||
|
TEST_TOOL_OPT] +
|
||||||
TEST_FLASH_OPTS +
|
TEST_FLASH_OPTS +
|
||||||
[RC_KERNEL_HEX])
|
[RC_KERNEL_HEX])
|
||||||
FLASH_DEF_EXPECTED_CALL = ['pyocd', 'flash', '-e', 'sector',
|
FLASH_DEF_EXPECTED_CALL = ['pyocd', 'flash', '-e', 'sector',
|
||||||
|
@ -83,7 +87,8 @@ DEBUG_ALL_EXPECTED_SERVER = [TEST_PYOCD,
|
||||||
'-T', str(TEST_TELNET_PORT),
|
'-T', str(TEST_TELNET_PORT),
|
||||||
'-t', TEST_TARGET,
|
'-t', TEST_TARGET,
|
||||||
'-u', TEST_BOARD_ID,
|
'-u', TEST_BOARD_ID,
|
||||||
'-f', TEST_FREQUENCY]
|
'-f', TEST_FREQUENCY,
|
||||||
|
TEST_TOOL_OPT]
|
||||||
DEBUG_ALL_EXPECTED_CLIENT = [RC_GDB, RC_KERNEL_ELF,
|
DEBUG_ALL_EXPECTED_CLIENT = [RC_GDB, RC_KERNEL_ELF,
|
||||||
'-ex', 'target remote :{}'.format(TEST_GDB_PORT),
|
'-ex', 'target remote :{}'.format(TEST_GDB_PORT),
|
||||||
'-ex', 'monitor halt',
|
'-ex', 'monitor halt',
|
||||||
|
@ -108,7 +113,8 @@ DEBUGSERVER_ALL_EXPECTED_CALL = [TEST_PYOCD,
|
||||||
'-T', str(TEST_TELNET_PORT),
|
'-T', str(TEST_TELNET_PORT),
|
||||||
'-t', TEST_TARGET,
|
'-t', TEST_TARGET,
|
||||||
'-u', TEST_BOARD_ID,
|
'-u', TEST_BOARD_ID,
|
||||||
'-f', TEST_FREQUENCY]
|
'-f', TEST_FREQUENCY,
|
||||||
|
TEST_TOOL_OPT]
|
||||||
DEBUGSERVER_DEF_EXPECTED_CALL = ['pyocd',
|
DEBUGSERVER_DEF_EXPECTED_CALL = ['pyocd',
|
||||||
'gdbserver',
|
'gdbserver',
|
||||||
'-p', '3333',
|
'-p', '3333',
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue