From: Eugene Crosser Date: Mon, 11 Dec 2017 18:37:51 +0000 (+0100) Subject: Initial Makefile X-Git-Url: http://www.average.org/gitweb/?p=sensor-light.git;a=commitdiff_plain;h=39874119dc219300a203f20525bd92246dd631e9 Initial Makefile Signed-off-by: Eugene Crosser --- diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..b3e5093 --- /dev/null +++ b/.gitignore @@ -0,0 +1,4 @@ +local.mk +*.o +*.elf +*.hex diff --git a/msp430/Makefile b/msp430/Makefile new file mode 100644 index 0000000..74948f3 --- /dev/null +++ b/msp430/Makefile @@ -0,0 +1,37 @@ +# Makefile for the MCU firmware + +# Must supply TOOLPATH, ARCH, MCU either in local.mk or in the make command line +# Example (toolchain in the system default location): +#TOOLPATH := /usr +#ARCH := msp430-elf +#MCU := msp430fr2433 + +-include local.mk + +ifdef TOOLPATH + # OK +else + $(error Must supply TOOLPATH, ARCH, MCU) +endif + +BIN = $(TOOLPATH)/bin +INC = $(TOOLPATH)/$(ARCH)/include +LIB = $(TOOLPATH)/$(ARCH)/lib +CC = $(BIN)/$(ARCH)-gcc +OBC = $(BIN)/$(ARCH)-objcopy +CFLAGS = -mmcu=$(MCU) -g -I $(INC) +LDFLAGS = -mmcu=$(MCU) -g + +.SUFFIXES: .elf .hex +.PRECIOUS: %.o %.elf + +all: main.hex + +%.elf: %.o + $(CC) $(LDFLAGS) -o $@ $< + +%.hex: %.elf + $(OBC) -O ihex $< $@ + +clean: + rm -f *.o *.elf