receiver/Makefile

Fri, 09 Dec 2011 09:40:15 +0100

author
Malte Bayer <mbayer@neo-soft.org>
date
Fri, 09 Dec 2011 09:40:15 +0100
changeset 53
f659e6faf18f
parent 9
20dbe0546a36
permissions
-rw-r--r--

moved ISRs from main.c to interrupts.c

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

mercurial