#!/usr/bin/env omake #---------------------------------------------------------------------------- # Project: Horizon # File: commondefs.cctype.RVCT.om # # Copyright 2007-2009 Nintendo. 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. # # $Date:: 2011-02-10#$ # $Rev: 34344 $ # $Author: yasuda_kei $ #---------------------------------------------------------------------------- # If CTRSDK_RVCT_VER is not defined, set the RVCT version for which SDK operations have been verified if $(defined CTRSDK_RVCT_VER) export else if $(defined-env CTRSDK_RVCT_VER) CTRSDK_RVCT_VER = $(getenv CTRSDK_RVCT_VER) export else CTRSDK_RVCT_VER = 40 export export if $(equal $(CTRSDK_RVCT_VER),40) RVCT_ENV_PREFIX = RVCT40 export else if $(equal $(CTRSDK_RVCT_VER),41) RVCT_ENV_PREFIX = ARMCC41 export else RVCT_ENV_PREFIX = ARMCC$(CTRSDK_RVCT_VER) export export # Version of RVCT supported SUOPPORT_RVCT_VER[] = RVCT40 \ ARMCC41 # If a RVCT version for which SDK operations have been verified has been installed, it is used # If not installed, the most recent supported version of the RVCT installed by the user is used # if $(defined-env $(RVCT_ENV_PREFIX)BIN) RVCT_BINDIR = $(getenv $"$(RVCT_ENV_PREFIX)BIN")$(DIRSEP) export else foreach(rvct_version, $(SUOPPORT_RVCT_VER)) if $(defined-env $(rvct_version)BIN) RVCT_BINDIR = $(getenv $"$(rvct_version)BIN")$(DIRSEP) RVCT_ENV_PREFIX = $(rvct_version) break() export RVCT_BINDIR = export export RVCT_DIAG_STYLE = arm if $(defined-env HORIZON_RVCT_DIAG_STYLE) RVCT_DIAG_STYLE = $(getenv HORIZON_RVCT_DIAG_STYLE) export CompilerRVCT. = extends $(Compiler) class CompilerRVCT CC = $"$(RVCT_BINDIR)armcc.exe" CXX = $"$(RVCT_BINDIR)armcc.exe" CPP = $"$(RVCT_BINDIR)armcc.exe" -E AR = $"$(RVCT_BINDIR)armar.exe" LD = $"$(RVCT_BINDIR)armlink.exe" AS = $"$(RVCT_BINDIR)armasm.exe" STRIP = $"$(RVCT_BINDIR)fromelf.exe" --strip debug,comment,symbols --elf DISAS = $"$(RVCT_BINDIR)fromelf.exe" --32x1 -cd 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 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 CCFLAGS_DEV_OPT = -O0 --retain=calls CCFLAGS = --multibyte_chars \ --apcs /interwork \ --data_reorder \ --debug \ --debug_info=line_inlining_extensions \ --no_debug_macros \ --diag_style=$(RVCT_DIAG_STYLE) \ --dwarf3 \ --no_exceptions \ --force_new_nothrow \ --fpmode=fast \ --littleend \ --remarks \ --remove_unneeded_entities \ --no_rtti \ --signed_chars \ --vfe \ --wchar16 \ $`(if $(equal $(CTRSDK_RVCT_VER), 41), -Ono_change_regsort) \ $`(uniq_diag_flags $(CCFLAGS_WARNING)) \ $`(if $(and $(not $(FEEDBACK_1ST_STAGE)), $(not $(FEEDBACK_2ND_STAGE))), --split_sections) \ $`(if $(and $(USE_GNU_EXTENTIONS), $(not $(equal $(config.buildtype), Debug))), --gnu) CFLAGS = --c99 CXXFLAGS = --cpp 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 LDFLAGS_WARNING = --diag_suppress L6314W,L6329W ASFLAGS = --cpreproc ARFLAGS = -rcuT RANLIB = echo ranlib INCLUDES_OPT = -I YACC = echo yacc LEX = echo lex # Option to generate .map files or call graph files # These are unnecessary when generating a feedback file LDFLAGS_INFO = $`(if $(and $(defined MAPFILE), $(MAPFILE)),\ --list=$(MAPFILE) \ --verbose --map --callgraph --callgraph_output=text --symbols --xref --unmangled \ $"--info=architecture,exceptions,inline,inputs,libraries,merge,sizes,stack,summarysizes,summarystack,tailreorder,totals,unused,unusedsymbols,veneerpools,veneers,veneercallers,visibility") LDFLAGS = $`(if $(FEEDBACK_1ST_STAGE),\ --feedback=$@.tmp --feedback_image=none, \ $(LDFLAGS_INFO)) \ --datacompressor off \ --debug \ --no_eager_load_debug \ --entry=$`(ENTRYPOINT) \ --no_exceptions \ --exceptions_tables=nocreate \ --keep=nnMain \ --largeregions \ --merge \ --pad 0xFF \ --remove \ --scanlib \ $`(if $(not $(EXCLUSION_SCATTER)), --scatter $`(LDSCRIPT)) \ --startup=$`(ENTRYPOINT) \ --strict \ --userlibpath=$`(LIBDIR) \ --vfemode=force \ --diag_style=$(RVCT_DIAG_STYLE) \ $`(LDFLAGS_WARNING) LDRESP = --via CCOUT = -o LDOUT = -o ASOUT = -o new() = return $(this) getLDFlagsDebug(config) = switch($(config.buildtype)) case $"Debug" return --bestdebug case $"Development" return --bestdebug case $"Release" return --no_bestdebug --inline --tailreorder return getCCFlagsCPU(config) = flags = switch($(config.processor)) case MPCore value --cpu MPCore case ARM946ES value --cpu ARM946E-S case ARM7TDMI value --cpu ARM7TDMI switch($(config.effort)) case fast return $(flags) --arm case small return $(flags) --thumb getASFlagsCPU(config) = flags = switch($(config.processor)) case MPCore value --cpu MPCore case ARM946ES value --cpu ARM946E-S case ARM7TDMI value --cpu ARM7TDMI return $(flags) --arm getCCFlagsLtcg(config) = if $(and $(not $(equal $(config.systemname),Process)),$(equal $(config.buildtype),Release)) return $(EMPTY) #--ltcg else return $(EMPTY) getLDFlagsLtcg(config) = if $(and $(not $(equal $(config.systemname),Process)),$(equal $(config.buildtype),Release)) return $(EMPTY) #--ltcg else return $(EMPTY) getMacroFlags(config) = flags = -DNN_COMPILER_RVCT -DNN_COMPILER_RVCT_VERSION_MAJOR=4 -DNN_COMPILER_RVCT_VERSION_MINOR=0 flags += $(config.getMacroFlags) flags += $(Compiler::getMacroFlags $(config)) switch($(config.effort)) case fast flags += -DNN_COMPILER_OPTION_ARM export return $(flags) uniq_diag_flags(flags) = #println($'input: '"$(flags)") flags = $(gsub $(flags), $' +', $' ') numbers_map = $(Map) lex($(open-in-string $(flags))) default # empty case $'\(A?[[:digit:]]+W?\)' g if $(numbers_map.mem $0) count = $(add $(numbers_map.find $0), 1) export else count = 1 export numbers_map = $(numbers_map.add $0, $(count)) export outstr = lex($(open-in-string $(flags))) case $'\(A?[[:digit:]]+W?\)\(,| |$\)' g count = $(numbers_map.find $1) if $(gt $(count), 1) if $(equal $2,$" ") outstr += $2 export #println("deleted $1") export else outstr += $(0) #println("skipped $1") export numbers_map = $(numbers_map.add $1, $(sub $(count), 1)) export default outstr += $0 export flags_tmp = $(split $' ', $(concat $(EMPTY), $(outstr))) flags = foreach(flag, $(flags_tmp)) flags += $(flag) export #println("$(flags)") flags = $(gsub $(flags), $', ', $' ') #flags = $(gsub $(flags)$" ", $'--diag_(suppress|error|warning) +', $(EMPTY)) # If there is an empty option such as '--diag_warning --diag_suppress', an error occurs, so it is removed # flags = $(gsub $(flags), $'(--diag_(suppress|error|warning)[[:space:]]*)+--', $'--') flags = $(gsub $(flags), $'--diag_(suppress|error|warning)[[:space:]]*$', $(EMPTY)) #println($'output: '"$(flags)") return $(flags)