diff options
author | Damien George <damien.p.george@gmail.com> | 2020-04-04 16:30:39 +1100 |
---|---|---|
committer | Damien George <damien.p.george@gmail.com> | 2020-04-04 16:30:39 +1100 |
commit | 497ca99eb29a724a6ff297bfa5e832c74a7fc7b0 (patch) | |
tree | c471e5c3f569694cee0726d1b00bc3014f2dcd6b | |
parent | e0905e85a7ad2961aa9192f6130565860e531ad3 (diff) |
esp8266/makeimg.py: Print out info about RAM segments when building fw.
-rw-r--r-- | ports/esp8266/makeimg.py | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/ports/esp8266/makeimg.py b/ports/esp8266/makeimg.py index a81b2d0c2..4d31cc079 100644 --- a/ports/esp8266/makeimg.py +++ b/ports/esp8266/makeimg.py @@ -2,6 +2,11 @@ import sys import struct import hashlib +# This region at the start of flash contains a small header and then segments +# containing .text, .data and .rodata, and so must be large enough to hold all +# of this. This data is loaded to the appropriate places in RAM by the ROM +# bootloader at boot. After this in flash comes .irom0.text, which must begin +# on a flash erase-page boundary. SEGS_MAX_SIZE = 0x9000 assert len(sys.argv) == 4 @@ -18,6 +23,15 @@ with open(sys.argv[3], "wb") as fout: md5.update(data_flash[4:]) print("flash ", len(data_flash)) + # Print info about segments in this first part of flash + num_segs = struct.unpack_from("<BBBBI", data_flash, 0)[1] + offset = 8 + for seg_num in range(num_segs): + seg_name = [".text", ".data", ".rodata"][seg_num] + seg_offset, seg_size = struct.unpack_from("<II", data_flash, offset) + print(" {:7} {} at 0x{:x}".format(seg_name, seg_size, seg_offset)) + offset += 8 + seg_size + with open(sys.argv[2], "rb") as f: data_rom = f.read() |