Commit a621333a authored by Paul Sokolovsky's avatar Paul Sokolovsky

esp8266/makeimg.py: Store firmware size as last 4 bytes of padding area.

parent efb8aa0e
import sys
import struct
SEGS_MAX_SIZE = 0x9000
......@@ -11,12 +12,15 @@ with open(sys.argv[3], 'wb') as fout:
fout.write(data_flash)
print('flash ', len(data_flash))
with open(sys.argv[2], 'rb') as f:
data_rom = f.read()
pad = b'\xff' * (SEGS_MAX_SIZE - len(data_flash))
fout.write(pad)
assert len(pad) >= 4
fout.write(pad[:-4])
fout.write(struct.pack("I", SEGS_MAX_SIZE + len(data_rom)))
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))
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment