Hexfile manipulation

>>> from ppci.format.hexfile import HexFile
>>> h = HexFile()
>>> h.add_region(0, bytes([1, 2, 3]))
>>> h.add_region(0x100, 'Hello world of hex'.encode('utf8'))
>>> h
Hexfile containing 21 bytes
>>> h.dump()
Hexfile containing 21 bytes
Region at 0x00000000 of 3 bytes
00000000  01 02 03                                         ...
Region at 0x00000100 of 18 bytes
00000100  48 65 6c 6c 6f 20 77 6f 72 6c 64 20 6f 66 20 68  Hello.world.of.h
00000110  65 78                                            ex


Module to work with intel hex files.

This module can be used to work with intel hexfiles.

class ppci.format.hexfile.HexFile

Represents an intel hexfile

add_region(address, data)

Add a chunk of data at the given address


Print info about this hexfile

static load()

Load a hexfile from file


Save hexfile to file-like object

write_hex_line(address, typ, data=b'')

Write a single hexfile line

exception ppci.format.hexfile.HexFileException
ppci.format.hexfile.make_hex_line(address, typ, data=b'')

Create an ascii hex line out of data, address and record type


Parses a hexfile line into three parts