#---------------------------------------------------------------------------- # Project: Horizon # File: commondefs.cctype.RVCT.om # # Copyright (C)2009-2011 Nintendo Co., Ltd. All rights reserved. # # These coded instructions, statements, and computer programs contain # proprietary information of Nintendo of America Inc. and/or Nintendo # Company Ltd., and are protected by Federal copyright law. They may # not be disclosed to third parties or copied or duplicated in any form, # in whole or in part, without the prior written consent of Nintendo. # # $Rev: 50029 $ #---------------------------------------------------------------------------- # Version of RVCT supported private.SUOPPORT_RVCT_VER[] = ARMCC41 global.RVCT_DIAG_STYLE = arm global.EXCLUSION_SCATTER = false global.EXT_CG = .txt # If CTRSDK_RVCT_VER is not defined, set the RVCT version for which SDK operations have been verified if $(not $(defined CTRSDK_RVCT_VER)) CTRSDK_RVCT_VER = 41 export CTRSDK_RVCT_VER if $(defined-env CTRSDK_RVCT_VER) CTRSDK_RVCT_VER = $(getenv CTRSDK_RVCT_VER) global.RVCT_ENV_PREFIX = if $(equal $(CTRSDK_RVCT_VER),40) eprintln(RVCT 4.0 は非対応ですので、ARMCC 4.1 を使用してください。) exit(1) else if $(equal $(CTRSDK_RVCT_VER),41) value ARMCC41 else value ARMCC$(CTRSDK_RVCT_VER) # If a RVCT version for which SDK operations have been verified has been installed, use it # If not installed, use the latest version of RVCT installed by the user from among the supported RVCT versions. # if $(defined-env $(RVCT_ENV_PREFIX)BIN) RVCT_BINDIR = $(string $(getenv $(RVCT_ENV_PREFIX)BIN)$(DIRSEP)) export else foreach(rvct_version, $(SUOPPORT_RVCT_VER)) if $(defined-env $(rvct_version)BIN) RVCT_BINDIR = $(string $(getenv $(rvct_version)BIN)$(DIRSEP)) RVCT_ENV_PREFIX = $(rvct_version) CTRSDK_RVCT_VER = $(gsub $(string $(RVCT_ENV_PREFIX)), $"ARMCC", $(EMPTY)) break() export RVCT_BINDIR = export export # Get the compiler version defined by macro if $(equal $(string-length $(CTRSDK_RVCT_VER)), 2) CTRSDK_RVCT_VER_MAJOR = $(div $(CTRSDK_RVCT_VER), 10) export else if $(equal $(string-length $(CTRSDK_RVCT_VER)), 1) CTRSDK_RVCT_VER_MAJOR = $(CTRSDK_RVCT_VER) export export if $(defined-env HORIZON_RVCT_DIAG_STYLE) RVCT_DIAG_STYLE = $(getenv HORIZON_RVCT_DIAG_STYLE) export #---------------------------------------------------------------------------- # Class definitions #---------------------------------------------------------------------------- CompilerRVCT. = extends $(Compiler) class CompilerRVCT #---------------------------------------------------------------------------- # Constant definitions #---------------------------------------------------------------------------- this.CC = $"$(RVCT_BINDIR)armcc.exe" this.CXX = $"$(RVCT_BINDIR)armcc.exe" this.CPP = $"$(RVCT_BINDIR)armcc.exe" -E this.AR = $"$(RVCT_BINDIR)armar.exe" this.LD = $"$(RVCT_BINDIR)armlink.exe" this.AS = $"$(RVCT_BINDIR)armasm.exe" this.STRIP = $"$(RVCT_BINDIR)fromelf.exe" --strip debug,comment,symbols --elf this.DISAS = $"$(RVCT_BINDIR)fromelf.exe" --32x1 -cd this.CCFLAGS_MACRO = #------------------------------------------------------------------------ # The following warnings are suppressed # # 186: pointless comparison of unsigned integer with zero # 340: value copied to temporary, reference to temporary used # 401: destructor for base class "" is not virtual # 1256: "" would have been promoted to "int" when passed # 1297: Header file not guarded against multiple inclusion # 1568: nonstandard reinterpret_cast # 1764: SWP instructions are deprecated in architecture ARMv6 and above # 1786: This instruction using SP is deprecated # 1788: Explicit use of PC in this instruction is deprecated # 2523: use of inline assembler is deprecated #------------------------------------------------------------------------ # The following comments are suppressed # # 96: a translation unit must contain at least one declaration # 1794: Error encountered parsing expansion routine # 1801: Optimization: Function expanded (xxx) # 2442: Could not inline: Cannot remove function from expression #------------------------------------------------------------------------ # The following warnings are handled as errors # # 68: integer conversion resulted in a change of sign # 88: assignment in condition # 174: expression has no effect # 188: enumerated type mixed with another type # 223: function "" declared implicitly # 3017: may be used before being set #------------------------------------------------------------------------ # The following comments are handled as warnings # # 177: variable "xxx" was declared but never referenced # 193: zero used for undefined preprocessing identifier "xxx" # 228: trailing comma is nonstandard # 550: variable "xxx" was set but never used # 826: parameter "" was never referenced # 1301: padding inserted in this.CCFLAGS_WARNING= --diag_suppress 186,340,401,1256,1297 \ --diag_suppress 1568,1764,1786,1788,2523 \ --diag_suppress 96,1794,1801,2442,3017 \ --diag_error 68,88,174,188,223 \ --diag_warning 177,193,228,550,826,1301 \ --diag_suppress=optimizations this.CCFLAGS_DEV_OPT= -O0 --retain=calls private.ccflags_must1 = \ --multibyte_chars \ --signed_chars \ private.ccflags_must2 = \ --dollar \ --littleend \ --wchar \ --wchar16 \ private.ccflags_may = \ --apcs /interwork \ --data_reorder \ --debug \ --diag_style=$(RVCT_DIAG_STYLE) \ --dwarf3 \ --no_debug_macros \ --remove_unneeded_entities \ --split_sections \ private.ccflags_var = \ --debug_info=line_inlining_extensions \ --force_new_nothrow \ --fpmode=fast \ --no_exceptions \ --no_rtti \ --remarks \ --vfe \ $`(uniq_diag_flags $(CCFLAGS_WARNING)) \ $`(if $(and $(USE_GNU_EXTENTIONS), $(not $(equal $(config.buildtype), Debug))), --gnu) \ $(if $(ge $(CTRSDK_RVCT_VER_MAJOR),5),--allow_fpreg_for_nonfpdata) \ private.ccflags_cppe = \ --rtti \ --exceptions \ this.CCFLAGS = $(ccflags_var) $(ccflags_may) $(ccflags_must2) $(ccflags_must1) this.CFLAGS = --c99 this.CXXFLAGS = --cpp this.CSCANFLAGS = -M --no_depend_system_headers # omake bugzilla #654 --ignore_missing_headers --phony_targets #------------------------------------------------------------------------ # Demote the following linker warnings to suppresses: # # L6314W: No section matches pattern # L6329W: Pattern * only matches removed unused sections this.LDFLAGS_WARNING= --diag_suppress L6314W,L6329W this.ASFLAGS = --cpreproc this.ARFLAGS = -rcuT this.RANLIB = echo ranlib this.INCLUDES_OPT = -I this.YACC = echo yacc this.LEX = echo lex # Option to generate .map files or call graph files # These are unnecessary when generating a feedback file this.LDFLAGS_INFO = $`(if $(and $(defined MAPFILE), $(MAPFILE)),\ --list=$(MAPFILE) \ --callgraph_file=$(removesuffix $(MAPFILE))$(EXT_CG) \ --callgraph --callgraph_output=text \ --verbose --map --symbols --xref --unmangled \ --info=$(concat $",",\ architecture \ exceptions \ inline \ inputs \ libraries \ merge \ sizes \ stack \ summarysizes \ summarystack \ tailreorder \ totals \ unused \ unusedsymbols \ veneerpools \ veneers \ veneercallers \ visibility)) \ private.ldflags_must1 = \ $`(if $(not $(EXCLUSION_SCATTER)), --scatter $`(LDSCRIPT)) \ --datacompressor off \ private.ldflags_must2 = \ --entry=$`(ENTRYPOINT) \ --keep=nnMain \ --startup=$`(ENTRYPOINT) \ private.ldflags_may = \ --debug \ --diag_style=$(RVCT_DIAG_STYLE) \ --largeregions \ --merge \ --no_eager_load_debug \ --pad 0xFF \ --remove \ --strict \ private.ldflags_var = \ --exceptions_tables=nocreate \ --no_exceptions \ --scanlib \ --userlibpath=$`(LIBDIR) \ --vfemode=force \ $(LDFLAGS_INFO) \ $`(LDFLAGS_WARNING) \ private.ldflags_cppe = \ --exceptions \ this.LDFLAGS = $(ldflags_var) $(ldflags_may) $(ldflags_must2) $(ldflags_must1) this.LDRESP = --via this.CCOUT = -o this.LDOUT = -o this.ASOUT = -o #---------------------------------------------------------------------------- # Function definitions #---------------------------------------------------------------------------- #------------------------------------------------------- # New. # # Overview # | # # Referenced global variables # None. #------------------------------------------------------- new() = return $(this) #------------------------------------------------------- # getLDFlagsDebug # # Overview # | # # Referenced global variables # None. #------------------------------------------------------- getLDFlagsDebug(config) = switch($(config.buildtype)) case $"Debug" return --bestdebug case $"Development" return --bestdebug case $"Release" return --no_bestdebug --inline --tailreorder return #------------------------------------------------------- # getCCFlagsCPU # # Overview # | # # Referenced global variables # None. #------------------------------------------------------- getCCFlagsCPU(config) = private.flags = switch($(config.processor)) case MPCore value --cpu MPCore switch($(config.effort)) case fast return $(flags) --arm case small return $(flags) --thumb #------------------------------------------------------- # getLDFlagsCPU # # Overview # | # # Referenced global variables # None. #------------------------------------------------------- getLDFlagsCPU(config) = switch($(config.processor)) case MPCore return --cpu MPCore return #------------------------------------------------------- # getCCFlagsLazy # # Overview # | # # Referenced global variables # None. #------------------------------------------------------- getCCFlagsLazy() = return $(if $`(ENABLE_CPP_EXCEPTION),$(ccflags_cppe)) #------------------------------------------------------- # getASFlagsCPU # # Overview # | # # Referenced global variables # None. #------------------------------------------------------- getASFlagsCPU(config) = private.flags = switch($(config.processor)) case MPCore value --cpu MPCore return $(flags) --arm #------------------------------------------------------- # getCCFlagsLtcg # # Overview # | # # Referenced global variables # None. #------------------------------------------------------- getCCFlagsLtcg(config) = if $(and $(not $(equal $(config.systemname),Process)),$(equal $(config.buildtype),Release)) return $(EMPTY) #--ltcg else return $(EMPTY) #------------------------------------------------------- # getLDFlagsLtcg # # Overview # | # # Referenced global variables # None. #------------------------------------------------------- getLDFlagsLtcg(config) = if $(and $(not $(equal $(config.systemname),Process)),$(equal $(config.buildtype),Release)) return $(EMPTY) #--ltcg else return $(EMPTY) #------------------------------------------------------- # getLDFlagsLazy # # Overview # | # # Referenced global variables # None. #------------------------------------------------------- getLDFlagsLazy() = return $(if $`(ENABLE_CPP_EXCEPTION),$(ldflags_cppe)) #------------------------------------------------------- # getMacroFlags # # Overview # | # # Referenced global variables # None. #------------------------------------------------------- getMacroFlags(config) = private.flags = -DNN_COMPILER_RVCT -DNN_COMPILER_RVCT_VERSION_MAJOR=$(CTRSDK_RVCT_VER_MAJOR) flags += $(config.getMacroFlags) flags += $(Compiler::getMacroFlags $(config)) switch($(config.effort)) case fast flags += -DNN_COMPILER_OPTION_ARM export flags return $(flags) #---------------------------------------------------------------------------- # Function definitions #---------------------------------------------------------------------------- #------------------------------------------------------- # uniq_diag_flags # # Overview # | # # Referenced global variables # None. #------------------------------------------------------- uniq_diag_flags(flags) = private.flags = $(gsub $(flags), $' +', $' ') private.numbers_map = $(Map) lex($(open-in-string $(flags))) default # empty case $'\(A?[[:digit:]]+W?\)' g private.count = 1 if $(numbers_map.mem $0) count = $(add $(numbers_map.find $0), 1) export count numbers_map = $(numbers_map.add $0, $(count)) export numbers_map private.outstr = $(EMPTY) lex($(open-in-string $(flags))) case $'\(A?[[:digit:]]+W?\)\(,| |$\)' g export outstr numbers_map private.count = $(numbers_map.find $1) if $(gt $(count), 1) if $(equal $2,$" ") outstr += $2 else outstr += $(0) numbers_map = $(numbers_map.add $1, $(sub $(count), 1)) default outstr += $0 export outstr private.flags_tmp = $(split $' ', $(concat $(EMPTY), $(outstr))) private.flags = foreach(flag, $(flags_tmp)) value $(flag) flags = $(gsub $(concat $" ",$(flags)), $', ', $' ') # If there are empty options, for instance, --diag_warning or --diag_suppress, they must be removed because they will generate errors. # flags = $(gsub $(flags), $'(--diag_(suppress|error|warning)[[:space:]]*)+--', $'--') flags = $(gsub $(flags), $'--diag_(suppress|error|warning)[[:space:]]*$', $(EMPTY)) return $(flags)