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 <carles.cufi@nordicsemi.no>
This commit is contained in:
Carles Cufi 2020-09-02 21:28:34 +02:00 committed by Anas Nashif
parent cf2b3596f7
commit f8ad4d5f87
2 changed files with 5 additions and 1 deletions

View File

@ -15,6 +15,7 @@ foreach(report ram_report rom_report)
${flag_for_${report}}
DEPENDS ${logical_target_for_zephyr_elf}
$<TARGET_PROPERTY:zephyr_property_target,${report}_DEPENDENCIES>
USES_TERMINAL
)
endforeach()

View File

@ -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"))