MCPcopy Create free account
hub / github.com/FrameworkComputer/framework-system / check_assumptions

Function check_assumptions

decode_pcapng.py:198–223  ·  view source on GitHub ↗
(img1_binary, img2_binary)

Source from the content-addressed store, hash-verified

196
197
198def check_assumptions(img1_binary, img2_binary):
199 # TODO: Check that addresses are in order
200 # TODO: Metadata right after each other
201
202 # Check assumptions that the updater relies on
203 if len(img1_binary) != len(img2_binary):
204 print("VIOLATED Assumption that both images are of the same size!")
205 sys.exit(1)
206 if len(img1_binary[0][1]) != ROW_SIZE:
207 print("VIOLATED Assumption that the row size is {} bytes! Is: {}", ROW_SIZE, img1_binary[0][1])
208 sys.exit(1)
209 if img1_binary[0][0] != 0x0030:
210 print("VIOLATED Assumption that start row of image 1 is at 0x0030. Is at 0x{:04X}".format(img1_binary[0][0]))
211 sys.exit(1)
212 if img1_binary[-1][0] != 0x03FF:
213 print("VIOLATED Assumption that metadata row of image 1 is at 0x03FF. Is at 0x{:04X}".format(img1_binary[-1][0]))
214 sys.exit(1)
215 if img2_binary[0][0] != 0x0200:
216 print("VIOLATED Assumption that start row of image 2 is at 0x0200. Is at 0x{:04X}".format(img2_binary[0]))
217 sys.exit(1)
218 if img2_binary[-1][0] != 0x03FE:
219 print("VIOLATED Assumption that metadata row of image 2 is at 0x03FE. Is at 0x{:04X}".format(img2_binary[-1][0]))
220 sys.exit(1)
221 if img1_binary == img2_binary:
222 print("VIOLATED Assumption that both images are not the same");
223 sys.exit(1)
224
225
226def decode_pcapng(path, bus_id, dev, second_first):

Callers 1

mainFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected