summaryrefslogtreecommitdiffstatshomepage
path: root/esp8266/makeimg.py
blob: 1ac681cb74fde51f4d8f75b873334de45c3c490b (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
import sys

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))

    pad = b'\xff' * (0x10000 - 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))

    print('total    ', 0x10000 + len(data_rom))