93 lines
2.3 KiB
Makefile
93 lines
2.3 KiB
Makefile
# $Id: Makefile.msp430,v 1.31 2009/11/19 17:33:05 nifi Exp $
|
|
|
|
ifdef nodeid
|
|
CFLAGS += -DNODEID=$(nodeid)
|
|
endif
|
|
|
|
.SUFFIXES:
|
|
|
|
### Define the CPU directory
|
|
CONTIKI_CPU=$(CONTIKI)/cpu/msp430
|
|
|
|
### Define the source files we have in the MSP430 port
|
|
|
|
CONTIKI_CPU_DIRS = . dev
|
|
|
|
MSP430 = msp430.c flash.c clock.c leds.c leds-arch.c \
|
|
watchdog.c lpm.c mtarch.c uart1.c slip_uart1.c uart1-putchar.c rtimer-arch.c
|
|
UIPDRIVERS = me.c me_tabs.c slip.c crc16.c
|
|
ELFLOADER = elfloader.c elfloader-msp430.c symtab.c
|
|
|
|
CONTIKI_TARGET_SOURCEFILES += $(MSP430) \
|
|
$(SYSAPPS) $(ELFLOADER) \
|
|
$(UIPDRIVERS)
|
|
|
|
CONTIKI_SOURCEFILES += $(CONTIKI_TARGET_SOURCEFILES)
|
|
|
|
|
|
### Compiler definitions
|
|
CC = msp430-gcc
|
|
LD = msp430-gcc
|
|
AS = msp430-as
|
|
AR = msp430-ar
|
|
NM = msp430-nm
|
|
OBJCOPY = msp430-objcopy
|
|
STRIP = msp430-strip
|
|
BSL = msp430-bsl
|
|
ifdef WERROR
|
|
CFLAGSWERROR=-Werror
|
|
endif
|
|
CFLAGSNO = -Wall -mmcu=$(MCU) -g $(CFLAGSWERROR)
|
|
CFLAGS += $(CFLAGSNO) -Os
|
|
LDFLAGS += -mmcu=$(MCU) -Wl,-Map=contiki-$(TARGET).map
|
|
|
|
PROJECT_OBJECTFILES += ${addprefix $(OBJECTDIR)/,$(CONTIKI_TARGET_MAIN:.c=.o)}
|
|
|
|
### Compilation rules
|
|
|
|
%-stripped.o: %.c
|
|
$(CC) $(CFLAGS) -c $< -o $@
|
|
$(STRIP) --strip-unneeded -g -x $@
|
|
|
|
%.cm: %.co
|
|
$(LD) -i -r --unresolved-symbols=ignore-in-object-files -mmsp430x149 -o $@ $^
|
|
$(STRIP) --strip-unneeded -g -x $@
|
|
|
|
%-stripped.o: %.o
|
|
$(STRIP) --strip-unneeded -g -x -o $@ $<
|
|
|
|
%.o: ${CONTIKI_TARGET}/loader/%.S
|
|
$(AS) -o $(notdir $(<:.S=.o)) $<
|
|
|
|
%.firmware: %.${TARGET}
|
|
mv $< $@
|
|
|
|
%.ihex: %.$(TARGET)
|
|
$(OBJCOPY) $^ -O ihex $@
|
|
|
|
%.mspsim: %.${TARGET}
|
|
java -jar ${CONTIKI}/tools/mspsim/mspsim.jar -platform=${TARGET} $<
|
|
|
|
core-labels.o: core.${TARGET}
|
|
${CONTIKI}/tools/msp430-make-labels core.${TARGET} > core-labels.S
|
|
$(AS) -o $@ core-labels.S
|
|
# cp core-labels.o app/
|
|
|
|
core-globals.o: core.${TARGET}
|
|
${CONTIKI}/tools/msp430-make-globals core.${TARGET} > core-globals.S
|
|
$(AS) -o $@ core-globals.S
|
|
|
|
loader-init.o: ${CONTIKI_TARGET}/loader/loader-init.S
|
|
$(AS) -o $(notdir $(<:.S=.o)) $<
|
|
# cp loader-init.o build-app/
|
|
|
|
.PHONY: symbols.c symbols.h
|
|
ifdef CORE
|
|
symbols.c:
|
|
# @${CONTIKI}/tools/msp430-make-symbols $(CORE)
|
|
$(NM) $(CORE) | awk -f $(CONTIKI)/tools/mknmlist > symbols.c
|
|
else
|
|
symbols.c symbols.h:
|
|
@${CONTIKI}/tools/make-empty-symbols
|
|
endif
|