From c79135c573cc3545c4fd01426f2d14aae3234329 Mon Sep 17 00:00:00 2001 From: Florent Kermarrec Date: Mon, 21 Dec 2020 19:27:21 +0100 Subject: [PATCH] software/demo: add litex_bare_metal_demo pre-installed script. Build demo: litex_bare_metal_demo --build-path=build/arty/ --- litex/soc/software/demo/README.md | 4 ++-- litex/soc/software/demo/__init__.py | 0 litex/soc/software/demo/demo.py | 33 +++++++++++++++++++++++++++++ setup.py | 1 + 4 files changed, 36 insertions(+), 2 deletions(-) create mode 100644 litex/soc/software/demo/__init__.py create mode 100644 litex/soc/software/demo/demo.py diff --git a/litex/soc/software/demo/README.md b/litex/soc/software/demo/README.md index 9f9f003d7..fd355ca30 100644 --- a/litex/soc/software/demo/README.md +++ b/litex/soc/software/demo/README.md @@ -6,8 +6,8 @@ This directory provides a minimal bare metal demo app that demonstrates how to e [> Build -------- -Imagine you just build Arty example design from LiteX-Boards, to build the demo app, run in this directory: - `$ export BUILD_DIR=xxyy/litex/litex/boards/targets/build/arty && make` +Imagine you just build the Arty example design from LiteX-Boards, to build the demo app, run: + `$ litex_bare_metal_demo --build-path=build/arty/` [> Load ------- diff --git a/litex/soc/software/demo/__init__.py b/litex/soc/software/demo/__init__.py new file mode 100644 index 000000000..e69de29bb diff --git a/litex/soc/software/demo/demo.py b/litex/soc/software/demo/demo.py new file mode 100644 index 000000000..c720a7f49 --- /dev/null +++ b/litex/soc/software/demo/demo.py @@ -0,0 +1,33 @@ +#!/usr/bin/env python3 + +# +# This file is part of LiteX. +# +# Copyright (c) 2020 Florent Kermarrec +# SPDX-License-Identifier: BSD-2-Clause + +import os +import argparse +from distutils.dir_util import copy_tree + +def main(): + parser = argparse.ArgumentParser(description="LiteX Bare Metal Demo App.") + parser.add_argument("--build-path", help="Target's build path.", required=True) + args = parser.parse_args() + + # Create demo directory + os.makedirs("demo", exist_ok=True) + + # Copy contents to demo directory + src = os.path.abspath(os.path.dirname(__file__)) + copy_tree(src, "demo") + + # Compile demo + os.system(f"export BUILD_DIR=../{args.build_path} && cd demo && make") + + # Copy demo.bin + os.system("cp demo/demo.bin ./") + +if __name__ == "__main__": + main() + diff --git a/setup.py b/setup.py index a4593910c..94abc5155 100755 --- a/setup.py +++ b/setup.py @@ -43,6 +43,7 @@ setup( "litex_read_verilog=litex.tools.litex_read_verilog:main", "litex_simple=litex.boards.targets.simple:main", "litex_json2dts=litex.tools.litex_json2dts:main", + "litex_bare_metal_demo=litex.soc.software.demo.demo:main", # short names "lxterm=litex.tools.litex_term:main", "lxserver=litex.tools.litex_server:main",