-->
Page 1 of 1

Getting memory usage at compile time

PostPosted: Fri Nov 14, 2014 11:38 am
by igrr
This is a reply to a question that was asked here somewhere, but I couldn't find the existing topic.

Here's a short script to get memory usage (data, rodata, bss) at compile time, like with avr-gcc.
https://gist.github.com/igrr/43f8b8c3c4f883f980e5

Code: Select all$ OBJDUMP=../xtensa-lx106-elf/bin/xtensa-lx106-elf-objdump ./mem_usage.sh app.out 81920
data: 2644
rodata: 3400
bss: 29536
total: 35580
free: 46340


edit: added free size reporting

Re: Getting memory usage at compile time

PostPosted: Fri Nov 14, 2014 2:52 pm
by reaper7
nice little tool!

TNX

Re: Getting memory usage at compile time

PostPosted: Wed Dec 30, 2015 11:16 am
by Gary B
I see what you are doing.. searching for text-markers ...
but I don't get it running.. tried to set the variable OBJDUMP in several ways but it does not work...
would it be possible to give a step by step advice?

best regards

Re: Getting memory usage at compile time

PostPosted: Thu Dec 31, 2015 4:33 am
by Gary B
Got it... just in case what I changed
OS: Ubuntu
1) I changed the first Part of the script into ..
Code: Select allif [ -z "$OBJDUMP" ]; then
   echo "Setting OBJDUMP"
   OBJDUMP=xtensa-lx106-elf-objdump
#   exit 1
fi

2) I did copy mem_usage.sh into the directory of the xtensa-compiler... which is in my case..
/opt/esp-open-sdk/xtensa-lx106-elf/bin
3) Added the path of the compiler to the environment variable $PATH .. which I already did before

now you can run it everywhere by entering...
> bash mem_usage.sh app.out 81920