TASKING VX-Toolset for C166 User Guide

Total Page:16

File Type:pdf, Size:1020Kb

TASKING VX-Toolset for C166 User Guide 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 ........................................................

  1046
Recommended publications
  • Coverstory by Robert Cravotta, Technical Editor
    coverstory By Robert Cravotta, Technical Editor u WELCOME to the 31st annual EDN Microprocessor/Microcontroller Di- rectory. The number of companies and devices the directory lists continues to grow and change. The size of this year’s table of devices has grown more than NEW PROCESSOR OFFERINGS 25% from last year’s. Also, despite the fact that a number of companies have disappeared from the list, the number of companies participating in this year’s CONTINUE TO INCLUDE directory has still grown by 10%. So what? Should this growth and change in the companies and devices the directory lists mean anything to you? TARGETED, INTEGRATED One thing to note is that this year’s directory has experienced more compa- ny and product-line changes than the previous few years. One significant type PERIPHERAL SETS THAT SPAN of change is that more companies are publicly offering software-programma- ble processors. To clarify this fact, not every company that sells processor prod- ALL ARCHITECTURE SIZES. ucts decides to participate in the directory. One reason for not participating is that the companies are selling their processors only to specific customers and are not yet publicly offering those products. Some of the new companies par- ticipating in this year’s directory have recently begun making their processors available to the engineering public. Another type of change occurs when a company acquires another company or another company’s product line. Some of the acquired product lines are no longer available in their current form, such as the MediaQ processors that Nvidia acquired or the Triscend products that Arm acquired.
    [Show full text]
  • Errata Sheet NG For
    16/32-Bit Architecture XC27x5X Derivatives 16/32-Bit Single-Chip Microcontroller with 32-Bit Performance XC2000 Family / Base Line Errata Sheet V1.5 2013-02 Microcontrollers Edition 2013-02 Published by Infineon Technologies AG 81726 Munich, Germany © 2013 Infineon Technologies AG All Rights Reserved. Legal Disclaimer The information given in this document shall in no event be regarded as a guarantee of conditions or characteristics. With respect to any examples or hints given herein, any typical values stated herein and/or any information regarding the application of the device, Infineon Technologies hereby disclaims any and all warranties and liabilities of any kind, including without limitation, warranties of non-infringement of intellectual property rights of any third party. Information For further information on technology, delivery terms and conditions and prices, please contact the nearest Infineon Technologies Office (www.infineon.com). Warnings Due to technical requirements, components may contain dangerous substances. For information on the types in question, please contact the nearest Infineon Technologies Office. Infineon Technologies components may be used in life-support devices or systems only with the express written approval of Infineon Technologies, if a failure of such components can reasonably be expected to cause the failure of that life-support device or system or to affect the safety or effectiveness of that device or system. Life support devices or systems are intended to be implanted in the human body or to support and/or maintain and sustain and/or protect human life. If they fail, it is reasonable to assume that the health of the user or other persons may be endangered.
    [Show full text]
  • The Insider's Guide to Planning 166 Family Designs
    Issue B Frequency (MHz) Frequency Rx2 (Ohm) Rx2 CX1 (pF) CX1 CX2 (pF) CX2 CL (pF) CL C0typ (pF) C0typ R1typ (Ohm) R1typ R1max (Ohm) R1max R1max (TK) (Ohm) R1max Pw (uW) Pw Rqmax (Ohm) Rqmax Safety Factor (SF) Factor Safety 40 0 12 15 13 7 10 50 60 420 300 2.11 32 0 12 15 11 5 15 50 60 520 390 3.07 24 180 15 22 12 5 15 50 60 510 390 3.24 20 390 8.2 39 10 4 20 60 80 375 560 3.57 18 390 12 39 14 4 20 60 80 335 540 4.08 16 390 12 47 13 4 20 60 80 353 580 4.24 12 390 15 47 13 4 30 70 90 312 1000 6.50 10 390 15 47 14 3 30 80 100 216 1200 8.14 8 390 15 47 15 3 35 80 100 372 1800 12.50 6 390 15 47 14 3 35 80 140 100 2200 10.66 5 390 22 47 18 3 35 80 140 110 2700 14.17 4 390 22 47 16 4 20 80 150 46 3300 14.08 166 Decoupling capacitor on reverse of board CB Vcc Vss XTAL1 XTAL2 RX CX1 CX2 = Connections to Crystal ground layer { time_for_60_degreesThe = CC15 - time_las Insiders Guide To CC0 = CC15 + (Injector_Firing _Angle time_last_60 = CC15 ; } CC15 Interrupt, cylinder 0 Injector Firing Angle 0 0 Injector 3 6 Opening Time Planning 166 5 7 1 CC0 Interrupt, 11 cylinder 0 injector { CC0 += Inje CC3 Interrupt, 10 8 cylinder 3 injector 4 2 Family Designs jector_Pulse_Width ; } Injector 0 Opening Time 9 3 Injector Firing Angle 3 CC15 Interrupt, cylinder 3 { time_for_60_degrees = CC15 - time_last_6 CC3 = CC15 + (Injector_Firing _Angle * t time_last_60 = CC15 ; } VAREF Analog Voltage Varef input Reference Internal capacitance Resistance Analog Voltage ~ Reference GND Optional Over-Voltage Protection Resistor AN0 Rap Signal Source Internal A/D Convertor Resistance Sample & Hold Capacitor A/D Convertor Analog Signal ~ Voltage Source VAGND 167 GND 166 Designers Guide - Page 1 This guide contains basic information that is useful when doing your first 166 family design.
    [Show full text]
  • Datasheet CAN Driver Source Code
    Source Code CAN Driver Source Code - CANpie FD CAN driver for embedded applications The driver CANpie FD (Controller Area Network Program- ming Interface Environment) provides a standarized API for software engineering of CAN-based applications. The driver forms the basis for higher-layer protocols (CANopen / DeviceNet / J1939) and is available for a wide range of microcontroller platforms. Scalability and modu- lar design of the CANpie drivers facilitate implementation into individual target systems. Features • Modular design, scalable, easy to implement • Optimized for low resources (ROM / RAM) User Functions • Wide range of supported CAN controllers • Support of standard and extended frames (11-bit / 29-bit identifier) Core Functions Receive Transmit • Data flow by polling or interrupt driven FIFO FIFO • Supports virtual mailboxes Mailbox Access Filter Receive Transmit IRQ CAN hardware MicroControl GmbH & Co. KG · Junkersring 23 · 53844 Troisdorf · Germany · Fon +49 (0) 2241 256 59 - 0 · Fax +49 (0) 2241 256 59 - 11 · [email protected] I/O Module Steuerungen Protokollstacks Dienstleistungen www.microcontrol.net Technical Data CAN driver source code - CANpie FD Identifier • Standard Frame (11-bit) • Extended Frame (29-bit) Formats • Data Frame • Remote Frame • Error Frame (Receive) Monitoring of fault conditions • ACK (depending on controller) • Bit Error • Format Error • CRC Error • Stuff Error Dataflow • Interrupt • Polling Special Features • Mailbox access • Software Filter Order Number Description / CAN Controller 50.10.079
    [Show full text]
  • TASKING VX-Toolset for C166 User Guide TASKING VX-Toolset for C166 User Guide
    TASKING VX-toolset for C166 User Guide TASKING VX-toolset for C166 User Guide Copyright © 2006 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 .............................................................................................
    [Show full text]
  • 1 Data Sheets and Application Notes
    INDEX Data Sheets and Application Notes The information in these data sheets and application notes has been carefully checked and is believed to be entirely reliable. However, PHYTEC Meßtechnik GmbH assumes no responsibility for any inaccuracies. PHYTEC Meßtechnik GmbH neither gives any guarantee nor accepts any liability whatsoever for consequential damages resulting from the use of these data sheets or application notes. PHYTEC reserves the right to alter the information contained herein without prior notification and accepts no responsibility for any damages which might result. 1 Index 1 Data Sheets 1.1 Altera 1.1.1 PLD MAX7000 Programmable Logic Device Family M7000.PDF Data Sheet, ver. 5.03 MAX7000A Programmable Logic Device Family M7000A.PDF Data Sheet, ver. 1.2 Operating Requirements for Altera Devices Data DSOPRQ.PDF Sheet, ver. 8 1.2 AMD 1.2.1 x86 Élan SC400 Data Sheet 21028A.PDF Élan SC400 and Élan SC410 User’s Manual 21030A.PDF Élan SC400 Register Set Reference Manual 21032A.PDF Élan SC400 Register Set Reference Manual 21032A1.PDF Amendment 1.2.2 FLASH Flash Memory Quick Reference Guide 21531.PDF Summer ‘98 Am29F080B 8 Megabit (1 M x 8-Bit) 21503C.PDF CMOS 5.0 Volt-only, Uniform Sector Flash Memory Am29F200AT / Am29F200AB 2 Megabit 29F200AB.PDF (262,144 x 8-Bit / 131,072 x 16-Bit) CMOS 5.0 Volt-only, Sector Erase Flash Memory 2 Am29F400AT / Am29F400AB 8 Megabit 29F400.PDF (1,048,576 x 8-Bit / 524,288 x 16-Bit) CMOS 5.0 Volt-only, Sectored Flash Memory Am29F800T / Am29F800B 8 Megabit 29F800B.PDF (1,048,576 x 8-Bit / 524,288 x
    [Show full text]
  • On Hardware and Hardware Models for Embedded Real-Time Systems
    On Hardware and Hardware Models for Embedded Real-Time Systems Jakob Engblom∗ Dept. of Information Technology, Uppsala University P.O. Box 325, SE-751 05 Uppsala, Sweden [email protected] / http://www.docs.uu.se/~jakob effects if deadlines are missed or some other timing- Abstract related bugs manifest themselves. When developing embedded real-time systems, de- When building an embedded real-time systems, the signers and programmers rely on various forms of choice of hardware platform is very important to create scheduling and timing analysis. At some point, all an analyzable and predictable system. Also, the quality such analyses must account for the hardware used to of the models of the hardware used in software tools obtain execution time information, and if the analysis is very important to the correctness of timing analysis method does not accurately reflect the hardware char- and the integrity of the system. acteristics, the result is likely to be a bad analysis and In this paper, we discuss some of the aspects of how potentially a bad system. to build hardware models that are correct visavi the The choice of hardware, specifically the microproces- hardware, and how to select hardware that allows real- sor or microcontroller to use, has a profound influence time systems to be constructed in a reliable fashion. on the analyzability of a system. The timing behav- The purpose of this paper is to inspire some discus- ior of a complex CPU core is very hard to understand sion regarding how real-time systems are designed and (even without a cached memory system).
    [Show full text]
  • XE166 Microcontroller Family Real-Time Signal Controllers for Industrial Applications
    XE166 Microcontroller Family Real-Time Signal Controllers for Industrial Applications [ www.infineon.com/XE166 ] 2 Contents Family Overview 4 Applications 16 Peripheral Highlights 22 Enhanced Communication 23 Safety Features 24 System Development Tools 26 Starter Kits and Evaluation Boards 26 3 Family Overview Evolution XE166 Family – More Performance, More Flash, Better Peripherals With more than 500 million units sold, C166 has set the standard for 16-bit architectures with the highest aggregate volume share of all available 16-bit devices. With its fast interrupt response and context switching, the C166 family is ideally suited for automotive, industrial, mass storage and wired as well as wireless communications applications. Compared with the XC166, the XE166 deli- vers more performance, more flash memory, more RAM, strongly enhanced peripherals and a complete DSP library. eFlash: – 1,600KB XE169 Up to 100MHz XE167 Integration MultiCAN, eVR XE164 USIC XE162 XC167 XE161 eFlash: – 256KB Up to 40MHz XE160 XC161 Single Cycle, MAC XE166 XC164CS TwinCAN, OCDS C167CS XC164CM C167 XC166 High real-time performance C161 High instruction throughput Minimal response time C164 Intelligent peripherals C166 Performance 4 Overview Family Overview Real-Time Signal Controller MCU and DSP in a Real-Time Core Infineon Technologies’ Real-Time Signal Controller (RTSC) combines the traditional strengths of a Microcontroller Unit (MCU) for the control of peripherals with the computing power of Digital Si- gnal Processors (DSPs), all in one enhanced XE166 core. Together, the microcontroller’s real-time capability and ease of use and the DSP’s mathematical performance and data throughput form a powerful single-chip solution ideal for many embedded applications.
    [Show full text]
  • Master's Thesis
    2009:122 CIV MASTER'S THESIS Requirements and possibilities of a new microcontroller in an embedded system David Wiberg Luleå University of Technology MSc Programmes in Engineering Computer Science and Engineering Department of Computer Science and Electrical Engineering Division of EISLAB 2009:122 CIV - ISSN: 1402-1617 - ISRN: LTU-EX--09/122--SE ABSTRACT Shortening product development cycles and reducing cost are important aspects for all development work. Being able to reuse resources spent on earlier product generations is one way to lower costs by preventing the same job from being done multiple times. In this master’s thesis in Computer Science and Engineering an evaluation of a new microcontroller is made with the goal of reusing a large codebase from previous projects. Studied is also the currently used program loading methods at Haldex Traction and a new concept is suggested which would render some of the current limitations invalid. Finally a presentation of the practical work needed to adapt a small real-time kernel called TinyTimber to a new platform is explained. PREFACE This master’s thesis in Computer Science and Engineering is written at Luleå University of Technology with Per Lindgren as examiner. The possibility to write my master’s thesis at Haldex Traction was given to me with help of my good friend Gustaf Lagunoff. For this I send my gratitude since the time spent at Haldex has been rewarding in many ways. I would also like to thank Johan Nilsson and Adam Eliasson at Haldex who have been supervising my work and always found the time to answer questions and provide feedback.
    [Show full text]
  • Processor Pipelines and Static Worst-Case Execution Time Analysis
    Uppsala Dissertations from the Faculty of Science and Technology 36 __________________________________________________________________________________________ JAKOB ENGBLOM Processor Pipelines and Static Worst-Case Execution Time Analysis ACTA UNIVERSITATIS UPSALIENSIS UPPSALA 2002 Dissertation for the Degree of Doctor of Philosophy in Computer Systems pre- sented at Uppsala University, April 19, 2002. ABSTRACT Engblom, J. 2002: Processor Pipelines and Static Worst-Case Execution Time Analy- sis. Acta Universitatis Upsaliensis. Uppsala dissertations from the Faculty of Science and Technology 36. 130 pp. Uppsala. ISBN 91-554-5228-0. Worst-Case Execution Time (WCET) estimates for programs are necessary when building real-time systems. They are used to ensure timely responses from interrupts, to guarantee the throughput of cyclic tasks, as input to scheduling and schedule anal- ysis algorithms, and in many other circumstances. Traditionally, such estimates have been obtained either by measurements or labor-intensive manual analysis, which is both time consuming and error-prone. Static worst-case execution time analysis is a family of techniques that promise to quickly provide safe execution time estimates for real-time programs, simultaneously increasing system quality and decreasing the development cost. This thesis presents several contributions to the state-of-the-art in WCET analysis. We present an overall architecture for WCET analysis tools that provides a frame- work for implementing modules. Within the stable interfaces provided, modules can be independently replaced, making it easy to customize a tool for a particular target and perform performance-precision trade-offs. We have developed concrete techniques for analyzing and representing the timing behavior of programs running on pipelined processors. The representation and anal- ysis is more powerful than previous approaches in that pipeline timing effects across more than pairs of instructions can be handled, and in that no assumptions are made about the program structure.
    [Show full text]
  • C166sv2 Architecture Overview Handbook
    Architecture Overview Handbook, V1.1, Feb. 2006 C166S V2 16-Bit Synthesizable Microcontroller Microcontrollers Never stop thinking. Edition 2006-02 Published by Infineon Technologies AG, St.-Martin-Strasse 53, D-81541 München, Germany © Infineon Technologies AG 2006. All Rights Reserved. Attention please! The information herein is given to describe certain components and shall not be considered as warranted characteristics. Terms of delivery and rights to technical change reserved. We hereby disclaim any and all warranties, including but not limited to warranties of non-infringement, regarding circuits, descriptions and charts stated herein. Infineon Technologies is an approved CECC manufacturer. Information For further information on technology, delivery terms and conditions and prices please contact your nearest Infineon Technologies Office in Germany or our Infineon Technologies Representatives worldwide. Warnings Due to technical requirements components may contain dangerous substances. For information on the types in question please contact your nearest Infineon Technologies Office. Infineon Technologies Components may only be used in life-support devices or systems with the express written approval of Infineon Technologies, if a failure of such components can reasonably be expected to cause the failure of that life-support device or system, or to affect the safety or effectiveness of that device or system. Life support devices or systems are intended to be implanted in the human body, or to support and/or maintain and sustain and/or protect human life. If they fail, it is reasonable to assume that the health of the user or other persons may be endangered. Architecture Overview Handbook, V1.1, Feb. 2006 C166S V2 16-Bit Synthesizable Microcontroller Microcontrollers Never stop thinking.
    [Show full text]
  • Data Sheet, V2.1, Aug
    Data Sheet, V2.1, Aug. 2008 XC2387 16/32-Bit Single-Chip Microcontroller with 32-Bit Performance Microcontrollers Edition 2008-08 Published by Infineon Technologies AG 81726 München, Germany © Infineon Technologies AG 2008. All Rights Reserved. Legal Disclaimer The information given in this document shall in no event be regarded as a guarantee of conditions or characteristics (“Beschaffenheitsgarantie”). With respect to any examples or hints given herein, any typical values stated herein and/or any information regarding the application of the device, Infineon Technologies hereby disclaims any and all warranties and liabilities of any kind, including without limitation warranties of non- infringement of intellectual property rights of any third party. Information For further information on technology, delivery terms and conditions and prices please contact your nearest Infineon Technologies Office (www.infineon.com). Warnings Due to technical requirements components may contain dangerous substances. For information on the types in question please contact your nearest Infineon Technologies Office. Infineon Technologies Components may only be used in life-support devices or systems with the express written approval of Infineon Technologies, if a failure of such components can reasonably be expected to cause the failure of that life-support device or system, or to affect the safety or effectiveness of that device or system. Life support devices or systems are intended to be implanted in the human body, or to support and/or maintain and sustain and/or protect human life. If they fail, it is reasonable to assume that the health of the user or other persons may be endangered. Data Sheet, V2.1, Aug.
    [Show full text]