Pedro Zorzenon Neto wrote:
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?)
No bug! As you can see size shows the actual size for the bss segment
but as long as the common objects aren't there jet they are not counted
to it. Whether they are positioned in the bss segment once or twice or
more often or even in the data (!) segment depends on the way it is
linked (especially when dealing with dynamically linked objects defining
the same symbol names). This will usually not apply to MSP users who
don't define the same symbol in two different modules by mistake (at
lest I wouldn't expect that) but it is generic behaviour.
So to determine the size of the common objects (as well as any other
objects/segments) you can use nm (msp430-nm) with the -S option. You can
run it with all your module object files (especially look for the c/C
(common), b/B (bss) objects for determining the later bss size or d/D
for data size).
So
msp430-gcc -mmcu=msp430x149 -I/usr/local/msp430/msp430/include -Wall -O1
-c size-test.c -o size-test.o;
msp430-nm -S *.o;
or more comfortable:
msp430-nm -S *.o|grep "^[0-9a-f]\{8\} [0-9a-f]\{8\} [CbB] .\+$"|sort -t
" " -k 4 -u|cut -d " " -f4,2;
should give a list of all objects to be positioned in the bss segment
with their sizes.
Good luck
Arnd-Hendrik
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
-------------------------------------------------------
This SF.Net email is sponsored by: YOU BE THE JUDGE. Be one of 170
Project Admins to receive an Apple iPod Mini FREE for your judgement on
who ports your project to Linux PPC the best. Sponsored by IBM.
Deadline: Sept. 13. Go here: http://sf.net/ppc_contest.php
_______________________________________________
Mspgcc-users mailing list
Mspgcc-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/mspgcc-users