Remove demo.py and include all steps in build.sh

This commit is contained in:
Aadi Desai 2023-05-12 14:29:20 +01:00
parent 0bf0c45bb9
commit 42826f57e4
No known key found for this signature in database
2 changed files with 13 additions and 39 deletions

View file

@ -1,5 +1,6 @@
#!/bin/bash
set -e
rm -f analyzer.csv csr.csv gsd_orangecrab.dfu kernel.bin && echo "Cleaned up previous run files"
python3 make.py --build --doc
cp build/gsd_orangecrab/gateware/gsd_orangecrab.bit gsd_orangecrab.dfu && echo "Copied .bit to .dfu"
dfu-suffix -v 1209 -p 5af0 -a gsd_orangecrab.dfu && echo "Added DFU suffix for target (VID:PID)"
@ -7,5 +8,15 @@ dfu-suffix -v 1209 -p 5af0 -a gsd_orangecrab.dfu && echo "Added DFU suffix for t
# mv gsd_orangecrab.dfu /mnt/c/Users/suple/Desktop/dfu-util-0.9-win64/gsd.dfu && echo "Moved new DFU to Win11 Desktop"
rm -r docs/ && echo "Deleted old docs in project root"
cp -r build/gsd_orangecrab/doc/_build/html docs/ && echo "Copied docs to project root"
python3 demo/demo.py --build-path build/gsd_orangecrab/
rm -f demo/*.o demo/*.d demo/demo.bin demo/demo.elf demo/demo.elf.map && echo "Cleaned up build artifacts"
BUILD_DIR=`realpath -eL build/gsd_orangecrab/` WITH_CXX=1 make -C demo && echo "Built demo files"
mv demo/demo.bin kernel.bin && echo "Moved kernel binary to project root"
rm -f demo/*.o demo/*.d demo/demo.elf demo/demo.elf.map && echo "Cleaned up build artifacts"
read -p "Flash OrangeCrab? [y/N]" -n 1 -r FLASH_OC
echo # Move to next line
if [[ $FLASH_OC =~ ^[Yy]$ ]] then
dfu-util -D gsd_orangecrab.dfu
fi
read -p "Start litex_term? [y/N]" -n 1 -r START_LT
if [[ $START_LT =~ ^[Yy]$ ]] then
litex_term --kernel demo.bin /dev/ttyACM0
fi

View file

@ -1,37 +0,0 @@
#!/usr/bin/env python3
#
# This file is part of LiteX.
#
# Copyright (c) 2020-2022 Florent Kermarrec <florent@enjoy-digital.fr>
# SPDX-License-Identifier: BSD-2-Clause
import os
import sys
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("--with-cxx", action="store_true", help="Enable CXX support.")
parser.add_argument("--mem", default="main_ram", help="Memory Region where code will be loaded/executed.")
args = parser.parse_args()
# 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 && cd demo && make")
# Copy demo.bin
os.system("cp demo/demo.bin ./")
# Prepare flash boot image.
# python3 = sys.executable or "python3" # Nix specific: Reuse current Python executable if available.
# os.system(f"{python3} -m litex.soc.software.crcfbigen demo.bin -o demo.fbi --fbi --little") # FIXME: Endianness.
if __name__ == "__main__":
main()