summaryrefslogtreecommitdiffstats
path: root/fpga/xilinx/programmer/program_device.sh
blob: 3e8bfb64f34d5fd47d9dc70f880bb6e2798991aa (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
#!/bin/bash

# (c) 2012 Timothy Pearson <kb9vqf@pearsoncomputing.net>
# Licensed under the GPL v2

if [[ $1 == "" ]]; then
	echo "Usage: ./program_device.sh bitfile.bit"
	exit 1
fi

UNIQUEID=$(date "+%s%N")
DEVICETYPE=$(bitdevice $1)
SVFFILE=/tmp/${UNIQUEID}.svf
if [[ $? != 0 ]]; then
	exit 1
fi
bit2svf $1 $SVFFILE $DEVICETYPE
if [[ $? != 0 ]]; then
	rm -f $SVFFILE
	exit 1
fi
xsvf-rpi -v -s $SVFFILE
if [[ $? != 0 ]]; then
	rm $SVFFILE
	exit 1
fi
rm $SVFFILE