Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 11 additions & 1 deletion tools/sizes.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,15 @@
import subprocess
import sys

def get_segment_hints():
hints = {}
hints['IROM'] = ' - code in flash (default or ICACHE_FLASH_ATTR)'
hints['IRAM'] = ' / 32768 - code in IRAM (ICACHE_RAM_ATTR, ISRs...)'
hints['DATA'] = ') - initialized variables (global, static) in RAM/HEAP'
hints['RODATA'] = ') / 81920 - constants (global, static) in RAM/HEAP'
hints['BSS'] = ') - zeroed variables (global, static) in RAM/HEAP'
return hints

def get_segment_sizes(elf, path):
sizes = {}
sizes['IROM'] = 0
Expand Down Expand Up @@ -53,10 +62,11 @@ def main():

args = parser.parse_args()
sizes = get_segment_sizes(args.elf, args.path)
hints = get_segment_hints()

sys.stderr.write("Executable segment sizes:" + os.linesep)
for k in sizes.keys():
sys.stderr.write("%-7s: %d%s" % (k, sizes[k], os.linesep))
sys.stderr.write("%-7s: %-5d %s %s" % (k, sizes[k], hints[k], os.linesep))

return 0

Expand Down