pitlane/Makefile

Wed, 19 Dec 2012 20:18:03 +0100

author
Malte Bayer <mbayer@neo-soft.org>
date
Wed, 19 Dec 2012 20:18:03 +0100
changeset 133
2dedc73bf54e
parent 104
95b2c23cb973
permissions
-rw-r--r--

release

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

mercurial