equal
deleted
inserted
replaced
|
1 PROG = hello |
|
2 # console |
|
3 # dmx |
|
4 |
|
5 all: $(PROG).hex |
|
6 |
|
7 ## Compiler |
|
8 MCU = atmega328p |
|
9 |
|
10 # CPU clock frequency |
|
11 CPU = 16000000 |
|
12 |
|
13 CC = avr-gcc |
|
14 CFLAGS = -g -mmcu=$(MCU) -DF_CPU=$(CPU)UL -Os |
|
15 |
|
16 %.elf: %.c |
|
17 $(CC) $(CFLAGS) -o $@ $+ |
|
18 |
|
19 %.hex: %.elf |
|
20 avr-objcopy -O ihex -R .eeprom $< $@ |
|
21 |
|
22 .PRECIOUS: %.elf |
|
23 |
|
24 ## Assembler |
1 AS = avra |
25 AS = avra |
2 ASFLAGS = |
26 ASFLAGS = |
3 |
27 |
|
28 matrix.hex: spi.inc matrix.inc timer.inc delay.inc macros.inc font.inc font.def |
|
29 led7seg.hex: spi.inc led7seg.inc adc.inc timer.inc delay.inc macros.inc |
|
30 timer.hex: timer.inc macros.inc |
|
31 |
|
32 %.hex: %.s |
|
33 $(AS) $(ASFLAGS) $< |
|
34 mv $<.hex $@ |
|
35 |
|
36 # fonts |
|
37 font.inc: font.def |
|
38 |
|
39 font.def: font.txt font-compile.py |
|
40 python font-compile.py $< $@ > /dev/null |
|
41 |
|
42 |
|
43 ## Flashing |
|
44 # Arduino Duemilanove |
4 AD_PART = m328p |
45 AD_PART = m328p |
5 AD_PROG = arduino |
46 AD_PROG = arduino |
6 AD_BAUD = 57600 |
47 AD_BAUD = 57600 |
7 AD_PORT = /dev/arduino |
48 AD_PORT = /dev/arduino |
8 |
49 |
9 AD = avrdude |
50 AD = avrdude |
10 ADFLAGS = -p $(AD_PART) -c $(AD_PROG) -b $(AD_BAUD) -P $(AD_PORT) |
51 ADFLAGS = -p $(AD_PART) -c $(AD_PROG) -b $(AD_BAUD) -P $(AD_PORT) |
11 |
52 |
12 PROG = dmx |
|
13 |
|
14 all: $(PROG).hex |
|
15 |
|
16 matrix.hex: spi.inc matrix.inc timer.inc delay.inc macros.inc font.inc font.def |
|
17 led7seg.hex: spi.inc led7seg.inc adc.inc timer.inc delay.inc macros.inc |
|
18 timer.hex: timer.inc macros.inc |
|
19 |
|
20 font.inc: font.def |
|
21 |
|
22 %.hex: %.s |
|
23 $(AS) $(ASFLAGS) $< |
|
24 mv $<.hex $@ |
|
25 |
|
26 font.def: font.txt font-compile.py |
|
27 python font-compile.py $< $@ > /dev/null |
|
28 |
|
29 upload: $(PROG).hex |
53 upload: $(PROG).hex |
30 $(AD) $(ADFLAGS) -U flash:w:$< |
54 $(AD) $(ADFLAGS) -U flash:w:$< |
31 |
55 |
|
56 ## Console |
32 SERIAL_BAUD = 9600 |
57 SERIAL_BAUD = 9600 |
33 SERIAL_FLOW = n |
58 SERIAL_FLOW = n |
34 SERIAL_PARITY = n |
59 SERIAL_PARITY = n |
35 SERIAL_BITS = 8 |
60 SERIAL_BITS = 8 |
36 SERIAL_PORT = $(AD_PORT) |
61 SERIAL_PORT = $(AD_PORT) |
37 |
62 |
38 SERIAL_TERM = picocom |
63 SERIAL_TERM = picocom |
39 SERIAL_FLAGS = -b $(SERIAL_BAUD) -f $(SERIAL_FLOW) -p $(SERIAL_PARITY) -d $(SERIAL_BITS) |
64 SERIAL_FLAGS = -b $(SERIAL_BAUD) -f $(SERIAL_FLOW) -p $(SERIAL_PARITY) -d $(SERIAL_BITS) |
40 |
65 |
41 chat: |
66 console: |
42 $(SERIAL_TERM) $(SERIAL_FLAGS) $(SERIAL_PORT) |
67 $(SERIAL_TERM) $(SERIAL_FLAGS) $(SERIAL_PORT) |
43 |
68 |