carrerashark/Makefile

Sun, 28 Oct 2012 18:53:03 +0100

author
Malte Bayer <mbayer@neo-soft.org>
date
Sun, 28 Oct 2012 18:53:03 +0100
changeset 109
bb00e6994e5e
parent 29
ba4f69250592
permissions
-rw-r--r--

typo...

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

mercurial