feat(memmap): add summary command to memory map script

This patch adds a `summary` command, invoked with:

  poetry run memory summary <map-file>

This command is capable of producing a summary table, similar to the
footprint command, or an HTML flame-graph representing the size of ELF
image sections.

When specified with `-o` (`--old`), an old GNU map file is used as a
past state and subtracted from the GNU map file specified by
`<map-file>` to annotate printed information with additional size
deltas.

Note that many bootloaders include alignment padding and will align to
a page size. To exclude this alignment-padding from the summary, use the
`-e` switch.

For example:

$ poetry run memory summary bl1.map -e -d 1
| Module    |        .text |    .data |      .bss |
|-----------|--------------|----------|-----------|
| bl1       |   32616(+24) | 2217(+0) | 11175(+0) |
| lib       | 55932(+2060) |   40(+0) | 10628(+0) |
| Subtotals | 88548(+2084) | 2257(+0) | 21803(+0) |
Total Static RAM memory (data + bss): 24060(+0) bytes
Total Flash memory (text + data): 90805(+2084) bytes

Change-Id: Id0bc157d09e654f89730dfbe318fa5f820e9f18d
Co-authored-by: Chris Kay <chris.kay@arm.com>
Signed-off-by: Chris Kay <chris.kay@arm.com>
Signed-off-by: Jimmy Brisson <jimmy.brisson@arm.com>
7 files changed