]> www.average.org Git - sensor-light.git/blob - msp430/Makefile
1f2d64c551e4642830958c9d51ac74171649733c
[sensor-light.git] / msp430 / Makefile
1 # Makefile for the MCU firmware
2
3 # Must supply TOOLPATH, ARCH, MCU either in local.mk or in the make command line
4 # Example (toolchain in the system default location):
5 #TOOLPATH ?= /usr
6 #ARCH     ?= msp430-elf
7 #MCU      ?= msp430fr2433
8
9 -include local.mk
10
11 ifdef TOOLPATH
12  # OK
13 else
14  $(error Must supply TOOLPATH, ARCH, MCU)
15 endif
16
17 BIN = $(TOOLPATH)/bin
18 INC = $(TOOLPATH)/$(ARCH)/include
19 LIB = $(TOOLPATH)/$(ARCH)/lib
20 CC  = $(BIN)/$(ARCH)-gcc
21 OBC = $(BIN)/$(ARCH)-objcopy
22 CFLAGS = -mmcu=$(MCU) -g -ffunction-sections -fdata-sections -DDEPRECATED -I $(INC)
23 LDFLAGS = -mmcu=$(MCU) -g -Wl,--gc-sections
24
25 .PRECIOUS: %.o
26
27 all: main.hex
28
29 main: main.o
30
31 main.hex: main
32         $(OBC) -O ihex $< $@
33
34 clean:
35         rm -f main *.o