forked from M-Labs/artiq
1
0
Fork 0

frontend/artiq_flash: reorganize device binaries

This commit is contained in:
Sebastien Bourdeauducq 2015-11-04 10:40:46 +08:00
parent e26147b2ac
commit 3404a6565b
1 changed files with 16 additions and 21 deletions

View File

@ -11,17 +11,14 @@ def run(script):
file.close() file.close()
run(""" run("""
# exit on error
set -e set -e
# print commands
#set -x
ARTIQ_PREFIX=$(python3 -c "import artiq; print(artiq.__path__[0])") ARTIQ_PREFIX=$(python3 -c "import artiq; print(artiq.__path__[0])")
# Default is kc705 # Default is kc705
BOARD=kc705 BOARD=kc705
# Default mezzanine board is nist_qc1 # Default hardware adapter is qc1
MEZZANINE_BOARD=nist_qc1 HARDWARE_ADAPTER=qc1
while getopts "bBrht:d:f:m:" opt while getopts "bBrht:d:f:m:" opt
do do
@ -67,14 +64,14 @@ do
fi fi
;; ;;
m) m)
if [ "$OPTARG" == "nist_qc1" ] if [ "$OPTARG" == "qc1" ]
then then
MEZZANINE_BOARD=nist_qc1 HARDWARE_ADAPTER=qc1
elif [ "$OPTARG" == "nist_qc2" ] elif [ "$OPTARG" == "qc2" ]
then then
MEZZANINE_BOARD=nist_qc2 HARDWARE_ADAPTER=qc2
else else
echo "KC705 mezzanine board is either nist_qc1 or nist_qc2" echo "Hardware adapter should be qc1 or qc2"
exit 1 exit 1
fi fi
;; ;;
@ -88,8 +85,8 @@ do
echo "-B Flash BIOS" echo "-B Flash BIOS"
echo "-r Flash ARTIQ runtime" echo "-r Flash ARTIQ runtime"
echo "-h Show this help message" echo "-h Show this help message"
echo "-t Target (kc705, pipistrello, default is: kc705)" echo "-t Target (kc705/pipistrello, default: kc705)"
echo "-m Mezzanine board (nist_qc1, nist_qc2, default is: nist_qc1)" echo "-m Hardware adapter (qc1/qc2, default: qc1)"
echo "-f Flash storage image generated with artiq_mkfs" echo "-f Flash storage image generated with artiq_mkfs"
echo "-d Directory containing the binaries to be flashed" echo "-d Directory containing the binaries to be flashed"
exit 1 exit 1
@ -129,30 +126,28 @@ fi
if [ "$BOARD" == "kc705" ] if [ "$BOARD" == "kc705" ]
then then
UDEV_RULES=99-kc705.rules UDEV_RULES=99-kc705.rules
BITSTREAM=artiq_kc705-${MEZZANINE_BOARD}-kc705.bit
CABLE=jtaghs1_fast CABLE=jtaghs1_fast
PROXY=bscan_spi_kc705.bit PROXY=bscan_spi_kc705.bit
BIOS_ADDR=0xaf0000 BIOS_ADDR=0xaf0000
RUNTIME_ADDR=0xb00000 RUNTIME_ADDR=0xb00000
RUNTIME_FILE=runtime.fbi
FS_ADDR=0xb40000 FS_ADDR=0xb40000
if [ -z "$BIN_PREFIX" ] if [ -z "$BIN_PREFIX" ]
then then
RUNTIME_FILE=${MEZZANINE_BOARD}/runtime.fbi BIN_PREFIX=$ARTIQ_PREFIX/binaries/kc705-$HARDWARE_ADAPTER
BIN_PREFIX=$ARTIQ_PREFIX/binaries/kc705
fi fi
search_for_proxy $PROXY search_for_proxy $PROXY
elif [ "$BOARD" == "pipistrello" ] elif [ "$BOARD" == "pipistrello" ]
then then
UDEV_RULES=99-papilio.rules UDEV_RULES=99-papilio.rules
BITSTREAM=artiq_pipistrello-nist_qc1-pipistrello.bit
CABLE=papilio CABLE=papilio
PROXY=bscan_spi_lx45_csg324.bit PROXY=bscan_spi_lx45_csg324.bit
BIOS_ADDR=0x170000 BIOS_ADDR=0x170000
RUNTIME_ADDR=0x180000 RUNTIME_ADDR=0x180000
RUNTIME_FILE=runtime.fbi
FS_ADDR=0x1c0000 FS_ADDR=0x1c0000
if [ -z "$BIN_PREFIX" ]; then BIN_PREFIX=$ARTIQ_PREFIX/binaries/pipistrello; fi if [ -z "$BIN_PREFIX" ];
then
BIN_PREFIX=$ARTIQ_PREFIX/binaries/pipistrello-$HARDWARE_ADAPTER
fi
search_for_proxy $PROXY search_for_proxy $PROXY
fi fi
@ -195,7 +190,7 @@ fi
if [ "${FLASH_BITSTREAM}" == "1" ] if [ "${FLASH_BITSTREAM}" == "1" ]
then then
echo "Flashing FPGA bitstream..." echo "Flashing FPGA bitstream..."
xc3sprog -v -c $CABLE -I$PROXY_PATH/$PROXY $BIN_PREFIX/$BITSTREAM:w:0x0:BIT xc3sprog -v -c $CABLE -I$PROXY_PATH/$PROXY $BIN_PREFIX/top.bit:w:0x0:BIT
fi fi
if [ "${FLASH_BIOS}" == "1" ] if [ "${FLASH_BIOS}" == "1" ]
@ -207,7 +202,7 @@ fi
if [ "${FLASH_RUNTIME}" == "1" ] if [ "${FLASH_RUNTIME}" == "1" ]
then then
echo "Flashing ARTIQ runtime..." echo "Flashing ARTIQ runtime..."
xc3sprog -v -c $CABLE -I$PROXY_PATH/$PROXY $BIN_PREFIX/${RUNTIME_FILE}:w:$RUNTIME_ADDR:BIN xc3sprog -v -c $CABLE -I$PROXY_PATH/$PROXY $BIN_PREFIX/runtime.fbi:w:$RUNTIME_ADDR:BIN
fi fi
echo "Done." echo "Done."
xc3sprog -v -c $CABLE -R > /dev/null 2>&1 xc3sprog -v -c $CABLE -R > /dev/null 2>&1