Commit | Line | Data |
---|---|---|
1375f65d H |
1 | #MCU=at90s2313 |
2 | MCU=attiny2313 | |
40e02009 | 3 | #FUSES=-U lfuse:w:0x64:m -U hfuse:w:0xdf:m -U efuse:w:0xff:m |
88e0a543 | 4 | PORT=/dev/ttyUSB0 |
1375f65d H |
5 | CC=avr-gcc |
6 | OBJCOPY=avr-objcopy | |
40e02009 | 7 | PROJECT=helloworld2 |
88e0a543 | 8 | RESET=false |
1375f65d H |
9 | # optimize for size: |
10 | CFLAGS=-g -mmcu=$(MCU) -Wall -Wstrict-prototypes -Os -mcall-prologues | |
11 | #------------------- | |
12 | all: $(PROJECT).hex | |
13 | #------------------- | |
14 | $(PROJECT).hex : $(PROJECT).out | |
15 | $(OBJCOPY) -R .eeprom -O ihex $(PROJECT).out $(PROJECT).hex | |
16 | $(PROJECT).out : $(PROJECT).o | |
17 | $(CC) $(CFLAGS) -o $(PROJECT).out -Wl,-Map,$(PROJECT).map $(PROJECT).o | |
18 | $(PROJECT).o : $(PROJECT).c | |
19 | $(CC) $(CFLAGS) -Os -c $(PROJECT).c | |
20 | asm : $(PROJECT).c | |
21 | $(CC) $(CFLAGS) -O -S $(PROJECT).c | |
22 | # you need to erase first before loading the program. | |
23 | # load (program) the software into the eeprom: | |
24 | load: $(PROJECT).hex | |
88e0a543 | 25 | $(RESET) && stty -F $(PORT) 19200 hupcl && sleep 2 && stty -F $(PORT) 19200 -hupcl && sleep 2 || true |
40e02009 | 26 | avrdude -cstk500v1 -P$(PORT) -b19200 -p $(MCU) -Uflash:w:$(PROJECT).hex:i $(FUSES) || $(MAKE) RESET=true MAKE=true load |
1375f65d H |
27 | # uisp -dlpt=/dev/parport0 --erase --upload --verify if=$(PROJECT).hex -dprog=dapa -v=3 --hash=12 |
28 | #------------------- | |
29 | clean: | |
30 | rm -f *.o *.map *.out *.hex | |
31 | #------------------- |