MCPcopy Create free account
hub / github.com/ExpressLRS/ExpressLRS / run_stub

Method run_stub

src/python/external/esptool/esptool/loader.py:889–916  ·  view source on GitHub ↗
(self, stub=None)

Source from the content-addressed store, hash-verified

887 )
888
889 def run_stub(self, stub=None):
890 if stub is None:
891 stub = StubFlasher(get_stub_json_path(self.CHIP_NAME))
892
893 if self.sync_stub_detected:
894 print("Stub is already running. No upload is necessary.")
895 return self.STUB_CLASS(self)
896
897 # Upload
898 print("Uploading stub...")
899 for field in [stub.text, stub.data]:
900 if field is not None:
901 offs = stub.text_start if field == stub.text else stub.data_start
902 length = len(field)
903 blocks = (length + self.ESP_RAM_BLOCK - 1) // self.ESP_RAM_BLOCK
904 self.mem_begin(length, blocks, self.ESP_RAM_BLOCK, offs)
905 for seq in range(blocks):
906 from_offs = seq * self.ESP_RAM_BLOCK
907 to_offs = from_offs + self.ESP_RAM_BLOCK
908 self.mem_block(field[from_offs:to_offs], seq)
909 print("Running stub...")
910 self.mem_finish(stub.entry)
911
912 p = self.read()
913 if p != b"OHAI":
914 raise FatalError("Failed to start stub. Unexpected response: %s" % p)
915 print("Stub running...")
916 return self.STUB_CLASS(self)
917
918 @stub_and_esp32_function_only
919 def flash_defl_begin(self, size, compsize, offset):

Callers 1

mainFunction · 0.80

Calls 7

mem_beginMethod · 0.95
mem_blockMethod · 0.95
mem_finishMethod · 0.95
readMethod · 0.95
StubFlasherClass · 0.85
get_stub_json_pathFunction · 0.85
FatalErrorClass · 0.85

Tested by

no test coverage detected