Now burning fuses too, adjusted to make avrdude happy (it needs 0's for unused fuses, where avr studio uses 1's).

This commit is contained in:
David A. Mellis 2007-07-18 21:25:23 +00:00
parent 0276117d36
commit 2e287ffb6a
1 changed files with 13 additions and 3 deletions

View File

@ -15,8 +15,18 @@ ISPSPEED = -b 115200
MCU_TARGET = atmega168
LDSECTION = --section-start=.text=0x3800
ISPFUSES = avrdude -c $(ISPTOOL) -p m168 -P $(ISPPORT) $(ISPSPEED) -u -U efuse:w:0xf8:m -U hfuse:w:0xd7:m -U lfuse:w:0xaf:m
ISPFLASH = avrdude -c $(ISPTOOL) -p m168 -P $(ISPPORT) $(ISPSPEED) -V -U flash:w:$(PROGRAM).hex
# the efuse should really be 0xf8; since, however, only the lower
# three bits of that byte are used on the atmega168, avrdude gets
# confused if you specify 1's for the higher bits, see:
# http://tinker.it/now/2007/02/24/the-tale-of-avrdude-atmega168-and-extended-bits-fuses/
#
# similarly, the lock bits should be 0xff instead of 0x3f (to
# unlock the bootloader section) and 0xcf instead of 0x0f (to
# lock it), but since the high two bits of the lock byte are
# unused, avrdude would get confused.
ISPFUSES = avrdude -c $(ISPTOOL) -p m168 -P $(ISPPORT) $(ISPSPEED) -e -u -U lock:w:0x3f:m -U efuse:w:0x00:m -U hfuse:w:0xdf:m -U lfuse:w:0xff:m
ISPFLASH = avrdude -c $(ISPTOOL) -p m168 -P $(ISPPORT) $(ISPSPEED) -U flash:w:$(PROGRAM).hex -U lock:w:0x0f:m
OBJ = $(PROGRAM).o
@ -39,8 +49,8 @@ OBJDUMP = avr-objdump
all: $(PROGRAM).elf lst text
isp: $(PROGRAM).hex
$(ISPFUSES)
$(ISPFLASH)
# $(ISPFUSES)
$(PROGRAM).elf: $(OBJ)
$(CC) $(CFLAGS) $(LDFLAGS) -o $@ $^ $(LIBS)