Initial Makefile
authorEugene Crosser <evgenii.cherkashin@profitbricks.com>
Mon, 11 Dec 2017 18:37:51 +0000 (19:37 +0100)
committerEugene Crosser <evgenii.cherkashin@profitbricks.com>
Mon, 11 Dec 2017 18:37:51 +0000 (19:37 +0100)
Signed-off-by: Eugene Crosser <evgenii.cherkashin@profitbricks.com>
.gitignore [new file with mode: 0644]
msp430/Makefile [new file with mode: 0644]

diff --git a/.gitignore b/.gitignore
new file mode 100644 (file)
index 0000000..b3e5093
--- /dev/null
@@ -0,0 +1,4 @@
+local.mk
+*.o
+*.elf
+*.hex
diff --git a/msp430/Makefile b/msp430/Makefile
new file mode 100644 (file)
index 0000000..74948f3
--- /dev/null
@@ -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