2023-02-26 19:41:10 +00:00
|
|
|
#!/bin/bash
|
2023-03-03 17:03:43 +00:00
|
|
|
set -e
|
2023-05-12 16:26:44 +00:00
|
|
|
read -p "Rebuild gateware? [y/N]" -n 1 -r REBUILD
|
|
|
|
if [[ $REBUILD =~ ^[Yy]$ ]]; then
|
|
|
|
echo # Move to next line
|
2023-06-24 14:50:19 +00:00
|
|
|
rm -f analyzer.csv csr.csv gsd_orangecrab.dfu kernel.bin; echo "Cleaned up previous run files"
|
2023-06-21 08:22:50 +00:00
|
|
|
python3 make.py --build --doc --cpu-type picorv32 --cpu-variant standard --nextpnr-ignoreloops --csr-csv csr.csv
|
2023-06-24 14:50:19 +00:00
|
|
|
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)"
|
|
|
|
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"
|
2023-05-12 16:26:44 +00:00
|
|
|
else echo "Skipping Rebuild"
|
|
|
|
fi
|
2023-06-24 14:50:19 +00:00
|
|
|
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"
|
2023-05-12 13:29:20 +00:00
|
|
|
read -p "Flash OrangeCrab? [y/N]" -n 1 -r FLASH_OC
|
2023-05-12 16:26:44 +00:00
|
|
|
if [[ $FLASH_OC =~ ^[Yy]$ ]]; then
|
|
|
|
echo # Move to next line
|
2023-05-12 18:53:52 +00:00
|
|
|
set +e
|
2023-06-04 11:01:56 +00:00
|
|
|
dfu-util -w -D gsd_orangecrab.dfu
|
2023-05-12 18:53:52 +00:00
|
|
|
set -e
|
2023-05-12 16:26:44 +00:00
|
|
|
else echo "Skipping Reflash"
|
2023-05-12 13:29:20 +00:00
|
|
|
fi
|
|
|
|
read -p "Start litex_term? [y/N]" -n 1 -r START_LT
|
2023-05-12 16:26:44 +00:00
|
|
|
if [[ $START_LT =~ ^[Yy]$ ]]; then
|
2023-05-12 18:53:52 +00:00
|
|
|
litex_term --kernel kernel.bin /dev/ttyACM0
|
2023-05-12 13:29:20 +00:00
|
|
|
fi
|