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