Commit graph

12 commits

Author SHA1 Message Date
Chris Kay
ed0c801fc6 refactor(memmap): migrate to Poetry
This change refactors the memmap tool into a Poetry project, with its
own dependencies. You can continue to run it manually with:

    poetry run memory <args>

Change-Id: I346283df1b8bfad4babc1f5a3861dab94d4a006a
Signed-off-by: Chris Kay <chris.kay@arm.com>
2025-02-27 15:32:05 +00:00
Yann Gautier
a6462e05cf feat(memmap): add RELA section display
When PIE is enabled, it can be handy to display the .rela.dyn section.
Add RELA in the list of symbols parsed, to display this section in
memory map.

Signed-off-by: Yann Gautier <yann.gautier@st.com>
Change-Id: Ic40da54ce6fb6e281fb1a6627e9b8830993cfb2c
2024-01-18 14:02:18 +01:00
Sekhar Nori
6dc8ee61ff fix(memmap): fix memory map dump when SEPARATE_CODE_AND_RODATA=0
When building BL1 with SEPARATE_CODE_AND_RODATA=0, symbol names
__RO_{START|END}__ are ignored by memory map dump script.

Fix it by including the symbol in regular expression.

While at it, update the copyright year to current.

Change-Id: Iafeab75c5711429ea0b744510caf27dd8784a29a
Signed-off-by: Sekhar Nori <nsekhar@ti.com>
2024-01-18 13:02:53 +05:30
Harrison Mutai
9e72d01ed2 fix(memmap): fix footprint free space calculation
Calculate the free space as the range between the
limit and the end of the memory region *_REGION_END.

Change-Id: I9cacadea2543c9f5ddaebca82344a83678cd7d55
Signed-off-by: Harrison Mutai <harrison.mutai@arm.com>
2024-01-12 10:27:22 +00:00
Michal Simek
f7d445fcbb chore(bl): add UNALIGNED symbols for TEXT/RODATA
Add symbols to mark end of TEXT/RODATA before page alignment.
Similar change was done by commit 8d69a03f6a ("Various
improvements/cleanups on the linker scripts") for
RO_END/COHERENT_RAM. These symbols help to know how much free
space is in the final binary because of page alignment.

Also show all *UNALIGNED__ symbols via poetry.
For example:
poetry run memory -p zynqmp -b debug

Change-Id: I322beba37dad76be9f4e88ca7e5b3eff2df7d96e
Signed-off-by: Michal Simek <michal.simek@amd.com>
2023-06-12 12:50:08 +02:00
Harrison Mutai
d0e3053c4f fix(memmap): reintroduce support for GNU map files
The intial patch stack only supported ELF files, which proved
particularly problematic when dealing with incomplete builds (i.e. build
didn't complete due to linker errors). This adds support for GNU map
files. Most analysis performed by the tool should be possible with map
files alone.

Change-Id: I89f775a98efc5aef6671a17d0e6e973df555a6fa
Signed-off-by: Harrison Mutai <harrison.mutai@arm.com>
2023-06-08 14:06:00 +01:00
Harrison Mutai
cc60aba227 feat(memmap): add topological memory view
Present memory usage in hierarchical view. This view maps modules to
their respective segments and sections.

Change-Id: I5c374b46738edbc83133441ff3f4268f08cb011d
Signed-off-by: Harrison Mutai <harrison.mutai@arm.com>
2023-05-12 14:38:22 +01:00
Harrison Mutai
d9d5eb138d feat(memmap): add tabular memory use data
Add support for tabulating static memory consumption data from ELF
binaries. This relies on static symbols, defined in the linker files,
that provide information about the memory ranges.

Change-Id: Ie19cd2b80a7b591607640feeb84c63266963ea4d
Signed-off-by: Harrison Mutai <harrison.mutai@arm.com>
2023-05-12 14:38:22 +01:00
Harrison Mutai
af5b49e992 refactor: improve readability of symbol table
Make the symbol table produced by the memory mapping script more
readable. Add a generic interface for interacting with ELF binaries.
This interface enables us to get symbols that provide some insights into
TF-A's memory usage.

Change-Id: I6646f817a1d38d6184b837b78039b7465a533c5c
Signed-off-by: Harrison Mutai <harrison.mutai@arm.com>
2023-05-12 14:38:22 +01:00
Yann Gautier
d16bfe0fef feat(debug): update print_memory_map.py
Add some entries in blx_symbols, that are used when the flag
SEPARATE_CODE_AND_RODATA is not enabled (__RO_* and __TEXT_RESIDENT_*).
Add all new symbols that were not yet present in the script.
Correct __BSS_END to __BSS_END__, and add __BSS_START__.
Add new *_XLAT_TABLE_* symbols.
As those strings are longer than 22, update display format string to
be dependent on the longest string.
The script also skips lines for which the _START__ and _END__
symbols have the same address (empty sections).

Signed-off-by: Yann Gautier <yann.gautier@foss.st.com>
Change-Id: I6c510ced6116b35d14ee2cb7a6711405604380d6
2022-04-07 13:46:31 +02:00
Louis Mayencourt
b890b36d1d tools: Small improvement to print_memory_map script
This patch:
- Add the __COHERENT_RAM_START__ and __COHERENT_RAM_END__ symbols.
- Improve how the symbols are found with a regex.
- Add a build option to revert the memory layout output.

Change-Id: I54ec660261431bc98d78acb0f80e3d95bc5397ac
Signed-off-by: Louis Mayencourt <louis.mayencourt@arm.com>
2020-02-14 16:31:19 +00:00
Louis Mayencourt
ea698c1ea4 tools: Add show_memory script
show_memory is a simple tools that parse the blx.map files and print a
representation of the memory layout for the latest build.
This representation is based on standard symbols present on the map
files as: __TEXT_START/END__, __RODATA_START/END__, __STACKS_START/END__
, etc..

Change-Id: Iba3e301a1a9fee9a35abf1afdb69093617d33929
Signed-off-by: Louis Mayencourt <louis.mayencourt@arm.com>
2019-11-25 09:47:50 +00:00