mirror of
https://github.com/supleed2/EIE4-FYP.git
synced 2024-12-22 22:25:50 +00:00
Remove demo.py and include all steps in build.sh
This commit is contained in:
parent
0bf0c45bb9
commit
42826f57e4
15
build.sh
15
build.sh
|
@ -1,5 +1,6 @@
|
||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
set -e
|
set -e
|
||||||
|
rm -f analyzer.csv csr.csv gsd_orangecrab.dfu kernel.bin && echo "Cleaned up previous run files"
|
||||||
python3 make.py --build --doc
|
python3 make.py --build --doc
|
||||||
cp build/gsd_orangecrab/gateware/gsd_orangecrab.bit gsd_orangecrab.dfu && echo "Copied .bit to .dfu"
|
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)"
|
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"
|
# 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"
|
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"
|
cp -r build/gsd_orangecrab/doc/_build/html docs/ && echo "Copied docs to project root"
|
||||||
python3 demo/demo.py --build-path build/gsd_orangecrab/
|
BUILD_DIR=`realpath -eL build/gsd_orangecrab/` WITH_CXX=1 make -C demo && echo "Built demo files"
|
||||||
rm -f demo/*.o demo/*.d demo/demo.bin demo/demo.elf demo/demo.elf.map && echo "Cleaned up build artifacts"
|
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
|
||||||
|
|
37
demo/demo.py
37
demo/demo.py
|
@ -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()
|
|
Loading…
Reference in a new issue