(binary, index)
| 95 | return ''.join('{:02x} '.format(x) for x in buf) |
| 96 | |
| 97 | def print_image_info(binary, index): |
| 98 | rows = len(binary) |
| 99 | size = rows * len(binary[0][1]) |
| 100 | print("Image {} Size: {} B, {} rows".format(index, size, rows)) |
| 101 | print(" FW at: 0x{:04X} Metadata at 0x{:04X}".format(binary[0][0], binary[-1][0])) |
| 102 | |
| 103 | def twos_comp(val, bits): |
| 104 | """compute the 2's complement of int value val""" |