MCU = msp430g2553 CC = msp430-gcc OBJCOPY = msp430-objcopy SIZE = msp430-size MSPDEBUG = mspdebug MSP430FLASHER = MSP430Flasher EMBUILDER = #em-builder COPTS = -Os -Wall -fno-strict-aliasing -c -g -mmcu=$(MCU) LDOPTS = -mmcu=$(MCU) -Wl,-Map=main.map EMSOUT = $(SCHEMA)/out RMFILES = *.out *.map *.hex *.obj CFLAGS = -I$(COMMON) -I$(EMSOUT) $(COPTS) LDFLAGS = $(LDOPTS) VPATH = $(COMMON) OUTFILE = main.out all: $(OUTFILE) ifeq (,$(findstring Windows,$(OS))) load: out-check $(MSPDEBUG) rf2500 "prog $(OUTFILE)" 2>&1 else load: $(OUTFILE:.out=.hex) $(MSP430FLASHER) -i USB -m AUTO -e ERASE_MAIN -n $(MCU) -w $< -v -z [VCC] -g endif $(OUTFILE): $(OBJECTS) $(CC) $(LDFLAGS) -o $@ $^ $(SIZE) $@ %.hex: out-check $(OBJCOPY) -O ihex $(@:.hex=.out) $@ %.obj: %.c $(EMSOUT)/$(EMSNAME).h $(CC) $(CFLAGS) -o $@ $< $(EMSNAME).obj: $(EMSOUT)/$(EMSNAME).c $(EMSOUT)/$(EMSNAME).h $(CC) $(CFLAGS) -o $@ $< $(EMSOUT)/$(EMSNAME).h: $(SCHEMA)/schema.ems $(EMBUILDER) -v --root=$(&2 @exit 1 endif .PHONY: all load clean local-clean out-check