2014-11-27 20:30:33 +00:00
|
|
|
import sys
|
|
|
|
|
2016-04-03 13:40:53 +01:00
|
|
|
SEGS_MAX_SIZE = 0x9000
|
|
|
|
|
2014-11-27 20:30:33 +00:00
|
|
|
assert len(sys.argv) == 4
|
|
|
|
|
|
|
|
with open(sys.argv[3], 'wb') as fout:
|
|
|
|
|
|
|
|
with open(sys.argv[1], 'rb') as f:
|
|
|
|
data_flash = f.read()
|
|
|
|
fout.write(data_flash)
|
|
|
|
print('flash ', len(data_flash))
|
|
|
|
|
2016-04-03 13:40:53 +01:00
|
|
|
pad = b'\xff' * (SEGS_MAX_SIZE - len(data_flash))
|
2014-11-27 20:30:33 +00:00
|
|
|
fout.write(pad)
|
|
|
|
print('padding ', len(pad))
|
|
|
|
|
|
|
|
with open(sys.argv[2], 'rb') as f:
|
|
|
|
data_rom = f.read()
|
|
|
|
fout.write(data_rom)
|
|
|
|
print('irom0text', len(data_rom))
|
|
|
|
|
2016-04-03 13:40:53 +01:00
|
|
|
print('total ', SEGS_MAX_SIZE + len(data_rom))
|