Intelhex in Python: How to write multiple bytes at once?

44 Views Asked by At

I am using Intelhex in Python to calculate a checksum of my hexfile and put it into a specific address. The checksum is 4-bytes long an somehow I am not able to write the calculated 4-bytes at a specific address at once.

I have to write byte per byte like this:

while i < 4:
    hexfile[0x0000000+i] = calculatedChecksum[i]
    i += 1

and finally calling the function hexfile.write_hex_file("myHex.hex", True, 'native', 16)

Has someone an advice how to do it at once or faster to avoid the while-loop?

Second, I noticed that IntelHex is putting ":040000050800E0E52A" at the beginning of the hexfile. Why is this happening? How can I avoid this?

Thank you in advance.

1

There are 1 best solutions below

0
On

I fixed it by myself.

The topic can be marked as solved