From 4810cc15dafccd07a0ae0ba1f01ed09b0fe6d07c Mon Sep 17 00:00:00 2001 From: Florent Kermarrec Date: Tue, 17 May 2022 19:15:06 +0200 Subject: [PATCH] soc/LiteXSoCArgumentParser: Fix --cpu-type parsing. Could still be improved. --- litex/soc/integration/soc.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/litex/soc/integration/soc.py b/litex/soc/integration/soc.py index 4deffca7b..6ce80c62a 100644 --- a/litex/soc/integration/soc.py +++ b/litex/soc/integration/soc.py @@ -1985,10 +1985,15 @@ class LiteXSoC(SoC): class LiteXSoCArgumentParser(argparse.ArgumentParser): def parse_args(self): + # FIXME: Use 2 stages parser? + def get_selected_cpu_name(): for name, cpu_cls in cpu.CPUS.items(): - if f"--cpu-type={name}" in sys.argv: # FIXME: Improve. + if f"--cpu-type={name}" in sys.argv: return cpu_cls + if f"--cpu-type" in sys.argv: + if name in sys.argv: + return cpu_cls return None # Intercept selected CPU to fill arguments.