esp8266/makeimg.py: Store firmware size as last 4 bytes of padding area.
This commit is contained in:
parent
efb8aa0ef6
commit
a621333a4c
@ -1,4 +1,5 @@
|
||||
import sys
|
||||
import struct
|
||||
|
||||
SEGS_MAX_SIZE = 0x9000
|
||||
|
||||
@ -11,13 +12,16 @@ with open(sys.argv[3], 'wb') as fout:
|
||||
fout.write(data_flash)
|
||||
print('flash ', len(data_flash))
|
||||
|
||||
pad = b'\xff' * (SEGS_MAX_SIZE - len(data_flash))
|
||||
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))
|
||||
|
||||
pad = b'\xff' * (SEGS_MAX_SIZE - len(data_flash))
|
||||
assert len(pad) >= 4
|
||||
fout.write(pad[:-4])
|
||||
fout.write(struct.pack("I", SEGS_MAX_SIZE + len(data_rom)))
|
||||
print('padding ', len(pad))
|
||||
|
||||
fout.write(data_rom)
|
||||
print('irom0text', len(data_rom))
|
||||
|
||||
print('total ', SEGS_MAX_SIZE + len(data_rom))
|
||||
|
Loading…
x
Reference in New Issue
Block a user