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.

Global symbols not in .map file

Other Parts Discussed in Thread: MSP430G2755

MSP430G2755, CCS 6.1.0.00104.  Global symbols that are static, and global arrays do no show up in the .map file.  I can have a global array Counts[10] and in the .map file it says I have 2,174 bytes of ram free; I can change it to Counts[1000] and it will still say I have 2,174 bytes free.  I cannot find anything in the linker properties that looks like it would suppress this info.


???

Thanks, Doug

  • Then probably CCS have optimized your array to use it on stack.
    Declare your array as ‘volatile’ or switch Optimization off or set to ‘0’.
  • Either that or it is optimized away totally. If it is never read from or written to it won't be included.

    Also, if the array is static const, it will be in Flash, not RAM.
  • Optimization was set to off; I changed it to '0' and they show up. My stack area is 1024 bytes so Counts[1000] wouldn't have fit on it. I have never heard of a compiler or linker putting static and/or global variables on the stack, is that very common?
  • I forgot to mention that the declaration was int Counts[1000] so it wouldn't fit on the stack. Also, I did already try creating a dummy routine to access all of the array and it made no difference.

    Thanks for the help.
    Doug
  • > I did already try creating a dummy routine

    Was this dummy routine called? Because if you only created a function that accesses it, but never actually call the function, then the function could be optimized away and along with it any variables only referenced in that function.

    Until you actually have code that uses the variable (writes to it in one part of your code, and uses it in another part of your code) you shouldn't care that it's being optimized away. It's good to understand why as a learning experience, but in practice the compiler generally does the right thing.
  • Ah, very interesting.  No, I did not call the dummy function that accessed the array.  I learn something knew every day.

    Thanks,

    Doug

**Attention** This is a public forum