From d70049c2e1fcdbe0850a50e8c7a7986df4ed391c Mon Sep 17 00:00:00 2001 From: Gwenhael Goavec-Merou Date: Wed, 11 Jan 2023 18:33:48 +0100 Subject: [PATCH] build/parser: adding a fallback to search for a platform explicitly into litex-boards package when platform name isn't found --- litex/build/parser.py | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/litex/build/parser.py b/litex/build/parser.py index 520b50d73..827524bab 100644 --- a/litex/build/parser.py +++ b/litex/build/parser.py @@ -177,7 +177,14 @@ class LiteXArgumentParser(argparse.ArgumentParser): if platform is None: # no user selection: try default platform = self.get_default_value_from_actions("platform", None) if platform is not None: - self.set_platform(importlib.import_module(platform).Platform) + try: + platform_cls = importlib.import_module(platform).Platform + except ModuleNotFoundError as e: + # platform not found: try litex-boards package + platform = "litex_boards.platforms." + platform + platform_cls = importlib.import_module(platform).Platform + self.set_platform(platform_cls) + self.add_target_group() # When platform provided/set, set builder/soc_core args.