diff --git a/firmware/Makefile b/firmware/Makefile index 8c327d8..2e18ac4 100755 --- a/firmware/Makefile +++ b/firmware/Makefile @@ -1,16 +1,41 @@ -CC=avr-gcc -CFLAGS=-g -Os -Wall -mcall-prologues -mmcu=attiny2313 -OBJ2HEX=avr-objcopy -AVRDUDE=avrdude -TARGET=midifs +# Include environment config +include Makefile.config + +# Project specific settings +TARGET = midifs +MCU = t2313 + +help: + @echo + @echo "Availiable targets:" + @echo " help Displays this help" + @echo + @echo " compile Compiles source code" + @echo " info Outputs device memory information" + @echo " program Programs the device" + @echo " clean Deletes temporary files" + @echo + @echo " all Compile, info, program, clean" + @echo + +# Some C flags +CFLAGS=-g -Os -Wall -mcall-prologues -mmcu=attiny2313 + +all: compile info program clean + +compile: $(TARGET).hex + +info: + avr-size $(TARGET).hex + +program: compile + @$(AVRDUDE) -p $(MCU) -c $(PGMDEV) -P $(PGMOPT) -U flash:w:$(TARGET).hex:i -program : $(TARGET).hex - $(AVRDUDE) -p t2313 -c stk500v2 -P /dev/ttyS0 -U $(TARGET).hex %.obj : %.o $(CC) $(CFLAGS) $< -o $@ %.hex : %.obj - $(OBJ2HEX) -R .eeprom -O ihex $< $@ + @$(OBJ2HEX) -R .eeprom -O ihex $< $@ -clean : - rm -f *.hex *.obj *.o +clean: + @$(REMOVE) *.hex *.obj *.o \ No newline at end of file diff --git a/firmware/Makefile.config b/firmware/Makefile.config new file mode 100644 index 0000000..b3055d2 --- /dev/null +++ b/firmware/Makefile.config @@ -0,0 +1,26 @@ +# +# Set toolchain. +# AVR-GCC and AVRDUDE need to be installed +# +CC = avr-gcc +OBJ2HEX = avr-objcopy +AVRDUDE = avrdude +REMOVE = rm -f + +# +# You probably want to change this to your own programming device. +# Some commonly used examples shown below. +# + +# STK500 +PGMDEV = stk500v2 +PGMOPT = -P /dev/ttyS0 + + +# AVR ISP mkII +#PGMDEV = avrispmkII +#PGMOPT = -P usb # Try -B 10 in case of programming errors + +# Pony-STK200 +#PGMDEV = pony-stk200 +#PGMOPT = -E noreset