print "{0:>10}|{1:>30}|{2:>12}|{3:>12}|{4:>8}".format("Section", "Description", "Start (hex)", "End (hex)", "Used space")
print "------------------------------------------------------------------------------"
sec_name = ["data", "rodata", "bss", "text", "irom0_text"]
sec_des = ["Initialized Data (RAM)", "ReadOnly Data (RAM)", "Uninitialized Data (RAM)", "Uncached Code (IRAM)", "Cached Code (SPI)"]
sec_size = []
for i in range(len(sec_name)):
ss = e.get_symbol_addr('_' + sec_name[i] + '_start')
se = e.get_symbol_addr('_' + sec_name[i] + '_end')
sec_size.append(int(se-ss))
print "{0:>10}|{1:>30}|{2:>12X}|{3:>12X}|{4:>8d}".format(sec_name[i], sec_des[i], ss, se, sec_size[i])
print "------------------------------------------------------------------------------"
print "{0} : {1:X} {2}()".format("Entry Point", image.entrypoint, args.entry_symbol)
ram_used = sec_size[0] + sec_size[1] + sec_size[2]
print "{0} : {1:d}".format("Total Used RAM", ram_used)
print "{0} : {1:d}".format("Free RAM", 0x014000 - ram_used)
print "{0} : {1:d}".format("Free IRam", 0x08000 - sec_size[3])