]> www.average.org Git - sensor-light.git/blob - msp430/Makefile
74948f385344b68b380266e23e6333d3f5048f94
[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 -I $(INC)
23 LDFLAGS = -mmcu=$(MCU) -g
24
25 .SUFFIXES: .elf .hex
26 .PRECIOUS: %.o %.elf
27
28 all: main.hex
29
30 %.elf: %.o
31         $(CC) $(LDFLAGS) -o $@ $<
32
33 %.hex: %.elf
34         $(OBC) -O ihex $< $@
35
36 clean:
37         rm -f *.o *.elf