TASKING VX-Toolset for Tricore User Guide
Total Page:16
File Type:pdf, Size:1020Kb
TASKING VX-toolset for TriCore User Guide MA160-800 (v6.1) September 14, 2016 Copyright © 2016 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 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. Half Precision Floating-Point ....................................................................... 3 1.1.2. Fractional Types ........................................................................................ 4 1.1.3. Packed Data Types .................................................................................... 5 1.1.4. Increasing 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() ........................................... 10 1.2.3. Accessing Bits ........................................................................................ 10 1.3. Data Type Qualifiers ........................................................................................... 12 1.3.1. Circular Buffers: __circ ............................................................................. 12 1.3.2. Accessing Hardware from C ...................................................................... 13 1.3.3. Saturation: __sat ..................................................................................... 15 1.3.4. External MCS RAM Data References: __mcsram ........................................... 15 1.3.5. External PCP PRAM Data References: __pram ............................................. 16 1.3.6. Shared Data between TriCore and PCP: __share_pcp .................................... 16 1.4. Multi-Core Support ............................................................................................. 18 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. Shift JIS Kanji Support ........................................................................................ 25 1.6. Using Assembly in the C Source: __asm() .............................................................. 26 1.7. Attributes ......................................................................................................... 33 1.8. Pragmas to Control the Compiler .......................................................................... 38 1.9. Predefined Preprocessor Macros .......................................................................... 45 1.10. Switch Statement ............................................................................................. 47 1.11. Functions ....................................................................................................... 48 1.11.1. Calling Convention ................................................................................. 48 1.11.2. Register Usage ..................................................................................... 50 1.11.3. Inlining Functions: inline .......................................................................... 51 1.11.4. Interrupt and Trap Functions .................................................................... 52 1.11.5. Intrinsic Functions ................................................................................. 60 1.12. Compiler Generated Sections ............................................................................. 72 1.12.1. Rename Sections .................................................................................. 73 1.12.2. Influence Section Definition ..................................................................... 75 2. C++ Language ............................................................................................................ 77 2.1. C++ Language Extension Keywords ...................................................................... 77 2.2. C++ Dialect Accepted ......................................................................................... 77 2.2.1. Default C++ Mode ................................................................................... 78 2.2.2. GNU C++ Mode ...................................................................................... 79 2.2.3. Anachronisms Accepted ........................................................................... 80 2.2.4. Atomic Operations ................................................................................... 81 2.3. Namespace Support .......................................................................................... 83 2.4. Template Instantiation ......................................................................................... 84 2.4.1. Instantiation Modes ................................................................................. 85 iii TASKING VX-toolset for TriCore User Guide 2.4.2. Instantiation #pragma Directives ................................................................. 86 2.4.3. Implicit Inclusion ..................................................................................... 87 2.5. Inlining Functions ............................................................................................... 88 2.6. Extern Inline Functions ....................................................................................... 89 2.7. Pragmas to Control the C++ Compiler .................................................................... 89 2.7.1. C pragmas Supported by the C++ compiler .................................................. 90 2.8. Predefined Macros ............................................................................................. 91 2.9. Precompiled Headers ......................................................................................... 95 2.9.1. Automatic Precompiled Header Processing .................................................. 95 2.9.2. Manual Precompiled Header Processing ...................................................... 98 2.9.3. Other Ways to Control Precompiled Headers ................................................ 98 2.9.4. Performance Issues ................................................................................. 99 3. Assembly Language .................................................................................................... 101 3.1. Assembly Syntax ............................................................................................. 101 3.2. Assembler Significant Characters ........................................................................ 102 3.3. Operands of an Assembly Instruction ................................................................... 102 3.4. Symbol Names ................................................................................................ 103 3.4.1. Predefined Preprocessor Symbols ............................................................ 104 3.5. Registers ........................................................................................................ 105 3.5.1. Special Function Registers ...................................................................... 105 3.6. Assembly Expressions ...................................................................................... 105 3.6.1. Numeric Constants ................................................................................ 106 3.6.2. Strings ................................................................................................ 107 3.6.3. Expression Operators ............................................................................. 107 3.7. Working with Sections ....................................................................................... 109 3.8. Built-in Assembly Functions ............................................................................... 110 3.9. Assembler Directives and Controls .....................................................................