pylab_ml.common.file_io.loadIHexFile
- loadIHexFile(fileName, bytemem=None, size=65536)[source]
Load an Intel Hex file into a byte array.
eg. loadIHexFile(‘firmware.hex’) will read the Intel Hex file ‘firmware.hex’ and return a byte array containing the data from the file. The function will read the file line by line, parse the Intel Hex format, and fill the byte array with the data from the file. The function will also keep track of the address range of the data read from the file and print it out at the end.
- Parameters:
fileName (str) – The name of the Intel Hex file to load.
bytemem (list, optional) – A pre-allocated byte array to fill with the data from the file. If None, a new byte array will be created. Default is None.
size (int, optional) – The size of the byte array to create if bytemem is None. Default is 0x10000 (64 KB).
- Returns:
bytemem : A byte array containing the data from the Intel Hex file, with None entries for unused/initialized values.
- Return type:
list