From 1b13b6981478d07bb64e466d7ffbc3bf47c3a27e Mon Sep 17 00:00:00 2001 From: Niclas Finne Date: Tue, 10 Apr 2012 16:05:10 +0200 Subject: [PATCH] Added support for mspgcc 4.6+ that no longer supports generic MCU identifiers such as msp430x1611 --- cpu/msp430/Makefile.msp430 | 59 ++++++++++++++++++++++--------- platform/esb/Makefile.esb | 2 +- platform/exp5438/Makefile.exp5438 | 4 +-- platform/msb430/Makefile.msb430 | 2 +- platform/sky/Makefile.common | 2 +- platform/wismote/Makefile.wismote | 2 +- platform/z1/Makefile.common | 2 +- 7 files changed, 50 insertions(+), 23 deletions(-) diff --git a/cpu/msp430/Makefile.msp430 b/cpu/msp430/Makefile.msp430 index a5eeb7ff3..8e9ffd2c2 100644 --- a/cpu/msp430/Makefile.msp430 +++ b/cpu/msp430/Makefile.msp430 @@ -11,19 +11,24 @@ CONTIKI_CPU=$(CONTIKI)/cpu/msp430 ### Define the source files we have in the MSP430 port -ifneq (,$(findstring msp430x1,$(MCU))) - CONTIKI_CPU_FAM_DIR = f1xxx -else - ifneq (,$(findstring msp430x5,$(MCU))) - CONTIKI_CPU_FAM_DIR = f5xxx - else - ifneq (,$(findstring msp430x2,$(MCU))) - CONTIKI_CPU_FAM_DIR = f2xxx f1xxx - else - ${error Unhandled MSP430 family: "$(MCU)"} - endif +ifndef CONTIKI_CPU_FAM_DIR + ifneq (,$(findstring msp430f1,$(MCU))) + CONTIKI_CPU_FAM_DIR = f1xxx endif endif +ifndef CONTIKI_CPU_FAM_DIR + ifneq (,$(findstring msp430f5,$(MCU))) + CONTIKI_CPU_FAM_DIR = f5xxx + endif +endif +ifndef CONTIKI_CPU_FAM_DIR + ifneq (,$(findstring msp430f2,$(MCU))) + CONTIKI_CPU_FAM_DIR = f2xxx f1xxx + endif +endif +ifndef CONTIKI_CPU_FAM_DIR + ${error Unhandled MSP430 family: "$(MCU)"} +endif CONTIKI_CPU_DIRS = $(CONTIKI_CPU_FAM_DIR) . dev @@ -54,9 +59,9 @@ STRIP = strip ifndef IAR_PATH # This works with cygwin... -IAR_BIN_PATH = $(shell dirname "`which $(CC)`") -IAR_PATH_C = $(shell dirname "$(IAR_BIN_PATH)") -IAR_PATH = $(shell cygpath -m "$(IAR_PATH_C)") +IAR_BIN_PATH := $(shell dirname "`which $(CC)`") +IAR_PATH_C := $(shell dirname "$(IAR_BIN_PATH)") +IAR_PATH := $(shell cygpath -m "$(IAR_PATH_C)") endif CFLAGS += --diag_suppress=Pa050 --silent @@ -101,11 +106,33 @@ NM = msp430-nm OBJCOPY = msp430-objcopy STRIP = msp430-strip BSL = msp430-bsl + +# From version 4.6.x, mspgcc does not support generic MCU identifiers such as +# msp430x1611 in contrast to msp430f1611 +ifndef CC_MCU + ifndef MSPGCC_VERSION + MSPGCC_VERSION := ${shell $(CC) -dumpversion} + endif +endif +ifndef CC_MCU + ifneq (,$(findstring 4.4.,$(MSPGCC_VERSION))) + CC_MCU := ${subst msp430f,msp430x,$(MCU)} + endif +endif +ifndef CC_MCU + ifneq (,$(findstring 3.2.,$(MSPGCC_VERSION))) + CC_MCU := ${subst msp430f,msp430x,$(MCU)} + endif +endif +ifndef CC_MCU + CC_MCU := $(MCU) +endif + ifndef CFLAGSNO -CFLAGSNO = -Wall -mmcu=$(MCU) -g $(CFLAGSWERROR) +CFLAGSNO = -Wall -mmcu=$(CC_MCU) -g $(CFLAGSWERROR) endif CFLAGS += -Os -fno-strict-aliasing -LDFLAGS += -mmcu=$(MCU) -Wl,-Map=contiki-$(TARGET).map +LDFLAGS += -mmcu=$(CC_MCU) -Wl,-Map=contiki-$(TARGET).map ### These flags can reduce the code size and RAM usage with up to 10% ifeq ($(SMALL),1) diff --git a/platform/esb/Makefile.esb b/platform/esb/Makefile.esb index 4fa71d2d3..9e82880f3 100644 --- a/platform/esb/Makefile.esb +++ b/platform/esb/Makefile.esb @@ -50,7 +50,7 @@ endif include $(CONTIKI)/platform/$(TARGET)/apps/Makefile.apps -MCU=msp430x149 +MCU=msp430f149 include $(CONTIKI)/cpu/msp430/Makefile.msp430 ifdef IAR diff --git a/platform/exp5438/Makefile.exp5438 b/platform/exp5438/Makefile.exp5438 index a3e57fc90..d1780dc39 100644 --- a/platform/exp5438/Makefile.exp5438 +++ b/platform/exp5438/Makefile.exp5438 @@ -47,9 +47,9 @@ endif CONTIKI_TARGET_SOURCEFILES += $(ARCH) $(UIPDRIVERS) ifdef IAR -MCU=msp430x5438a +MCU=msp430f5438a else -MCU=msp430x5438 +MCU=msp430f5438 endif include $(CONTIKI)/cpu/msp430/Makefile.msp430 diff --git a/platform/msb430/Makefile.msb430 b/platform/msb430/Makefile.msb430 index af5c95caa..8ac7f68f9 100644 --- a/platform/msb430/Makefile.msb430 +++ b/platform/msb430/Makefile.msb430 @@ -12,7 +12,7 @@ endif CONTIKI_TARGET_SOURCEFILES += $(SENSORS) $(MSB) $(CONTIKI_TARGET_MAIN) -MCU=msp430x1612 +MCU=msp430f1612 include $(CONTIKI)/cpu/msp430/Makefile.msp430 contiki-$(TARGET).a: ${addprefix $(OBJECTDIR)/,symbols.o} diff --git a/platform/sky/Makefile.common b/platform/sky/Makefile.common index 77e13ee84..492a7371a 100644 --- a/platform/sky/Makefile.common +++ b/platform/sky/Makefile.common @@ -21,7 +21,7 @@ endif CONTIKI_TARGET_SOURCEFILES += $(ARCH) $(UIPDRIVERS) -MCU=msp430x1611 +MCU=msp430f1611 include $(CONTIKI)/cpu/msp430/Makefile.msp430 contiki-$(TARGET).a: ${addprefix $(OBJECTDIR)/,symbols.o} diff --git a/platform/wismote/Makefile.wismote b/platform/wismote/Makefile.wismote index 1a675f7ad..e24d9d002 100644 --- a/platform/wismote/Makefile.wismote +++ b/platform/wismote/Makefile.wismote @@ -30,7 +30,7 @@ endif CONTIKI_TARGET_SOURCEFILES += $(ARCH) $(UIPDRIVERS) -MCU=msp430x5437 +MCU=msp430f5437 include $(CONTIKI)/cpu/msp430/Makefile.msp430 ifdef IAR diff --git a/platform/z1/Makefile.common b/platform/z1/Makefile.common index 2c21dc75e..aab1a55ad 100644 --- a/platform/z1/Makefile.common +++ b/platform/z1/Makefile.common @@ -36,7 +36,7 @@ endif CONTIKI_TARGET_SOURCEFILES += $(ARCH) $(UIPDRIVERS) CONTIKI_TARGET_SOURCEFILES += i2cmaster.c adxl345.c -MCU=msp430x2617 +MCU=msp430f2617 include $(CONTIKI)/cpu/msp430/Makefile.msp430 # Add LDFLAGS after IAR_PATH is set