Today I finally managed to program attiny2313a via Arduino Uno. It was a test blink program. After it was uploaded I saw that the LED blinked with 8 seconds delays instead of 1 second, so I decided to change clock settings in Makefile and main.c and burn the chip again.
so, I only changed 8000000 to 1000000 in both Makefile and main.c and ran make flash
in cmd (windows shell). Below is the output:
avr-gcc -Wall -Os -DF_CPU=1000000 -mmcu=attiny2313 -F -c main.c -o main.o
cc1.exe: error: avr25: No such file or directory
make: *** [main.o] Error 1
Why am I getting this error? Why was I able to compile and burn the program only once? I did not remove nor add nothing new. Actually I did not touch nothing except those clock settings. But even when I returned back to original settings (8000000) I still got the same error.
my Makefile
DEVICE = attiny2313 -F
CLOCK = 1000000
PROGRAMMER = -c arduino -P COM5 -b 19200
OBJECTS = main.o
FUSES = -U lfuse:w:0x5e:m -U hfuse:w:0xdd:m -U efuse:w:0xff:m
######################################################################
######################################################################
# Tune the lines below only if you know what you are doing:
AVRDUDE = avrdude $(PROGRAMMER) -p $(DEVICE)
COMPILE = avr-gcc -Wall -Os -DF_CPU=$(CLOCK) -mmcu=$(DEVICE)
# symbolic targets:
all: main.hex
.c.o:
$(COMPILE) -c $< -o $@
.S.o:
$(COMPILE) -x assembler-with-cpp -c $< -o $@
# "-x assembler-with-cpp" should not be necessary since this is the default
# file type for the .S (with capital S) extension. However, upper case
# characters are not always preserved on Windows. To ensure WinAVR
# compatibility define the file type manually.
.c.s:
$(COMPILE) -S $< -o $@
flash: all
$(AVRDUDE) -U flash:w:main.hex:i
fuse:
$(AVRDUDE) $(FUSES)
install: flash fuse
# if you use a bootloader, change the command below appropriately:
load: all
bootloadHID main.hex
clean:
rm -f main.hex main.elf $(OBJECTS)
# file targets:
main.elf: $(OBJECTS)
$(COMPILE) -o main.elf $(OBJECTS)
main.hex: main.elf
rm -f main.hex
avr-objcopy -j .text -j .data -O ihex main.elf main.hex
# If you have an EEPROM section, you must also create a hex file for the
# EEPROM and add it to the "flash" target.
# Targets for code debugging and analysis:
disasm: main.elf
avr-objdump -d main.elf
cpp:
$(COMPILE) -E main.c
my main.c
#define F_CPU 1000000 // CPU frequency for proper time calculation in delay function
#include <avr/io.h>
#include <util/delay.h>
int main (void){
DDRD |= (1 << PD6); // make PD6 an output
for(;;){
PORTD ^= (1 << PD6); // toggle PD6
_delay_ms(1000); // delay for a second
}
return 0; // the program executed successfully
}