#!/bin/bash #Building the bootloader #make mega128rfa1-RSS2 V=1 #make mega256rfr2-RSS2 V=1 #PGM=avrispmkII #PGM=jtag2isp PGM=avrispv2 #MCU=atmega128rfa1 MCU=atmega256rfr2 BLDR=stk500boot_v2_mega256rfr2-16M.hex #BLDR=stk500boot_v2_mega128rfa1.hex FIRMWARE=s2.hex avrdude -p $MCU -c $PGM -P usb -e -U flash:w:$BLDR sleep 2 # Use tranceaiver 16MHz XTAL, BOD 1.8V avrdude -p $MCU -c $PGM -P usb -U hfuse:w:0x98:m -U lfuse:w:0x46:m -U efuse:w:0xfe:m sleep 2 # Lock bootloader avrdude -p $MCU -c $PGM -P usb -U lock:w:0xEF:m # avrdude -p $MCU -c stk500v2 -P /dev/ttyUSB0 -b 38400 -e -U flash:w:$FIRMWARE