AVRPATH = /usr/bin/ # AVRPATH = C:/WinAVR-20100110/bin/ CC = $(AVRPATH)avr-gcc OBJCOPY = $(AVRPATH)avr-objcopy AVRSTRIP = $(AVRPATH)avr-strip AVRDUDE = $(AVRPATH)avrdude AVRSIZE = $(AVRPATH)avr-size AVRNM = $(AVRPATH)avr-nm PRG = main PATH = output/ MCU_TARGET = atmega16 # F_CPU = 7372800UL #F_CPU = 4000000UL # F_CPU = 8000000UL F_CPU = 12000000UL # F_CPU = 12288000UL #F_CPU = 20000000UL # override CFLAGS = -Wall -gstabs+ -Os -mcall-prologues -fshort-enums -msize -fno-jump-tables -std=c99 -Wunsafe-loop-optimizations -mmcu=$(MCU_TARGET) #override PENIBL = -Wunused-parameter -Wunsafe-loop-optimizations -funsafe-loop-optimizations -Wextra -Wpadded -Wredundant-decls -Winline -Werror -nodefaultlibs -nostdlib override PREPRO = -DF_CPU=$(F_CPU) -DBAUD=19200 override LDFLAGS = -Wl,-Map,$(PATH)$(PRG).map override STDOUT = -DSTDOUT_put_string -DSTDOUT_put_uint inc/stdout.c # override STDALG = -DSTDALGO_CRC7 inc/stdalg.c # -DSTDOUT_putf #/ FATFS_PATH = inc/spi/dev/petit_fatfs/avr/ #/ ASRC = $(FATFS_PATH)xitoa.S $(FATFS_PATH)usi.S #/ OBJ = $(CSRC:.c=.o) $(ASRC:.S=.o) #/ ASFLAGS = -Wa,-adhlns=$(<:.S=.lst),-gstabs #/ ALL_ASFLAGS = -mmcu=$(MCU_TARGET) -I. -x assembler-with-cpp $(ASFLAGS) # inc/spi/dev/petit_fatfs/avr/pff.c inc/spi/dev/memory_sdcard.c # inc/uart/uart.c \ #/ inc/spi/dev/petit/pff.c \ #/ inc/spi/dev/petit/diskio.c #/ inc/spi/dev/audio_vs1011.c $(PATH)$(PRG).elf: clean $(CC) -o$(PATH)$(PRG).elf $(PREPRO) $(CFLAGS) $(LDFLAGS) $(DEBUG) $(STDOUT) $(STDALG) \ $(PRG).c \ inc/spi/spi.c \ inc/int/dcf77/clock.c \ inc/spi/dev/display_dogm.c @$(AVRNM) --size-sort -l ./output/$(PRG).elf @$(AVRSIZE) -d ./output/$(PRG).elf #@$(AVRSIZE) -C --mcu=$(MCU_TARGET) ./output/$(TARGET).elf %.hex: $(PATH)%.elf $(OBJCOPY) -S -j.text -j.data -Oihex $< $(PATH)$@ #/ %.o : %.S #/ $(CC) -c $(ALL_ASFLAGS) $< -o $@ upload: clean $(PRG).hex # skip: -e (erase, because ATMega doesn't need it and avrdude checks this automatically) $(AVRDUDE) -cavrispv2 -b115200 -pm16 -Pusb -e -V -U ./output/$(PRG).hex upload_mp3: $(AVRDUDE) -cavrispv2 -pm16 -Pusb -V -F -Ueeprom:w:accessdenied.mp3 clean: $(shell rm -f $(PATH)$(PRG).elf) $(shell rm -f $(PATH)$(PRG).hex) $(shell rm -f $(PATH)$(PRG).map) #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