TASKING VX-toolset for C166 User Guide MA119-800 (v3.1) October 25, 2012 Copyright © 2012 Altium Limited. All rights reserved.You are permitted to print this document provided that (1) the use of such is for personal use only and will not be copied or posted on any network computer or broadcast in any media, and (2) no modifications of the document is made. Unauthorized duplication, in whole or part, of this document by any means, mechanical or electronic, including translation into another language, except for brief excerpts in published reviews, is prohibited without the express written permission of Altium Limited. Unauthorized duplication of this work may also be prohibited by local statute. Violators may be subject to both criminal and civil penalties, including fines and/or imprisonment. Altium, TASKING, and their respective logos are trademarks or registered trademarks of Altium Limited or its subsidiaries. All other registered or unregistered trademarks referenced herein are the property of their respective owners and no trademark rights to the same are claimed. Table of Contents 1. C Language .................................................................................................................. 1 1.1. Data Types ......................................................................................................... 1 1.2. Changing the Alignment: __unaligned and __packed__ ............................................... 3 1.3. Accessing Memory .............................................................................................. 4 1.3.1. Memory Type Qualifiers .............................................................................. 5 1.3.2. Memory Models ........................................................................................ 8 1.3.3. Placing an Object at an Absolute Address: __at() ........................................... 10 1.3.4. Accessing Bits ........................................................................................ 11 1.3.5. Accessing Hardware from C ...................................................................... 13 1.4. Using Assembly in the C Source: __asm() .............................................................. 18 1.5. Attributes ......................................................................................................... 23 1.6. Pragmas to Control the Compiler .......................................................................... 27 1.7. Predefined Preprocessor Macros .......................................................................... 33 1.8. Variables .......................................................................................................... 35 1.8.1. Initialized Variables .................................................................................. 35 1.8.2. Non-Initialized Variables ........................................................................... 36 1.9. Strings ............................................................................................................ 36 1.10. Constant Data ................................................................................................. 37 1.11. Switch Statement ............................................................................................. 38 1.12. Functions ....................................................................................................... 39 1.12.1. Calling Convention ................................................................................. 40 1.12.2. Register Usage ..................................................................................... 42 1.12.3. Inlining Functions: inline .......................................................................... 43 1.12.4. Interrupt Functions ................................................................................. 44 1.12.5. Intrinsic Functions ................................................................................. 47 1.13. Floating-Point Trapping ...................................................................................... 58 1.13.1. Handling Floating-Point Traps in a C Application ........................................... 59 1.13.2. IEEE-754 Compliant Error Handling .......................................................... 60 1.14. MAC Unit Support ............................................................................................ 61 1.14.1. MAC Code Generation from Native C ........................................................ 61 1.14.2. Manual MAC Qualification: __mac ............................................................. 63 1.14.3. MAC Support by Intrinsic Functions ........................................................... 64 1.14.4. Using the MAC Status Word .................................................................... 65 1.14.5. Evaluation of a Single Expression ............................................................. 66 1.14.6. Hardware Loops .................................................................................... 66 1.14.7. Considerations when Using the MAC ......................................................... 67 1.15. Section Naming ............................................................................................... 67 1.16. TASKING Volatile Implementation ........................................................................ 68 2. C++ Language ............................................................................................................ 71 2.1. C++ Language Extension Keywords ...................................................................... 71 2.2. C++ Dialect Accepted ......................................................................................... 71 2.2.1. Standard Language Features Accepted ....................................................... 71 2.2.2. C++0x Language Features Accepted .......................................................... 74 2.2.3. Anachronisms Accepted ........................................................................... 78 2.2.4. Extensions Accepted in Normal C++ Mode ................................................... 79 2.3. GNU Extensions ................................................................................................ 81 2.4. Namespace Support .......................................................................................... 95 2.5. Template Instantiation ......................................................................................... 97 iii TASKING VX-toolset for C166 User Guide 2.5.1. Automatic Instantiation ............................................................................. 98 2.5.2. Instantiation Modes ................................................................................. 99 2.5.3. Instantiation #pragma Directives ............................................................... 100 2.5.4. Implicit Inclusion .................................................................................... 101 2.5.5. Exported Templates ............................................................................... 102 2.6. Inlining Functions ............................................................................................. 105 2.7. Extern Inline Functions ...................................................................................... 106 2.8. Pragmas to Control the C++ Compiler .................................................................. 106 2.9. Predefined Macros ........................................................................................... 107 2.10. Precompiled Headers ...................................................................................... 111 2.10.1. Automatic Precompiled Header Processing ............................................... 111 2.10.2. Manual Precompiled Header Processing .................................................. 114 2.10.3. Other Ways to Control Precompiled Headers ............................................. 115 2.10.4. Performance Issues ............................................................................. 115 3. Assembly Language .................................................................................................... 117 3.1. Assembly Syntax ............................................................................................. 117 3.2. Assembler Significant Characters ........................................................................ 118 3.3. Operands of an Assembly Instruction ................................................................... 119 3.4. Symbol Names ................................................................................................ 119 3.4.1. Predefined Preprocessor Symbols ............................................................ 120 3.5. Registers ........................................................................................................ 121 3.6. Special Function Registers ................................................................................ 121 3.7. Assembly Expressions ...................................................................................... 122 3.7.1. Numeric Constants ................................................................................ 123 3.7.2. Strings ................................................................................................ 123 3.7.3. Expression Operators ............................................................................. 123 3.7.4. Symbol Types and Expression Types ........................................................
Details
-
File Typepdf
-
Upload Time-
-
Content LanguagesEnglish
-
Upload UserAnonymous/Not logged-in
-
File Pages1046 Page
-
File Size-