From e1927b7cbbf03d90d6f13a9e2825fc54881d69e0 Mon Sep 17 00:00:00 2001 From: Sebastien Bourdeauducq Date: Tue, 29 Sep 2015 18:14:19 +0800 Subject: [PATCH] flterm: cleanup --- misoc/tools/flterm.py | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/misoc/tools/flterm.py b/misoc/tools/flterm.py index cafe7a90..c7b7fff8 100644 --- a/misoc/tools/flterm.py +++ b/misoc/tools/flterm.py @@ -118,7 +118,6 @@ class Flterm: self.detect_magic_str = " "*len(sfl_magic_req) def open(self, port, speed): - port = port if not port.isdigit() else int(port) self.serial = serial.serial_for_url( port, baudrate=speed, @@ -284,13 +283,14 @@ class Flterm: def _get_args(): parser = argparse.ArgumentParser() - parser.add_argument("--port", default="2", help="serial port") + parser.add_argument("port", help="serial port") parser.add_argument("--speed", default=115200, help="serial baudrate") parser.add_argument("--kernel", default=None, help="kernel image") parser.add_argument("--kernel-adr", type=lambda a: int(a, 0), default=0x40000000, help="kernel address") return parser.parse_args() -if __name__ == "__main__": + +def main(): args = _get_args() flterm = Flterm(args.kernel, args.kernel_adr) flterm.open(args.port, args.speed) @@ -300,3 +300,7 @@ if __name__ == "__main__": except KeyboardInterrupt: pass flterm.join() + + +if __name__ == "__main__": + main() -- 2.30.2