Lines Matching full:self
19 def __init__(self, cfg, target, argument
30 self.pyocd_config = default
32 self.pyocd_config = None
35 self.target_args = ['-t', target]
36 self.pyocd = pyocd
37 self.flash_addr_args = ['-a', hex(flash_addr)] if flash_addr else []
38 self.erase = erase
39 self.gdb_cmd = [cfg.gdb] if cfg.gdb is not None else None
40 self.gdb_port = gdb_port
41 self.telnet_port = telnet_port
42 self.tui_args = ['-tui'] if tui else []
43 self.hex_name = cfg.hex_file
44 self.bin_name = cfg.bin_file
45 self.elf_name = cfg.elf_file
49 if self.pyocd_config is not None:
50 pyocd_config_args = ['--config', self.pyocd_config]
52 self.pyocd_config_args = pyocd_config_args
57 self.board_args = board_args
62 self.daparg_args = daparg_args
67 self.frequency_args = frequency_args
69 self.tool_opt_args = tool_opt or []
71 self.flash_extra = flash_opts if flash_opts else []
140 def port_args(self): argument
141 return ['-p', str(self.gdb_port), '-T', str(self.telnet_port)]
143 def do_run(self, command, **kwargs): argument
144 self.require(self.pyocd)
146 self.flash(**kwargs)
148 self.debug_debugserver(command, **kwargs)
150 def flash(self, **kwargs): argument
151 if self.hex_name is not None and os.path.isfile(self.hex_name):
152 fname = self.hex_name
153 elif self.bin_name is not None and os.path.isfile(self.bin_name):
154 self.logger.warning(
156 format(self.hex_name, self.bin_name) +
158 fname = self.bin_name
162 self.hex_name, self.bin_name))
164 erase_method = 'chip' if self.erase else 'sector'
166 cmd = ([self.pyocd] +
168 self.pyocd_config_args +
170 self.flash_addr_args +
171 self.daparg_args +
172 self.target_args +
173 self.board_args +
174 self.frequency_args +
175 self.tool_opt_args +
176 self.flash_extra +
179 self.logger.info('Flashing file: {}'.format(fname))
180 self.check_call(cmd)
182 def log_gdbserver_message(self): argument
183 self.logger.info('pyOCD GDB server running on port {}'.
184 format(self.gdb_port))
186 def debug_debugserver(self, command, **kwargs): argument
187 server_cmd = ([self.pyocd] +
189 self.daparg_args +
190 self.port_args() +
191 self.target_args +
192 self.board_args +
193 self.frequency_args +
194 self.tool_opt_args)
197 self.log_gdbserver_message()
198 self.check_call(server_cmd)
200 if self.gdb_cmd is None:
202 if self.elf_name is None:
204 client_cmd = (self.gdb_cmd +
205 self.tui_args +
206 [self.elf_name] +
207 ['-ex', 'target remote :{}'.format(self.gdb_port)])
213 self.require(client_cmd[0])
214 self.log_gdbserver_message()
215 self.run_server_and_client(server_cmd, client_cmd)