receiver/Makefile

changeset 9
20dbe0546a36
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/receiver/Makefile	Wed Nov 16 17:04:10 2011 +0100
@@ -0,0 +1,92 @@
+PRG=main
+
+MCU=atmega16
+FUSES=-U lfuse:w:0x2f:m -U hfuse:w:0xc8:m
+BOOTFUSES=-U lfuse:w:0xff:m -U hfuse:w:0xce:m
+
+#F_CPU=4185600
+#F_CPU = 14318000
+
+F_CPU = 8000000
+
+BAUD=38400
+ISP_BAUD = 115200
+
+#SRC = main.c seriald.c driver/ADC.c driver/clock.c driver/timer.c
+#SRC = main.c driver/rs232.c driver/manchester.c
+SRC = main.c driver/rs232.c
+
+###################################################################
+# You possibly do not need to change settings below this marker
+###################################################################
+
+# Binaries to be used
+# You may add the path to them if they are not in the PATH variable.
+CC      = avr-gcc
+OBJCOPY = avr-objcopy
+OBJDUMP = avr-objdump
+AVRDUDE = avrdude
+PERL    = perl
+
+# Optional library search path
+LIBS =
+
+# Compiler options for all c source files
+CFLAGS += -g -Wall -mmcu=$(MCU) -DBAUD=$(BAUD) -DF_CPU=$(F_CPU)UL -std=gnu99 
+CFLAGS += -funsigned-char
+CFLAGS += -funsigned-bitfields
+CFLAGS += -fpack-struct
+CFLAGS += -fshort-enums
+CFLAGS += -Wstrict-prototypes
+CFLAGS += -Wundef
+#CFLAGS += -save-temps
+
+# optimize for size
+CFLAGS += -Os
+# dont optimize
+#CFLAGS += -O0
+
+# Linker options
+LDFLAGS = -Wl,-Map,$(PRG).map
+
+# Enable floating-point support in printf
+#LDFLAGS += -Wl,-u,vfprintf -lprintf_flt -lm
+
+###################################################################
+# TARGET DEFINITIONS:
+
+
+all: code
+
+code: $(PRG).hex
+
+$(PRG).elf: $(SRC:.c=.o)
+	$(CC) $(CFLAGS) $(LDFLAGS) -o $@ $^ $(LIBS)
+
+%.lst: %.elf
+	$(OBJDUMP) -h -S $< > $@
+
+%.hex: %.elf
+	$(OBJCOPY) -j .text -j .data -O ihex $< $@
+	rm $(PRG).elf
+	rm $(PRG).map
+
+program: code
+	$(AVRDUDE) -c stk500v2 -b $(ISP_BAUD) -i 1 -p $(MCU) -V -U flash:w:$(PRG).hex:i
+
+fuse:
+	$(AVRDUDE) -c stk500 -p $(MCU) -V $(FUSES)
+
+clean:
+	rm -rf *.o *.elf *.elf.src *.s *.i
+	rm -rf driver/*.o
+
+upgrade: code
+	$(RESETCOMMAND)
+	./bootloader -d $(NETDEV) -b $(UPGRADE_BAUD) -p $(PRG).hex
+
+bootloader: bootload.hex
+	$(AVRDUDE) -p $(MCU) -c stk500 -V -U flash:w:bootload.hex:i
+
+bootfuses:
+	$(AVRDUDE) -p $(MCU) -c stk500 $(BOOTFUSES)

mercurial