size_report: cleanup up detection and error handling
We first check to see if we have a valid elf file before doing anything else. Otherwise we'd could get script errors instead of just notifying the user the file doesn't exist. Signed-off-by: Kumar Gala <kumar.gala@gmail.com>
This commit is contained in:
parent
f6af3ed14a
commit
73c7cd184b
1 changed files with 13 additions and 13 deletions
|
@ -425,25 +425,25 @@ def main():
|
||||||
stat_file = os.path.join(args.outdir, args.binary + ".stat")
|
stat_file = os.path.join(args.outdir, args.binary + ".stat")
|
||||||
elf_file = os.path.join(args.outdir, args.binary + ".elf")
|
elf_file = os.path.join(args.outdir, args.binary + ".elf")
|
||||||
|
|
||||||
|
if not os.path.exists(elf_file):
|
||||||
|
print("%s does not exist." % (elf_file))
|
||||||
|
return
|
||||||
|
|
||||||
if not os.path.exists(bin_file):
|
if not os.path.exists(bin_file):
|
||||||
FNULL = open(os.devnull, 'w')
|
FNULL = open(os.devnull, 'w')
|
||||||
subprocess.call([args.bin_objcopy,"-S", "-Obinary", "-R", ".comment", "-R",
|
subprocess.call([args.bin_objcopy,"-S", "-Obinary", "-R", ".comment", "-R",
|
||||||
"COMMON", "-R", ".eh_frame", elf_file, bin_file],
|
"COMMON", "-R", ".eh_frame", elf_file, bin_file],
|
||||||
stdout=FNULL, stderr=subprocess.STDOUT)
|
stdout=FNULL, stderr=subprocess.STDOUT)
|
||||||
|
|
||||||
if args.outdir and os.path.exists(elf_file):
|
fp = get_footprint_from_bin_and_statfile(bin_file, stat_file, 0, 0)
|
||||||
fp = get_footprint_from_bin_and_statfile(bin_file, stat_file, 0, 0)
|
base = os.environ['ZEPHYR_BASE']
|
||||||
base = os.environ['ZEPHYR_BASE']
|
ram, data = generate_target_memory_section(
|
||||||
ram, data = generate_target_memory_section(
|
args.bin_objdump, args.bin_nm, args.outdir, args.binary,
|
||||||
args.bin_objdump, args.bin_nm, args.outdir, args.binary,
|
base + '/', None)
|
||||||
base + '/', None)
|
if args.rom:
|
||||||
if args.rom:
|
print_tree(data, fp['total_flash'], args.depth)
|
||||||
print_tree(data, fp['total_flash'], args.depth)
|
if args.ram:
|
||||||
if args.ram:
|
print_tree(ram, fp['total_ram'], args.depth)
|
||||||
print_tree(ram, fp['total_ram'], args.depth)
|
|
||||||
|
|
||||||
else:
|
|
||||||
print("%s does not exist." % (elf_file))
|
|
||||||
|
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue