Improved support for the IAR compiler for the MSP430 platforms

This commit is contained in:
Niclas Finne 2012-03-07 23:03:15 +01:00
parent 569477b10c
commit ff7a977dc7
7 changed files with 31 additions and 22 deletions

View file

@ -71,10 +71,19 @@ CUSTOM_RULE_C_TO_O = 1
%.o: %.c
$(CC) $(CFLAGS) $< -o $@
define FINALIZE_CYGWIN_DEPENDENCY
sed -e 's/ \([A-Z]\):\\/ \/cygdrive\/\L\1\//' -e 's/\\/\//g' \
<$(@:.o=.P) >$(@:.o=.d); \
rm -f $(@:.o=.P)
endef
CUSTOM_RULE_C_TO_OBJECTDIR_O = 1
$(OBJECTDIR)/%.o: %.c
$(CC) $(CFLAGS) $< -o $@
# @$(FINALIZE_DEPENDENCY)
$(CC) $(CFLAGS) $< --dependencies=m $(@:.o=.P) -o $@
ifeq ($(HOST_OS),Windows)
@$(FINALIZE_CYGWIN_DEPENDENCY)
endif
CUSTOM_RULE_C_TO_CO = 1
%.co: %.c
$(CC) $(CFLAGS) -DAUTOSTART_ENABLE $< -o $@
@ -82,6 +91,7 @@ CUSTOM_RULE_C_TO_CO = 1
AROPTS = -o
else
GCC = 1
CC = msp430-gcc
LD = msp430-gcc
@ -129,8 +139,13 @@ PROJECT_OBJECTFILES += ${addprefix $(OBJECTDIR)/,$(CONTIKI_TARGET_MAIN:.c=.o)}
%.firmware: %.${TARGET}
mv $< $@
ifdef IAR
%.ihex: %.co $(PROJECT_OBJECTFILES) $(PROJECT_LIBRARIES) contiki-$(TARGET).a
$(LD) $(LDFLAGSNO) -Fintel-extended -yn $(TARGET_STARTFILES) ${filter-out %.a,$^} ${filter %.a,$^} $(TARGET_LIBFILES) -o $@
else
%.ihex: %.$(TARGET)
$(OBJCOPY) $^ -O ihex $@
endif
%.mspsim: %.${TARGET}
java -jar ${CONTIKI}/tools/mspsim/mspsim.jar -platform=${TARGET} $<

View file

@ -17,7 +17,7 @@ endif
CONTIKI_TARGET_SOURCEFILES += $(SENSORS) $(ESB) \
contiki-esb-default-init-lowlevel.c \
contiki-esb-default-init-apps.c \
rs232.c rs232-putchar.c fader.c $(CONTIKI_TARGET_MAIN)
rs232.c rs232-putchar.c fader.c
ifdef WITH_CODEPROP
CONTIKI_TARGET_DIRS += ../../apps/codeprop
@ -30,7 +30,7 @@ CFLAGS+=-Os -g
endif
ifdef IAR
CFLAGS+=-e --vla -Ohz --multiplier=16s --core=430 --double=32
CFLAGS += -D__MSP430F149__=1 -e --vla -Ohz --multiplier=16s --core=430 --double=32
CFLAGSNO = --dlib_config "$(IAR_PATH)/LIB/DLIB/dl430fn.h" $(CFLAGSWERROR)
endif
@ -53,6 +53,11 @@ include $(CONTIKI)/platform/$(TARGET)/apps/Makefile.apps
MCU=msp430x149
include $(CONTIKI)/cpu/msp430/Makefile.msp430
ifdef IAR
LDFLAGSNO += -B -xm "$(IAR_PATH)/lib/dlib/dl430fn.r43" -f "$(IAR_PATH)/config/lnk430f149.xcl" -l contiki-$(TARGET).map -s __program_start -D_STACK_SIZE=80 -D_DATA16_HEAP_SIZE=80 -D_DATA20_HEAP_SIZE=80
LDFLAGS += $(LDFLAGSNO) -Felf -yn
endif # IAR
contiki-$(TARGET).a: ${addprefix $(OBJECTDIR)/,symbols.o}
# $(AR) rcf $@ $^

View file

@ -60,8 +60,6 @@
#define CCIF
#define CLIF
#define CC_CONF_INLINE inline
#define HAVE_STDINT_H
#include "msp430def.h"

View file

@ -59,8 +59,6 @@
#define CCIF
#define CLIF
#define CC_CONF_INLINE inline
#define HAVE_STDINT_H
#include "msp430def.h"

