Skip to content

Commit a621333

Browse files
committed
esp8266/makeimg.py: Store firmware size as last 4 bytes of padding area.
1 parent efb8aa0 commit a621333

File tree

1 file changed

+9
-5
lines changed

1 file changed

+9
-5
lines changed

esp8266/makeimg.py

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import sys
2+
import struct
23

34
SEGS_MAX_SIZE = 0x9000
45

@@ -11,13 +12,16 @@
1112
fout.write(data_flash)
1213
print('flash ', len(data_flash))
1314

15+
with open(sys.argv[2], 'rb') as f:
16+
data_rom = f.read()
17+
1418
pad = b'\xff' * (SEGS_MAX_SIZE - len(data_flash))
15-
fout.write(pad)
19+
assert len(pad) >= 4
20+
fout.write(pad[:-4])
21+
fout.write(struct.pack("I", SEGS_MAX_SIZE + len(data_rom)))
1622
print('padding ', len(pad))
1723

18-
with open(sys.argv[2], 'rb') as f:
19-
data_rom = f.read()
20-
fout.write(data_rom)
21-
print('irom0text', len(data_rom))
24+
fout.write(data_rom)
25+
print('irom0text', len(data_rom))
2226

2327
print('total ', SEGS_MAX_SIZE + len(data_rom))

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy