Keil Logo

How to find the location of a symbol within the map file

5.5 How to find the location of a symbol within the map file

To find the location of a symbol within the map file you must find the section that defines the symbol, and ensure that the linker has not removed the section.

To find the location of a symbol within the map file, use the --keep=section_id and --map options to view the image memory map. For example, if object(section) is the section containing the symbol, enter:
armlink --keep=object(section) --map s.o --output=s.axf
The memory map shows where the section containing the symbol is placed.
As an example, do the following:

Procedure

  1. Create the file s.c containing the following source code:
    long long altstack[10] __attribute__ ((section ("STACK"), zero_init));
    int main(void)
    {
        return sizeof(altstack);
    }
  2. Compile the source:
    armcc -c s.c -o s.o
  3. Link the object s.o, keeping the STACK symbol and displaying the image memory map:
    armlink --keep=s.o(STACK) --map s.o --output=s.axf
  4. Locate the STACK symbol in the output, for example:
    …
    Execution Region ER_RW (…)
    **** No section assigned to this execution region ****
    Execution Region ER_ZI (…)
    Base Addr    Size         Type   Attr      Idx    E Section Name        Object
    …
    0x00008228   0x00000050   Zero   RW            2    STACK               s.o
    This shows that the stack is placed in execution region ER_ZI.
Non-ConfidentialPDF file icon PDF versionARM DUI0377H
Copyright © 2007, 2008, 2011, 2012, 2014-2016 ARM. All rights reserved. 
  Arm logo
Important information

This site uses cookies to store information on your computer. By continuing to use our site, you consent to our cookies.

Change Settings

Privacy Policy Update

Arm’s Privacy Policy has been updated. By continuing to use our site, you consent to Arm’s Privacy Policy. Please review our Privacy Policy to learn more about our collection, use and transfers
of your data.