View file

@ -17,7 +17,6 @@ endif
ifdef IAR
CFLAGS += -D__MSP430F1611__=1 -e --vla -Ohz --multiplier=16s --core=430 --double=32
CFLAGSNO = --dlib_config "$(IAR_PATH)/LIB/DLIB/dl430fn.h" $(CFLAGSWERROR)
endif
CONTIKI_TARGET_SOURCEFILES += $(ARCH) $(UIPDRIVERS)
@ -30,12 +29,9 @@ contiki-$(TARGET).a: ${addprefix $(OBJECTDIR)/,symbols.o}
ifdef IAR
ifdef ELF
LDFLAGS += -B -xm "$(IAR_PATH)/lib/dlib/dl430fn.r43" -f "$(IAR_PATH)/config/lnk430f1611.xcl" -l contiki-$(TARGET).map -Felf -yn -s __program_start -D_STACK_SIZE=80 -D_DATA16_HEAP_SIZE=80 -D_DATA20_HEAP_SIZE=80
else
LDFLAGS += -B -xm "$(IAR_PATH)/lib/dlib/dl430fn.r43" -f "$(IAR_PATH)/config/lnk430f1611.xcl" -l contiki-$(TARGET).map -Fintel-extended -s __program_start -D_STACK_SIZE=80 -D_DATA16_HEAP_SIZE=80 -D_DATA20_HEAP_SIZE=80
endif
endif
LDFLAGSNO += -B -xm "$(IAR_PATH)/lib/dlib/dl430fn.r43" -f "$(IAR_PATH)/config/lnk430f1611.xcl" -l contiki-$(TARGET).map -s __program_start -D_STACK_SIZE=80 -D_DATA16_HEAP_SIZE=80 -D_DATA20_HEAP_SIZE=80
LDFLAGS += $(LDFLAGSNO) -Felf -yn
endif # IAR
NUMPAR=20
IHEXFILE=tmpimage.ihex

View file

@ -34,19 +34,15 @@ MCU=msp430x5437
include $(CONTIKI)/cpu/msp430/Makefile.msp430
ifdef IAR
LDFLAGS += -B -xm "$(IAR_PATH)/lib/dlib/dl430xsfn.r43" -f "$(IAR_PATH)/config/lnk430f5437.xcl" -l contiki-$(TARGET).map -Fintel-extended -s __program_start -D_STACK_SIZE=80 -D_DATA16_HEAP_SIZE=80 -D_DATA20_HEAP_SIZE=80
LDFLAGSNO += -B -xm "$(IAR_PATH)/lib/dlib/dl430xsfn.r43" -f "$(IAR_PATH)/config/lnk430f5437.xcl" -l contiki-$(TARGET).map -s __program_start -D_STACK_SIZE=80 -D_DATA16_HEAP_SIZE=80 -D_DATA20_HEAP_SIZE=80
LDFLAGS += $(LDFLAGSNO) -Felf -yn
endif
contiki-$(TARGET).a: ${addprefix $(OBJECTDIR)/,symbols.o}
# $(AR) rcf $@ $^
ifdef IAR
%.hex: %.$(TARGET)
mv $< $@
else
%.hex: %.ihex
mv $< $@
endif
%.upload: %.hex
msp430flasher -n msp430x5437 -e ERASE_MAIN -w $< -v -z [VCC]

View file

@ -41,7 +41,8 @@ include $(CONTIKI)/cpu/msp430/Makefile.msp430
# Add LDFLAGS after IAR_PATH is set
ifdef IAR
LDFLAGS += -B -xm "$(IAR_PATH)/lib/dlib/dl430xsfn.r43" -f "$(IAR_PATH)/config/lnk430f2617.xcl" -l contiki-$(TARGET).map -Fintel-extended -s __program_start -D_STACK_SIZE=80 -D_DATA16_HEAP_SIZE=80 -D_DATA20_HEAP_SIZE=80
LDFLAGSNO += -B -xm "$(IAR_PATH)/lib/dlib/dl430xsfn.r43" -f "$(IAR_PATH)/config/lnk430f2617.xcl" -l contiki-$(TARGET).map -s __program_start -D_STACK_SIZE=80 -D_DATA16_HEAP_SIZE=80 -D_DATA20_HEAP_SIZE=80
LDFLAGS += $(LDFLAGSNO) -Felf -yn
endif
contiki-$(TARGET).a: ${addprefix $(OBJECTDIR)/,symbols.o}