Subversion Repositories group.electronics

Rev

Details | Last modification | View Log | RSS feed

Rev Author Line No. Line
11 pfowler 1
# WinAVR cross-compiler toolchain is used here
2
CC = avr-gcc
3
OBJCOPY = avr-objcopy
4
DUDE = avrdude
5
 
6
# If you are not using ATtiny2313 and the USBtiny programmer, 
7
# update the lines below to match your configuration
8
CFLAGS = -Wall -Os -I. -mmcu=attiny2313
9
OBJFLAGS = -j .text -j .data -O ihex
10
DUDEFLAGS = -p attiny2313 -P usb -c avrispmkii -v
11
 
12
# Object files for the firmware (usbdrv/oddebug.o not strictly needed I think)
13
OBJECTS = main.o
14
 
15
# Command-line client
16
CMDLINE = usbtest
17
 
18
# By default, build the firmware and command-line client, but do not flash
19
#all: main.hex $(CMDLINE)
20
all: main.hex 
21
 
22
# With this, you can flash the firmware by just typing "make flash" on command-line
23
flash: main.hex
24
	$(DUDE) $(DUDEFLAGS) -U flash:w:$<
25
 
26
# Housekeeping if you want it
27
clean:
28
	$(RM) *.o *.hex *.elf 
29
 
30
# From .elf file to .hex
31
%.hex: %.elf
32
	$(OBJCOPY) $(OBJFLAGS) $< $@
33
 
34
# Main.elf requires additional objects to the firmware, not just main.o
35
main.elf: $(OBJECTS)
36
	$(CC) $(CFLAGS) $(OBJECTS) -o $@
37
 
38
# From C source to .o object file
39
%.o: %.c	
40
	$(CC) $(CFLAGS) -c $< -o $@
41
 
42
# From assembler source to .o object file
43
%.o: %.S
44
	$(CC) $(CFLAGS) -x assembler-with-cpp -c $< -o $@