# # Copyright 2015, Olivier MATZ # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions are met: # # * Redistributions of source code must retain the above copyright # notice, this list of conditions and the following disclaimer. # * Redistributions in binary form must reproduce the above copyright # notice, this list of conditions and the following disclaimer in the # documentation and/or other materials provided with the distribution. # * Neither the name of the University of California, Berkeley nor the # names of its contributors may be used to endorse or promote products # derived from this software without specific prior written permission. # # THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND ANY # EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED # WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE # DISCLAIMED. IN NO EVENT SHALL THE REGENTS AND CONTRIBUTORS BE LIABLE FOR ANY # DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES # (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; # LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND # ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS # SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. # XXX UCGINE ?= /home/zer0/projects/ucgine MCU = atmega328p F_CPU = 8000000UL AVRDUDE_PORT = /dev/ttyUSB0 AVRDUDE_PROG = arduino AVRDUDE_BAUD = 57600 O ?= $(CURDIR)/build CROSS = avr- ifneq ($(CROSS),avr-) $(error AVR target only, cannot override CROSS) endif CFLAGS += -g -O2 -Wall CFLAGS += -I$(UCGINE)/arch/avr/include CFLAGS += -mmcu=$(MCU) CFLAGS += -DF_CPU=$(F_CPU) LDFLAGS += -mmcu=$(MCU) # cirbuf CFLAGS += -I$(UCGINE)/lib/cirbuf/include exe-y-$(O)/spi-client += $(UCGINE)/lib/cirbuf/ucg_cirbuf.c # uart CFLAGS += -I$(UCGINE)/arch/avr/include CFLAGS += -I$(UCGINE)/arch/avr/uart/include CFLAGS += -I$(UCGINE)/lib/uart CFLAGS += -I$(UCGINE)/lib/uart/include exe-y-$(O)/spi-client += $(UCGINE)/lib/uart/ucg_uart.c exe-y-$(O)/spi-client += $(UCGINE)/arch/avr/uart/ucg_avr_uart.c # local files exe-y-$(O)/spi-client += main.c uart.c objcopy-hex-y-$(O)/spi-client.hex := $(O)/spi-client objcopy-bin-y-$(O)/spi-client.bin := $(O)/spi-client include $(UCGINE)/mk/ucgine.mk .PHONY: all all: $(all-targets) .PHONY: clean clean: _ucgine_clean .PHONY: burn burn: all avrdude -e -p $(MCU) -P $(AVRDUDE_PORT) -c $(AVRDUDE_PROG) \ -b $(AVRDUDE_BAUD) -U flash:w:$(O)/spi-client:e