Address of a variable and a function in map file

Tip / Sign in to post questions, reply, level up, and achieve exciting badges. Know more

cross mob
BaT_3785171
Level 2
Level 2
First like given

43xxx_Wi-Fi project:

I added MyFile.c at this path
(43xxx_Wi-Fi_Exp\apps\snip\bluetooth_audio\MyFile1.c)

Contents of MyFile.c is as follows


/******start of MyFile.c *******/
int MyVariable;

void MyFunction()
{
MyVariable = 1;
}
/******end of MyFile.c *******/

MyFile1.c is included in makefile bluetooth_audio.mk as follows
$(NAME)_SOURCES    := bluetooth_audio.c \
                                           MyFile1.c \
                                           bluetooth_audio_nv.c
      
When I compile (snip.bluetooth_audio-CYW943907WAE3) the code,compilation is successful.

As per my understanding in map file snip.bluetooth_audio-CYW943907WAE3.map
(at path 43xxx_Wi-Fi_Exp\build\snip.bluetooth_audio-CYW943907WAE3\binary)
I should be able to see the address of 'MyVariable' declared in MyFile.c
and address of 'MyFunction' defined in MyFile.c

But even after successful compilation why i am not able to see address of 'MyVariable'
and 'MyFunction'?

pastedImage_4.png

0 Likes
1 Solution
PriyaM_16
Moderator
Moderator
Moderator
250 replies posted 100 replies posted 50 replies posted

Hello,

Compiler optimizations might result in variables being moved to a resistor and so they do not have any address associated with them.

You can use objdump tool to check all the symbols in your program using the elf file of program:

objdump.exe --dwarf=info elf_file_name >text_file_name.txt

Besides you may have a look at this article: https://www.embeddedrelated.com/showarticle/900.php I found this interesting and relevant to your question.

View solution in original post

1 Reply
PriyaM_16
Moderator
Moderator
Moderator
250 replies posted 100 replies posted 50 replies posted

Hello,

Compiler optimizations might result in variables being moved to a resistor and so they do not have any address associated with them.

You can use objdump tool to check all the symbols in your program using the elf file of program:

objdump.exe --dwarf=info elf_file_name >text_file_name.txt

Besides you may have a look at this article: https://www.embeddedrelated.com/showarticle/900.php I found this interesting and relevant to your question.