From 39874119dc219300a203f20525bd92246dd631e9 Mon Sep 17 00:00:00 2001 From: Eugene Crosser Date: Mon, 11 Dec 2017 19:37:51 +0100 Subject: [PATCH] Initial Makefile Signed-off-by: Eugene Crosser --- .gitignore | 4 ++++ msp430/Makefile | 37 +++++++++++++++++++++++++++++++++++++ 2 files changed, 41 insertions(+) create mode 100644 .gitignore create mode 100644 msp430/Makefile 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 -- 2.39.2