Scheda TecnicaSommarioDocumentation Conventions9Chapter 1. Compiler Overview131.1 Introduction131.2 Device Description131.3 Compiler Description and Documentation131.3.1 Conventions131.3.2 ANSI C Standards141.3.3 Optimization141.3.4 ANSI Standard Library Support141.3.5 ISO/IEC C++ Standard141.3.6 Compiler Driver141.3.7 Documentation141.4 Compiler and Other Development Tools15Chapter 2. Common C Interface172.1 Introduction172.2 Background – The Desire for Portable Code172.2.1 The ANSI Standard182.2.2 The Common C Interface192.3 Using the CCI202.4 ANSI Standard Refinement212.4.1 Source File Encoding212.4.1.1 Example212.4.1.2 Differences212.4.1.3 Migration to the CCI212.4.2 The Prototype for main212.4.2.1 Example212.4.2.2 Differences212.4.2.3 Migration to the CCI212.4.3 Header File Specification212.4.3.1 Example212.4.3.2 Differences222.4.3.3 Migration to the CCI222.4.4 Include Search Paths222.4.4.1 Example222.4.4.2 Differences222.4.4.3 Migration to the CCI222.4.5 The Number of Significant Initial Characters in an Identifier232.4.5.1 Example232.4.5.2 Differences232.4.5.3 Migration to the CCI232.4.6 Sizes of Types232.4.6.1 Example232.4.6.2 Differences232.4.6.3 Migration to the CCI232.4.7 Plain char Types242.4.7.1 Example242.4.7.2 Differences242.4.7.3 Migration to the CCI242.4.8 Signed Integer Representation242.4.8.1 Example242.4.8.2 Differences242.4.8.3 Migration to the CCI242.4.9 Integer conversion252.4.9.1 Example252.4.9.2 Differences252.4.9.3 Migration to the CCI252.4.10 Bit-wise Operations on Signed Values252.4.10.1 Example252.4.10.2 Differences252.4.10.3 Migration to the CCI252.4.11 Right-shifting Signed Values252.4.11.1 Example252.4.11.2 Differences262.4.11.3 Migration to the CCI262.4.12 Conversion of Union Member Accessed Using Member With Different Type262.4.12.1 Example262.4.12.2 Differences262.4.12.3 Migration to the CCI262.4.13 Default Bit-field int Type262.4.13.1 Example262.4.13.2 Differences272.4.13.3 Migration to the CCI272.4.14 Bit-fields Straddling a Storage Unit Boundary272.4.14.1 Example272.4.14.2 Differences272.4.14.3 Migration to the CCI272.4.15 The Allocation Order of Bits-field272.4.15.1 Example282.4.15.2 Differences282.4.15.3 Migration to the CCI282.4.16 The NULL macro282.4.16.1 Example282.4.16.2 Differences282.4.16.3 Migration to the CCI282.4.17 Floating-point sizes282.4.17.1 Example282.4.17.2 Differences282.4.17.3 Migration to the CCI282.5 ANSI Standard Extensions292.5.1 Generic Header File292.5.1.1 Example292.5.1.2 Differences292.5.1.3 Migration to the CCI292.5.2 Absolute addressing292.5.2.1 Example292.5.2.2 Differences292.5.2.3 Migration to the CCI302.5.2.4 Caveats302.5.3 Far Objects and Functions302.5.3.1 Example302.5.3.2 Differences302.5.3.3 Migration to the CCI312.5.3.4 Caveats312.5.4 Near Objects312.5.4.1 Example312.5.4.2 Differences312.5.4.3 Migration to the CCI322.5.4.4 Caveats322.5.5 Persistent Objects322.5.5.1 Example322.5.5.2 Differences322.5.5.3 Migration to the CCI322.5.5.4 Caveats322.5.6 X and Y Data Objects332.5.6.1 Example332.5.6.2 Differences332.5.6.3 Migration to the CCI332.5.6.4 Caveats332.5.7 Banked Data Objects332.5.7.1 Example332.5.7.2 Differences342.5.7.3 Migration to the CCI342.5.7.4 Caveats342.5.8 Alignment of Objects342.5.8.1 Example342.5.8.2 Differences342.5.8.3 Migration to the CCI342.5.8.4 Caveats342.5.9 EEPROM Objects352.5.9.1 Example352.5.9.2 Differences352.5.9.3 Migration to the CCI352.5.9.4 Caveats352.5.10 Interrupt Functions352.5.10.1 Example362.5.10.2 Differences362.5.10.3 Migration to the CCI362.5.10.4 Caveats372.5.11 Packing Objects372.5.11.1 Example372.5.11.2 Differences372.5.11.3 Migration to the CCI382.5.11.4 Caveats382.5.12 Indicating Antiquated Objects382.5.12.1 Example382.5.12.2 Differences382.5.12.3 Migration to the CCI382.5.12.4 Caveats382.5.13 Assigning Objects to Sections392.5.13.1 Example392.5.13.2 Differences392.5.13.3 Migration to the CCI392.5.13.4 Caveats402.5.14 Specifying Configuration Bits402.5.14.1 Example402.5.14.2 Differences402.5.14.3 Migration to the CCI402.5.14.4 Caveats402.5.15 Manifest Macros41Table 2-1: Manifest macros defined by the CCI412.5.15.1 Example412.5.15.2 Differences412.5.15.3 Migration to the CCI412.5.15.4 Caveats412.5.16 In-line Assembly422.5.16.1 Example422.5.16.2 Differences422.5.16.3 Migration to the CCI422.5.16.4 Caveats422.6 Compiler Features432.6.1 Enabling the CCI432.6.1.1 Differences432.6.1.2 Migration to the CCI432.6.1.3 Caveats43Chapter 3. Compiler Command Line Driver453.1 Introduction453.2 Invoking the Compiler453.2.1 Driver Command Line Format45Table 3-1: Compiler-Related Environmental Variables463.2.2 Input File Types48Table 3-2: File Names483.3 The C Compilation Sequence493.3.1 Single-step C Compilation493.3.1.1 Compiling a Single C File493.3.1.2 Compiling Multiple C Files503.3.2 Multi-step C Compilation513.4 The C++ Compilation Sequence513.4.1 Single-step C++ Compilation513.4.1.1 Compiling a Single C++ File513.4.2 Compiling Multiple C and C++ files543.5 Runtime Files553.5.1 Library Files553.5.1.1 Standard Libraries563.5.1.2 User-defined libraries573.5.2 Peripheral Library Functions573.6 Start-up and Initialization583.7 Compiler Output583.7.1 Output Files58Table 3-3: File Names583.7.2 Diagnostic Files593.8 Compiler Messages603.9 Driver Option Descriptions60Table 3-4: PIC32MX Device-Specific Options61Table 3-5: Kind-of-Output Control Options62Table 3-6: C Dialect Control Options63Table 3-7: C++ Dialect Control Options64Table 3-8: Warning and Error Options Implied by All Warnings65Table 3-9: Warning and Error Options Not Implied by All Warnings69Table 3-10: Debugging Options72Table 3-11: General Optimization Options72Table 3-12: Specific Optimization Options73Table 3-13: Machine-Independent Optimization Options76Table 3-14: Preprocessor Options78Table 3-15: Assembly Options81Table 3-16: Linking Options81Table 3-17: Directory Search Options82Table 3-18: Code Generation Convention Options83Chapter 4. Device-Related Features854.1 Introduction854.2 Device Support854.3 Device Header Files854.3.1 CP0 Register Definitions Header File854.4 Stack864.4.1 Configuration Bit Access864.5 Using SFRs From C Code884.5.1 CP0 Register Definitions894.5.2 CP0 Register Field Definitions894.5.3 CP0 Access Macros894.5.4 Address Translation Macros90Chapter 5. ANSI C Standard Issues915.1 Divergence from the ANSI C Standard915.2 Extensions to the ANSI C Standard915.2.1 Keyword Differences915.2.2 Statement Differences915.2.3 Expression Differences915.3 Implementation-defined behavior92Chapter 6. Supported Data Types and Variables936.1 Introduction936.2 Identifiers936.3 Data Representation936.4 Integer Data Types946.5 Floating-Point Data Types96Table 6-1: Floating-point format example IEEE 75496Table 6-2: Ranges of floating-point type values976.6 Structures and Unions986.6.1 Structure and Union Qualifiers986.6.2 Bit Fields in Structures986.7 Pointer Types1006.7.1 Combining Type Qualifiers and Pointers1006.7.3 Function Pointers1016.7.3.1 Special Pointer Targets1016.8 Complex Data Types1026.9 Constant Types and Formats102Table 6-3: Radix formats102Table 6-4: Suffixes and assigned types1026.10 Standard Type Qualifiers1046.10.1 Const Type Qualifier1046.10.2 Volatile Type Qualifier1046.11 Compiler-Specific Qualifiers1056.12 Variable Attributes105Chapter 7. Memory Allocation and Access1097.1 Introduction1097.2 Address Spaces1097.3 Variables in Data Memory1107.3.1 Non-auto Variable Allocation1107.3.3 Non-auto Variable Size Limits1117.3.4 Changing the Default Non-auto Variable Allocation1117.4 Auto Variable Allocation and Access1127.4.1 Local Variable Size Limits1137.5 Variables in Program Memory1137.5.1 Size Limitations of const Variables1147.5.2 Changing the Default Allocation1147.6 Variables in Registers1147.7 Dynamic Memory Allocation1147.8 Memory Models114Chapter 8. Operators and Statements1178.1 Introduction1178.2 Integral Promotion1178.3 Type References1188.4 Labels as Values1198.5 Conditional Operator Operands1208.6 Case Ranges120Chapter 9. Register Usage1219.1 Introduction1219.2 Register Usage1219.3 Register Conventions121Table 9-1: Register Conventions121Chapter 10. Functions12310.1 Writing Functions12310.2 Function Attributes and Specifiers12310.2.1 Function Attributes12310.3 Allocation of Function Code12710.4 Changing the Default Function Allocation12710.5 Function Size Limits12810.6 Function Parameters128Table 10-1: Registers Required12810.7 Function Return Values13010.8 Calling Functions13010.9 Inline Functions130Chapter 11. Interrupts13311.1 Introduction13311.2 Interrupt Operation13311.3 Writing an Interrupt Service Routine13411.3.1 Interrupt Attribute13411.3.3.1 __ISR(V, IPL)13511.3.3.2 __ISR_AT_VECTOR(v, IPL)13611.3.3.3 Interrupt-Vector Macros13711.4 Associating a Handler Function with an Exception Vector13911.4.1 Vector Attribute13911.4.3 Vector Pragma14011.5 Exception Handlers14111.5.1 Bootstrap Exception14111.5.2 General Exception14111.6 Interrupt Service Routine Context Switching14111.6.1 Context Restoration14211.7 Latency14211.8 Nesting Interrupts14211.9 Enabling/Disabling Interrupts14211.10 ISR Considerations142Chapter 12. Main, Runtime Start-up and Reset14312.1 Introduction14312.2 The Main Function14312.3 Runtime Start-up Code14312.3.1 Jump to NMI Handler if an NMI Occurred14412.3.5.2 Hardware Enable Register (HWREna – CP0 Register 7, Select 0)14912.3.5.3 Bad Virtual Address Register (BadVAddr – CP0 Register 8, Select 0)14912.3.5.4 Count Register (Count – CP0 Register 9, Select 0)15012.3.5.5 Compare Register (Compare – CP0 Register 11, Select 0)15012.3.5.7 Interrupt Control Register (IntCtl – CP0 Register 12, Select 1)15012.3.5.8 Shadow Register Control Register (SRSCtl – CP0 Register 12, Select 2)15112.3.5.9 Shadow Register Map Register (SRSMap – CP0 Register 12, Select 3)15112.3.5.11 Exception Program Counter (EPC – CP0 Register 14, Select 0)15112.3.5.12 Processor Identification Register (PRId – CP0 Register 15, Select 0)15212.3.5.15 Trace Control Register (TraceControl – CP0 Register 23, Select 1)15312.3.5.16 Trace Control 2 Register (TraceControl2 – CP0 Register 23, Select 2)15312.3.5.18 TraceBPC Register (TraceBPC – CP0 Register 23, Select 4)15312.3.5.19 Debug2 Register (Debug2 – CP0 Register 23, Select 5)15412.3.5.20 Debug Exception Program Counter (DEPC – CP0 Register 24, Select 0)15412.3.5.22 Debug Exception Save Register (DeSave – CP0 Register 31, Select 0)15412.3.7 Change Location of Exception Vectors15512.3.8 Call the C++ initialization code15512.3.9 Call Main15512.4 The On Reset Routine15712.4.1 Clearing Objects157Chapter 13. Library Routines15913.1 Using Library Routines159Chapter 14. Mixing C/C++ and Assembly Language16114.1 Introduction16114.2 Using Inline Assembly Language161Table 14-1: Register Constraint Letters Supported by the Compiler162Table 14-2: Integer Constraint Letters Supported by the Compiler162Table 14-3: General Constraint Letters Supported by the Compiler162Table 14-4: Constraint Modifiers Supported by the Compiler16214.2.1 Equivalent Assembly Symbols16414.3 Predefined Assembly Macros164Table 14-5: Predefined Macros164Chapter 15. Optimizations16715.1 Introduction167Chapter 16. Preprocessing16916.1 Introduction16916.2 C/C++ Language Comments16916.3 Preprocessor Directives169Table 16-1: Preprocessor directives16916.4 Pragma Directives17116.5 Predefined Macros17216.5.1 32-Bit C/C++ Compiler Macros172Chapter 17. Linking Programs17517.1 Introduction17517.2 Replacing Library Symbols17517.3 Linker-Defined Symbols17517.4 Default Linker Script17617.4.1 Output Format and Entry Points17617.4.3.2 OPTIONAL Inclusion of Processor-Specific Peripheral Libraries17817.4.3.3 Base Exception Vector Address and Vector Spacing Symbols17817.4.4.2 .bev_excpt Section18217.4.4.3 .dbg_excpt Section18217.4.4.5 .app_excpt Section18217.4.4.6 .vector_0 .. .vector_63 Sections18317.4.4.7 .start-up Section18317.4.4.9 C++ Initialization Sections18417.4.4.10 .rodata Section18517.4.4.12 .sbss2 Section18617.4.4.14 .data Section18617.4.4.15 .got Section18617.4.4.16 .sdata Section18717.4.4.18 .lit4 Section18717.4.4.19 .sbss Section18817.4.4.21 .heap Section18817.4.4.23 .ramfunc Section18917.4.4.24 Stack Location189Appendix 18. Implementation-Defined Behavior19118.1 Introduction19118.2 Highlights19118.3 Overview19118.4 Translation19218.5 Environment19218.6 Identifiers19318.7 Characters19318.8 Integers19418.9 Floating-Point19418.10 Arrays and Pointers19618.11 Hints19618.12 Structures, Unions, Enumerations, and Bit fields19718.13 Qualifiers19718.14 Declarators19818.15 Statements19818.16 Pre-Processing Directives19818.17 Library Functions19918.18 Architecture202Appendix 19. ASCII Character Set203Table 19-1: ASCII character set203Appendix 20. Deprecated Features20520.1 Introduction20520.2 Variables in Specified Registers205Corporate Office238Atlanta238Boston238Chicago238Cleveland238Fax: 216-447-0643238Dallas238Detroit238Indianapolis238Toronto238Fax: 852-2401-3431238Australia - Sydney238China - Beijing238China - Shanghai238India - Bangalore238Korea - Daegu238Korea - Seoul238Singapore238Taiwan - Taipei238Fax: 43-7242-2244-393238Denmark - Copenhagen238France - Paris238Germany - Munich238Italy - Milan238Spain - Madrid238UK - Wokingham238Worldwide Sales and Service238Dimensioni: 2,7 MBPagine: 238Language: EnglishApri il manuale