From 6f77d81b1ca937c369b26b99ee503cff10bc5ff2 Mon Sep 17 00:00:00 2001 From: Daniel Friesel Date: Thu, 28 Jan 2021 22:02:18 +0100 Subject: add kconfig variables for inflate lib --- Makefile | 8 ++++++++ src/app/deflatetest/Makefile.inc | 8 ++++++-- src/app/deflatetest/benchmark.py | 9 +++++---- 3 files changed, 19 insertions(+), 6 deletions(-) diff --git a/Makefile b/Makefile index 5ec0340..e7ce2cc 100644 --- a/Makefile +++ b/Makefile @@ -258,6 +258,14 @@ ifdef CONFIG_driver_softi2c COMMON_FLAGS += -DDRIVER_SOFTI2C endif +ifdef CONFIG_lib_inflate + CXX_TARGETS += src/lib/inflate.cc +endif + +ifdef CONFIG_lib_inflate_checksum + COMMON_FLAGS += -DDEFLATE_CHECKSUM +endif + # Configure drivers (TODO: Kconfig) ifneq (${i2c_freq}, ) diff --git a/src/app/deflatetest/Makefile.inc b/src/app/deflatetest/Makefile.inc index 9d8756c..d1275be 100644 --- a/src/app/deflatetest/Makefile.inc +++ b/src/app/deflatetest/Makefile.inc @@ -8,10 +8,14 @@ ifdef app override timer_s = 0 override loop = 0 override arch_drivers += ,counter + override CONFIG_lib_inflate = y endif ifdef deflate_nop COMMON_FLAGS += -DDEFLATE_NOP -else - CXX_TARGETS += src/lib/inflate.cc + override undefine CONFIG_lib_inflate +endif + +ifdef deflate_checksum + override CONFIG_lib_inflate_checksum = y endif diff --git a/src/app/deflatetest/benchmark.py b/src/app/deflatetest/benchmark.py index a88a28d..379b62f 100755 --- a/src/app/deflatetest/benchmark.py +++ b/src/app/deflatetest/benchmark.py @@ -6,8 +6,8 @@ import subprocess import sys -def main(arch): - make_args = [f"arch={arch}", "app=deflatetest"] +def main(make_args): + make_args += ["app=deflatetest"] base_rom = None base_ram = None defl_rom = None @@ -55,7 +55,8 @@ def main(arch): rom_usage = int(np.ceil((defl_rom - base_rom) / 16)) * 16 ram_usage = int(np.ceil((defl_ram - base_ram) / 16)) * 16 - print(f"| {arch} | {rom_usage} B | {ram_usage} B") + arch_line = " ".join(make_args) + print(f"| {arch_line} | {rom_usage} B | {ram_usage} B") status = subprocess.run( ["make", "cat"] + make_args, stdout=subprocess.PIPE, universal_newlines=True @@ -74,4 +75,4 @@ def main(arch): if __name__ == "__main__": - main(*sys.argv[1:]) + main(sys.argv[1:]) -- cgit v1.2.3