ARM Optimizing C/C++ Compiler v5.2 User's Guide LiteratureNumber:SPNU151J November2014 Contents Preface........................................................................................................................................ 9 1 IntroductiontotheSoftwareDevelopmentTools.................................................................... 12 1.1 SoftwareDevelopmentToolsOverview................................................................................. 13 1.2 CompilerInterface.......................................................................................................... 15 1.3 ANSI/ISOStandard........................................................................................................ 15 1.4 OutputFiles................................................................................................................. 15 1.5 Utilities....................................................................................................................... 16 2 UsingtheC/C++Compiler................................................................................................... 17 2.1 AbouttheCompiler......................................................................................................... 18 2.2 InvokingtheC/C++Compiler............................................................................................. 18 2.3 ChangingtheCompiler'sBehaviorwithOptions....................................................................... 19 2.3.1 LinkerOptions..................................................................................................... 26 2.3.2 FrequentlyUsedOptions......................................................................................... 28 2.3.3 MiscellaneousUsefulOptions................................................................................... 30 2.3.4 Run-TimeModelOptions......................................................................................... 31 2.3.5 SymbolicDebuggingandProfilingOptions.................................................................... 34 2.3.6 SpecifyingFilenames............................................................................................. 35 2.3.7 ChangingHowtheCompilerInterpretsFilenames ........................................................... 35 2.3.8 ChangingHowtheCompilerProcessesCFiles.............................................................. 35 2.3.9 ChangingHowtheCompilerInterpretsandNamesExtensions............................................ 36 2.3.10 SpecifyingDirectories............................................................................................ 36 2.3.11 AssemblerOptions............................................................................................... 37 2.3.12 DeprecatedOptions.............................................................................................. 38 2.4 ControllingtheCompilerThroughEnvironmentVariables............................................................ 38 2.4.1 SettingDefaultCompilerOptions(TI_ARM_C_OPTION).................................................... 38 2.4.2 NaminganAlternateDirectory(TI_ARM_C_DIR)............................................................ 39 2.5 ControllingthePreprocessor ............................................................................................. 39 2.5.1 PredefinedMacroNames........................................................................................ 40 2.5.2 TheSearchPathfor#includeFiles............................................................................. 41 2.5.3 Supportforthe#warningand#warnDirectives............................................................... 42 2.5.4 GeneratingaPreprocessedListingFile(--preproc_onlyOption)........................................... 42 2.5.5 ContinuingCompilationAfterPreprocessing(--preproc_with_compileOption)........................... 43 2.5.6 GeneratingaPreprocessedListingFilewithComments(--preproc_with_commentOption)........... 43 2.5.7 GeneratingaPreprocessedListingFilewithLine-ControlInformation(--preproc_with_lineOption).. 43 2.5.8 GeneratingPreprocessedOutputforaMakeUtility(--preproc_dependencyOption) ................... 43 2.5.9 GeneratingaListofFilesIncludedwiththe#includeDirective(--preproc_includesOption)............ 43 2.5.10 GeneratingaListofMacrosinaFile(--preproc_macrosOption)......................................... 43 2.6 PassingArgumentstomain()............................................................................................. 44 2.7 UnderstandingDiagnosticMessages.................................................................................... 44 2.7.1 ControllingDiagnosticMessages............................................................................... 46 2.7.2 HowYouCanUseDiagnosticSuppressionOptions......................................................... 47 2.8 OtherMessages............................................................................................................ 47 2.9 GeneratingCross-ReferenceListingInformation(--gen_acp_xrefOption)......................................... 47 2.10 GeneratingaRawListingFile(--gen_acp_rawOption)............................................................... 48 2.11 UsingInlineFunctionExpansion......................................................................................... 49 2 Contents SPNU151J–November2014 SubmitDocumentationFeedback Copyright©2014,TexasInstrumentsIncorporated www.ti.com 2.11.1 InliningIntrinsicOperators...................................................................................... 50 2.11.2 AutomaticInlining................................................................................................ 50 2.11.3 InliningRestrictions.............................................................................................. 50 2.12 UsingInterlist............................................................................................................... 51 2.13 ControllingApplicationBinaryInterface................................................................................. 52 2.14 VFPSupport................................................................................................................ 53 2.15 EnablingEntryHookandExitHookFunctions......................................................................... 54 3 OptimizingYourCode......................................................................................................... 55 3.1 InvokingOptimization...................................................................................................... 56 3.2 PerformingFile-LevelOptimization(--opt_level=3option)............................................................ 57 3.2.1 ControllingFile-LevelOptimization(--std_lib_func_defOptions)........................................... 57 3.2.2 CreatinganOptimizationInformationFile(--gen_opt_infoOption)......................................... 57 3.3 Program-LevelOptimization(--program_level_compileand--opt_level=3options)............................... 58 3.3.1 ControllingProgram-LevelOptimization(--call_assumptionsOption)...................................... 58 3.3.2 OptimizationConsiderationsWhenMixingC/C++andAssembly.......................................... 59 3.4 Link-TimeOptimization(--opt_level=4Option)......................................................................... 60 3.4.1 OptionHandling................................................................................................... 60 3.4.2 IncompatibleTypes............................................................................................... 61 3.5 AccessingAliasedVariablesinOptimizedCode....................................................................... 61 3.6 UseCautionWithasmStatementsinOptimizedCode............................................................... 61 3.7 AutomaticInlineExpansion(--auto_inlineOption)..................................................................... 61 3.8 UsingtheInterlistFeatureWithOptimization........................................................................... 62 3.9 DebuggingandProfilingOptimizedCode............................................................................... 64 3.9.1 ProfilingOptimizedCode......................................................................................... 64 3.10 ControllingCodeSizeVersusSpeed ................................................................................... 65 3.11 WhatKindofOptimizationIsBeingPerformed?....................................................................... 65 3.11.1 Cost-BasedRegisterAllocation................................................................................ 66 3.11.2 AliasDisambiguation ............................................................................................ 66 3.11.3 BranchOptimizationsandControl-FlowSimplification...................................................... 66 3.11.4 DataFlowOptimizations........................................................................................ 66 3.11.5 ExpressionSimplification........................................................................................ 67 3.11.6 InlineExpansionofFunctions.................................................................................. 67 3.11.7 FunctionSymbolAliasing....................................................................................... 67 3.11.8 InductionVariablesandStrengthReduction ................................................................. 67 3.11.9 Loop-InvariantCodeMotion.................................................................................... 67 3.11.10 LoopRotation................................................................................................... 67 3.11.11 InstructionScheduling.......................................................................................... 67 3.11.12 TailMerging..................................................................................................... 68 3.11.13 AutoincrementAddressing .................................................................................... 68 3.11.14 BlockConditionalizing.......................................................................................... 68 3.11.15 EpilogInlining................................................................................................... 68 3.11.16 RemovingComparisonstoZero.............................................................................. 68 3.11.17 IntegerDivisionWithConstantDivisor....................................................................... 69 3.11.18 BranchChaining................................................................................................ 69 4 LinkingC/C++Code............................................................................................................ 70 4.1 InvokingtheLinkerThroughtheCompiler(-zOption)................................................................ 71 4.1.1 InvokingtheLinkerSeparately.................................................................................. 71 4.1.2 InvokingtheLinkerasPartoftheCompileStep.............................................................. 72 4.1.3 DisablingtheLinker(--compile_onlyCompilerOption) ...................................................... 72 4.2 LinkerCodeOptimizations................................................................................................ 73 4.2.1 GenerateListofDeadFunctions(--generate_dead_funcs_listOption).................................... 73 4.2.2 GeneratingFunctionSubsections(--gen_func_subsectionsCompilerOption)........................... 73 4.3 ControllingtheLinkingProcess .......................................................................................... 74 SPNU151J–November2014 Contents 3 SubmitDocumentationFeedback Copyright©2014,TexasInstrumentsIncorporated www.ti.com 4.3.1 IncludingtheRun-Time-SupportLibrary....................................................................... 74 4.3.2 Run-TimeInitialization............................................................................................ 75 4.3.3 InitializationofCinitandWatchdogTimerHold............................................................... 75 4.3.4 GlobalObjectConstructors...................................................................................... 75 4.3.5 SpecifyingtheTypeofGlobalVariableInitialization.......................................................... 76 4.3.6 SpecifyingWheretoAllocateSectionsinMemory ........................................................... 77 4.3.7 ASampleLinkerCommandFile ................................................................................ 78 5 ARMC/C++LanguageImplementation.................................................................................. 79 5.1 CharacteristicsofARMC................................................................................................. 80 5.1.1 Implementation-DefinedBehavior............................................................................... 80 5.2 CharacteristicsofARMC++.............................................................................................. 84 5.3 UsingMISRA-C:2004...................................................................................................... 84 5.4 UsingtheULPAdvisor .................................................................................................... 85 5.5 DataTypes.................................................................................................................. 86 5.5.1 SizeofEnumTypes .............................................................................................. 87 5.6 Keywords.................................................................................................................... 88 5.6.1 TheconstKeyword................................................................................................ 88 5.6.2 The__interruptKeyword......................................................................................... 88 5.6.3 ThevolatileKeyword.............................................................................................. 89 5.7 C++ExceptionHandling................................................................................................... 90 5.8 RegisterVariablesandParameters...................................................................................... 91 5.8.1 LocalRegisterVariablesandParameters..................................................................... 91 5.8.2 GlobalRegisterVariables........................................................................................ 91 5.9 The__asmStatement..................................................................................................... 92 5.10 PragmaDirectives.......................................................................................................... 93 5.10.1 TheCHECK_MISRAPragma .................................................................................. 94 5.10.2 TheCHECK_ULPPragma...................................................................................... 94 5.10.3 TheCLINKPragma.............................................................................................. 94 5.10.4 TheCODE_SECTIONPragma................................................................................. 95 5.10.5 TheCODE_STATEPragma.................................................................................... 96 5.10.6 TheDATA_ALIGNPragma..................................................................................... 96 5.10.7 TheDATA_SECTIONPragma................................................................................. 97 5.10.8 TheDiagnosticMessagePragmas............................................................................ 98 5.10.9 TheDUAL_STATEPragma..................................................................................... 98 5.10.10 TheFUNC_ALWAYS_INLINEPragma...................................................................... 99 5.10.11 TheFUNC_CANNOT_INLINEPragma...................................................................... 99 5.10.12 TheFUNC_EXT_CALLEDPragma.......................................................................... 99 5.10.13 TheFUNCTION_OPTIONSPragma....................................................................... 100 5.10.14 TheINTERRUPTPragma.................................................................................... 100 5.10.15 TheLOCATIONPragma..................................................................................... 101 5.10.16 TheMUST_ITERATEPragma .............................................................................. 102 5.10.17 TheNOINITandPERSISTENTPragmas ................................................................. 103 5.10.18 TheNO_HOOKSPragma.................................................................................... 104 5.10.19 ThePACKPragma............................................................................................ 104 5.10.20 TheRESET_MISRAPragma................................................................................ 105 5.10.21 TheRESET_ULPPragma................................................................................... 105 5.10.22 TheRETAINPragma......................................................................................... 105 5.10.23 TheSET_CODE_SECTIONandSET_DATA_SECTIONPragmas.................................... 106 5.10.24 TheSWI_ALIASPragma..................................................................................... 107 5.10.25 TheTASKPragma............................................................................................ 108 5.10.26 TheUNROLLPragma........................................................................................ 108 5.10.27 TheWEAKPragma........................................................................................... 109 5.11 The_PragmaOperator .................................................................................................. 109 4 Contents SPNU151J–November2014 SubmitDocumentationFeedback Copyright©2014,TexasInstrumentsIncorporated www.ti.com 5.12 ApplicationBinaryInterface............................................................................................. 110 5.12.1 TI_ARM9_ABI................................................................................................... 110 5.12.2 TIABI(Deprecated)............................................................................................. 110 5.12.3 ARMABIv2orEABI............................................................................................ 111 5.13 ARMInstructionIntrinsics................................................................................................ 111 5.14 ObjectFileSymbolNamingConventions(Linknames).............................................................. 119 5.15 InitializingStaticandGlobalVariablesinTIARM9ABIandTIABIModes ....................................... 119 5.15.1 InitializingStaticandGlobalVariablesWiththeLinker.................................................... 120 5.15.2 InitializingStaticandGlobalVariablesWiththeconstTypeQualifier................................... 120 5.16 ChangingtheANSI/ISOC/C++LanguageMode..................................................................... 121 5.16.1 EnablingC99Mode(--c99).................................................................................... 121 5.16.2 CompatibilityWithK&RC(--kr_compatibleOption) ....................................................... 122 5.16.3 EnablingStrictANSI/ISOModeandRelaxedANSI/ISOMode(--strict_ansiand--relaxed_ansi Options)........................................................................................................... 123 5.16.4 EnablingEmbeddedC++Mode(--embedded_cppOption)............................................... 124 5.17 GNULanguageExtensions ............................................................................................. 124 5.17.1 Extensions....................................................................................................... 124 5.17.2 FunctionAttributes.............................................................................................. 126 5.17.3 VariableAttributes.............................................................................................. 126 5.17.4 TypeAttributes.................................................................................................. 126 5.17.5 Built-InFunctions............................................................................................... 127 5.18 AUTOSAR................................................................................................................. 127 5.19 CompilerLimits............................................................................................................ 128 6 Run-TimeEnvironment...................................................................................................... 129 6.1 MemoryModel............................................................................................................ 130 6.1.1 Sections........................................................................................................... 130 6.1.2 C/C++SystemStack............................................................................................ 131 6.1.3 DynamicMemoryAllocation.................................................................................... 132 6.1.4 InitializationofVariablesinTI_ARM9_ABIandTIABI ..................................................... 132 6.2 ObjectRepresentation................................................................................................... 132 6.2.1 DataTypeStorage............................................................................................... 132 6.2.2 BitFields.......................................................................................................... 136 6.2.3 CharacterStringConstants..................................................................................... 138 6.3 RegisterConventions.................................................................................................... 139 6.4 FunctionStructureandCallingConventions.......................................................................... 142 6.4.1 HowaFunctionMakesaCall.................................................................................. 143 6.4.2 HowaCalledFunctionResponds............................................................................. 144 6.4.3 CExceptionHandlerCallingConvention..................................................................... 144 6.4.4 AccessingArgumentsandLocalVariables................................................................... 145 6.4.5 GeneratingLongCalls(-mlOption)in16-bitMode......................................................... 145 6.5 AccessingLinkerSymbolsinCandC++.............................................................................. 145 6.6 InterfacingCandC++WithAssemblyLanguage.................................................................... 145 6.6.1 UsingAssemblyLanguageModulesWithC/C++Code.................................................... 145 6.6.2 AccessingAssemblyLanguageFunctionsFromC/C++ ................................................... 146 6.6.3 AccessingAssemblyLanguageVariablesFromC/C++.................................................... 147 6.6.4 SharingC/C++HeaderFilesWithAssemblySource....................................................... 148 6.6.5 UsingInlineAssemblyLanguage.............................................................................. 148 6.6.6 ModifyingCompilerOutput..................................................................................... 148 6.7 InterruptHandling......................................................................................................... 149 6.7.1 SavingRegistersDuringInterrupts............................................................................ 149 6.7.2 UsingC/C++InterruptRoutines ............................................................................... 149 6.7.3 UsingAssemblyLanguageInterruptRoutines............................................................... 149 6.7.4 HowtoMapInterruptRoutinestoInterruptVectors......................................................... 150 SPNU151J–November2014 Contents 5 SubmitDocumentationFeedback Copyright©2014,TexasInstrumentsIncorporated www.ti.com 6.7.5 UsingSoftwareInterrupts....................................................................................... 151 6.7.6 OtherInterruptInformation..................................................................................... 151 6.8 IntrinsicRun-Time-SupportArithmeticandConversionRoutines.................................................. 152 6.8.1 NamingConventions............................................................................................ 152 6.8.2 CPSRRegisterandInterruptIntrinsics....................................................................... 154 6.9 Built-InFunctions......................................................................................................... 155 6.10 SystemInitialization...................................................................................................... 156 6.10.1 SystemPre-Initialization....................................................................................... 156 6.10.2 Run-TimeStack................................................................................................. 157 6.10.3 TIARM9ABI/TIABIAutomaticInitializationofVariables.................................................. 157 6.10.4 EABIAutomaticInitializationofVariables................................................................... 159 6.10.5 InitializationTables............................................................................................. 165 6.11 Dual-StateInterworkingUnderTIABI(Deprecated).................................................................. 167 6.11.1 LevelofDual-StateSupport................................................................................... 167 6.11.2 Implementation.................................................................................................. 168 7 UsingRun-Time-SupportFunctionsandBuildingLibraries................................................... 171 7.1 CandC++Run-TimeSupportLibraries............................................................................... 172 7.1.1 LinkingCodeWiththeObjectLibrary......................................................................... 172 7.1.2 HeaderFiles...................................................................................................... 172 7.1.3 ModifyingaLibraryFunction................................................................................... 172 7.1.4 SupportforStringHandling..................................................................................... 173 7.1.5 MinimalSupportforInternationalization...................................................................... 173 7.1.6 AllowableNumberofOpenFiles.............................................................................. 173 7.1.7 NonstandardHeaderFilesintheSourceTree .............................................................. 173 7.1.8 LibraryNamingConventions................................................................................... 174 7.2 TheCI/OFunctions...................................................................................................... 175 7.2.1 High-LevelI/OFunctions ....................................................................................... 175 7.2.2 OverviewofLow-LevelI/OImplementation.................................................................. 176 7.2.3 Device-DriverLevelI/OFunctions............................................................................. 180 7.2.4 AddingaUser-DefinedDeviceDriverforCI/O.............................................................. 184 7.2.5 ThedevicePrefix................................................................................................ 185 7.3 HandlingReentrancy(_register_lock()and_register_unlock()Functions)........................................ 187 7.4 Library-BuildProcess..................................................................................................... 188 7.4.1 RequiredNon-TexasInstrumentsSoftware.................................................................. 188 7.4.2 UsingtheLibrary-BuildProcess............................................................................... 188 7.4.3 Extendingmklib.................................................................................................. 191 8 C++NameDemangler........................................................................................................ 192 8.1 InvokingtheC++NameDemangler.................................................................................... 193 8.2 C++NameDemanglerOptions......................................................................................... 193 8.3 SampleUsageoftheC++NameDemangler......................................................................... 194 A Glossary.......................................................................................................................... 195 B RevisionHistory............................................................................................................... 200 6 Contents SPNU151J–November2014 SubmitDocumentationFeedback Copyright©2014,TexasInstrumentsIncorporated www.ti.com List of Figures 1-1. ARMSoftwareDevelopmentFlow....................................................................................... 13 6-1. CharandShortDataStorageFormat.................................................................................. 133 6-2. 32-BitDataStorageFormat............................................................................................. 134 6-3. Double-PrecisionFloating-PointDataStorageFormat.............................................................. 135 6-4. Bit-FieldPackinginBig-EndianandLittle-EndianFormats......................................................... 136 6-5. UseoftheStackDuringaFunctionCall............................................................................... 143 6-6. AutoinitializationatRunTime........................................................................................... 158 6-7. InitializationatLoadTime ............................................................................................... 158 6-8. AutoinitializationatRunTimeinEABIMode.......................................................................... 160 6-9. InitializationatLoadTimeinEABIMode.............................................................................. 164 6-10. ConstructorTableinEABIMode....................................................................................... 164 6-11. FormatofInitializationRecordsinthe.cinitSection................................................................. 165 6-12. FormatofInitializationRecordsinthe.pinitSection................................................................. 166 List of Tables 2-1. ProcessorOptions ......................................................................................................... 19 2-2. OptimizationOptions ...................................................................................................... 19 2-3. AdvancedOptimizationOptions ......................................................................................... 20 2-4. DebugOptions.............................................................................................................. 20 2-5. AdvancedDebugOptions................................................................................................. 21 2-6. IncludeOptions ............................................................................................................ 21 2-7. ULPAdvisorOptions....................................................................................................... 21 2-8. ControlOptions ............................................................................................................ 21 2-9. LanguageOptions.......................................................................................................... 21 2-10. ParserPreprocessingOptions............................................................................................ 22 2-11. PredefinedSymbolsOptions ............................................................................................. 22 2-12. DiagnosticMessageOptions............................................................................................. 22 2-13. Run-TimeModelOptions.................................................................................................. 23 2-14. Entry/ExitHookOptions................................................................................................... 24 2-15. LibraryFunctionAssumptionsOptions.................................................................................. 24 2-16. AssemblerOptions......................................................................................................... 24 2-17. FileTypeSpecifierOptions............................................................................................... 24 2-18. DirectorySpecifierOptions................................................................................................ 25 2-19. DefaultFileExtensionsOptions.......................................................................................... 25 2-20. CommandFilesOptions................................................................................................... 25 2-21. MISRA-C:2004Options.................................................................................................... 25 2-22. LinkerBasicOptions....................................................................................................... 26 2-23. FileSearchPathOptions.................................................................................................. 26 2-24. CommandFilePreprocessingOptions.................................................................................. 26 2-25. DiagnosticMessageOptions............................................................................................. 26 2-26. LinkerOutputOptions ..................................................................................................... 27 2-27. SymbolManagementOptions............................................................................................ 27 2-28. Run-TimeEnvironmentOptions.......................................................................................... 27 2-29. Link-TimeOptimizationOptions.......................................................................................... 28 2-30. MiscellaneousOptions..................................................................................................... 28 2-31. CompilerBackwards-CompatibilityOptionsSummary................................................................ 38 2-32. PredefinedARMMacroNames.......................................................................................... 40 SPNU151J–November2014 ListofFigures 7 SubmitDocumentationFeedback Copyright©2014,TexasInstrumentsIncorporated www.ti.com 2-33. RawListingFileIdentifiers................................................................................................ 48 2-34. RawListingFileDiagnosticIdentifiers................................................................................... 49 3-1. InteractionBetweenDebuggingandOptimizationOptions........................................................... 57 3-2. OptionsThatYouCanUseWith--opt_level=3......................................................................... 57 3-3. SelectingaFile-LevelOptimizationOption............................................................................. 57 3-4. SelectingaLevelforthe--gen_opt_infoOption........................................................................ 57 3-5. SelectingaLevelforthe--call_assumptionsOption................................................................... 58 3-6. SpecialConsiderationsWhenUsingthe--call_assumptionsOption................................................ 59 3-7. InteractionBetweenDebuggingandOptimizationOptions........................................................... 64 4-1. InitializedSectionsCreatedbytheCompilerforTIARM9ABIandTIABI(deprecated).......................... 77 4-2. InitializedSectionsCreatedbytheCompilerforEABI................................................................ 77 4-3. UninitializedSectionsCreatedbytheCompiler........................................................................ 77 5-1. ARMC/C++DataTypes................................................................................................... 86 5-2. EABIEnumeratorTypes................................................................................................... 86 5-3. ARMIntrinsicSupportbyTarget........................................................................................ 111 5-4. ARMCompilerIntrinsics................................................................................................. 114 5-5. GCCLanguageExtensions ............................................................................................. 124 6-1. SummaryofSectionsandMemoryPlacement....................................................................... 131 6-2. DataRepresentationinRegistersandMemory ...................................................................... 132 6-3. HowRegisterTypesAreAffectedbytheConventions.............................................................. 139 6-4. RegisterUsage ........................................................................................................... 139 6-5. VFPRegisterUsage...................................................................................................... 140 6-6. NeonRegisterUsage.................................................................................................... 141 6-7. NamingConventionPrefixes............................................................................................ 152 6-8. SummaryofRun-Time-SupportArithmeticandConversionFunctions............................................ 152 6-9. Run-Time-SupportFunctionRegisterUsageConventions.......................................................... 153 6-10. CPSRandInterruptC/C++CompilerIntrinsics....................................................................... 154 6-11. SelectingaLevelofDual-StateSupport............................................................................... 167 7-1. ThemklibProgramOptions............................................................................................. 190 B-1. RevisionHistory........................................................................................................... 200 8 ListofTables SPNU151J–November2014 SubmitDocumentationFeedback Copyright©2014,TexasInstrumentsIncorporated Preface SPNU151J–November2014 Read This First About This Manual TheARMOptimizingC/C++CompilerUser'sGuide explainshowtousethesecompiler tools: • Compiler • Librarybuildutility • C++namedemangler ThecompileracceptsCandC++codeconformingtotheInternationalOrganizationfor Standardization (ISO)standardsfortheselanguages.Thecompilersupports boththe1989and1999versionsoftheC languageandthe2003versionoftheC++language. Thisuser'sguidediscussesthecharacteristicsoftheC/C++compiler.It assumesthat youalreadyknow howtowriteC/C++programs. TheCProgrammingLanguage(secondedition), byBrianW.Kernighan andDennisM.Ritchie,describesCbasedontheISOCstandard. YoucanusetheKernighanand Ritchie (hereafterreferredtoasK&R)bookasasupplementtothismanual.ReferencestoK&RC(asopposed to ISOC)inthismanualrefertotheClanguageasdefinedinthefirsteditionofKernighanandRitchie's The CProgrammingLanguage. Notational Conventions Thisdocumentusesthefollowingconventions: • Programlistings,programexamples,andinteractivedisplaysareshowninaspecial typeface. Interactivedisplaysuseaboldversionofthespecialtypefacetodistinguishcommandsthat you enter fromitemsthatthesystemdisplays(suchasprompts,commandoutput,error messages, etc.). Hereis asampleofCcode: #include <stdio.h> main() { printf("hello, cruel world\n"); } • Insyntaxdescriptions,theinstruction,command, ordirectiveisina boldtypefaceandparametersare inanitalictypeface.Portionsofasyntaxthat areinboldshouldbeenteredasshown; portionsof a syntaxthatareinitalicsdescribethetypeofinformationthat shouldbeentered. • Squarebrackets([and])identifyanoptionalparameter.If youuseanoptionalparameter,you specify theinformationwithinthebrackets.Unlessthesquarebracketsareinthe boldtypeface,donotenter thebracketsthemselves.Thefollowingisanexampleofacommandthat hasanoptionalparameter: armcl[options][filenames][--run_linker [link_options][object files]] • Braces({and})indicatethatyoumustchooseoneoftheparameterswithinthebraces; youdo not enterthebracesthemselves.Thisisanexampleofacommandwithbracesthat arenotincludedinthe actualsyntaxbutindicatethatyoumustspecifyeitherthe--rom_modelor--ram_modeloption: armcl--run_linker {--rom_model|--ram_model}filenames[--output_file= name.out] --library=libraryname SPNU151J–November2014 ReadThisFirst 9 SubmitDocumentationFeedback Copyright©2014,TexasInstrumentsIncorporated RelatedDocumentation www.ti.com • Inassemblersyntaxstatements,column1isreservedfor thefirstcharacterofalabelorsymbol.Ifthe labelorsymbol isoptional,itisusuallynotshown. If alabelorsymbolisarequiredparameter,itis shownstartingagainsttheleftmarginofthebox,asintheexamplebelow.Noinstruction,command, directive,orparameter,otherthanasymbolorlabel,canbeginincolumn1. symbol.usect "sectionname",sizeinbytes[,alignment] • Somedirectivescanhaveavaryingnumberofparameters.Forexample,the.bytedirective. This syntaxisshownas[,..., parameter]. • TheARM®16-bitinstructionsetisreferred toas16-BIS. • TheARM32-bitinstructionsetisreferredtoas32-BIS. Related Documentation Youcanusethefollowingbookstosupplementthisuser'sguide: ANSI X3.159-1989,ProgrammingLanguage-C(Alternateversionofthe1989CStandard),American NationalStandardsInstitute ISO/IEC9899:1989,InternationalStandard-ProgrammingLanguages-C(The1989CStandard), InternationalOrganizationforStandardization ISO/IEC9899:1999,InternationalStandard-ProgrammingLanguages-C(The1999CStandard), InternationalOrganizationforStandardization ISO/IEC14882-2003,InternationalStandard-ProgrammingLanguages-C++(The2003C++ Standard),InternationalOrganizationfor Standardization TheCProgrammingLanguage(secondedition),byBrianW.KernighanandDennisM. Ritchie, publishedbyPrentice-Hall,EnglewoodCliffs,NewJersey, 1988 TheAnnotatedC++ReferenceManual,MargaretA.EllisandBjarneStroustrup,publishedbyAddison- WesleyPublishingCompany,Reading,Massachusetts,1990 C:AReferenceManual(fourth edition),bySamuelP.Harbison, andGuyL.SteeleJr.,publishedby PrenticeHall,EnglewoodCliffs,NewJersey ProgrammingEmbeddedSystemsinCandC++,byMichaelBarr,AndyOram(Editor),publishedby O'Reilly& Associates;ISBN:1565923545,February1999 ProgramminginC,SteveG.Kochan,HaydenBookCompany TheC++ProgrammingLanguage(secondedition),BjarneStroustrup,publishedbyAddison-Wesley PublishingCompany,Reading,Massachusetts,1990 ToolInterfaceStandards(TIS)DWARFDebuggingInformationFormatSpecificationVersion2.0, TISCommittee,1995 DWARFDebuggingInformationFormatVersion3,DWARFDebuggingInformationFormatWorkgroup, FreeStandardsGroup,2005(http://dwarfstd.org) SystemVABIspecification(http://www.sco.com/developers/gabi/) 10 ReadThisFirst SPNU151J–November2014 SubmitDocumentationFeedback Copyright©2014,TexasInstrumentsIncorporated
Description: