Lines Matching refs: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 []
138 def port_args(self): argument
139 return ['-p', str(self.gdb_port), '-T', str(self.telnet_port)]
141 def do_run(self, command, **kwargs): argument
142 self.require(self.pyocd)
144 self.rtt(**kwargs)
146 self.flash(**kwargs)
148 self.debug_debugserver(command, **kwargs)
150 def flash(self, **kwargs): argument
153 if self.hex_name is not None and os.path.isfile(self.hex_name):
154 fname = self.hex_name
156 elif self.bin_name is not None and os.path.isfile(self.bin_name):
157 fname = self.bin_name
158 elif self.elf_name is not None and os.path.isfile(self.elf_name):
159 fname = self.elf_name
165 erase_method = 'chip' if self.erase else 'sector'
167 cmd = ([self.pyocd] +
169 self.pyocd_config_args +
171 self.flash_addr_args +
172 self.daparg_args +
173 self.target_args +
174 self.board_args +
175 self.frequency_args +
176 self.tool_opt_args +
177 self.flash_extra +
180 self.logger.info(f'Flashing file: {fname}')
181 self.check_call(cmd)
183 def log_gdbserver_message(self): argument
184 self.logger.info(f'pyOCD GDB server running on port {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] +
213 self.require(client_cmd[0])
214 self.log_gdbserver_message()
215 self.run_server_and_client(server_cmd, client_cmd)
218 def rtt(self): argument
219 rtt_addr = self.get_rtt_address()
223 self.logger.debug(f'rtt address: 0x{rtt_addr:x}')
225 cmd = ([self.pyocd] +
227 self.pyocd_config_args +
228 self.daparg_args +
229 self.target_args +
230 self.board_args +
231 self.frequency_args +
232 self.tool_opt_args +
235 self.check_call(cmd)