Does z88dk/sdcc output a map file or file that can be used to see...
Posted: Tue Feb 20, 2018 4:29 pm
Does z88dk/sdcc output a map file or file that can be used to see the size of functions and variables making up the final code?
The z80 Development Kit
https://www.z88dk.org/forum/
Code: Select all
_main = $9360 ; addr, public, , terms_c, code_compiler, terms.c:1526
_isr = $9319 ; addr, public, , terms_c, code_compiler, terms.c:1476
_print_line_word_wrapped = $91D0 ; addr, public, , terms_c, code_compiler, terms.c:1284
_dy = $DD83 ; addr, public, , terms_c, bss_compiler, terms.c:1250
Code: Select all
1281 0000 ; ---------------------------------
1282 0000 ; Function print_line_word_wrapped
1283 0000 ; ---------------------------------
1284 0000 _print_line_word_wrapped:
1285 0000 DD E5 push ix
1286 0002 DD 21 00 00 ld ix,0
1287 0006 DD 39 add ix,sp
1288 0008 F5 push af
1289 0009 DD 4E 06 ld c,(ix+6)
....
1473 0149 ; ---------------------------------
1474 0149 ; Function isr
1475 0149 ; ---------------------------------
1476 0149 _isr:
1477 0149 F5 push af
1478 014A C5 push bc
1479 014B D5 push de
...
Code: Select all
1284 0000 _print_line_word_wrapped:
Code: Select all
1476 0149 _isr:
Code: Select all
SECTION CODE
org __crt_org_code
Code: Select all
import fileinput
last_size = 0
last_item = None
entries = []
for line in fileinput.input():
size_, entry_ = line.split(",")
entry_ = entry_.strip()
if entry_.startswith("i_") or entry_.startswith("__code_") or entry_.startswith("__rodata_") or entry_.startswith("__data_"):
continue
size_ = int(size_, 16)
if size_ > 65535:
continue
diff = size_ - last_size
if diff <= 0:
last_size = size_
continue
if diff >= 64:
entries.append((last_item, diff))
last_size = size_
last_item = entry_
for key, value in sorted(entries, key=lambda x: x[1], reverse=True):
print("{0}: {1}".format(key, value))
Code: Select all
cat map_file.map | sed -n "s/^\\([a-zA-Z0-9_]*\\).*= .\([A-Z0-9]*\).*/\2,\1/p" | sort | python whatever.py