From acdd758e56e28f22846e7d34d87f5533c8682574 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Karel=20Ko=C4=8D=C3=AD?= Date: Thu, 8 Oct 2015 20:59:26 +0200 Subject: Add implementation of USART and more ground changes --- avr-ioe.mk | 47 +++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 47 insertions(+) create mode 100644 avr-ioe.mk (limited to 'avr-ioe.mk') diff --git a/avr-ioe.mk b/avr-ioe.mk new file mode 100644 index 0000000..1248f11 --- /dev/null +++ b/avr-ioe.mk @@ -0,0 +1,47 @@ +ifndef IOE_PREFIX + IOE_PREFIX = . +endif + +IOE_SRC_SPI = $(IOE_PREFIX)/src/spi.c +IOE_SRC_USART = $(IOE_PREFIX)/src/usart.c +IOE_SRC = $(IOE_SRC_SPI) $(IOE_SRC_USART) + +IOE_OBJ_SPI = $(patsubst %.c,%.o,$(IOE_SRC_SPI)) +IOE_OBJ_USART = $(patsubst %.c,%.o,$(IOE_SRC_USART)) +IOE_OBJ = $(patsubst %.c,%.o,$(IOE_SRC)) + +IOE_DEP_SPI = $(patsubst %.c,%.d,$(IOE_SRC_SPI)) +IOE_DEP_USART = $(patsubst %.c,%.d,$(IOE_SRC_USART)) +IOE_DEP = $(patsubst %.c,%.d,$(IOE_SRC)) + + +ifndef IOE_ONLYPATHS # Following section can be suppressed by defining this variable + +ifneq ($(MAKECMDGOALS),clean) +ifneq ($(MAKECMDGOALS),help) +-include $(IOE_DEP) +endif +endif + +ifndef F_CPU + $(error Please define F_CPU variable in makefile before including avr-ioe.mk) +endif +ifndef MMCU + $(error Pleade define MMCU variable in makefile before including avr-ioe.mk) +endif +IOE_CFLAGS ?= -Os -ffunction-sections -fdata-sections -fshort-enums -Wall +IOE_CFLAGS += -DF_CPU=$(F_CPU) -mmcu=$(MMCU) +IOE_GCC ?= avr-gcc + +$(IOE_OBJ): %.o: %.c + $(IOE_GCC) $(IOE_CFLAGS) -c -o $@ $< + +$(IOE_DEP): %.d: %.c + $(IOE_GCC) -MM -MG -MT '$*.o $@' $(IOE_CFLAGS) -c -o $@ $< + +.PHONY: ioeclean +ioeclean: + $(RM) $(IOE_OBJ) + $(RM) $(IOE_DEP) + +endif -- cgit v1.2.3