Lines Matching full:self
25 def __init__(self, cfg, device, core, argument
35 self.file = cfg.file
36 self.file_type = cfg.file_type
37 self.hex_name = cfg.hex_file
38 self.bin_name = cfg.bin_file
39 self.elf_name = cfg.elf_file
40 self.gdb_cmd = cfg.gdb if cfg.gdb else None
41 self.device = device
42 self.core = core
43 self.linkserver = linkserver
44 self.dt_flash = dt_flash
45 self.erase = erase
46 self.probe = probe
47 self.gdb_host = gdb_host
48 self.gdb_port = gdb_port
49 self.semihost_port = semihost_port
50 self.tui_arg = ['-tui'] if tui else []
51 self.override = override
52 self.override_cli = self._build_override_cli()
54 self.tool_opt = []
56 self.tool_opt += opts
109 def linkserver_version_str(self): argument
111 if not hasattr(self, '_linkserver_version'):
112 linkserver_version_cmd=[self.linkserver, "-v"]
113 ls_output=self.check_output(linkserver_version_cmd)
114 self.linkserver_version = str(ls_output.split()[1].decode()).lower()
116 return self.linkserver_version
118 def do_run(self, command, **kwargs): argument
120 self.linkserver = self.require(self.linkserver)
121 self.logger.info(f'LinkServer: {self.linkserver}, version {self.linkserver_version_str}')
124 self.flash(**kwargs)
126 if self.core is not None:
127 _cmd_core = [ "-c", self.core ]
131 linkserver_cmd = ([self.linkserver] +
133 ["--probe", str(self.probe) ] +
134 ["--gdb-port", str(self.gdb_port )] +
135 ["--semihost-port", str(self.semihost_port) ] +
137 self.override_cli +
138 [self.device])
140 self.logger.debug(f'LinkServer cmd: + {linkserver_cmd}')
143 if self.elf_name is None or not os.path.isfile(self.elf_name):
146 gdb_cmd = ([self.gdb_cmd] +
147 self.tui_arg +
148 [self.elf_name] +
149 ['-ex', 'target remote {}:{}'.format(self.gdb_host, self.gdb_port)])
157 self.run_server_and_client(linkserver_cmd, gdb_cmd)
160 if self.gdb_host:
163 self.check_call(linkserver_cmd)
165 def do_erase(self, **kwargs): argument
167 linkserver_cmd = ([self.linkserver, "flash"] + ["--probe", str(self.probe)] +
168 [self.device] + ["erase"])
169 self.logger.debug("flash erase command = " + str(linkserver_cmd))
170 self.check_call(linkserver_cmd)
172 def _build_override_cli(self): argument
176 if self.override is not None:
177 for ov in self.override:
182 def flash(self, **kwargs): argument
184 …linkserver_cmd = ([self.linkserver, "flash"] + ["--probe", str(self.probe)] + self.override_cli + …
185 self.logger.debug(f'LinkServer cmd: + {linkserver_cmd}')
187 if self.erase:
188 self.do_erase()
191 if self.supports_hex and self.hex_name is not None and os.path.isfile(self.hex_name):
192 flash_cmd = (["load", self.hex_name])
193 elif self.bin_name is not None and os.path.isfile(self.bin_name):
194 if self.dt_flash:
195 load_addr = self.flash_address_from_build_conf(self.build_conf)
197 self.logger.critical("no load flash address could be found...")
200 flash_cmd = (["load", "--addr", str(load_addr), self.bin_name])
203 raise ValueError(err.format(self.hex_name, self.bin_name))
207 self.logger.debug("flash command = " + str(linkserver_cmd))
209 if not self.logger.isEnabledFor(logging.DEBUG):
210 if self.linkserver_version_str < "v1.3.15":
215 self.check_call(linkserver_cmd, **kwargs)
217 def supports_hex(self): argument
219 return self.linkserver_version_str >= "v1.5.30"