Rev 385 | Rev 5709 | Go to most recent revision | Blame | Compare with Previous | Last modification | View Log | RSS feed
######################################################################### Copyright (C) 1998-2011 Vix Technology, All rights reserved## Module name : MSP430.RUL# Module type : Makefile system# Compiler(s) : Perl# Environment(s): jats## Description : Toolset Rules for the Texas Instruments CC Studio##......................................................................#################################################################################.. Remove "undef" warnings#cc_defines +=as_defines +=cxx_includes +=cxx_defines +=################################################################################.. Parse user options# Global options already parsed# These options extend the global options#ifdef OPTIONSendif################################################################################# Extend LIBDIRS with toolset libraries# Create a ';' separated list# Start with a space separated list# May need to change if ARMLIB is to be installed# in a path with spaces in it.LIB := $(patsubst %,%;,$(LIBDIRS));$(MSP430_LIBS)export LIB################################################################################.. C++ Compiler definition#.. C Compiler definition### Compiler flags##cc = $(CC_PRE) $(msp430_compiler)cc_init =cc_o_switch =cc_object = --obj_directory=$(@D)cc_source = $<cc_cmdfile = $(basename $@).cmdcc_flags = --compile_only --cmd_file=$(cc_cmdfile)cc_defines = $(MSP430_DEFINES)msp430_includes = $(subst ;,$(space),$(subst \,/,$(subst $(space),$(spacealt),$(subst ;$(space),;,$(MSP430_INCLUDES)))))msp430_flags = $(MSP430_FLAGS)cc_filter := "$(notdir $(wildcard $(GBE_ROOT)/warnings.msp430*))"ifeq ($(strip $(cc_filter)), "warnings.msp430")cc_redirect = 1cc_error_filter = $(awk) -f $(GBE_ROOT)/warnings.msp430endififdef ITP_MODEmsp430_flags += --silicon_version=mspelsemsp430_flags += --silicon_version=mspxmsp430_flags += --gccmsp430_flags += --silicon_errata=CPU21msp430_flags += --silicon_errata=CPU22msp430_flags += --silicon_errata=CPU23endififdef MSP430_PROCDEFmsp430_flags += --define=$(MSP430_PROCDEF)endif#msp430_flags += --make_globalmsp430_flags += --diag_warning=225msp430_flags += --printf_support=minimalifdef LEAVETMPmsp430_flags += --keep_asm --asm_directory=$(@D)endififdef USE_STRICT_ANSImsp430_flags += --strict_ansiendififdef USE_OPTIMISEmsp430_flags += -O2elsemsp430_flags +=endififdef USE_DEBUGINFOcc_defines += DEBUGelsecc_defines += NDEBUGendififeq "$(DEBUG)" "1"msp430_flags +=elsemsp430_flags +=endifcc_defines += __SOURCE__=$(notdir $<)define cc_pre@$(echo) "[$<] compiling.."; \$(cmdfile) -ko$(cc_cmdfile) "\$(patsubst %,%\\n,$(CFLAGS)) \$(patsubst %,--define=%\\n,$(cc_defines)) \$(subst =,$(space),$(patsubst %,%\\n,$(msp430_flags))) \--include_path=$(dir $<)\\n \$(patsubst %,--include_path=%\\n,$(INCDIRS)) \$(subst $(spacealt),$(space),$(patsubst %,--include_path=\"%\"\\n,$(msp430_includes))) \$(cc_object)"$(call show_cmdfile,$(cc_cmdfile))endefifndef LEAVETMPdefine cc_post@$(rm) -f $(cc_cmdfile)endefelsedefine cc_postendefendif################################################################################.. C/C++ dependencies# depend and depend.err#msp430_depend = -D__STDC__ifeq "$(DEBUG)" "1"msp430_depend += -DDEBUGendifmsp430_depend += -D__SOURCE__=$(notdir $<)ccdep = $(XX_PRE)$(GBE_BIN)/mkdependccdep_init =ccdep_o_switch = -f -ccdep_source = $(filter %.c %.cc %.cpp, $+) > $(subst /,\\,$@) 2> $@.errccdep_flags = -MM -b -We -p \$$\(OBJDIR\)/ -o .$(o) \$(filter -D%, $(CFLAGS)) \$(filter -U%, $(CFLAGS)) \$(patsubst %,-D%,$(cc_defines)) \$(patsubst %,%,$(msp430_depend)) \$(patsubst %,-I %,$(INCDIRS)) \$(subst $(spacealt),$(space),$(patsubst %,-Y"%",$(msp430_includes))) \$(patsubst %,-Y %,$(NODEPDIRS))ccdep_pre =ccdep_post =################################################################################.. Assembler definition# Not used as assember files are treated as 'c' files################################################################################.. Archiver## Swicthes# -V Verbose# -o file Output file#ar = $(XX_PRE) "$(msp430_librarian)"ar_init =ar_flags = -aq $@ar_o_switch = $^ar_term =define ar_pre@$(echo) [\$@] Creating library archive.. ; \$(rm) -f $@endefifndef LEAVETMPdefine ar_postendefelsedefine ar_postendefendif################################################################################.. Archive Merge# Not currently supported.# Can add if required#################################################################################.. Linker## Add CC definitions and options# May(don't know) be used by the linker# Add the header file search path to the linker# Used to locate linker command files# Add library search path to the linker# Used within linker command files#ld = $(XX_PRE) $(msp430_compiler)ld_cmdfile = $(basename $@).ldld_flags = -@$(ld_cmdfile)msp430_libs = $(subst ;,$(space),$(subst \,/,$(subst $(space),$(spacealt),$(subst ;$(space),;,$(MSP430_LIBS)))))define ld_pre$(XX_PRE)$(echo) [$@] Linking program .. ;\export LIB; \LIB="$(subst $(space),;,$(LIBDIRS));$(MSP430_LIBS)"; \$(cmdfile) -W0ko$(ld_cmdfile) "\$(patsubst %,%\\n,$(CFLAGS)) \$(patsubst %,--define=%\\n,$(cc_defines)) \$(subst =,$(space),$(patsubst %,%\\n,$(msp430_flags))) \--run_linker\\n \--search_path=$(dir $<)\\n \$(patsubst %,--search_path=%\\n,$(INCDIRS)) \$(subst $(spacealt),$(space),$(patsubst %,--search_path=\"%\"\\n,$(msp430_includes))) \$(patsubst %,--search_path=%\\n,$(LIBDIRS)) \$(subst $(spacealt),$(space),$(patsubst %,--search_path=\"%\"\\n,$(msp430_libs))) \$($(notdir $(basename $@))_ld)"$(call show_cmdfile,$(ld_cmdfile))endefifndef LEAVETMPdefine ld_post@$(rm) -f $(ld_cmdfile)endefelsedefine ld_postendefendif## Create Library dependency file#define LDDEPEND$(XX_PRE) export LIB; \LIB="$(subst $(space),;,$(LIBDIRS));$(MSP430_LIBS)"; \$(cmdfile) -W1ko$(@) "$($(DPLIST))"endef################################################################################## Post Process COFF files into IMG files# $1 - coff file (input)# $2 - img file (output)# $3 - Build Version String (input)# Generates .img file and a .hex file# The .hex file is a buried dependency#define COFF2IMG@$(echo) "[$@] Convert COFF to IMG.."$(XX_PRE)$(TOOL_VXP430IMG) $1 $2 $3endef################################################################################## Post Process COFF files into HEX files# $1 - coff file (input)# $2 - Hex file (output)# Generates .hex file#define COFF2HEX@$(echo) "[$@] Convert COFF to HEX.."$(XX_PRE)$(msp430_hex) -i $1 -o $2 -order MS -romwidth 16endef#