]> www.average.org Git - sensor-light.git/blob - msp430/Makefile
streamline logic, adjust ambient light value
[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 -ffunction-sections -fdata-sections -Wl,--gc-sections -L $(INC)
24 ifneq (,$(findstring msp430g2,$(MCU)))
25   LOAD = mspdebug rf2500 'prog main'
26 else
27   LOAD = MSP430Flasher -w main.hex
28 endif
29
30 .PRECIOUS: main %.o
31
32 all: main.hex
33
34 main: main.o
35
36 main.hex: main
37         $(OBC) -O ihex $< $@
38
39 load: main.hex
40         $(LOAD)
41
42 clean:
43         rm -f *.o