TASKING VX-Toolset for C166 User Guide 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 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 .............................................................................................. 4 1.3.1. Memory Type Qualifiers .............................................................................. 5 1.3.2. Memory Models ........................................................................................ 8 1.3.3. Allocate an Automatic Object in the MAC accumulator ...................................... 9 1.3.4. Placing an Object at an Absolute Address: __at() and __atbit() ......................... 10 1.3.5. Accessing Hardware from C ...................................................................... 13 1.4. Using Assembly in the C Source: __asm() .............................................................. 15 1.5. Pragmas to Control the Compiler .......................................................................... 18 1.6. Predefined Preprocessor Macros .......................................................................... 22 1.7. Variables .......................................................................................................... 24 1.7.1. Initialized Variables .................................................................................. 24 1.7.2. Non-Initialized Variables ........................................................................... 24 1.8. Strings ............................................................................................................ 25 1.9. Switch Statement ............................................................................................... 25 1.10. Functions ....................................................................................................... 26 1.10.1. Calling Convention ................................................................................. 27 1.10.2. Register Usage ..................................................................................... 29 1.10.3. Inlining Functions: inline .......................................................................... 30 1.10.4. Interrupt Functions ................................................................................. 31 1.10.5. Intrinsic Functions ................................................................................. 33 1.11. Section Naming ............................................................................................... 44 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 ................................................................................................ 54 2.4. Namespace Support .......................................................................................... 65 2.5. Template Instantiation ......................................................................................... 67 2.5.1. Automatic Instantiation ............................................................................. 68 2.5.2. Instantiation Modes ................................................................................. 70 2.5.3. Instantiation #pragma Directives ................................................................. 71 2.5.4. Implicit Inclusion ..................................................................................... 73 2.5.5. Exported Templates ................................................................................. 73 2.6. Extern Inline Functions ....................................................................................... 76 2.7. Pragmas to Control the C++ Compiler .................................................................... 77 2.8. Predefined Macros ............................................................................................. 78 2.9. Precompiled Headers ......................................................................................... 82 2.9.1. Automatic Precompiled Header Processing .................................................. 82 2.9.2. Manual Precompiled Header Processing ...................................................... 85 2.9.3. Other Ways to Control Precompiled Headers ................................................ 85 2.9.4. Performance Issues ................................................................................. 86 3. Assembly Language ..................................................................................................... 89 iii TASKING VX-toolset for C166 User Guide 3.1. Assembly Syntax ............................................................................................... 89 3.2. Assembler Significant Characters .......................................................................... 90 3.3. Operands of an Assembly Instruction ..................................................................... 90 3.4. Symbol Names .................................................................................................. 91 3.4.1. Predefined Preprocessor Symbols .............................................................. 91 3.5. Registers ......................................................................................................... 92 3.6. Special Function Registers .................................................................................. 93 3.7. Assembly Expressions ........................................................................................ 93 3.7.1. Numeric Constants .................................................................................. 94 3.7.2. Strings .................................................................................................. 94 3.7.3. Expression Operators .............................................................................. 95 3.7.4. Symbol Types and Expression Types ........................................................... 97 3.8. Built-in Assembly Functions ............................................................................... 100 3.9. Assembler Directives and Controls ...................................................................... 105 3.9.1. Assembler Directives .............................................................................. 105 3.9.2. Assembler Controls ................................................................................ 150 3.10. Macro Operations ........................................................................................... 170 3.10.1. Defining a Macro ................................................................................. 170 3.10.2. Calling a Macro ................................................................................... 170 3.10.3. Using Operators for Macro Arguments ..................................................... 171 3.11. Generic Instructions ........................................................................................ 174 4. Using the C Compiler .................................................................................................. 177 4.1. Compilation Process ......................................................................................... 177 4.2. Calling the C Compiler ...................................................................................... 178 4.3. The C Startup Code .......................................................................................... 180 4.4. How the Compiler Searches Include Files ............................................................. 181 4.5. Compiling
Recommended publications
  • Program-Library-HOWTO.Pdf
    Program Library HOWTO David A. Wheeler version 1.20, 11 April 2003 This HOWTO for programmers discusses how to create and use program libraries on Linux. This includes static libraries, shared libraries, and dynamically loaded libraries. Program Library HOWTO Table of Contents 1. Introduction.....................................................................................................................................................1 2. Static Libraries................................................................................................................................................2 3. Shared Libraries.............................................................................................................................................3 3.1. Conventions......................................................................................................................................3 3.1.1. Shared Library Names.............................................................................................................3 3.1.2. Filesystem Placement..............................................................................................................4 3.2. How Libraries are Used....................................................................................................................4 3.3. Environment Variables.....................................................................................................................5 3.3.1. LD_LIBRARY_PATH............................................................................................................5
    [Show full text]
  • 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]
  • Linux Standard Base Development Kit for Application Building/Porting
    Linux Standard Base Development Kit for application building/porting Rajesh Banginwar Nilesh Jain Intel Corporation Intel Corporation [email protected] [email protected] Abstract validating binaries and RPM packages for LSB conformance. We conclude with a couple of case studies that demonstrate usage of the build The Linux Standard Base (LSB) specifies the environment as well as the associated tools de- binary interface between an application and a scribed in the paper. runtime environment. This paper discusses the LSB Development Kit (LDK) consisting of a build environment and associated tools to assist software developers in building/porting their applications to the LSB interface. Developers 1 Linux Standard Base Overview will be able to use the build environment on their development machines, catching the LSB porting issues early in the development cycle The Linux* Standard Base (LSB)[1] specifies and reducing overall LSB conformance testing the binary interface between an application and time and cost. Associated tools include appli- a runtime environment. The LSB Specifica- cation and package checkers to test for LSB tion consists of a generic portion, gLSB, and conformance of application binaries and RPM an architecture-specific portion, archLSB. As packages. the names suggest, gLSB contains everything that is common across all architectures, and This paper starts with the discussion of ad- archLSBs contain the things that are specific vantages the build environment provides by to each processor architecture, such as the ma- showing how it simplifies application develop- chine instruction set and C library symbol ver- ment/porting for LSB conformance. With the sions. availability of this additional build environment from LSB working group, the application de- As much as possible, the LSB builds on ex- velopers will find the task of porting applica- isting standards, including the Single UNIX tions to LSB much easier.
    [Show full text]
  • Today's Big Adventure
    Today’s Big Adventure f.c gcc f.s as f.o ld a.out c.c gcc c.s as c.o • How to name and refer to things that don’t exist yet • How to merge separate name spaces into a cohesive whole • More information: - How to write shared libraries - Run “nm,” “objdump,” and “readelf” on a few .o and a.out files. - The ELF standard - Examine /usr/include/elf.h 3 / 45 How is a program executed? • On Unix systems, read by “loader” compile time run time ld loader cache - Reads all code/data segments into buer cache; Maps code (read only) and initialized data (r/w) into addr space - Or...fakes process state to look like paged out • Lots of optimizations happen in practice: - Zero-initialized data does not need to be read in. - Demand load: wait until code used before get from disk - Copies of same program running? Share code - Multiple programs use same routines: share code 4 / 45 x86 Assembly syntax • Linux uses AT&T assembler syntax – places destination last - Be aware that intel syntax (used in manual) places destination first • Types of operand available: - Registers start with “%”– movl %edx,%eax - Immediate values (constants) prefixed by “$”– movl $0xff,%edx - (%reg) is value at address in register reg – movl (%edi),%eax - n(%reg) is value at address in (register reg)+n – movl 8(%ebp),%eax - *%reg in an indirection through reg – call *%eax - Everything else is an address – movl var,%eax; call printf • Some heavily used instructions - movl – moves (copies) value from source to destination - pushl/popl – pushes/pops value on stack - call – pushes next
    [Show full text]
  • Meson Manual Sample.Pdf
    Chapter 2 How compilation works Compiling source code into executables looks fairly simple on the surface but gets more and more complicated the lower down the stack you go. It is a testament to the design and hard work of toolchain developers that most developers don’t need to worry about those issues during day to day coding. There are (at least) two reasons for learning how the system works behind the scenes. The first one is that learning new things is fun and interesting an sich. The second one is that having a grasp of the underlying system and its mechanics makes it easier to debug the issues that inevitably crop up as your projects get larger and more complex. This chapter aims outline how the compilation process works starting from a single source file and ending with running the resulting executable. The information in this chapter is not necessary to be able to use Meson. Beginners may skip it if they so choose, but they are advised to come back and read it once they have more experience with the software build process. The treatise in this book is written from the perspective of a build system. Details of the process that are not relevant for this use have been simplified or omitted. Entire books could (and have been) written about subcomponents of the build process. Readers interested in going deeper are advised to look up more detailed reference works such as chapters 41 and 42 of [10]. 2.1 Basic term definitions compile time All operations that are done before the final executable or library is generated are said to happen during compile time.
    [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]
  • A Shared Library and Dynamic Linking Monitor
    MONDO: A Shared Library and Dynamic Linking Monitor C. Donour Sizemore, Jacob R. Lilly, and David M. Beazley Department of Computer Science University of Chicago Chicago, Illinois 60637 {donour,jrlilly,beazley}@cs.uchicago.edu March 15, 2003 Abstract ically loadable extension modules. Similarly, dy- namic modules are commonly used to extend web Dynamic modules are one of the most attractive servers, browsers, and other large programming en- features of modern scripting languages. Dynamic vironments. modules motivate programmers to build their ap- Although dynamic linking offers many benefits plications as small components, then glue them to- such as increased modularity, simplified mainte- gether. They rely on the runtime linker to assemble nance, and extensibility, it has also produced a con- components and shared libraries as the application siderable amount of programmer confusion. Few runs. MONDO, a new debugging tool, provides pro- programmers would claim to really understand how grammers with the ability to monitor in real-time dynamic linking actually works. Moreover, the run- the dynamic linking of a program. MONDO sup- time linking process depends heavily on the system plies programmers with a graphical interface show- configuration, environment variables, subtle com- ing library dependencies, listing symbol bindings, piler and linker options, and the flags passed to low- and providing linking information used to uncover level dynamic loader. The interaction of these pieces subtle programming errors related to the use of tends to produce a very obscured picture of what shared libraries. The use of MONDO requires no is actually going on inside an application that uses modification to existing code or any changes to the shared libraries.
    [Show full text]
  • 2D-Compiler Libraries.Pdf
    Laboratorio di Tecnologie dell'Informazione Ing. Marco Bertini marco.bertini@unifi.it http://www.micc.unifi.it/bertini/ lunedì 17 marzo 14 How the compiler works Programs and libraries lunedì 17 marzo 14 The compiler "In C++, everytime someone writes ">> 3" instead of "/ 8", I bet the compiler is like, "OH DAMN! I would have never thought of that!" - Jon Shiring (Call of Duty 4 / MW2) lunedì 17 marzo 14 What is a compiler ? • A compiler is a computer program (or set of programs) that translate source code from a high-level programming language to a lower level language (e.g., assembly language or machine code). • A compiler typically performs: lexical analysis (tokenization), preprocessing, parsing, semantic analysis, code generation, and code optimization. lunedì 17 marzo 14 From source code to a running program text editor Source file compiler Object file Libraries linker Running program loader Executable lunedì 17 marzo 14 From source to object file • Lexical analysis: breaks the source code text into small pieces source file Lexical analyzer called tokens. Each token is a single atomic unit of the language, for instance a keyword, identifier or symbol name. • Preprocessing: in C/C++ macro substitution and conditional Preprocessor Analysis compilation • Syntax analysis: token sequences are parsed to identify the Syntax analyzer syntactic structure of the program. • Semantic analysis: semantic checks such as type checking (checking for type errors), or object binding (associating Semantic analyzer variable and function references with their definitions), or definite assignment (requiring all local variables to be initialized before use), rejecting incorrect programs or issuing warnings • Code generation: translation into the output language, usually Code generator Synthesis the native machine language of the system.
    [Show full text]
  • Dependency Management in C++ Xavier Bonaventura BMW AG
    Dependency management in C++ Xavier Bonaventura BMW AG. xbonaventurab limdor limdor xavierbonaventura code::dive 2019 – Wrocław, Poland – 20th November 2019 About me • I… • studied software engineering • created a 3D model visualization tool in C++ and OpenGL during my PhD https://github.com/limdor/quoniam (~10.000 LOC) (2010 - 2015) • moved to Munich to work in 2015 BMW AG – • started attending the C++ User Group Munich (MUC++) to realize that I knew nothing about C++ • decided to do this presentation about dependencies after 4 years attending to C++ meetups every month Xavier Bonaventura Bonaventura Xavier • remembered that I developed the 3D model visualization tool when I knew nothing about C++ 2 Goal Awareness and better understanding of the BMW BMW AG dependencies in your project – Xavier Bonaventura Bonaventura Xavier 3 What will we see? • Basic dependency concepts • Difference between declaration and definition • Building process BMW AG – • Execution sequence of a process • Implications of the design of a library Xavier Bonaventura Bonaventura Xavier • Examples with code 4 What are dependencies? 5 Basic concepts Build and runtime phase Library design Examples Dependencies in real life Apple pie Apples Pastry Sugar Flour Butter Egg white Lemon juice Spices Apple tree BMW AG – Butter Flour Salt Sugar Egg Lemon Milk Wheat Chicken Nutmeg Lemon tree Cow Egg Ginger Bonaventura Xavier Cinnamon 6 Chicken Basic concepts Build and runtime phase Egg Library design Examples Dependencies in real life digraph G { "apple pie" -> apples apples
    [Show full text]
  • Boost.Build V2 User Manual
    Boost.Build V2 User Manual XML to PDF by RenderX XEP XSL-FO Formatter, visit us at http://www.renderx.com/ Boost.Build V2 User Manual Copyright © 2006-2009 Vladimir Prus Distributed under the Boost Software License, Version 1.0. (See accompanying ®le LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) XML to PDF by RenderX XEP XSL-FO Formatter, visit us at http://www.renderx.com/ Table of Contents How to use this document ........................................................................................................................................ 1 Installation ............................................................................................................................................................ 2 Tutorial ................................................................................................................................................................ 3 Hello, world .................................................................................................................................................. 4 Properties ..................................................................................................................................................... 5 Project Hierarchies ......................................................................................................................................... 7 Dependent Targets .........................................................................................................................................
    [Show full text]