Page 1 of 1

[SOLVED] Report memory

Posted: Sat Jun 02, 2012 10:52 am
by indigos
Hi,

Can I see the RAM static and dynamic allocated with command in shell?
Can I see the static RAM allocated with gcc/eclipse? I tried to read map file but I don't understand which informations I need read.

Thank you

Re: Report memory

Posted: Sat Jun 02, 2012 11:35 am
by Giovanni
Hi,

The shell command "mem" gives you info about the used/free memory and the fragmentation status at runtime.

Statically allocated memory can be seen by reading the file ch.map created under ./build after compiling any demo. There you can see position and size of all modules.

Giovanni

Re: Report memory

Posted: Sat Jun 02, 2012 12:11 pm
by DrunkenDonkey
Based on code provided in this forum (sorry, can't remeber by who, but thanks) I hacked some script to display the memory usage after build and also create report which are biggest memory and code hogs for optimization. Just add somwhere at the bottom of your makefile:

include memory.mk

I did it just before the included rules.mk

The result in the console after build:

Code: Select all

Ram usage
Creating build/iMedical.dmp
   text      data       bss       dec       hex   filename
  66868      1488     11692     80048     138b0   build/project.elf

Done
SRAM:  stacks = 0, program = 12940, total = 12940, left = 3444, mcu_ram = 16384, utilization = 78%


edit: found where I took it from, thanks mabl :D