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 %.o: %.c
$(CC) $(CFLAGS) $< -o $@ $(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 CUSTOM_RULE_C_TO_OBJECTDIR_O = 1
$(OBJECTDIR)/%.o: %.c $(OBJECTDIR)/%.o: %.c
$(CC) $(CFLAGS) $< -o $@ $(CC) $(CFLAGS) $< --dependencies=m $(@:.o=.P) -o $@
# @$(FINALIZE_DEPENDENCY) ifeq ($(HOST_OS),Windows)
@$(FINALIZE_CYGWIN_DEPENDENCY)
endif
CUSTOM_RULE_C_TO_CO = 1 CUSTOM_RULE_C_TO_CO = 1
%.co: %.c %.co: %.c
$(CC) $(CFLAGS) -DAUTOSTART_ENABLE $< -o $@ $(CC) $(CFLAGS) -DAUTOSTART_ENABLE $< -o $@
@ -82,6 +91,7 @@ CUSTOM_RULE_C_TO_CO = 1
AROPTS = -o AROPTS = -o
else else
GCC = 1 GCC = 1
CC = msp430-gcc CC = msp430-gcc
LD = msp430-gcc LD = msp430-gcc
@ -129,8 +139,13 @@ PROJECT_OBJECTFILES += ${addprefix $(OBJECTDIR)/,$(CONTIKI_TARGET_MAIN:.c=.o)}
%.firmware: %.${TARGET} %.firmware: %.${TARGET}
mv $< $@ 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) %.ihex: %.$(TARGET)
$(OBJCOPY) $^ -O ihex $@ $(OBJCOPY) $^ -O ihex $@
endif
%.mspsim: %.${TARGET} %.mspsim: %.${TARGET}
java -jar ${CONTIKI}/tools/mspsim/mspsim.jar -platform=${TARGET} $< java -jar ${CONTIKI}/tools/mspsim/mspsim.jar -platform=${TARGET} $<

View file

@ -17,7 +17,7 @@ endif
CONTIKI_TARGET_SOURCEFILES += $(SENSORS) $(ESB) \ CONTIKI_TARGET_SOURCEFILES += $(SENSORS) $(ESB) \
contiki-esb-default-init-lowlevel.c \ contiki-esb-default-init-lowlevel.c \
contiki-esb-default-init-apps.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 ifdef WITH_CODEPROP
CONTIKI_TARGET_DIRS += ../../apps/codeprop CONTIKI_TARGET_DIRS += ../../apps/codeprop
@ -30,7 +30,7 @@ CFLAGS+=-Os -g
endif endif
ifdef IAR 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) CFLAGSNO = --dlib_config "$(IAR_PATH)/LIB/DLIB/dl430fn.h" $(CFLAGSWERROR)
endif endif
@ -53,6 +53,11 @@ include $(CONTIKI)/platform/$(TARGET)/apps/Makefile.apps
MCU=msp430x149 MCU=msp430x149
include $(CONTIKI)/cpu/msp430/Makefile.msp430 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} contiki-$(TARGET).a: ${addprefix $(OBJECTDIR)/,symbols.o}
# $(AR) rcf $@ $^ # $(AR) rcf $@ $^

View file

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

View file

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

View file

@ -17,7 +17,6 @@ endif
ifdef IAR ifdef IAR
CFLAGS += -D__MSP430F1611__=1 -e --vla -Ohz --multiplier=16s --core=430 --double=32 CFLAGS += -D__MSP430F1611__=1 -e --vla -Ohz --multiplier=16s --core=430 --double=32
CFLAGSNO = --dlib_config "$(IAR_PATH)/LIB/DLIB/dl430fn.h" $(CFLAGSWERROR) CFLAGSNO = --dlib_config "$(IAR_PATH)/LIB/DLIB/dl430fn.h" $(CFLAGSWERROR)
endif endif
CONTIKI_TARGET_SOURCEFILES += $(ARCH) $(UIPDRIVERS) CONTIKI_TARGET_SOURCEFILES += $(ARCH) $(UIPDRIVERS)
@ -30,12 +29,9 @@ contiki-$(TARGET).a: ${addprefix $(OBJECTDIR)/,symbols.o}
ifdef IAR ifdef IAR
ifdef ELF 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 += -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 LDFLAGS += $(LDFLAGSNO) -Felf -yn
else endif # IAR
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
NUMPAR=20 NUMPAR=20
IHEXFILE=tmpimage.ihex IHEXFILE=tmpimage.ihex

View file

@ -34,19 +34,15 @@ MCU=msp430x5437
include $(CONTIKI)/cpu/msp430/Makefile.msp430 include $(CONTIKI)/cpu/msp430/Makefile.msp430
ifdef IAR 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 endif
contiki-$(TARGET).a: ${addprefix $(OBJECTDIR)/,symbols.o} contiki-$(TARGET).a: ${addprefix $(OBJECTDIR)/,symbols.o}
# $(AR) rcf $@ $^ # $(AR) rcf $@ $^
ifdef IAR
%.hex: %.$(TARGET)
mv $< $@
else
%.hex: %.ihex %.hex: %.ihex
mv $< $@ mv $< $@
endif
%.upload: %.hex %.upload: %.hex
msp430flasher -n msp430x5437 -e ERASE_MAIN -w $< -v -z [VCC] 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 # Add LDFLAGS after IAR_PATH is set
ifdef IAR 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 endif
contiki-$(TARGET).a: ${addprefix $(OBJECTDIR)/,symbols.o} contiki-$(TARGET).a: ${addprefix $(OBJECTDIR)/,symbols.o}