nes-proj/cpu/msp430/Makefile.msp430
oliverschmidt ae2073cac9 Factored out setup directory search path for source files into Makefile.include.
- All compilers used support the -I option for setting an include search directory.

- The Contiki source tree follows the (common) approach of placing declarations (in headerf iles) in the same directory as definitions (in source files).

As a result it makes sense to use the -I compiler option for just the same set of directories used for the vpath gnumake directive.

Note: I checked several builds but nevertheless one or the other might need some additional adjustsments. Sorry for the inconvenience.
2007-05-19 07:54:53 +00:00

92 lines
2.5 KiB
Makefile

# $Id: Makefile.msp430,v 1.18 2007/05/19 07:56:34 oliverschmidt 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 rtimer-arch.c
UIPDRIVERS = me.c me_tabs.c slip.c crc16.c
#UIPDRIVERS = me.c me_tabs.c crc16.c ppp/ahdlc.c ppp/ipcp.c ppp/lcp.c ppp/pap.c ppp/ppp.c ppp/ppp_process.c
SYSAPPS = codeprop-tmp.c
APPDIRS += $(CONTIKI)/apps/codeprop
#ELFLOADER = loader-arch.c elfloader.c elfloader-msp430.c symtab.c
ELFLOADER = elfloader.c elfloader-msp430.c symtab.c
TARGETLIBS = random.c serial.c
CONTIKI_TARGET_SOURCEFILES += $(MSP430) \
$(SYSAPPS) $(ELFLOADER) \
$(TARGETLIBS) $(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
CFLAGSNO = -Wall -mmcu=$(MCU) -g
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: %.co $(PROJECT_OBJECTFILES) contiki-$(TARGET).a
$(CC) $(LDFLAGS) $(CFLAGS) -o $@ $(filter-out %.a,$^) $(filter %.a,$^)
%.ihex: %.firmware
$(OBJCOPY) $^ -O ihex $@
core-labels.o: core.firmware
${CONTIKI}/tools/msp430-make-labels core.firmware > core-labels.S
$(AS) -o $@ core-labels.S
# cp core-labels.o app/
core-globals.o: core.firmware
${CONTIKI}/tools/msp430-make-globals core.firmware > 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 ../../tools/mknmlist > symbols.c
else
symbols.c symbols.h:
@${CONTIKI}/tools/make-empty-symbols
endif