Skip to content

Commit

Permalink
software/demo: add litex_bare_metal_demo pre-installed script.
Browse files Browse the repository at this point in the history
Build demo: litex_bare_metal_demo --build-path=build/arty/
  • Loading branch information
enjoy-digital committed Dec 21, 2020
1 parent 4df56ed commit c79135c
Show file tree
Hide file tree
Showing 4 changed files with 36 additions and 2 deletions.
4 changes: 2 additions & 2 deletions litex/soc/software/demo/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
-------
Expand Down
Empty file.
33 changes: 33 additions & 0 deletions litex/soc/software/demo/demo.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
#!/usr/bin/env python3

#
# This file is part of LiteX.
#
# Copyright (c) 2020 Florent Kermarrec <florent@enjoy-digital.fr>
# 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()

1 change: 1 addition & 0 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@
"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",
Expand Down

0 comments on commit c79135c

Please sign in to comment.