software/demo: add support for absolute/relative --build-path and simplify comment.

This commit is contained in:
Florent Kermarrec 2021-02-08 10:29:26 +01:00
parent 876ee69e69
commit 5430c1455e
1 changed files with 3 additions and 4 deletions

View File

@ -12,9 +12,7 @@ from distutils.dir_util import copy_tree
def main(): def main():
parser = argparse.ArgumentParser(description="LiteX Bare Metal Demo App.") parser = argparse.ArgumentParser(description="LiteX Bare Metal Demo App.")
parser.add_argument("--build-path", help="Target's build path (eg ./build/board_name/)." + \ parser.add_argument("--build-path", help="Target's build path (ex build/board_name)", required=True)
"Note: this tool needs to be invoked from the project directory " + \
"(the directory containing the build/ subdirectory)", required=True)
args = parser.parse_args() args = parser.parse_args()
# Create demo directory # Create demo directory
@ -25,7 +23,8 @@ def main():
copy_tree(src, "demo") copy_tree(src, "demo")
# Compile demo # Compile demo
os.system(f"export BUILD_DIR=../{args.build_path} && cd demo && make") 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} && cd demo && make")
# Copy demo.bin # Copy demo.bin
os.system("cp demo/demo.bin ./") os.system("cp demo/demo.bin ./")