From 3604cb1f8ca4a926039a9540d03bb224d84af3e1 Mon Sep 17 00:00:00 2001 From: Tristan Gingold Date: Fri, 5 Jun 2015 15:09:31 +0200 Subject: Add new ld option: --print-memory-usage ld/ * NEWS: Mention new option. * lexsup.c (parse_args): Handle --print-memory-usage. (ld_options): Add --print-memory-usage. * ldmain.c (main): Call lang_print_memory_usage. * ldlex.h (enum option_values): Add OPTION_PRINT_MEMORY_USAGE. * ldlang.h: Add prototype of lang_print_memory_usage. * ldlang.c (lang_print_memory_size, lang_print_memory_usage): New functions. * ld.texinfo (Options): Document --print-memory-usage. * ld.h (args_type): Add print_memory_usage field. ld/testsuite/ * ld-scripts/print-memory-usage-1.t, * ld-scripts/print-memory-usage-1.s, * ld-scripts/print-memory-usage-1.l, * ld-scripts/print-memory-usage-2.t, * ld-scripts/print-memory-usage-2.l, * ld-scripts/print-memory-usage-3.s, * ld-scripts/print-memory-usage-3.t, * ld-scripts/print-memory-usage-3.l, * ld-scripts/print-memory-usage.t: New tests. * ld-scripts/print-memory-usage.exp: Run them. --- ld/ld.texinfo | 15 +++++++++++++++ 1 file changed, 15 insertions(+) (limited to 'ld/ld.texinfo') diff --git a/ld/ld.texinfo b/ld/ld.texinfo index 0c5f884..e12b64a 100644 --- a/ld/ld.texinfo +++ b/ld/ld.texinfo @@ -1472,6 +1472,21 @@ Print the name of the default output format (perhaps influenced by other command-line options). This is the string that would appear in an @code{OUTPUT_FORMAT} linker script command (@pxref{File Commands}). +@kindex --print-memory-usage +@cindex memory usage +@item --print-memory-usage +Print used size, total size and used size of memory regions created with +the @ref{MEMORY} command. This is useful on embedded targets to have a +quick view of amount of free memory. The format of the output has one +headline and one line per region. It is both human readable and easily +parsable by tools. Here is an example of an output: + +@smallexample +Memory region Used Size Region Size %age Used + ROM: 256 KB 1 MB 25.00% + RAM: 32 B 2 GB 0.00% +@end smallexample + @cindex help @cindex usage @kindex --help -- cgit v1.1