Skip to content
Snippets Groups Projects
Commit a621333a authored by Paul Sokolovsky's avatar Paul Sokolovsky
Browse files

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

parent efb8aa0e
Branches
No related tags found
No related merge requests found
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))
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment