View Global variable Address in Segger Embedded Studio

Hi,

I want to view the Address of the Global variable In Segger Embedded Studio. I want to check this when debugger is not connected and not during runtime.
Is there is any way to view that?

Thank you,
Shreya JB

Parents
  • Hi,

    All static variables (this includes global variables) are listed with their address in the .map file, which is among the output files when you build the project. Static variables are placed in the data segment, so in the map file they will be listed on the form .data.VARIABLE_NAME, where VARIABLE_NAME is the name of the variable.

    For example, in the ble_app_hrs_pca10040_s132 example of nRF5 SDK v.17.1.0, in main.c there is a global variable m_conn_handle:

    Building the project and opening the .map file...

    ...reveals that the memory address used by the global variable m_conn_handle is 0x20002cc0, for this particular build:

    Please note that the address may be different when built on a different computer, or with a different toolchain or version of the toolchain, or at a different folder location, or at a different point in time, etc.

    The same generally applies for all c projects and for all SDKs: If you have a look in the map file, then you should find the memory locations given to static variables in the data section.

    Regards,
    Terje

  • Hi Terje,

    Thank you for the information. can we find the Globally defined structure members in that file?

  • Hi,

    The structure members will be layed out according to the specification of the C language and/or the toolchain implementation, accounting for any packing/aligning of data and so on, with the struct itself (typically the first member of the struct) at the address found in the map file.

    Regards,
    Terje

  • Hi Terje,

    Thank you for providing the information.

Reply Children
No Data
Related