Forum Discussion

Altera_Forum's avatar
Altera_Forum
Icon for Honored Contributor rankHonored Contributor
22 years ago

How can I obtain a map file from the linker?

Hi all,

just a silly question...

How can I obtain a map file from the NIOS II IDE?

(usually I always put a "-M >mymapfile.txt" at the end of the linker command, but if I do that on the Properties window, nios2-elf-gcc.linker/General/Linker Flags I get an error...

Thanks for all,

Paolo

6 Replies

  • Altera_Forum's avatar
    Altera_Forum
    Icon for Honored Contributor rankHonored Contributor

    Yes and no...

    The map file generated by LD gives concise informations about which file contributed to which section...

    The objdump file contains the information about the size of each section, and its disassembled content...

    I usually using the map file to see which files have contributed to the final image, and which is the final footprint of the files I'm writing; It is quite hard to find these info in the objdump file.

    bye

    Paolo
  • Altera_Forum's avatar
    Altera_Forum
    Icon for Honored Contributor rankHonored Contributor

    Just add the following to the Compiler flags

    -Wl,-Map -Wl,/cygdrive/c/my_map_file

    This will deposit a map file called my_map_file at the root of c:
  • Altera_Forum's avatar
    Altera_Forum
    Icon for Honored Contributor rankHonored Contributor

    <div class='quotetop'>QUOTE </div>

    --- Quote Start ---

    Just add the following to the Compiler flags

    -Wl,-Map -Wl,/cygdrive/c/my_map_file[/b]

    --- Quote End ---

    this only works under the condition that you have a drive with this path, I guess.

    I had to instead simply put

    -Wl,-Map -Wl,project.map

    to get it put the map into file project.map in my debug/release directory, readily available inside IDE project navigator.
  • Altera_Forum's avatar
    Altera_Forum
    Icon for Honored Contributor rankHonored Contributor

    and you may want to add "--demangle" if you are programming in C++

    "-Wl,--demangle,-Map,/cygdrive/c/mapfile"

    Dirk