1
0
forked from me/IronOS

Fix checksum computation in python_logo_converter (#371)

This commit is contained in:
Philippe Teuwen
2018-10-16 22:28:03 +02:00
committed by Ben V. Brown
parent 40907a384e
commit 15f365d2bd

View File

@@ -43,13 +43,14 @@ def intel_hex_line(file, record_type, offset, data):
# compute and write checksum (with DOS line ending for compatibility/safety)
file.write("{:02X}\r\n"
.format(((sum(data, # sum data ...
record_length # ... and other ...
+ sum(split16(offset)) # ... fields ...
+ record_type) # ... on line
& 0xff) # low 8 bits
^ 0xff) # two's ...
+ 1)) # ... complement
.format((((sum(data, # sum data ...
record_length # ... and other ...
+ sum(split16(offset)) # ... fields ...
+ record_type) # ... on line
& 0xff) # low 8 bits
^ 0xff) # two's ...
+ 1) # ... complement
& 0xff)) # low 8 bits
def intel_hex(file, bytes_, start_address=0x0):