This is the mail archive of the mailing list for the binutils project.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [Patch]: ld - add --print-memory-usage option

Hi Tristan,

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 ?


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]