TASKING VX-Toolset for Tricore User Guide
Total Page:16
File Type:pdf, Size:1020Kb
TASKING VX-toolset for TriCore User Guide MA160-800 (v3.2) February 25, 2009 TASKING VX-toolset for TriCore User Guide Copyright © 2009 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.1.1. Bit Data Type ........................................................................................... 2 1.1.2. Fractional Types ........................................................................................ 3 1.1.3. Packed Data Types .................................................................................... 4 1.1.4. Changing the Alignment: __align() ................................................................ 6 1.2. Accessing Memory .............................................................................................. 6 1.2.1. Memory Qualifiers ..................................................................................... 6 1.2.2. Placing an Object at an Absolute Address: __at() and __atbit() ........................... 8 1.3. Data Type Qualifiers ........................................................................................... 10 1.3.1. Data Type Alignment: __align32 ................................................................. 10 1.3.2. Circular Buffers: __circ ............................................................................. 10 1.3.3. Accessing Hardware from C ...................................................................... 11 1.3.4. Saturation: __sat ..................................................................................... 13 1.4. Using Assembly in the C Source: __asm() .............................................................. 13 1.5. Attributes ......................................................................................................... 18 1.6. Pragmas to Control the Compiler .......................................................................... 18 1.7. Predefined Preprocessor Macros .......................................................................... 23 1.8. Switch Statement ............................................................................................... 25 1.9. Functions ......................................................................................................... 26 1.9.1. Calling Convention .................................................................................. 26 1.9.2. Register Usage ....................................................................................... 28 1.9.3. Inlining Functions: inline ........................................................................... 28 1.9.4. Interrupt and Trap Functions ...................................................................... 30 1.9.5. Intrinsic Functions ................................................................................... 34 1.10. Compiler Generated Sections ............................................................................. 43 1.10.1. Rename Sections .................................................................................. 44 1.10.2. Influence Section Definition ..................................................................... 45 1.10.3. Change Section Alignment ...................................................................... 45 2. C++ Language ............................................................................................................ 47 2.1. C++ Language Extension Keywords ...................................................................... 47 2.2. C++ Dialect Accepted ......................................................................................... 47 2.2.1. Standard Language Features Accepted ....................................................... 48 2.2.2. C++0x Language Features Accepted .......................................................... 51 2.2.3. Anachronisms Accepted ........................................................................... 52 2.2.4. Extensions Accepted in Normal C++ Mode ................................................... 53 2.3. GNU Extensions ................................................................................................ 55 2.4. Namespace Support .......................................................................................... 65 2.5. Template Instantiation ......................................................................................... 67 2.5.1. Automatic Instantiation ............................................................................. 68 2.5.2. Instantiation Modes ................................................................................. 69 2.5.3. Instantiation #pragma Directives ................................................................. 70 2.5.4. Implicit Inclusion ..................................................................................... 71 2.5.5. Exported Templates ................................................................................. 72 2.6. Inlining Functions ............................................................................................... 75 2.7. Extern Inline Functions ....................................................................................... 76 2.8. Pragmas to Control the C++ Compiler .................................................................... 76 2.9. Predefined Macros ............................................................................................. 77 iii TASKING VX-toolset for TriCore User Guide 2.10. Precompiled Headers ....................................................................................... 81 2.10.1. Automatic Precompiled Header Processing ................................................. 81 2.10.2. Manual Precompiled Header Processing .................................................... 84 2.10.3. Other Ways to Control Precompiled Headers ............................................... 84 2.10.4. Performance Issues ............................................................................... 85 3. Assembly Language ..................................................................................................... 87 3.1. Assembly Syntax ............................................................................................... 87 3.2. Assembler Significant Characters .......................................................................... 88 3.3. Operands of an Assembly Instruction ..................................................................... 88 3.4. Symbol Names .................................................................................................. 89 3.4.1. Predefined Preprocessor Symbols .............................................................. 90 3.5. Registers ......................................................................................................... 91 3.5.1. Special Function Registers ........................................................................ 91 3.6. Assembly Expressions ........................................................................................ 91 3.6.1. Numeric Constants .................................................................................. 92 3.6.2. Strings .................................................................................................. 92 3.6.3. Expression Operators .............................................................................. 93 3.7. Working with Sections ......................................................................................... 95 3.8. Built-in Assembly Functions ................................................................................. 96 3.9. Assembler Directives and Controls ...................................................................... 108 3.9.1. Assembler Directives .............................................................................. 109 3.9.2. Assembler Controls ................................................................................ 154 3.10. Macro Operations ........................................................................................... 171 3.10.1. Defining a Macro ................................................................................. 171 3.10.2. Calling a Macro ................................................................................... 171 3.10.3. Using Operators for Macro Arguments ....................................................