Add the hearing aid sample to the footprint tracking for the
nrf52840dk_nrf52840 and nrf5340dk_nrf5340_cpuapp.
The sample should represent a simple hearing aid implementation,
and is thus a very good candidate for tracking the footprint
of LE Audio in Zephyr.
Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
This commit adds a call to the Colorama initialisation function during
the module execution so that ANSI color sequences are properly
converted to the relevant Win32 API calls on the Windows.
Signed-off-by: Stephanos Ioannidis <root@stephanos.io>
Iterate on 3 main namespace to avoid collision in identifiers sharing
the same name at the top level when creating the diff.
Fixes#44940
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
replace with version.parse from packaging module.
prevent this warning message:
DeprecationWarning: The distutils package is deprecated
and slated for removal in Python 3.12. Use setuptools or
check PEP 632 for potential alternatives
Signed-off-by: Julien Massot <julien.massot@iot.bzh>
Add a few Bluetooth samples to track their footprint as part of the
effort to contain firmware bloat.
Signed-off-by: Carles Cufi <carles.cufi@nordicsemi.no>
The size percentage was doing "xx.xx%" so 100% would not be
aligned correctly when printed. So add a space for percentage
printing.
Also change the coloring of "(hidden)" node so it would not
have the same color as files or symbols.
Signed-off-by: Daniel Leung <daniel.leung@intel.com>
Extends memory footprint tracking to include echo_client and echo_server
networking samples on the frdm_k64f board.
Signed-off-by: Maureen Helm <maureen.helm@nxp.com>
Very simple script to diff between two ram or rom reports generated by
size_report. When you call call the ram_report or rom_report targets you
end up with a json file in the build directory that can be used as input
for this script.
The output shows which symbols insreased and which decreased in size and
also tracked added/remove symbols as well.
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
Add a tree node to group files under WORKSPACE so that
they won't be shown with full path. The WORKSPACE is
usually the same as WEST_TOPDIR unless ZEPHYR_WORKSPACE
is defined during build.
Signed-off-by: Daniel Leung <daniel.leung@intel.com>
The list of symbols only contain visible symbols that can be
obtained through ELF file. There are code and data where
the toolchain never emits symbols for them and thus are not
visible in the list. So add a "(hidden)" node to the tree
to show they are there.
Signed-off-by: Daniel Leung <daniel.leung@intel.com>
This changes how the tree is generated. Symbols with no paths
are now grouped together instead of scattering throughout
the tree. If paths in ELF file are not all under ZEPHYR_BASE,
it will create additional node groups as 2nd level. This is
useful when not all source files are under ZEPHYR_BASE, and
provides a better indications of where they are.
Signed-off-by: Daniel Leung <daniel.leung@intel.com>
This changes how paths are stored in intermediate structures
so that full paths are stored. This makes it more consistent
with those structures to avoid an issue where some paths are
full paths, some are relateive to ZEPHYR_BASE.
Signed-off-by: Daniel Leung <daniel.leung@intel.com>
This adds some common C++ file extensions so the script
can recognize those as source file, and display them in
different color.
Signed-off-by: Daniel Leung <daniel.leung@intel.com>
This fixes the issues on import statements identified by pylint.
Also add docstrings for method and classes. Most of them are
already there as comments, so simply move them as docstrings.
Signed-off-by: Daniel Leung <daniel.leung@intel.com>
It's easier and safer to parse json file rather than extract
total size from stdout
Now the .json file has two keys:
{
"symbols": {
"children": [
...
],
"identifier": ":",
"name": "root",
"size": 2220
},
"total_size": 34272
}
Signed-off-by: Jingru Wang <jingru@synopsys.com>
The script already accepts a depth parameter to configure the output,
but that parameter was not used at all. This commit adds the correct
handling by passing it to anytrees RenderTree iterator.
Signed-off-by: Detlev Zundel <dzu@member.fsf.org>
When printing the unassigned values the 'sym' variable is
used as a dict from which we try to get the 'name' value.
However, 'symbols['unassigned']' gives a list of keys, so
we get an 'TypeError' when trying to access ['name'] of
a string (the key).
Fix this issue by iterating over the values from
the 'symbols['unassigned']' dict instead.
Signed-off-by: Håkon Øye Amundsen <haakon.amundsen@nordicsemi.no>
Move the CSV files with release related data out of the python directory
into scripts/releases, which is more appropriate.
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
Colorama needs to be initialized, and for colors to display correctly on
Windows one needs to use the `USES_TERMINAL` option in CMake.
Signed-off-by: Carles Cufi <carles.cufi@nordicsemi.no>
Certain symbols do not contain a valid path, instead showing
`<built-in>` in the filename attribute. This leads to the resolve() call
failing on Windows, since the `<>` characters are not allowed in
filenames there. Fix this by catching the exception and skipping the
call in that case.
Signed-off-by: Carles Cufi <carles.cufi@nordicsemi.no>
Use anytree module to display tree and to allow easy exporting into
json.
Add option to export results into a json file.
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
...instead of GNU binutils to extract DWARF information.
This is now a bit more portable across OS and toolchain.
One bouns is that this nows with on qemu_x86_64.
A few differences are:
() z_mrsh_* which are aliases to handler_no_syscalls() are now
dropped as they are mapped to the same address, so that they
are not counted multiple times.
() Static functions and variables with same names should now be
attributed to the correct source files instead of being
accumulated into the same symbol of one file (e.g. multiple
thread_entry() in kernel tests).
() The totals for ROM and RAM are calculated from the
corresponding sections. Previous script includes the debug
sections as total ROM size which is not entirely correct.
Fixes#22996
Signed-off-by: Daniel Leung <daniel.leung@intel.com>
- Remove unused variables and an unused 'sys' import
- Simplify 'if len(foo) != 0' to 'if foo'. Non-empty lists/dicts/etc.
are truthy in Python.
- Use a raw string to fix this warning:
scripts/footprint/size_report:270:0: W1401: Anomalous backslash
in string: '\.'. String constant might be missing an r prefix.
(anomalous-backslash-in-string)
The issue is that '\.' just happens to work due to not being
recognized as an escape sequence.
Escape sequences are not interpreted in raw strings, so they're safer
for regexes.
- Replace 'is 0' with '== 0'. 'is' is for testing object identity, and
0 isn't guaranteed to be a unique object (but always is in practice).
Signed-off-by: Ulf Magnusson <Ulf.Magnusson@nordicsemi.no>
When stripped symbols are present in the build size_report has crashed
due to it not being aware of this case.
This patch causes stripped symbols to be ignored instead, allowing
analysis of the non-stripped symbols.
It is left as future work to somehow display how much space stripped
symbols are taking up.
Stripped symbols can be present when third-party binaries are linked
into the build.
Signed-off-by: Sebastian Bøe <sebastian.boe@nordicsemi.no>
Update the files which contain no license information with the
'Apache-2.0' SPDX license identifier. Many source files in the tree are
missing licensing information, which makes it harder for compliance
tools to determine the correct license.
By default all files without license information are under the default
license of Zephyr, which is Apache version 2.
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
Was apparently an artifact of Python2 to Python3 conversion. Led to
printing of literal '='*110i instead of a line of ='s.
Signed-off-by: Paul Sokolovsky <paul.sokolovsky@linaro.org>
We first check to see if we have a valid elf file before doing anything
else. Otherwise we'd could get script errors instead of just notifying
the user the file doesn't exist.
Signed-off-by: Kumar Gala <kumar.gala@gmail.com>
We need a minimum of --outdir, --objdump, and --nm set for the script to
work so mark these arguments as required.
Signed-off-by: Kumar Gala <kumar.gala@gmail.com>
Do a straight forward conversion from optparse to argparser. All
of our other python scripts use argparser already.
Signed-off-by: Kumar Gala <kumar.gala@gmail.com>
Instead of crashing when a source file outside of ZEPHYR_BASE is
detected we accept it as-is to include it in the report.
This fixes#5866
Signed-off-by: Sebastian Bøe <sebastian.boe@nordicsemi.no>
Some boards do not generate .bin files by default, this file is however
needed when generating ram/rom reports, so in case it is not present,
create it.
Fixes#5784
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
size_report was assuming Unix-style absolute paths and misbehaving
when paths had a colon ("C:\") in them. Also, refactored and improved
documentation.
Signed-off-by: Sebastian Bøe <sebastian.boe@nordicsemi.no>
Use Universal newlines when calling check_output and rely on the
locale's encoding to decode the output instead of explicitly decoding
UTF-8.
Signed-off-by: Sebastian Bøe <sebastian.boe@nordicsemi.no>
size_report was assuming that the GNU Binutils programs were
generating files with the line ending '\n'. But on native Windows
binutils will generate files with the line ending \r\n.
This patches size_report to use so-called "Universal newlines"[0], so
that size_report can deal with any kind of newline on any kind of
platform.
[0] https://www.python.org/dev/peps/pep-0278/
Signed-off-by: Sebastian Bøe <sebastian.boe@nordicsemi.no>
size_report was using the environment variables NM and OBJDUMP to find
it's toolchain dependencies. It is not clear how well this will work
on different platforms; OSX, Windows. So we now pass the paths of
these dependencies from the build system to the script.
PS: This ensures that size_report uses the cross-compiler's GNU bin
tool instead of the host GNU bin tools. This is presumably beneficial
as it has been required for other GNU bin tools like GDB.
Signed-off-by: Sebastian Bøe <sebastian.boe@nordicsemi.no>