Lines Matching +full:class +full:- +full:rev
3 # SPDX-License-Identifier: Apache-2.0
5 '''Runner for debugging with J-Link.'''
44 class ToggleAction(argparse.Action):
47 setattr(args, self.dest, not option.startswith('--no-'))
49 class JLinkBinaryRunner(ZephyrBinaryRunner):
50 '''Runner front-end for the J-Link GDB server.'''
81 self.tui_arg = ['-tui'] if tui else []
101 def dev_id_help(cls) -> str:
102 return '''Device identifier. Use it to select the J-Link Serial Number
103 of the device connected over USB. If the J-Link is connected over ip,
107 def tool_opt_help(cls) -> str:
108 return "Additional options for JLink Commander, e.g. '-autoconnect 1'"
113 parser.add_argument('--device', required=True, help='device name')
116 parser.add_argument('--loader', required=False, dest='loader',
118 parser.add_argument('--id', required=False, dest='dev_id',
119 help='obsolete synonym for -i/--dev-id')
120 parser.add_argument('--iface', default='swd',
122 parser.add_argument('--speed', default='auto',
124 parser.add_argument('--flash-script', default=None,
126 parser.add_argument('--tui', default=False, action='store_true',
127 help='if given, GDB uses -tui')
128 parser.add_argument('--gdbserver', default='JLinkGDBServer',
130 parser.add_argument('--gdb-host', default='',
133 parser.add_argument('--gdb-port', default=DEFAULT_JLINK_GDB_PORT,
135 parser.add_argument('--commander', default=DEFAULT_JLINK_EXE,
136 help=f'''J-Link Commander, default is
138 parser.add_argument('--reset-after-load', '--no-reset-after-load',
141 help='obsolete synonym for --reset/--no-reset')
142 parser.add_argument('--rtt-client', default='JLinkRTTClient',
144 parser.add_argument('--rtt-port', default=DEFAULT_JLINK_RTT_PORT,
172 thread_msg = '; update J-Link software for thread info'
173 self.logger.info('J-Link GDB server running on port '
177 self.logger.info(f'J-Link RTT server running on port {self.rtt_port}')
181 # Get the J-Link version as a (major, minor, rev) tuple of integers.
183 # J-Link's command line tools provide neither a standalone
184 # "--version" nor help output that contains the version. Hack
185 # around this deficiency by using the third-party pylink library
221 # Converts the numeric revision tuple to something human-readable.
223 major, minor, rev = self.jlink_version
224 rev_str = chr(ord('a') + rev - 1) if rev else ''
230 # -nogui was introduced in J-Link Commander v6.80
263 '-select',
267 + ['-port', str(self.gdb_port)]
268 + ['-if', self.iface]
269 + ['-speed', self.speed]
270 + ['-device', self.device]
271 + ['-silent']
272 + ['-endian' 'big' if big_endian else 'little']
273 + ['-singlerun']
274 + (['-nogui'] if self.supports_nogui else [])
275 + (['-rtos', plugin_dir] if rtos else [])
276 + ['-rtttelnetport', str(self.rtt_port)]
284 raise ValueError('Cannot run debugserver with --gdb-host')
291 server_cmd += ['-nohalt']
324 ['-ex', f'target remote {self.gdb_host}:{self.gdb_port}'])
326 client_cmd += ['-ex', 'monitor halt',
327 '-ex', 'monitor reset',
328 '-ex', 'load']
330 client_cmd += ['-ex', 'monitor reset']
340 'ExitOnError 1', # Treat any command-error as fatal
401 # The J-Link scripting layer chains commands, meaning that writes are
421 ['-IP', f'{self.dev_id}']
423 else (['-USB', f'{self.dev_id}'] if self.dev_id else [])
425 + (['-nogui', '1'] if self.supports_nogui else [])
426 + ['-if', self.iface]
427 + ['-speed', self.speed]
428 + ['-device', self.device + loader_details]
429 + ['-CommanderScript', fname]
430 + (['-nogui', '1'] if self.supports_nogui else [])
450 f.writelines(bytes(line + '\n', 'utf-8') for line in lines)