diff --git a/litex/soc/software/demo/demo.py b/litex/soc/software/demo/demo.py index 5ad4ee8c3..51c9df2fb 100755 --- a/litex/soc/software/demo/demo.py +++ b/litex/soc/software/demo/demo.py @@ -3,16 +3,19 @@ # # This file is part of LiteX. # -# Copyright (c) 2020 Florent Kermarrec +# Copyright (c) 2020-2022 Florent Kermarrec # SPDX-License-Identifier: BSD-2-Clause import os import argparse +from litex.build.tools import replace_in_file + def main(): parser = argparse.ArgumentParser(description="LiteX Bare Metal Demo App.") - parser.add_argument("--build-path", help="Target's build path (ex build/board_name).", required=True) + parser.add_argument("--build-path", help="Target's build path (ex build/board_name).", required=True) parser.add_argument("--with-cxx", action="store_true", help="Enable CXX support.") + parser.add_argument("--mem", default="main_ram", help="Memory Region from which code will be executed.") args = parser.parse_args() # Create demo directory @@ -21,6 +24,9 @@ def main(): # Copy contents to demo directory os.system(f"cp {os.path.abspath(os.path.dirname(__file__))}/* demo") + # Update memory region. + replace_in_file("demo/linker.ld", "main_ram", args.mem) + # Compile demo build_path = args.build_path if os.path.isabs(args.build_path) else os.path.join("..", args.build_path) os.system(f"export BUILD_DIR={build_path} && {'export WITH_CXX=1 &&' if args.with_cxx else ''} cd demo && make")