Support Python 3.x in make_spi_image.py.

This commit is contained in:
Jared Boone 2015-08-25 14:56:50 -07:00
parent dfe0bd7366
commit f7ced7a823

View file

@ -73,8 +73,8 @@ images = (
} }
) )
spi_image = [] spi_image = bytearray()
spi_image_default_byte = '\xff' spi_image_default_byte = bytearray((255,))
for image in images: for image in images:
if len(image['data']) > image['size']: if len(image['data']) > image['size']:
@ -83,7 +83,6 @@ for image in images:
padded_data = image['data'] + (spi_image_default_byte * pad_size) padded_data = image['data'] + (spi_image_default_byte * pad_size)
spi_image += padded_data spi_image += padded_data
spi_image = ''.join(spi_image)
if len(spi_image) > spi_size: if len(spi_image) > spi_size:
raise RuntimeError('SPI flash image size of %d exceeds device size of %d bytes' % (len(spi_image), spi_size)) raise RuntimeError('SPI flash image size of %d exceeds device size of %d bytes' % (len(spi_image), spi_size))