AVR programmer autoreset magic :-)
[mirrors/Programs.git] / avr / blink / Makefile
CommitLineData
1375f65d
H
1#MCU=at90s2313
2MCU=attiny2313
88e0a543 3PORT=/dev/ttyUSB0
1375f65d
H
4CC=avr-gcc
5OBJCOPY=avr-objcopy
6PROJECT=helloworld
88e0a543 7RESET=false
1375f65d
H
8# optimize for size:
9CFLAGS=-g -mmcu=$(MCU) -Wall -Wstrict-prototypes -Os -mcall-prologues
10#-------------------
11all: $(PROJECT).hex
12#-------------------
13$(PROJECT).hex : $(PROJECT).out
14 $(OBJCOPY) -R .eeprom -O ihex $(PROJECT).out $(PROJECT).hex
15$(PROJECT).out : $(PROJECT).o
16 $(CC) $(CFLAGS) -o $(PROJECT).out -Wl,-Map,$(PROJECT).map $(PROJECT).o
17$(PROJECT).o : $(PROJECT).c
18 $(CC) $(CFLAGS) -Os -c $(PROJECT).c
19asm : $(PROJECT).c
20 $(CC) $(CFLAGS) -O -S $(PROJECT).c
21# you need to erase first before loading the program.
22# load (program) the software into the eeprom:
23load: $(PROJECT).hex
88e0a543
H
24 $(RESET) && stty -F $(PORT) 19200 hupcl && sleep 2 && stty -F $(PORT) 19200 -hupcl && sleep 2 || true
25 avrdude -cstk500v1 -P$(PORT) -b19200 -p $(MCU) -Uflash:w:$(PROJECT).hex:i || $(MAKE) RESET=true MAKE=true load
1375f65d
H
26 # uisp -dlpt=/dev/parport0 --erase --upload --verify if=$(PROJECT).hex -dprog=dapa -v=3 --hash=12
27#-------------------
28clean:
29 rm -f *.o *.map *.out *.hex
30#-------------------
This page took 0.127939 seconds and 4 git commands to generate.