This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

What, exactly, goes in .ebss? How can I reduce usage?



I have a fairly large program, with a few small global variables and a few large global variables (they are not exactly massive though).

The rest of my variables are either function scope or files scope. Very few are static function scope.

A) The description of .ebss from the documentation says that data in .ebss is "global and static" variables... I guess this is static as in function scope static rather than static file scope??

B) My .ebss is 0x12c9 and max hole is 0x5de, quite a difference... so I am looking at anyway I can to reduce it. My first step is to try to reduce the larger global vars but as I mentioned even the large ones aren't exactly massive and I'm thinking would make only a little difference. Is there anything else I should do to reduce .ebss usage??

C) Unfortunately I also have a few other things in dataRAM that prevent me from expanding .ebss such as objects from the SigGen lib and DP lib as well as .esysmem. I'm not sure if some of these could be moved to flash??

D) I do have quite a lot of string literals, though I assume these would be stored in .econst (which I have in flash)?

Thanks

P.S. Im working with the F28027

  • Hi!

    How much memory you allocate for global and static data is up to you only. On the other hand, your allocated memory should at least match the total volume of this data.

    May be I'm writing banalities...

    Regards,

    Igor

  • Toby - I moved this to the compiler forum in case the experts there have something to add

    Toby Mole said:
    A) The description of .ebss from the documentation says that data in .ebss is "global and static" variables... I guess this is static as in function scope static rather than static file scope??

    I think both - but would need to confirm. 

    Toby Mole said:
    B) My .ebss is 0x12c9 and max hole is 0x5de, quite a difference..

    This could be due to data page blocking.  The compiler likes to keep structures/arrays/etc from crossing page boundaries.  This helps code size and performance.  By default, data memory may be wasted to avoid excessive DP loads.  You can avoid the wasted data space by using the -md compiler switch but that costs cycles and code size.  

    Toby Mole said:
    C) Unfortunately I also have a few other things in dataRAM that prevent me from expanding .ebss such as objects from the SigGen lib and DP lib as well as .esysmem. I'm not sure if some of these could be moved to flash??

    If they are constants yes - sysmem no.

  • Thanks Igor, Lori.

    Lori Heustess said:
    I think both - but would need to confirm. 

    If this is the case, then only function scope local non-static variables are not stored in .ebss?

  • The .ebss section contains global, file level static, and function level static variables.  Function local variables that are not static are stored on the stack.  Building with higher levels of optimization can cause some function local variables to reside entirely in registers.

    Thanks and regards,

    -George

  • Toby Mole said:
    A) The description of .ebss from the documentation says that data in .ebss is "global and static" variables... I guess this is static as in function scope static rather than static file scope??

    What's stored there is non-const static-scope variables.  Static-scope variables are global variables and function-local static-declared variables.

    Yes, string literals go in .econst:string