I am programming a set of ATtiny84Vs using WinAVR. I am using the makefile from the WinAVR Makefile generator, which is attached below since it is too big to post.
I wish to use the macros in the <avr/fuse.h> header file to set the fuses in code for my set of ATtinys, rather than program them individually using avrdude. For example:
// Fuse settings
.low = (FUSE_CKDIV8 & FUSE_SUT0 & FUSE_CKSEL3 & FUSE_CKSEL2 & FUSE_CKSEL0),
.high = (FUSE_SPIEN),
.extended = (EFUSE_DEFAULT),
In particular, I am changing the SUT (Start Up Time) fuse bits to a shorter startup than the default (4 ms instead of 64 ms).
If I have this in my code and compile it with "make all", then use "make program" to upload it to my uC, will the fuses be appropriately programmed? Do I need to add something to my makefile in order to program the fuse bits? Or do I just have to do it manually with the AVRdude terminal?
Relavent section from the makefile:
#---------------- Programming Options (avrdude) ----------------
# Programming hardware
# Type: avrdude -c ?
# to get a full listing.
AVRDUDE_PROGRAMMER = avrisp
# com1 = serial port. Use lpt1 to connect to parallel port.
AVRDUDE_PORT = com3
AVRDUDE_WRITE_FLASH = -U flash:w:$(TARGET).hex
AVRDUDE_WRITE_EEPROM = -U eeprom:w:$(TARGET).eep
# Uncomment the following if you want avrdude's erase cycle counter.
# Note that this counter needs to be initialized first using -Yn,
# see avrdude manual.
#AVRDUDE_ERASE_COUNTER = -y
# Uncomment the following if you do /not/ wish a verification to be
# performed after programming the device.
#AVRDUDE_NO_VERIFY = -V
# Increase verbosity level. Please use this when submitting bug
# reports about avrdude. See <http://savannah.nongnu.org/projects/avrdude>
# to submit bug reports.
#AVRDUDE_VERBOSE = -v -v
AVRDUDE_FLAGS = -p $(MCU) -P $(AVRDUDE_PORT) -c $(AVRDUDE_PROGRAMMER)
AVRDUDE_FLAGS += $(AVRDUDE_NO_VERIFY)
AVRDUDE_FLAGS += $(AVRDUDE_VERBOSE)
AVRDUDE_FLAGS += $(AVRDUDE_ERASE_COUNTER)
AVRDUDE_FLAGS +=-b 19200
# Program the device.
program: $(TARGET).hex $(TARGET).eep
$(AVRDUDE) $(AVRDUDE_FLAGS) $(AVRDUDE_WRITE_FLASH) $(AVRDUDE_WRITE_EEPROM)
In particular, I see -U flags for the flash and eeprom, but not any of the fuse bits. Do I need to add these flags myself in order to program the fuse bits?
The documentation at the avr-libc page (http://www.nongnu.org/avr-libc/user-manual/group__avr__fuse.html
Programming tools can take advantage of the fuse information embedded in the ELF file, by extracting this information and determining if the fuses need to be programmed before programming the Flash and EEPROM memories. This also allows a single ELF file to contain all the information needed to program an AVR.
This seems to say that you can set the programmer up to automatically program the fuses, but it doesn't tell how. Does anyone ave any experience in this area?