Is there a way to avoid generating the 'discarded input sections' portion of the linker map file? The map file is a great resource, but it gives me just over 25,000 lines of absolutely useless entries, mostly in .debug_macro and .group. I'm having a heck of a time finding any information on where those come from and how to get rid of them.
Thanks,
Scott
Wanted to share my solution - turns out I don't need to dig that out of the map file, MCUX's Symbol Viewer does a pretty good job of extracting everything from the ELF file. It's sortable by size or address and you can sort within a section, which is exactly what I'm after.
Hi Scott,
Thanks for sharing your solution.
Best Regards,
Alexis Andalon
Hi Scott,
Sometimes the compiler detect that a variable or a function isn't necessary and optimize it, this can be seen in this section.
But this isn't relevant for your implementation, as you see in the image, this not has a memory location assigned.
I hope this helps you.
Best Regards,
Alexis Andalon
Yes, I understand that, but how do I stop it from outputting that? Or is there a tool I can use to easily generate a linker map that only lists things actually placed in memory? I often need to consult the linker map to see how much space things are using and it's hard to do when 95% of the file is garbage.
Thanks,
Scott
I think you’ll need to write yourself a script to filter out these line. I’d suggest using (g)awk.
This is one of those things that makes me wonder what I'm doing so differently that this is a difficult thing to do. On the HC08 the linker map output was nicely formatted and readable without a lot of excess cruft, and while the ARM linker's map file is more standard, I can't find any off-the-shelf tools that let me view it in a useful manner.
I've got AMAP and it'll parse the files, but it doesn't distinguish between things that go in memory (which are the only things I care about in this context) and debug objects, and it doesn't let you sort by size within a section.
What I'm usually doing is looking for hogs - things in RAM taking more space than I expect, things that don't need to be there at all like USB descriptors only used during enumeration but placed in RAM by default, and code that's bloated.
I can cut out the 'discarded sections' part of the linker map and drop all of the .debug* sections and get AMAP's display down to something reasonable, but because of its limited sorting options I can't separate RAM from ROM objects and they're all mixed in together.
What's everyone else use to keep an eye on their memory usage?
Scott
Hi Scott,
I couldn't find any way to hide this section. I will suggest to check the ARM Compiler armlink User Guide, there should be a way to hide this section when the .map is created.
You can find the -Xlinker commands used for the default project in the project options - C/C++ Build - Settings - MCU Linker - Miscellaneous.
Best Regards,
Alexis Andalon
Thanks, I've looked it over but I can't find anything on controlling the map output, other than turning it on or off. I can exclude sections from linking, but not from the map as far as I can see.