Nios® V/II Embedded Design Suite (EDS)
Support for Embedded Development Tools, Processors (SoCs and Nios® V/II processor), Embedded Development Suites (EDSs), Boot and Configuration, Operating Systems, C and C++
12745 Discussions

How can I obtain a map file from the linker?

Altera_Forum
Honored Contributor II
2,181 Views

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
0 Kudos
6 Replies
Altera_Forum
Honored Contributor II
1,293 Views

would the objdump file be what you are looking for?

0 Kudos
Altera_Forum
Honored Contributor II
1,293 Views

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
0 Kudos
Altera_Forum
Honored Contributor II
1,293 Views

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:
0 Kudos
Altera_Forum
Honored Contributor II
1,293 Views

Works great, thanks! 

 

Paolo
0 Kudos
Altera_Forum
Honored Contributor II
1,293 Views

<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.
0 Kudos
Altera_Forum
Honored Contributor II
1,293 Views

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

 

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

 

Dirk
0 Kudos
Reply