Hi Arnd-Hendrik,

  Thanks for your answer, but it did not work. In each file of my
project I have 3 types of variables:
   - local variables (declared with static, used only locally)
   - global variables (declared in the current .c, also used by other .c)
   - extern variables (declared in other .c file, used in current .c file)

  The full project has 43 .c files, some of them with these 3 kinds of
variables. I'm getting out of msp ram and need to debug it.

  What can I do to show how many bytes each of this 43 files.c are using
in bss section?

  (I noticed that I can generate a .s file, and search for ".comm"
keywords inside it, and calculate the bss size, but I supose that
msp430-size was the right tool for this... is this a bug in msp430-size?)

  Thanks,
    Pedro
  
On Sun, Sep 12, 2004 at 03:16:23PM +0200, Arnd-Hendrik Mathias wrote:
> Hi Pedro,
> in your first example there is only one step missing in comparison to 
> the second one: Your code is assembled but not linked against anything. 
> So if you have a look at your assembler file and also at your object 
> file (msp430-nm size-test.o) you have one locally linked static int 
> variable (size 2Bytes) and two global "common objects" which will be 
> resolved on link time (with other objects). The latter ones are not jet 
> counted to the bss segment (however they will be positioned there 
> later). You can check out this (not for production purposes ;°):
> add a line
> void* __stop_progExec__;
> to your size-test.c file
> do the steps from your first example and finally do
> msp430-ld -o size-test size-test.o
> then look at the object size-test with
> msp430-size size-test
> msp430-nm size-test
> you will find your symbols allocated in the bss segment.
> 
> The appropriate steps are included in the complete way (as in your 
> second example). You usually use the gcc (msp430-gcc) call as wrapper 
> for all of these steps. So you find the same (correct) results as in the 
> previous case.
> Best regards
> 
> Arnd-Hendrik
> 
> 
> Pedro Zorzenon Neto wrote:
> 
> >Hi,
> >
> > I think I found a bug in msp430-size. I'll show it with an example:
> >
> >/* --- begin of code --- */
> >int i;
> >static int j;
> >volatile int k;
> >
> >int main (void) {
> > return 1;
> >}
> >/* --- end of code --- */
> >
> >
> >msp430-gcc -mmcu=msp430x149 -I/usr/local/msp430/msp430/include -Wall -O1 
> >-S size-test.c -o size-test.s
> >msp430-as -mmcu=msp430x149 size-test.s -o size-test.o
> >msp430-size size-test.o
> >  text    data     bss     dec     hex filename
> >    10       0       2      12       c size-test.o
> >msp430-gcc -mmcu=msp430x149 -B/usr/local/msp430/msp430/lib size-test.o -o 
> >size-test
> >msp430-size size-test
> >  text    data     bss     dec     hex filename
> >   110       0       6     116      74 size-test
> >
> >  Why is msp430-size reporting "2" in the "bss" field for file size-test.o?
> >
> >  Thanks in advance,
> >    Pedro

Reply via email to