TASKING VX-Toolset for Tricore User Guide
Total Page:16
File Type:pdf, Size:1020Kb
TASKING VX-toolset for TriCore User Guide MA160-800 (v4.3) July 12, 2013 Copyright © 2013 Altium BV. 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 BV. 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 ........................................................................................... 3 1.1.2. Fractional Types ........................................................................................ 4 1.1.3. Packed Data Types .................................................................................... 5 1.1.4. Changing the Alignment: __align() ................................................................ 6 1.2. Accessing Memory .............................................................................................. 7 1.2.1. Memory Qualifiers ..................................................................................... 7 1.2.2. Placing an Object at an Absolute Address: __at() ............................................ 9 1.2.3. Accessing Bits ........................................................................................ 10 1.3. Data Type Qualifiers ........................................................................................... 13 1.3.1. Circular Buffers: __circ ............................................................................. 13 1.3.2. Accessing Hardware from C ...................................................................... 14 1.3.3. Saturation: __sat ..................................................................................... 15 1.3.4. External MCS RAM Data References: __mcsram ........................................... 16 1.3.5. External PCP PRAM Data References: __pram ............................................. 16 1.3.6. Shared Data between TriCore and PCP: __share_pcp .................................... 17 1.4. Multi-Core Support ............................................................................................. 19 1.4.1. Data Core Association ............................................................................. 19 1.4.2. Code Core Association ............................................................................. 20 1.4.3. Core Association Restrictions .................................................................... 21 1.4.4. Core Association and Addressing Modes ..................................................... 24 1.4.5. Core Association and Function Calls ........................................................... 25 1.5. Using Assembly in the C Source: __asm() .............................................................. 26 1.6. Attributes ......................................................................................................... 31 1.7. Pragmas to Control the Compiler .......................................................................... 36 1.8. Predefined Preprocessor Macros .......................................................................... 43 1.9. Switch Statement ............................................................................................... 44 1.10. Functions ....................................................................................................... 45 1.10.1. Calling Convention ................................................................................. 45 1.10.2. Register Usage ..................................................................................... 48 1.10.3. Inlining Functions: inline .......................................................................... 48 1.10.4. Interrupt and Trap Functions .................................................................... 50 1.10.5. Intrinsic Functions ................................................................................. 57 1.11. Compiler Generated Sections ............................................................................. 68 1.11.1. Rename Sections .................................................................................. 69 1.11.2. Influence Section Definition ..................................................................... 70 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 2.5.1. Automatic Instantiation ............................................................................. 98 iii TASKING VX-toolset for TriCore User Guide 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 ................................................................... 118 3.4. Symbol Names ................................................................................................ 119 3.4.1. Predefined Preprocessor Symbols ............................................................ 120 3.5. Registers ........................................................................................................ 121 3.5.1. Special Function Registers ...................................................................... 121 3.6. Assembly Expressions ...................................................................................... 121 3.6.1. Numeric Constants ................................................................................ 122 3.6.2. Strings ................................................................................................ 123 3.6.3. Expression Operators ............................................................................. 123 3.7. Working with Sections ....................................................................................... 125 3.8. Built-in Assembly Functions ..............................................................................