From f8ad4d5f87689732a859d3796d5dc812687afb46 Mon Sep 17 00:00:00 2001 From: Carles Cufi Date: Wed, 2 Sep 2020 21:28:34 +0200 Subject: [PATCH] scripts: size_report: Fix colorized output 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 --- cmake/reports/CMakeLists.txt | 1 + scripts/footprint/size_report | 5 ++++- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/cmake/reports/CMakeLists.txt b/cmake/reports/CMakeLists.txt index 931b493b258..5b5e5d7d2ac 100644 --- a/cmake/reports/CMakeLists.txt +++ b/cmake/reports/CMakeLists.txt @@ -15,6 +15,7 @@ foreach(report ram_report rom_report) ${flag_for_${report}} DEPENDS ${logical_target_for_zephyr_elf} $ + USES_TERMINAL ) endforeach() diff --git a/scripts/footprint/size_report b/scripts/footprint/size_report index bf4a96f15d8..c24f8a666e8 100755 --- a/scripts/footprint/size_report +++ b/scripts/footprint/size_report @@ -27,7 +27,7 @@ from elftools.dwarf.locationlists import ( if LooseVersion(elftools.__version__) < LooseVersion('0.24'): sys.exit("pyelftools is out of date, need version 0.24 or later") -from colorama import Fore +from colorama import init, Fore from anytree import RenderTree, NodeMixin, findall_by_attr from anytree.exporter import JsonExporter @@ -586,6 +586,9 @@ def parse_args(): def main(): parse_args() + # Init colorama + init() + assert os.path.exists(args.kernel), "{0} does not exist.".format(args.kernel) elf = ELFFile(open(args.kernel, "rb"))