aboutsummaryrefslogtreecommitdiff
path: root/src/Makefile
diff options
context:
space:
mode:
authorMax Christian Pohle2015-07-27 15:12:22 +0200
committerMax Christian Pohle2015-07-27 15:12:22 +0200
commit2df2697107d7873232c31a25a6947711b0903edb (patch)
treeff7247e9e970c69f3d3385950b19db9997a511b8 /src/Makefile
downloadalarmclock-2df2697107d7873232c31a25a6947711b0903edb.tar.bz2
alarmclock-2df2697107d7873232c31a25a6947711b0903edb.zip
latest running version from march 2011, not having been in repo before,
dcf77 working, mp3 playback and two display types are supported
Diffstat (limited to 'src/Makefile')
-rwxr-xr-xsrc/Makefile75
1 files changed, 75 insertions, 0 deletions
diff --git a/src/Makefile b/src/Makefile
new file mode 100755
index 0000000..ca05759
--- /dev/null
+++ b/src/Makefile
@@ -0,0 +1,75 @@
1AVRPATH = /usr/bin/
2# AVRPATH = C:/WinAVR-20100110/bin/
3
4CC = $(AVRPATH)avr-gcc
5OBJCOPY = $(AVRPATH)avr-objcopy
6AVRSTRIP = $(AVRPATH)avr-strip
7AVRDUDE = $(AVRPATH)avrdude
8AVRSIZE = $(AVRPATH)avr-size
9AVRNM = $(AVRPATH)avr-nm
10
11PRG = main
12PATH = output/
13
14
15MCU_TARGET = atmega16
16# F_CPU = 7372800UL
17#F_CPU = 4000000UL
18# F_CPU = 8000000UL
19F_CPU = 12000000UL
20# F_CPU = 12288000UL
21#F_CPU = 20000000UL
22
23#
24override CFLAGS = -Wall -gstabs+ -Os -mcall-prologues -fshort-enums -msize -fno-jump-tables -std=c99 -Wunsafe-loop-optimizations -mmcu=$(MCU_TARGET)
25#override PENIBL = -Wunused-parameter -Wunsafe-loop-optimizations -funsafe-loop-optimizations -Wextra -Wpadded -Wredundant-decls -Winline -Werror -nodefaultlibs -nostdlib
26override PREPRO = -DF_CPU=$(F_CPU) -DBAUD=19200
27override LDFLAGS = -Wl,-Map,$(PATH)$(PRG).map
28override STDOUT = -DSTDOUT_put_string -DSTDOUT_put_uint inc/stdout.c
29# override STDALG = -DSTDALGO_CRC7 inc/stdalg.c
30# -DSTDOUT_putf
31
32
33#/ FATFS_PATH = inc/spi/dev/petit_fatfs/avr/
34#/ ASRC = $(FATFS_PATH)xitoa.S $(FATFS_PATH)usi.S
35#/ OBJ = $(CSRC:.c=.o) $(ASRC:.S=.o)
36
37#/ ASFLAGS = -Wa,-adhlns=$(<:.S=.lst),-gstabs
38#/ ALL_ASFLAGS = -mmcu=$(MCU_TARGET) -I. -x assembler-with-cpp $(ASFLAGS)
39
40
41# inc/spi/dev/petit_fatfs/avr/pff.c inc/spi/dev/memory_sdcard.c
42# inc/uart/uart.c \
43#/ inc/spi/dev/petit/pff.c \
44#/ inc/spi/dev/petit/diskio.c
45#/ inc/spi/dev/audio_vs1011.c
46
47$(PATH)$(PRG).elf: clean
48 $(CC) -o$(PATH)$(PRG).elf $(PREPRO) $(CFLAGS) $(LDFLAGS) $(DEBUG) $(STDOUT) $(STDALG) \
49 $(PRG).c \
50 inc/spi/spi.c \
51 inc/int/dcf77/clock.c \
52 inc/spi/dev/display_dogm.c
53 @$(AVRNM) --size-sort -l ./output/$(PRG).elf
54 @$(AVRSIZE) -d ./output/$(PRG).elf
55 #@$(AVRSIZE) -C --mcu=$(MCU_TARGET) ./output/$(TARGET).elf
56
57%.hex: $(PATH)%.elf
58 $(OBJCOPY) -S -j.text -j.data -Oihex $< $(PATH)$@
59
60#/ %.o : %.S
61 #/ $(CC) -c $(ALL_ASFLAGS) $< -o $@
62
63upload: clean $(PRG).hex
64 # skip: -e (erase, because ATMega doesn't need it and avrdude checks this automatically)
65 $(AVRDUDE) -cavrispv2 -b115200 -pm16 -Pusb -e -V -U ./output/$(PRG).hex
66
67upload_mp3:
68 $(AVRDUDE) -cavrispv2 -pm16 -Pusb -V -F -Ueeprom:w:accessdenied.mp3
69
70clean:
71 $(shell rm -f $(PATH)$(PRG).elf)
72 $(shell rm -f $(PATH)$(PRG).hex)
73 $(shell rm -f $(PATH)$(PRG).map)
74
75#avr-gcc -o./output/main.elf -DF_CPU=7372800UL -DBAUD=9600 -DSTDOUT_reverse_bits -DSTDOUT_put_int -DSTDOUT_put_string -g -Wall -std=c99 -Os -mmcu=atmega16 -Wl,-Map,./output/main.map ./inc/display/dog.c main.c ./inc/dcf77/clock.c ./inc/stdout.c
..