Subversion Repositories svnkaklik

Rev

Rev 410 | Details | Compare with Previous | Last modification | View Log

Rev Author Line No. Line
134 kaklik 1
#!/bin/sh 
2
prg="adude"
3
if [ "$1" = "-u" ]; then
4
	shift;
5
	prg="uisp"
6
fi
7
if [ -z "$1" -o "$1" = "-h" -o "$1" = "--help" ]; then
8
	echo "prg_load_uc -- load a .hex file into a atmega8 microcontroller"
9
	echo ""
10
	echo "Usage: prg_load_uc [-hu] File.hex"
11
	echo ""
12
	echo "OPTIONS: -h this help"
13
	echo "         -u use uisp instead of avrdude"
14
	echo "            avrdude can automatically detect dapa or avrusb500."
15
	echo "            uisp can only be used with the parallel port dapa."
16
	echo ""
17
	echo "This script can be easily adapted to different programmer types"
18
	exit 0
19
fi
20
pfile="$1"
21
 
22
if [ "$prg" = "uisp" ]; then
23
	set -x
24
	uisp -dlpt=/dev/parport0 --erase  -dprog=dapa
25
	uisp -dlpt=/dev/parport0 --upload if="$pfile" -dprog=dapa  -v=3 --hash=32 --verify
26
	set +x
27
fi
28
if [ "$prg" = "adude" ]; then
29
	if grep "Vendor=0403 ProdID=6001" /proc/bus/usb/devices > /dev/null ; then
30
		set -x
31
		avrdude -p m8 -c avrusb500 -e -U flash:w:"$pfile"
32
		set +x
33
	else
34
		set -x
35
		avrdude -p m8 -c dapa -e -U flash:w:"$pfile"
36
		set +x
37
	fi
38
fi