From 701b344471fe5e0b90d95e1ac2c3c9525bb7dcfb Mon Sep 17 00:00:00 2001 From: Daniel Friesel Date: Mon, 13 Jul 2020 10:53:46 +0200 Subject: Run MSP430FR benchmarks at 8 MHz; support sleep > 500 ms for energytrace --- lib/runner.py | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) (limited to 'lib/runner.py') diff --git a/lib/runner.py b/lib/runner.py index aeb8600..77b7c68 100644 --- a/lib/runner.py +++ b/lib/runner.py @@ -405,6 +405,23 @@ def get_counter_limits(arch: str) -> tuple: raise RuntimeError("Did not find Counter Overflow limits") +def sleep_ms(duration: int, arch: str, cpu_freq: int = None) -> str: + max_sleep = None + if "msp430fr" in arch: + if cpu_freq is not None and cpu_freq > 8000000: + max_sleep = 250 + else: + max_sleep = 500 + if max_sleep is not None and duration > max_sleep: + sub_sleep_count = duration // max_sleep + tail_sleep = duration % max_sleep + ret = f"for (unsigned char i = 0; i < {sub_sleep_count}; i++) {{ arch.sleep_ms({max_sleep}); }}\n" + if tail_sleep > 0: + ret += f"arch.sleep_ms({tail_sleep});\n" + return ret + return "arch.sleep_ms({duration});\n" + + def get_counter_limits_us(arch: str) -> tuple: """Return duration of one counter step and one counter overflow in us.""" cpu_freq = 0 -- cgit v1.2.3