Lines Matching refs:self
15 def __init__(self, cfg, tool, dev_id=None, tool_opt=None, erase=False, reset=True): argument
17 self.bin_ = cfg.bin_file
19 self.tool = tool
20 self.dev_id = dev_id
21 self.erase = bool(erase)
22 self.reset = bool(reset)
24 self.tool_opt = []
27 self.tool_opt += opts
58 def needs_product_header(self): argument
63 is_mcuboot = self.build_conf.getboolean('CONFIG_MCUBOOT')
64 uses_code_partition = self.build_conf.getboolean('CONFIG_USE_DT_CODE_PARTITION')
68 def get_options(self): argument
70 if self.dev_id is not None:
72 return device_args + self.tool_opt
74 def program_bin(self): argument
75 options = self.get_options()
77 if self.erase:
78 self.logger.info("Erasing flash...")
79 self.check_call([self.tool] + options + ["erase_flash"])
81 self.logger.info(f"Flashing {self.bin_}...")
82 if self.needs_product_header():
85 self.check_call([self.tool] + options + ["image_flash", self.bin_])
87 load_offset = self.build_conf['CONFIG_FLASH_LOAD_OFFSET']
88 self.check_call(
89 [self.tool] + options + ["write_flash", f'0x{load_offset:x}', self.bin_]
92 def reset_device(self): argument
93 self.logger.info("Resetting...")
94 options = self.get_options()
95 self.check_call([self.tool] + options + ["go"])
97 def do_run(self, command, **kwargs): argument
98 self.require(self.tool)
99 self.ensure_output('bin')
100 self.program_bin()
101 if self.reset:
102 self.reset_device()