Lines Matching full:self

30     def __call__(self, parser, args, ignored, option):  argument
31 setattr(args, self.dest, not option.startswith('--no-'))
36 def __init__(self, cfg, device, dev_id=None, argument
46 self.file = cfg.file
47 self.file_type = cfg.file_type
48 self.hex_name = cfg.hex_file
49 self.bin_name = cfg.bin_file
50 self.elf_name = cfg.elf_file
51 self.gdb_cmd = [cfg.gdb] if cfg.gdb else None
52 self.device = device
53 self.dev_id = dev_id
54 self.commander = commander
55 self.dt_flash = dt_flash
56 self.erase = erase
57 self.reset_after_load = reset_after_load
58 self.gdbserver = gdbserver
59 self.iface = iface
60 self.speed = speed
61 self.gdb_host = gdb_host
62 self.gdb_port = gdb_port
63 self.tui_arg = ['-tui'] if tui else []
64 self.loader = loader
66 self.tool_opt = []
68 self.tool_opt += opts
138 def print_gdbserver_message(self): argument
139 if not self.thread_info_enabled:
141 elif self.supports_thread_info:
145 self.logger.info('J-Link GDB server running on port '
146 f'{self.gdb_port}{thread_msg}')
149 def jlink_version(self): argument
157 if not hasattr(self, '_jlink_version'):
173 self.logger.warning(f'unknown platform {plat}; assuming UNIX')
176 lib = Library(dllpath=os.fspath(Path(self.commander).parent /
179 self.logger.debug('JLINKARM_GetDLLVersion()=%s', version)
182 self._jlink_version = (version // 10000,
186 return self._jlink_version
189 def jlink_version_str(self): argument
191 if not hasattr(self, '_jlink_version_str'):
192 major, minor, rev = self.jlink_version
194 self._jlink_version_str = f'{major}.{minor:02}{rev_str}'
195 return self._jlink_version_str
198 def supports_nogui(self): argument
200 return self.jlink_version >= (6, 80, 0)
203 def supports_thread_info(self): argument
205 return self.jlink_version >= (7, 11, 2)
208 def supports_loader(self): argument
209 return self.jlink_version >= (7, 70, 4)
211 def do_run(self, command, **kwargs): argument
220 self.commander = os.fspath(
221 Path(self.require(self.commander)).resolve())
222 self.logger.info(f'JLink version: {self.jlink_version_str}')
224 rtos = self.thread_info_enabled and self.supports_thread_info
225 plugin_dir = os.fspath(Path(self.commander).parent / 'GDBServer' /
228 server_cmd = ([self.gdbserver] +
230 ['-select', 'usb' + (f'={self.dev_id}'
231 if self.dev_id else ''),
232 '-port', str(self.gdb_port),
233 '-if', self.iface,
234 '-speed', self.speed,
235 '-device', self.device,
238 (['-nogui'] if self.supports_nogui else []) +
240 self.tool_opt)
243 self.flash(**kwargs)
245 if self.gdb_host:
247 self.require(self.gdbserver)
248 self.print_gdbserver_message()
249 self.check_call(server_cmd)
251 if self.gdb_cmd is None:
253 if self.file is not None:
254 if self.file_type != FileType.ELF:
256 elf_name = self.file
257 elif self.elf_name is None:
260 elf_name = self.elf_name
261 client_cmd = (self.gdb_cmd +
262 self.tui_arg +
264 ['-ex', 'target remote {}:{}'.format(self.gdb_host, self.gdb_port)])
269 if self.reset_after_load:
271 if not self.gdb_host:
272 self.require(self.gdbserver)
273 self.print_gdbserver_message()
274 self.run_server_and_client(server_cmd, client_cmd)
276 self.run_client(client_cmd)
278 def flash(self, **kwargs): argument
286 if self.erase:
290 if self.file is not None:
292 if not os.path.isfile(self.file):
294 raise ValueError(err.format(self.file))
296 flash_file = self.file
298 if self.file_type == FileType.HEX:
299 flash_cmd = f'loadfile "{self.file}"'
300 elif self.file_type == FileType.BIN:
301 if self.dt_flash:
302 flash_addr = self.flash_address_from_build_conf(self.build_conf)
305 flash_cmd = f'loadfile "{self.file}" 0x{flash_addr:x}'
312 if self.hex_name is not None and os.path.isfile(self.hex_name):
313 flash_file = self.hex_name
314 flash_cmd = f'loadfile "{self.hex_name}"'
315 elif self.bin_name is not None and os.path.isfile(self.bin_name):
316 if self.dt_flash:
317 flash_addr = self.flash_address_from_build_conf(self.build_conf)
320 flash_file = self.bin_name
321 flash_cmd = f'loadfile "{self.bin_name}" 0x{flash_addr:x}'
324 raise ValueError(err.format(self.hex_name, self.bin_name))
329 if self.reset_after_load:
345 self.logger.debug('JLink commander script:\n' +
354 if self.supports_loader and self.loader:
355 loader_details = "?" + self.loader
357 cmd = ([self.commander] +
359 (['-USB', f'{self.dev_id}'] if self.dev_id else []) +
360 (['-nogui', '1'] if self.supports_nogui else []) +
361 ['-if', self.iface,
362 '-speed', self.speed,
363 '-device', self.device + loader_details,
365 (['-nogui', '1'] if self.supports_nogui else []) +
366 self.tool_opt)
368 self.logger.info('Flashing file: {}'.format(flash_file))
370 if not self.logger.isEnabledFor(logging.DEBUG):
372 self.check_call(cmd, **kwargs)