2005-09-20 18:23:15 +02:00
|
|
|
#!/bin/sh
|
|
|
|
|
|
|
|
# fixmybootloader.command 25.06.2005 mbanzi
|
|
|
|
#
|
|
|
|
# Arduino project http://arduino.berlios.de
|
|
|
|
#
|
|
|
|
# quick and dirty script to set the proper fuses and lock bits
|
|
|
|
# while loading the bootloader onto a brand new arduino board
|
|
|
|
#
|
|
|
|
# very useful also when for some reasons the bootloader disappears
|
|
|
|
#
|
|
|
|
# TODO: cleanup and make it more user friendly
|
|
|
|
# TODO: move this (and related) scripts to platform dist/ dirs
|
|
|
|
#
|
|
|
|
# expects an STK500 compatible programmer on the specified serial port
|
|
|
|
# if you use the parallel port programmer you need to change the dprog
|
|
|
|
# parametre
|
|
|
|
#
|
|
|
|
|
2005-09-28 17:20:06 +02:00
|
|
|
BINDIR=../tools/avr/bin
|
2005-11-29 14:24:27 +01:00
|
|
|
PORT=/dev/tty.USA19QW1b1P1.1
|
2005-09-20 18:23:15 +02:00
|
|
|
|
2005-09-28 17:20:06 +02:00
|
|
|
# unlock bootloader segment
|
2005-09-20 18:23:15 +02:00
|
|
|
$BINDIR/uisp -dpart=ATmega8 -dprog=stk500 -dserial=$PORT -dspeed=115200 --wr_lock=0xFF
|
2005-09-28 17:20:06 +02:00
|
|
|
|
|
|
|
# set fuses
|
|
|
|
# bootloader size of 512 words; from 0xE00-0xFFF
|
|
|
|
# clock speed of 16 MHz, external quartz
|
|
|
|
$BINDIR/uisp -dpart=ATmega8 -dprog=stk500 -dserial=$PORT -dspeed=115200 --wr_fuse_l=0xdf --wr_fuse_h=0xca
|
|
|
|
|
|
|
|
# upload bootloader
|
2005-09-20 18:23:15 +02:00
|
|
|
$BINDIR/uisp -dpart=ATmega8 -dprog=stk500 -dserial=$PORT -dspeed=115200 --erase --upload if=ATMegaBOOT.hex -v
|
2005-09-28 17:20:06 +02:00
|
|
|
|
|
|
|
# lock bootloader segment
|
2005-09-20 18:23:15 +02:00
|
|
|
$BINDIR/uisp -dpart=ATmega8 -dprog=stk500 -dserial=$PORT -dspeed=115200 --wr_lock=0xCF
|