Lines Matching full:self

38     def __call__(self, parser, args, ignored, option):  argument
39 setattr(args, self.dest, not option.startswith('--no-'))
44 def __init__(self, cfg, device, dev_id=None, argument
54 self.file = cfg.file
55 self.file_type = cfg.file_type
56 self.hex_name = cfg.hex_file
57 self.bin_name = cfg.bin_file
58 self.elf_name = cfg.elf_file
59 self.gdb_cmd = [cfg.gdb] if cfg.gdb else None
60 self.device = device
61 self.dev_id = dev_id
62 self.commander = commander
63 self.dt_flash = dt_flash
64 self.erase = erase
65 self.reset = reset
66 self.gdbserver = gdbserver
67 self.iface = iface
68 self.speed = speed
69 self.gdb_host = gdb_host
70 self.gdb_port = gdb_port
71 self.tui_arg = ['-tui'] if tui else []
72 self.loader = loader
74 self.tool_opt = []
76 self.tool_opt += opts
147 def print_gdbserver_message(self): argument
148 if not self.thread_info_enabled:
150 elif self.supports_thread_info:
154 self.logger.info('J-Link GDB server running on port '
155 f'{self.gdb_port}{thread_msg}')
158 def jlink_version(self): argument
166 if not hasattr(self, '_jlink_version'):
182 self.logger.warning(f'unknown platform {plat}; assuming UNIX')
185 lib = Library(dllpath=os.fspath(Path(self.commander).parent /
188 self.logger.debug('JLINKARM_GetDLLVersion()=%s', version)
191 self._jlink_version = (version // 10000,
195 return self._jlink_version
198 def jlink_version_str(self): argument
200 if not hasattr(self, '_jlink_version_str'):
201 major, minor, rev = self.jlink_version
203 self._jlink_version_str = f'{major}.{minor:02}{rev_str}'
204 return self._jlink_version_str
207 def supports_nogui(self): argument
209 return self.jlink_version >= (6, 80, 0)
212 def supports_thread_info(self): argument
214 return self.jlink_version >= (7, 11, 2)
217 def supports_loader(self): argument
218 return self.jlink_version >= (7, 70, 4)
220 def do_run(self, command, **kwargs): argument
229 self.commander = os.fspath(
230 Path(self.require(self.commander)).resolve())
231 self.logger.info(f'JLink version: {self.jlink_version_str}')
233 rtos = self.thread_info_enabled and self.supports_thread_info
234 plugin_dir = os.fspath(Path(self.commander).parent / 'GDBServer' /
236 big_endian = self.build_conf.getboolean('CONFIG_BIG_ENDIAN')
238 server_cmd = ([self.gdbserver] +
240 ('ip' if is_ip(self.dev_id) else 'usb') +
241 (f'={self.dev_id}' if self.dev_id else ''),
242 '-port', str(self.gdb_port),
243 '-if', self.iface,
244 '-speed', self.speed,
245 '-device', self.device,
249 (['-nogui'] if self.supports_nogui else []) +
251 self.tool_opt)
254 self.flash(**kwargs)
256 if self.gdb_host:
258 self.require(self.gdbserver)
259 self.print_gdbserver_message()
260 self.check_call(server_cmd)
262 if self.gdb_cmd is None:
264 if self.file is not None:
265 if self.file_type != FileType.ELF:
267 elf_name = self.file
268 elif self.elf_name is None:
271 elf_name = self.elf_name
272 client_cmd = (self.gdb_cmd +
273 self.tui_arg +
275 ['-ex', 'target remote {}:{}'.format(self.gdb_host, self.gdb_port)])
280 if self.reset:
282 if not self.gdb_host:
283 self.require(self.gdbserver)
284 self.print_gdbserver_message()
285 self.run_server_and_client(server_cmd, client_cmd)
287 self.run_client(client_cmd)
289 def flash(self, **kwargs): argument
295 'BE' if self.build_conf.getboolean('CONFIG_BIG_ENDIAN') else 'LE'
298 if self.erase:
302 if self.file is not None:
304 if not os.path.isfile(self.file):
306 raise ValueError(err.format(self.file))
308 flash_file = self.file
310 if self.file_type == FileType.HEX:
311 flash_cmd = f'loadfile "{self.file}"'
312 elif self.file_type == FileType.BIN:
313 if self.dt_flash:
314 flash_addr = self.flash_address_from_build_conf(self.build_conf)
317 flash_cmd = f'loadfile "{self.file}" 0x{flash_addr:x}'
324 if self.hex_name is not None and os.path.isfile(self.hex_name):
325 flash_file = self.hex_name
326 flash_cmd = f'loadfile "{self.hex_name}"'
327 elif self.bin_name is not None and os.path.isfile(self.bin_name):
328 if self.dt_flash:
329 flash_addr = self.flash_address_from_build_conf(self.build_conf)
332 flash_file = self.bin_name
333 flash_cmd = f'loadfile "{self.bin_name}" 0x{flash_addr:x}'
336 raise ValueError(err.format(self.hex_name, self.bin_name))
341 if self.reset:
357 self.logger.debug('JLink commander script:\n' +
366 if self.supports_loader and self.loader:
367 loader_details = "?" + self.loader
369 cmd = ([self.commander] +
370 …(['-IP', f'{self.dev_id}'] if is_ip(self.dev_id) else (['-USB', f'{self.dev_id}'] if self.dev_id e…
371 (['-nogui', '1'] if self.supports_nogui else []) +
372 ['-if', self.iface,
373 '-speed', self.speed,
374 '-device', self.device + loader_details,
376 (['-nogui', '1'] if self.supports_nogui else []) +
377 self.tool_opt)
379 self.logger.info('Flashing file: {}'.format(flash_file))
381 if not self.logger.isEnabledFor(logging.DEBUG):
383 self.check_call(cmd, **kwargs)