I believe that you have to use the -e option which also erases the fuses when you program the
flash.
http://www.nongnu.org/avrdude/user-manual/avrdude_4.html#Option-DescriptionsDo you know the value for your 644 fuses?
I'd update the Makefile to include a rule to burn the flash to avoid
typing in the long command line.
I've updated my arduino AmetaBOOT makefile to support doing all this in one avrdude command
for the Dragon as the current avrdude has a bug in it such that back to back avrdude commands
will fail on the dragon. (I also have a patch for that but the avrdude maintainer refuses to accept
it - but that is another story).
Here is the definition that I use:
# enter the parameters for the avrdude isp tool
ISPTOOL = dragon_isp
ISPPORT = usb
ISPSPEED =
# 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.
ISPFUSEFLASH = avrdude -c $(ISPTOOL) -p $(MCU_TARGET) -P $(ISPPORT) $(ISPSPEED) \
-e -u -U lock:w:0x3f:m -U efuse:w:0x$(EFUSE):m -U hfuse:w:0x$(HFUSE):m -U lfuse:w:0x$(LFUSE):m \
-U flash:w:$(PROGRAM).hex -U lock:w:0x0f:m
This single command was a modification of their existing fuse burning methodology.
When using the dragon you can remove the initial "-U lock:w:0x3f:m" as it is not needed.
Not sure if other programmers need it as some of them ignore the erase
command and only erase things when new data is written.
You will need to define EFUSE, HFUSE, and LFUSE
I assume the 644 has 3 fuses? and I'm not sure what those are or
what the final lock bits need to be for that part.
you will then need a rule to to the actual burn.
Something like this near the bottom of the makefile:
program: $(PROGRAM).hex
$(ISPFUSEFLASH)
You can then do "make program" to program the part.
Make sure you use a <TAB> in the program rule above rather than spaces
as make after 35+ years still requires tabs rather than whitespace as lead in separators.