If you are using malloc, you can estimate how much memory is used fairly 
easily: 

1. At the beginning of the startup code (before idata and bss are set up), 
fill all ram with an arbitrary value, like 0x55.  
2. Let your application run for a long time
3. Examine the contents of memory looking for contiguous blocks of 0x55.  

The block between the stack and the heap is the only one that is very 
interesting, as any other blocks are likely uninitialized arrays and unused 
blocks from the heap.  This block represents all of the ram that has not been 
used, yet.

This only gives an estimate, because if you're using malloc, you probably 
won't be able to determine if more blocks will be taken from the heap later.  
Increasing the time the system runs before examining your ram contents will 
improve confidence in the estimate.  Even without malloc, this can show you 
the maximum stack usage at any time.

It's not perfect, but you can leave the ram initialisation in your startup 
code forever, and always have a way of checking the ram contents against a 
known initial value.  Also, using a strange value (not 0x00 or 0xFF) can make 
bugs involving uninitialised memory more obvious.

Neil

On Wednesday 21 December 2005 01:12, nobo...@web.de wrote:
> Hi,
>
> the msp430-size can't estimate how much space will be used on the stack
> and on the heap.
> The only way is to use a stackcheck (see at examples) and not use
> malloc.
>
> Regards,
>
> Rolf
>
> mspgcc-users@lists.sourceforge.net schrieb am 21.12.05 08:30:07:
> > msp430-size <file-name>.elf
> >
> > Sincerely,
> >
> > David Smead
> > www.amplepower.com
> > www.amplepower.net
> >
> > On Wed, 21 Dec 2005, Thomas - DC2RPT wrote:
> > > Hi,
> > >
> > > Maybe someone could help me a little bit.
> > >
> > > - Is it possible to find out in a easy way, how much of my ram (not
> > > flash) on the target is used or how could i see at least, if i use to
> > > much ?
> > >
> > > cu Thomas
> > >
> > >
> > > -------------------------------------------------------
> > > This SF.net email is sponsored by: Splunk Inc. Do you grep through log
> > > files for problems?  Stop!  Download the new AJAX search engine that
> > > makes searching your log files as easy as surfing the  web.  DOWNLOAD
> > > SPLUNK! http://ads.osdn.com/?ad_id=7637&alloc_id=16865&op=click
> > > _______________________________________________
> > > Mspgcc-users mailing list
> > > Mspgcc-users@lists.sourceforge.net
> > > https://lists.sourceforge.net/lists/listinfo/mspgcc-users
> >
> > -------------------------------------------------------
> > This SF.net email is sponsored by: Splunk Inc. Do you grep through log
> > files for problems?  Stop!  Download the new AJAX search engine that
> > makes searching your log files as easy as surfing the  web.  DOWNLOAD
> > SPLUNK! http://ads.osdn.com/?ad_id=7637&alloc_id=16865&op=click
> > _______________________________________________
> > Mspgcc-users mailing list
> > Mspgcc-users@lists.sourceforge.net
> > https://lists.sourceforge.net/lists/listinfo/mspgcc-users
>
> -------------------------------------------------------
> This SF.net email is sponsored by: Splunk Inc. Do you grep through log
> files for problems?  Stop!  Download the new AJAX search engine that makes
> searching your log files as easy as surfing the  web.  DOWNLOAD SPLUNK!
> http://ads.osdn.com/?ad_id=7637&alloc_id=16865&op=click
> _______________________________________________
> Mspgcc-users mailing list
> Mspgcc-users@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/mspgcc-users

Reply via email to