Hi,

Wanting to look how much ram my project uses I came across the following
issue:
Using the binutils size program to have a look at the used ram gives
wrong results when you have data in the .infomem section.
The reported size of data includes the .infomem size (because .infomem
is writeable and has contents). Ok, .infomem should contain data but
this is confusing as I expect the reported data and bss sizes to
indicate how much of my valuable ram is used.

Maybe .infomem could get marked as executable so it will count to text.

Clemens


example data follows:

binutils size source snippet:
---------------
  if ((flags & SEC_CODE) != 0 || (flags & SEC_READONLY) != 0)
    textsize += size;
  else if ((flags & SEC_HAS_CONTENTS) != 0)
    datasize += size;
  else
    bsssize += size;
---------------

$ msp430-objdump -h main.elf
[...]
Sections:
Idx Name          Size      VMA       LMA       File off  Algn
  0 .text         00004cc2  00001100  00001100  0000010e  2**1
                  CONTENTS, ALLOC, LOAD, READONLY, CODE
  1 .data         00000012  00000200  00005dc2  00004dd0  2**1
                  CONTENTS, ALLOC, LOAD, DATA
  2 .bootloader   00000000  00000c00  00000c00  00004e02  2**0
                  CONTENTS
  3 .infomem      0000003a  00001000  00001000  000000d4  2**1
                  CONTENTS, ALLOC, LOAD, DATA
  4 .infomemnobits 00000000  00001000  00001000  00004e02  2**0
                  CONTENTS
  5 .bss          000002bf  00000212  00000212  000000d4  2**1
                  ALLOC
  6 .noinit       00000000  000004d1  000004d1  00004e02  2**0
                  CONTENTS
  7 .vectors      00000020  0000ffe0  0000ffe0  00004de2  2**0
                  CONTENTS, ALLOC, LOAD, READONLY, CODE
[...]

$ msp430-size -x main.elf
   text    data     bss     dec     hex filename
 0x4ce2    0x4c   0x2bf   20461    4fed main.elf

msp430-gcc ver. 3.3.3
binutils version 2.14

Reply via email to