This is the mail archive of the
mailing list for the binutils project.
Re: [Patch]: ld - add --print-memory-usage option
- From: Nicholas Clifton <nickc at redhat dot com>
- To: Tristan Gingold <gingold at adacore dot com>, Binutils <binutils at sourceware dot org>
- Date: Mon, 08 Jun 2015 09:57:34 +0100
- Subject: Re: [Patch]: ld - add --print-memory-usage option
- Authentication-results: sourceware.org; auth=none
- References: <F5C89706-F319-4A2D-8995-DF3A16E339B8 at adacore dot com>
this patch adds a new linker option to display memory usage on the target.
This feature is useful for embedded targets when you need to monitor the
amount of free memory. As far as I know there is no binutils tool for that:
the output of size is too rough, and the output of 'objdump -hâ is not clear
enough. Here is an example of output:
Memory region size total size Ratio
FLASH: 1524 B 3 MB 0.05%
SRAM: 22536 B 256 KB 8.60%
SDRAM: 0 GB 8 MB 0.00%
The names of memory region directly comes from the linker script.
I think that the names of the columns are slightly confusing. "size" is
really "Size of Region" and "total size" is "Size Occupied". Also
"Ratio" probably ought to be "%age Used" or something like that.
It might also help if the format of this layout is defined in the
documentation somewhere so that it becomes fixed, and users can write
tools to parse the output if they want to.
No regression on arm-elf.
What - no other targets ? Please check x86 or x86_64 at least.
Is it OK for trunk ?
I like it, but please could you add a testcase (or two) to check that
the feature continues to work ?