static variables missing from map file

Go To Last Post
10 posts / 0 new
Author
Message
#1
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Anybody knows, why are variables declared as static - no matter whether explicitly initialised or not, local or global - missing from the map file?

avr-gcc (GCC) 4.2.2 (WinAVR 20071221)

Thanks,

Jan Waclawek

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

The whole point of static is to make the names "secret".
They should have the same importance as "non-global" ASM symbols.

There will often be a switch in avr-ld that will publish these "local" symbols. You will probably enjoy having all the compiler-generated labels to trawl through.

If you want to debug a static variable, you can always mangle the name and make it global.

David.

p.s. Welcome Jan.
Do we keep quiet about your presence here ?
Are you secretly using C ? You must meet Mr Samperi.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

david.prentice wrote:
The whole point of static is to make the names "secret".
Well... this puts it into a certain perspective...

david.prentice wrote:
There will often be a switch in avr-ld that will publish these "local" symbols. You will probably enjoy having all the compiler-generated labels to trawl through.
I'd appreciate if you or anybody else could point me to that switch. A half-hour's browsing through ld's ehm...documentation yielded me nothing.

david.prentice wrote:
There will often be a switch in avr-ld that will publish these "local" symbols.
The map file is no light entertaining reading anyway, is it... Once I have to go through cryptic debugging information, I prefer to have a complete information at hand.

david.prentice wrote:
If you want to debug a static variable, you can always mangle the name and make it global.
Oh, there is no need for this. nm (avr-nm) hasn't heard yet that static means hidden, so it has no problem extracting also static variables from the binary (elf or whatever).

This could also be the end of story, just I prefer not to run an unnecessary utility, would the linker be able to do what it might IMHO rightfully be supposed to do.

---

david.prentice wrote:
p.s. Welcome Jan.
Thanks, David.
david.prentice wrote:
Do we keep quiet about your presence here ?
You mean, on 8052.com, the site dedicated to the best microcontroller of all times? No, it's no secret. The 8052 is a passion, you know, and AVRs are simply a necessity...
david.prentice wrote:
Are you secretly using C ?
Well, again, you know, I need to buy food, pay bills... ;-)

david.prentice wrote:
You must meet Mr Samperi.
Looking forward to it... ;-)

Jan

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

clawson wrote:
LD manual is here:
http://sourceware.org/binutils/d...

Well, I believe, the most relevant ld manual for the version of WinAVR I use is at
c:\Program Files\Atmel\AVR Tools\WinAVR\doc\binutils\ld.html\
however, as I said above, I found nothing relevant to the topic yet.

If you know what to look for specifically, please tell.

JW

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Run avr-nm on your elf file. The upper case letters give the properties of all the global symbols. The lower case letters give the properties of the local symbols. Type "man nm" into google for more info.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Jan,

I will give you the ld manual exercise.

avr-nm works like any regular nm, and may well give you easier answers.

David.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

checksix, David,

I just said it above: I know avr-nm will do the job in this respect; I am just #$%&... ehm... angry that I need to run two tools instead of one, and keep an eye on two files instead of one. OK, I know, it's a fair value for the money... :-D

I'd say case is dismissed by now, unless somebody comes up with a genuine ld-only solution... ;-)

Thanks to all for the hints and explanations.

Jan Waclawek

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

If you are using grown-up makefiles, then you just add the extra steps to your target-build. This should be painless.

If you are using Studio generated makefiles, you are limited to what Studio chooses to generate. e.g. you can add options but not extra processing steps.

The alternative is to add a "tool" to your Studio Tools Menu. Unfortunately I have never discovered how to pass project or filename parameters to the external tools.

You can of course do your building externally, an only go into Studio for debugging.

David.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Oh yes, sure. Thanks.

Jan