|
@@ -0,0 +1,65 @@
|
|
1
|
+MCU = attiny85
|
|
2
|
+F_CPU = 16000000
|
|
3
|
+RM = rm -rf
|
|
4
|
+EXTRAINCDIR = include
|
|
5
|
+CSTANDARD = gnu99
|
|
6
|
+
|
|
7
|
+GCC = avr-gcc
|
|
8
|
+SIZE = avr-size
|
|
9
|
+OBJCOPY = avr-objcopy
|
|
10
|
+OBJDUMP = avr-objdump
|
|
11
|
+AVRDUDE = avrdude
|
|
12
|
+
|
|
13
|
+SRC = src/cc2500_BB_SPI.c
|
|
14
|
+SRC += src/frsky_arduino_rx_complete.c
|
|
15
|
+
|
|
16
|
+OBJ = $(SRC:.c=.o)
|
|
17
|
+
|
|
18
|
+CARGS = -mmcu=$(MCU)
|
|
19
|
+CARGS += -I$(EXTRAINCDIR)
|
|
20
|
+CARGS += -Os
|
|
21
|
+CARGS += -funsigned-char
|
|
22
|
+CARGS += -funsigned-bitfields
|
|
23
|
+CARGS += -fpack-struct
|
|
24
|
+CARGS += -fshort-enums
|
|
25
|
+CARGS += -Wall -pedantic -Wstrict-prototypes -Wshadow
|
|
26
|
+CARGS += -Wpointer-arith -Wcast-qual -Wextra
|
|
27
|
+CARGS += -Wno-write-strings -Wno-unused-parameter
|
|
28
|
+CARGS += -std=$(CSTANDARD)
|
|
29
|
+CARGS += -DF_CPU=$(F_CPU)
|
|
30
|
+#CARGS += -lm -lprintf_flt
|
|
31
|
+CARGS += -ffunction-sections
|
|
32
|
+
|
|
33
|
+LINKER = -Wl,--relax
|
|
34
|
+#LINKER = -Wl,--relax,-u,vfprintf,-lm,-lprintf_flt,-u,vfscanf,-lscanf_flt
|
|
35
|
+#LINKER += -Wl,--defsym=__heap_start=0x802200,--defsym=__heap_end=0x80ffff
|
|
36
|
+#LINKER += -Wl,-gc-sections
|
|
37
|
+
|
|
38
|
+PROGRAMMER = avrisp2
|
|
39
|
+ISPPORT = usb
|
|
40
|
+
|
|
41
|
+TARGET = rx
|
|
42
|
+
|
|
43
|
+all: $(TARGET).hex
|
|
44
|
+
|
|
45
|
+%.o: %.c
|
|
46
|
+ $(GCC) -c $< -o $@ $(CARGS)
|
|
47
|
+
|
|
48
|
+$(TARGET).elf: $(OBJ)
|
|
49
|
+ $(GCC) $(CARGS) $(OBJ) --output $@ $(LINKER) -Wl,-Map -Wl,$(@:.elf=.map)
|
|
50
|
+ $(SIZE) --mcu=$(MCU) -C $@
|
|
51
|
+
|
|
52
|
+$(TARGET).hex: $(TARGET).elf
|
|
53
|
+ $(OBJCOPY) -O ihex $< $@
|
|
54
|
+ $(OBJDUMP) -h -S $< > $(@:.hex=.lss)
|
|
55
|
+
|
|
56
|
+program: $(TARGET).hex
|
|
57
|
+ $(AVRDUDE) -p $(MCU) -c $(PROGRAMMER) -P $(ISPPORT) -e -U $(TARGET).hex
|
|
58
|
+
|
|
59
|
+clean:
|
|
60
|
+ $(RM) $(OBJ)
|
|
61
|
+ $(RM) *.o
|
|
62
|
+ $(RM) *.elf
|
|
63
|
+ $(RM) *.hex
|
|
64
|
+ $(RM) *.lss
|
|
65
|
+ $(RM) *.map
|