Rev 6177 | Blame | Compare with Previous | Last modification | View Log | RSS feed
################################################################################ COPYRIGHT - VIX IP PTY LTD ("VIX"). ALL RIGHTS RESERVED.## File: TOOLSET/AVR_IAR.rul[e]# Contents: IAR rules as used for the AVR# Make definitions for the IAR tools.## Description:# This file provides Toolset rules for the target makefiles# The file is dropped into the target makefile## Revision History:# 16-Aug-04 DDP Created###############################################################################################################################################################.. Remove "undef" warnings#cc_includes +=cc_defines +=as_includes +=as_defines +=cxx_includes +=cxx_defines +=################################################################################.. Parse user options# Global options already parsed# These options extend the global options#ifdef OPTIONSendif################################################################################.. C Compiler definition### Compiler flags# --cpu=cpu Specify cpu type# -D Symbol Define a symbol# --debug Include debug information# -e Enables language extensions# --ec++ Default language is C++# --eprom_size=N Set eeprom size# --enhanced_core Allow enhanced core instructions# -f file Read commands from a file# --initializers_in_flash Places aggregate initializers in flash memory# --no_clustering Disables clustering of variables# --no_code_motion Disables code motion optimization# --no_cross_call Disables cross-call optimization# --no_cse Disables common sub-expression elimination# --no_inline Disables function inlining# -lA file/dir Generate a list file# -lC file/dir Generate a list file# -m[stl] Memory model# -o filename Output filename# --require_prototypes Verifies that prototypes are proper# -s[2369] Optimise code for speed, none,Low,Med,Hi# --strict_ansi# --silent Supress banner# -v[0-6] Specify processor variant# -y Places constants and literals# -z[2369] Optimise code for size, none,Low,Med,Hi##cc = $(CC_PRE) "$(avr_iar_compiler)"cc_init =cc_o_switch =cc_object = -o $@cc_source = $<cc_cmdfile = $(basename $@).cmdcc_flags = --silent -f $(cc_cmdfile)cc_defines = $(AVR_IAR_DEFINES)iar_includes = $(subst ;,$(space),$(subst \,/,$(subst $(space),$(spacealt),$(subst ;$(space),;,$(AVR_IAR_INCLUDES)))))iar_flags = $(AVR_IAR_FLAGS)cc_filter := "$(notdir $(wildcard $(GBE_ROOT)/warnings.iar*))"ifeq ($(strip $(cc_filter)), "warnings.iar")cc_redirect = 1cc_error_filter = $(awk) -f $(GBE_ROOT)/warnings.iarendififdef LEAVETMPiar_flags += -lC=$(basename $@).lstendififdef USE_STRICT_ANSIiar_flags += --strict_ansielseiar_flags += -eendififdef USE_OPTIMISEiar_flags +=elseiar_flags +=endififdef USE_DEBUGINFOcc_defines += DEBUGelsecc_defines += NDEBUGendififeq "$(DEBUG)" "1"iar_flags += --debugelseiar_flags +=endififdef ALVLcc_defines += ALVL=$(ALVL)endififdef DLVLcc_defines += DLVL=$(DLVL)endifcc_defines += __SOURCE__=$(notdir $<)define cc_pre@$(echo) "[$<] compiling..";\$(cmdfile) -ko$(cc_cmdfile) "\$(patsubst %,%\\n,$(CFLAGS)) \$(patsubst %,-D%\\n,$(cc_defines)) \$(subst =,$(space),$(patsubst %,%\\n,$(iar_flags))) \$(subst =,$(space),$(patsubst %,%\\n,$(AVR_IAR_CC_FLAGS))) \-I $(dir $<)\\n \$(patsubst %,-I %\\n,$(INCDIRS)) \$(patsubst %,-I %\\n,$(cc_includes)) \$(subst $(spacealt),$(space),$(patsubst %,-I \"%\"\\n,$(iar_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#iar_depend = -D__STDC__ifeq "$(DEBUG)" "1"iar_depend += -DDEBUGendififdef ALVLiar_depend += -DALVL=$(ALVL)endififdef DLVLiar_depend += -DDLVL=$(DLVL)endifiar_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 %,%,$(iar_depend)) \$(patsubst %,-I %,$(INCDIRS)) \$(patsubst %,-Y %,$(cc_includes)) \$(subst $(spacealt),$(space),$(patsubst %,-Y"%",$(iar_includes))) \$(patsubst %,-Y %,$(NODEPDIRS))ccdep_pre =ccdep_post =#.. C++ Compiler definition#cxx = $(CC_PRE) "$(avr_iar_cpp_compiler)"cxx_init =cxx_o_switch =cxx_object = -o $@cxx_source = $<cxx_cmdfile = $(basename $@).cmdcxx_flags = -f $(cxx_cmdfile)define cxx_pre@$(echo) "[$<] compiling..";\$(cmdfile) -ko$(cxx_cmdfile) "\$(patsubst %,%\\n,$(CXXFLAGS)) \$(patsubst %,-D%\\n,$(cc_defines)) \$(subst =,$(space),$(patsubst %,%\\n,$(iar_flags))) \$(subst =,$(space),$(patsubst %,%\\n,$(AVR_IAR_CXX_FLAGS))) \-I $(dir $<)\\n \$(patsubst %,-I %\\n,$(INCDIRS)) \$(patsubst %,-I %\\n,$(cc_includes)) \$(subst $(spacealt),$(space),$(patsubst %,-I \"%\"\\n,$(iar_includes))) \$(cxx_object)" ;\$(call show_cmdfile,$(cxx_cmdfile))endefifndef LEAVETMPdefine cxx_post@$(rm) -f $(cxx_cmdfile)endefelsedefine cxx_postendefendif################################################################################.. Assembler definition## Note: All the options go on the command line at present so this# passes a minimal set of definitions. (v4.3)## Assembler switches# -Ifile Extend include path# -o file Specfify output file# -S No messages# -r Generate symbolic debug info# -D symbol Define a symbol# -f cmd_file Take options from a command file#as = $(XX_PRE) "$(avr_iar_assembler)"as_init =as_o_switch = -o $@as_source = $<as_cmdfile =as_includes =as_flags = -S $(AVR_IAR_ASFLAGS)as_defines = $(AVR_IAR_ASDEFINES)#ifdef ASFLAGSas_flags += $(ASFLAGS)#endififeq "$(DEBUG)" "1"as_flags += -relseas_flags +=endififdef as_definesas_flags += $(addprefix -D,$(as_defines))endif#ifdef INCDIRSas_flags += $(patsubst %,-I%,$(strip $(INCDIRS)))#endififdef as_includesas_flags += $(patsubst %,-I%,$(strip $(as_includes)))endif#ifdef AVR_IAR_INCLUDESas_flags += $(subst $(spacealt),$(space),$(patsubst %,"-I%",$(subst ;,$(space),$(subst \,/,$(subst $(space),$(spacealt),$(subst ;$(space),;,$(AVR_IAR_INCLUDES))))) ))#endifdefine as_pre@$(echo) '[$@] Assembling file..'endefdefine as_postendef################################################################################.. Archiver## Swicthes# -V Verbose# -o file Output file#ar = $(XX_PRE) "$(avr_iar_librarian)"ar_init =ar_flags = $^ar_o_switch = -o $@ar_term =define ar_pre@$(echo) '[$@] Creating library archive..' ; \$(rm) -f $@endefifndef LEAVETMPdefine ar_postendefelsedefine ar_postendefendif################################################################################.. Archive Merge#armerge = $(XX_PRE) "$(avr_iar_librarian)"armerge_init =armerge_flags = $^armerge_o_switch = -o $@define armerge_pre@$(echo) '[$@] Creating a Merged library..' ; \$(rm) -f $@endefifndef LEAVETMPdefine armerge_postendefelsedefine armerge_postendefendif################################################################################.. Linker#ld = $(XX_PRE) "$(avr_iar_linker)"ld_cmdfile = $(basename $@).ldld_flags = -f $(ld_cmdfile)define ld_pre$(XX_PRE)$(echo) '[$@] Linking program ..' ;\export IAR_LIB; \IAR_LIB="$(subst $(space),;,$(LIBDIRS))"; \$(cmdfile) -W2ko$(ld_cmdfile) "$($(notdir $(basename $@))_ld)"endefifndef LEAVETMPdefine ld_post@$(rm) -f $(ld_cmdfile)endefelsedefine ld_postendefendifdefine LD_IAR$(show_environment)$(ld_pre)$(ld) $(ld_flags)$(ld_post)endef## Create Library dependency file#define LDDEPEND$(XX_PRE) export IAR_LIB; \IAR_LIB="$(subst $(space),;,$(LIBDIRS))"; \$(cmdfile) -W1ko$(@) "$($(DPLIST))"endef## Program Loader processing# Args: $1 Path to the exe# $2 Path to the ProgLoader## The process# Remove last line from the executable (S9 Entry Point and Termination)# Remove the first line from the ProgLoader (S0 Header)# Concatenate the exe + progloader to the original file name#define LD_IAR_PROCESS$(XX_PRE) $(echo) "[$@]Process Program Loader .." ;\sed '-e$$d' $1 >$1.ed ;\sed '-e1d' $2 >$2.ed ;\rm -f $1.keep ;\mv $1 $1.keep ;\cat $1.ed $2.ed >$1 ;\rm $1.ed $2.edendef## Generate SREC file# Not used by all versions of IAR# Args: $1 Path to the out file (input)# $2 Path to the SREC file (output)# $3 Additional Args#define GENERATE_SREC$(XX_PRE) $(echo) "[$@]Generate SREC .." ;\rm -f $2;\"$(avr_iar_elftool)" --srec --verbose $3 $1 $2endef## Generate SXML file# Args: $1 Path to the S19 file# $2 Path to the SXML file (output)# $3 Payload Type# $4 Major version# $5 Minor version# $6 Patch# $7 Build# $8 WrapperTag. Has _Image appended#define GENERATE_SXML$(XX_PRE) $(echo) "[$@]Generate SXML .." ;\rm -f $2;\echo "<$8_Image>" >$2;\echo " <Header>" >>$2;\echo " <version>0</version>" >>$2;\echo " <builddate>$$(date +%c)</builddate>" >>$2;\echo " <buildtime>$$(date +%s)</buildtime>" >>$2;\echo " <platform>$(GBE_PLATFORM)</platform>" >>$2;\echo " <type>$3</type>" >>$2;\echo " <major>$4</major>" >>$2;\echo " <minor>$5</minor>" >>$2;\echo " <patch>$6</patch>" >>$2;\echo " <build>$7</build>" >>$2;\echo " <encrypted>false</encrypted>" >>$2;\echo " <binary>false</binary>" >>$2;\echo " </Header>" >>$2;\echo " <Data>" >>$2;\cat $1 >>$2;\echo " </Data>" >>$2;\echo "</$8_Image>" >>$2endef#