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>