Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Newer
Older
100644 97 lines (71 sloc) 2.203 kb
b823759 @tabascoeye First commit, working single animations from 1024 char array bitmaps
tabascoeye authored
1
2 # Default values
3 OUT ?= image
4 MCU_TARGET ?= atmega32
5 MCU_CC ?= avr-gcc
6 OPTIMIZE ?= -Os
7 WARNINGS ?= -Wall
8 DEFS ?= -DF_CPU=16000000
9 CFLAGS += -MMD -g -mmcu=$(MCU_TARGET) $(OPTIMIZE) $(WARNINGS) $(DEFS)
10 ASFLAGS ?=
11 ASFLAGS += -g $(DEFS)
12 LDFLAGS = -Wl,-Map,$(OUT).map
13 CANADDR ?= XXX
14
15 OBJ = main.o
16
17 # External Tools
18 OBJCOPY ?= avr-objcopy
19 OBJDUMP ?= avr-objdump
20 FLASHCMD ?= uisp -dprog=bsd --upload if=$(OUT).hex
21 ERASECMD ?= uisp -dprog=bsd --erase
1dd7b66 @tiefpunkt Halloween Graphics
tiefpunkt authored
22 #FLASHUSBCMD ?= avrdude -c avr910 -p m32 -P $(AVRPROGDEV) -e -U flash:w:image.hex
23 FLASHUSBCMD ?= avrdude -c usbasp -p m32 -U flash:w:image.hex
b823759 @tabascoeye First commit, working single animations from 1024 char array bitmaps
tabascoeye authored
24 LAPFLASHCMD ?= lapcontrol -s rl
25
26 #############################################################################
27 # Rules
28 all: $(OUT).elf lst text eeprom
29
30 clean:
31 rm -rf $(OUT) *.o *.d *.lst *.map $(OUT).hex $(OUT)_eeprom.hex *.bin *.srec
32 rm -rf *.srec $(OUT).elf
33
34 flash: $(OUT).hex
35 $(ERASECMD)
36 $(FLASHCMD)
37
38 flashusb: $(OUT).hex
39 $(FLASHUSBCMD)
40
41 canflash: $(OUT).hex
42 $(LAPFLASHCMD) flash $(CANADDR) $(OUT).hex
43
44 #############################################################################
45 # Building Rules
46 $(OUT).elf: $(OBJ)
47 $(MCU_CC) $(CFLAGS) $(LDFLAGS) -o $@ $^ $(LIBS)
48
49 %.o: %.c
50 $(MCU_CC) $(CFLAGS) -c $<
51
52 %.o: %.S
53 $(MCU_CC) -mmcu=$(MCU_TARGET) $(ASFLAGS) -c $<
54
55 lst: $(OUT).lst
56
57 %.lst: %.elf
58 $(OBJDUMP) -h -S $< > $@
59
60 # Rules for building the .text rom images
61 text: hex bin srec
62
63 hex: $(OUT).hex
64 bin: $(OUT).bin
65 srec: $(OUT).srec
66
67 %.hex: %.elf
68 $(OBJCOPY) -j .text -j .data -O ihex $< $@
69
70 %.srec: %.elf
71 $(OBJCOPY) -j .text -j .data -O srec $< $@
72
73 %.bin: %.elf
74 $(OBJCOPY) -j .text -j .data -O binary $< $@
75
76 # Rules for building the .eeprom rom images
77
78 eeprom: ehex ebin esrec
79
80 ehex: $(OUT)_eeprom.hex
81 ebin: $(OUT)_eeprom.bin
82 esrec: $(OUT)_eeprom.srec
83
84 %_eeprom.hex: %.elf
85 $(OBJCOPY) -j .eeprom --change-section-lma .eeprom=0 -O ihex $< $@
86
87 %_eeprom.srec: %.elf
88 $(OBJCOPY) -j .eeprom --change-section-lma .eeprom=0 -O srec $< $@
89
90 %_eeprom.bin: %.elf
91 $(OBJCOPY) -j .eeprom --change-section-lma .eeprom=0 -O binary $< $@
92
93 DEPS := $(wildcard *.d)
94 ifneq ($(DEPS),)
95 include $(DEPS)
96 endif
Something went wrong with that request. Please try again.