EmbeddedRelated.com
Forums

mspgcc: how much flash and memory needed?

Started by M. Adam Davis September 2, 2004
What do I look for to find out how much memory and code is used in a 
compiled mspgcc program?

I've looked through the .LST file, but it seems to mention only where 
each segment is located, rather than how much of each is used.

When I flash the device the programmer tells me how many bytes are 
programmed, so I can at least get the flash code size, but still have no 
way to find the memory size needed.

-Adam

Beginning Microcontrollers with the MSP430

That gives me a long listing of the disassembled program in sections, 
but I'm not sure what to look for in it to find the memory usage.  Is 
there a particular section I should be looking at?

-Adam

R. Nusser wrote:

>>What do I look for to find out how much memory
and code is used in a
>>compiled mspgcc program?
>>    
>>
>
>If you have the objectfile after linking, try
>msp430-objdump -DS 
>
>Rudolf
>
>
>
>.
>
> 
>Yahoo! Groups Links
>
>
>
> 
>
>
>
>
>  
>

> What do I look for to find out how much memory and
code is used in a
> compiled mspgcc program?

If you have the objectfile after linking, try
msp430-objdump -DS 

Rudolf

Try msp430-size whatever.hex

More Spaghetti Please


--- In msp430@msp4..., "M. Adam Davis" <adavis@u...> wrote:
> That gives me a long listing of the disassembled
program in sections, 
> but I'm not sure what to look for in it to find the memory usage.  Is 
> there a particular section I should be looking at?
> 
> -Adam
> 
> R. Nusser wrote:
> 
> >>What do I look for to find out how much memory and code is used in
a
> >>compiled mspgcc program?
> >>    
> >>
> >
> >If you have the objectfile after linking, try
> >msp430-objdump -DS 
> >
> >Rudolf
> >
> >
> >
> >.
> >
> > 
> >Yahoo! Groups Links
> >
> >
> >
> > 
> >
> >
> >
> >
> >  
> >


Ok, I get
----------
msp430-size display.elf

   text    data     bss     dec     hex filename
   6074       4       0    6078    17be display.elf
----------
According to this page:
http://www.lawrencechitty.uklinux.net/wizardwiki/index.php?Memory%20Usage
text is code
data is initialized variables
bss is uninitialized variables

So, assuming I'm on the right path here, my program contains 6074 bytes 
of program code, and uses 4 bytes of variable memory.  I imagine it's so 
simple a program that it can rely mostly on the registers.

I suppose this means it'll fit into the 435... :-)

Let me know if I'm interpretting this incorrectly - I assume these are 
all in bytes and not words or kilobytes.

Thanks for your help!

-Adam

fqrley wrote:

>Try msp430-size whatever.hex
>
>More Spaghetti Please
>
>
>--- In msp430@msp4..., "M. Adam Davis" <adavis@u...> wrote:
>  
>
>>That gives me a long listing of the disassembled program in sections, 
>>but I'm not sure what to look for in it to find the memory usage. 
Is 
>>there a particular section I should be looking at?
>>
>>-Adam
>>
>>R. Nusser wrote:
>>
>>    
>>
>>>>What do I look for to find out how much memory and code is used
in a
>>>>compiled mspgcc program?
>>>>   
>>>>
>>>>        
>>>>
>>>If you have the objectfile after linking, try
>>>msp430-objdump -DS 
>>>
>>>Rudolf
>>>
>>>
>>>
>>>.
>>>
>>>
>>>Yahoo! Groups Links
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>> 
>>>
>>>      
>>>
>
>
>
>
>.
>
> 
>Yahoo! Groups Links
>
>
>
> 
>
>
>
>
>  
>

M. Adam Davis wrote:

> Ok, I get
> ----------
> msp430-size display.elf
> 
>    text    data     bss     dec     hex filename
>    6074       4       0    6078    17be display.elf
> ----------
> According to this page:
> http://www.lawrencechitty.uklinux.net/wizardwiki/index.php?Memory%20Usage
> text is code
> data is initialized variables
> bss is uninitialized variables
> 
> So, assuming I'm on the right path here, my program contains 6074
bytes 
> of program code, and uses 4 bytes of variable memory.  I imagine it's
so 
> simple a program that it can rely mostly on the registers.


Be careful, data doesn't include local variables. Local variables are 
created on the stack and it isn't possible to calculate the maximum 
stack size at compile time.


I assumed it needed more than it was telling me, but it's a simple 
enough program with no recursion that I'm not worried.

I haven't looked into it, but do you know off the top of your head what 
happens when the stack overflows?  Does the processor know about it, 
does gcc have code to handle it, or does the processor simply go off 
into never never land unless I monitor for it myself?

-Adam

Andreas Schwarz wrote:

>M. Adam Davis wrote:
>
>  
>
>>Ok, I get
>>----------
>>msp430-size display.elf
>>
>>   text    data     bss     dec     hex filename
>>   6074       4       0    6078    17be display.elf
>>----------
>>According to this page:
>>http://www.lawrencechitty.uklinux.net/wizardwiki/index.php?Memory%20Usage
>>text is code
>>data is initialized variables
>>bss is uninitialized variables
>>
>>So, assuming I'm on the right path here, my program contains 6074
bytes 
>>of program code, and uses 4 bytes of variable memory.  I imagine
it's so 
>>simple a program that it can rely mostly on the registers.
>>    
>>
>
>
>Be careful, data doesn't include local variables. Local variables are 
>created on the stack and it isn't possible to calculate the maximum 
>stack size at compile time.
>
>
>
>
>.
>
> 
>Yahoo! Groups Links
>
>
>
> 
>
>
>
>
>  
>

M. Adam Davis wrote:
> I assumed it needed more than it was telling me,
but it's a simple 
> enough program with no recursion that I'm not worried.
> 
> I haven't looked into it, but do you know off the top of your head
what 
> happens when the stack overflows?  Does the processor know about it, 
> does gcc have code to handle it, or does the processor simply go off 
> into never never land unless I monitor for it myself?

You have to take care of the stack size yourself.

Andreas