receiver/Makefile

changeset 9
20dbe0546a36
equal deleted inserted replaced
8:84249ab5d691 9:20dbe0546a36
1 PRG=main
2
3 MCU=atmega16
4 FUSES=-U lfuse:w:0x2f:m -U hfuse:w:0xc8:m
5 BOOTFUSES=-U lfuse:w:0xff:m -U hfuse:w:0xce:m
6
7 #F_CPU=4185600
8 #F_CPU = 14318000
9
10 F_CPU = 8000000
11
12 BAUD=38400
13 ISP_BAUD = 115200
14
15 #SRC = main.c seriald.c driver/ADC.c driver/clock.c driver/timer.c
16 #SRC = main.c driver/rs232.c driver/manchester.c
17 SRC = main.c driver/rs232.c
18
19 ###################################################################
20 # You possibly do not need to change settings below this marker
21 ###################################################################
22
23 # Binaries to be used
24 # You may add the path to them if they are not in the PATH variable.
25 CC = avr-gcc
26 OBJCOPY = avr-objcopy
27 OBJDUMP = avr-objdump
28 AVRDUDE = avrdude
29 PERL = perl
30
31 # Optional library search path
32 LIBS =
33
34 # Compiler options for all c source files
35 CFLAGS += -g -Wall -mmcu=$(MCU) -DBAUD=$(BAUD) -DF_CPU=$(F_CPU)UL -std=gnu99
36 CFLAGS += -funsigned-char
37 CFLAGS += -funsigned-bitfields
38 CFLAGS += -fpack-struct
39 CFLAGS += -fshort-enums
40 CFLAGS += -Wstrict-prototypes
41 CFLAGS += -Wundef
42 #CFLAGS += -save-temps
43
44 # optimize for size
45 CFLAGS += -Os
46 # dont optimize
47 #CFLAGS += -O0
48
49 # Linker options
50 LDFLAGS = -Wl,-Map,$(PRG).map
51
52 # Enable floating-point support in printf
53 #LDFLAGS += -Wl,-u,vfprintf -lprintf_flt -lm
54
55 ###################################################################
56 # TARGET DEFINITIONS:
57
58
59 all: code
60
61 code: $(PRG).hex
62
63 $(PRG).elf: $(SRC:.c=.o)
64 $(CC) $(CFLAGS) $(LDFLAGS) -o $@ $^ $(LIBS)
65
66 %.lst: %.elf
67 $(OBJDUMP) -h -S $< > $@
68
69 %.hex: %.elf
70 $(OBJCOPY) -j .text -j .data -O ihex $< $@
71 rm $(PRG).elf
72 rm $(PRG).map
73
74 program: code
75 $(AVRDUDE) -c stk500v2 -b $(ISP_BAUD) -i 1 -p $(MCU) -V -U flash:w:$(PRG).hex:i
76
77 fuse:
78 $(AVRDUDE) -c stk500 -p $(MCU) -V $(FUSES)
79
80 clean:
81 rm -rf *.o *.elf *.elf.src *.s *.i
82 rm -rf driver/*.o
83
84 upgrade: code
85 $(RESETCOMMAND)
86 ./bootloader -d $(NETDEV) -b $(UPGRADE_BAUD) -p $(PRG).hex
87
88 bootloader: bootload.hex
89 $(AVRDUDE) -p $(MCU) -c stk500 -V -U flash:w:bootload.hex:i
90
91 bootfuses:
92 $(AVRDUDE) -p $(MCU) -c stk500 $(BOOTFUSES)

mercurial