IAR C/C++ Compiler Reference Guide for V850

Total Page:16

File Type:pdf, Size:1020Kb

IAR C/C++ Compiler Reference Guide for V850 IAR Embedded Workbench® IAR C/C++ Compiler Reference Guide for the Renesas V850 Microcontroller Family CV850-9 COPYRIGHT NOTICE © 1998–2013 IAR Systems AB. No part of this document may be reproduced without the prior written consent of IAR Systems AB. The software described in this document is furnished under a license and may only be used or copied in accordance with the terms of such a license. DISCLAIMER The information in this document is subject to change without notice and does not represent a commitment on any part of IAR Systems. While the information contained herein is assumed to be accurate, IAR Systems assumes no responsibility for any errors or omissions. In no event shall IAR Systems, its employees, its contractors, or the authors of this document be liable for special, direct, indirect, or consequential damage, losses, costs, charges, claims, demands, claim for lost profits, fees, or expenses of any nature or kind. TRADEMARKS IAR Systems, IAR Embedded Workbench, C-SPY, visualSTATE, The Code to Success, IAR KickStart Kit, I-jet, I-scope, IAR and the logotype of IAR Systems are trademarks or registered trademarks owned by IAR Systems AB. Microsoft and Windows are registered trademarks of Microsoft Corporation. Renesas is a registered trademark of Renesas Electronics Corporation. V850 is a trademark of Renesas Electronics Corporation. Adobe and Acrobat Reader are registered trademarks of Adobe Systems Incorporated. All other product names are trademarks or registered trademarks of their respective owners. EDITION NOTICE Ninth edition: May 2013 Part number: CV850-9 This guide applies to version 4.x of IAR Embedded Workbench® for the Renesas V850 microcontroller family. Internal reference: M13, Too6.5, csrct2010.1, V_110411, IJOA. IAR C/C++ Compiler 2 Reference Guide for V850 AFE1_AFE2-1:1 Brief contents Tables ...................................................................................................................... 23 Preface .................................................................................................................... 25 Part 1. Using the compiler ....................................................... 33 Getting started .................................................................................................. 35 Data storage ...................................................................................................... 43 Functions ............................................................................................................... 53 Placing code and data .................................................................................... 67 The DLIB runtime environment .............................................................. 81 Assembler language interface ................................................................. 117 Using C ................................................................................................................ 145 Using C++ .......................................................................................................... 153 Efficient coding for embedded applications ...................................... 163 Part 2. Reference information ........................................... 183 External interface details ............................................................................ 185 Compiler options ........................................................................................... 191 Data representation ...................................................................................... 227 Extended keywords ....................................................................................... 239 Pragma directives ............................................................................................ 251 Intrinsic functions ........................................................................................... 271 The preprocessor ........................................................................................... 281 Library functions ............................................................................................. 289 3 CMYSTRO11-1:1 Segment reference ......................................................................................... 299 Implementation-defined behavior for Standard C ......................... 317 Implementation-defined behavior for C89 ........................................ 333 Index ..................................................................................................................... 345 IAR C/C++ Compiler 4 Reference Guide for V850 CMYSTRO11-1:1 Contents Tables ...................................................................................................................... 23 Preface .................................................................................................................... 25 Who should read this guide ............................................................... 25 How to use this guide .......................................................................... 25 What this guide contains ................................................................... 25 Part 1. Using the compiler .................................................................. 26 Part 2. Reference information ............................................................ 26 Other documentation ........................................................................... 27 User and reference guides .................................................................. 27 The online help system ......................................................................28 Further reading ................................................................................... 28 Web sites ............................................................................................29 Document conventions ....................................................................... 29 Typographic conventions ................................................................... 30 Naming conventions .......................................................................... 30 Part 1. Using the compiler ....................................................... 33 Getting started .................................................................................................. 35 IAR language overview ......................................................................... 35 Supported V850 devices ......................................................................36 Building applications—an overview ................................................ 36 Compiling ........................................................................................... 36 Linking .............................................................................................. 37 Basic project configuration ................................................................. 37 Core .................................................................................................... 38 Data model ......................................................................................... 38 Code model ........................................................................................ 38 Optimization for speed and size ......................................................... 39 Runtime environment ......................................................................... 39 5 CMYSTRO11-1:1 Special support for embedded systems ........................................ 40 Extended keywords ............................................................................ 41 Pragma directives ............................................................................... 41 Predefined symbols ............................................................................ 41 Special function types ........................................................................ 41 Accessing low-level features ............................................................. 41 Data storage ...................................................................................................... 43 Introduction ............................................................................................. 43 Different ways to store data ............................................................... 43 Data models .............................................................................................. 44 Specifying a data model ..................................................................... 44 Memory types ......................................................................................... 45 Near ................................................................................................... 46 Brel (base-relative) ............................................................................. 46 Brel23 (base-relative23) ..................................................................... 47 Huge .................................................................................................. 47 Saddr (Short addressing) .................................................................... 47 Using data memory attributes ............................................................ 47 Structures and memory types ............................................................ 49 More examples ................................................................................... 49 C++ and memory types ......................................................................50 Auto
Recommended publications
  • Computer Organization and Architecture Designing for Performance Ninth Edition
    COMPUTER ORGANIZATION AND ARCHITECTURE DESIGNING FOR PERFORMANCE NINTH EDITION William Stallings Boston Columbus Indianapolis New York San Francisco Upper Saddle River Amsterdam Cape Town Dubai London Madrid Milan Munich Paris Montréal Toronto Delhi Mexico City São Paulo Sydney Hong Kong Seoul Singapore Taipei Tokyo Editorial Director: Marcia Horton Designer: Bruce Kenselaar Executive Editor: Tracy Dunkelberger Manager, Visual Research: Karen Sanatar Associate Editor: Carole Snyder Manager, Rights and Permissions: Mike Joyce Director of Marketing: Patrice Jones Text Permission Coordinator: Jen Roach Marketing Manager: Yez Alayan Cover Art: Charles Bowman/Robert Harding Marketing Coordinator: Kathryn Ferranti Lead Media Project Manager: Daniel Sandin Marketing Assistant: Emma Snider Full-Service Project Management: Shiny Rajesh/ Director of Production: Vince O’Brien Integra Software Services Pvt. Ltd. Managing Editor: Jeff Holcomb Composition: Integra Software Services Pvt. Ltd. Production Project Manager: Kayla Smith-Tarbox Printer/Binder: Edward Brothers Production Editor: Pat Brown Cover Printer: Lehigh-Phoenix Color/Hagerstown Manufacturing Buyer: Pat Brown Text Font: Times Ten-Roman Creative Director: Jayne Conte Credits: Figure 2.14: reprinted with permission from The Computer Language Company, Inc. Figure 17.10: Buyya, Rajkumar, High-Performance Cluster Computing: Architectures and Systems, Vol I, 1st edition, ©1999. Reprinted and Electronically reproduced by permission of Pearson Education, Inc. Upper Saddle River, New Jersey, Figure 17.11: Reprinted with permission from Ethernet Alliance. Credits and acknowledgments borrowed from other sources and reproduced, with permission, in this textbook appear on the appropriate page within text. Copyright © 2013, 2010, 2006 by Pearson Education, Inc., publishing as Prentice Hall. All rights reserved. Manufactured in the United States of America.
    [Show full text]
  • Introduction to the Intel® Nios® II Soft Processor
    Introduction to the Intel® Nios® II Soft Processor For Quartus® Prime 18.1 1 Introduction This tutorial presents an introduction the Intel® Nios® II processor, which is a soft processor that can be instantiated on an Intel FPGA device. It describes the basic architecture of Nios II and its instruction set. The Nios II processor and its associated memory and peripheral components are easily instantiated by using Intel’s SOPC Builder or Platform Designer tool in conjunction with the Quartus® Prime software. A full description of the Nios II processor is provided in the Nios II Processor Reference Handbook, which is available in the literature section of the Intel web site. Introductions to the SOPC Builder and Platform Designer tools are given in the tutorials Introduction to the Intel SOPC Builder and Introduction to the Intel Platform Designer Tool, respectively. Both can be found in the University Program section of the web site. Contents: • Nios II System • Overview of Nios II Processor Features • Register Structure • Accessing Memory and I/O Devices • Addressing • Instruction Set • Assembler Directives • Example Program • Exception Processing • Cache Memory • Tightly Coupled Memory Intel Corporation - FPGA University Program 1 March 2019 ® ® INTRODUCTION TO THE INTEL NIOS II SOFT PROCESSOR For Quartus® Prime 18.1 2 Background Intel’s Nios II is a soft processor, defined in a hardware description language, which can be implemented in Intel’s FPGA devices by using the Quartus Prime CAD system. This tutorial provides a basic introduction to the Nios II processor, intended for a user who wishes to implement a Nios II based system on an Intel Development and Education board.
    [Show full text]
  • Computer Organization & Architecture Eie
    COMPUTER ORGANIZATION & ARCHITECTURE EIE 411 Course Lecturer: Engr Banji Adedayo. Reg COREN. The characteristics of different computers vary considerably from category to category. Computers for data processing activities have different features than those with scientific features. Even computers configured within the same application area have variations in design. Computer architecture is the science of integrating those components to achieve a level of functionality and performance. It is logical organization or designs of the hardware that make up the computer system. The internal organization of a digital system is defined by the sequence of micro operations it performs on the data stored in its registers. The internal structure of a MICRO-PROCESSOR is called its architecture and includes the number lay out and functionality of registers, memory cell, decoders, controllers and clocks. HISTORY OF COMPUTER HARDWARE The first use of the word ‘Computer’ was recorded in 1613, referring to a person who carried out calculation or computation. A brief History: Computer as we all know 2day had its beginning with 19th century English Mathematics Professor named Chales Babage. He designed the analytical engine and it was this design that the basic frame work of the computer of today are based on. 1st Generation 1937-1946 The first electronic digital computer was built by Dr John V. Atanasoff & Berry Cliford (ABC). In 1943 an electronic computer named colossus was built for military. 1946 – The first general purpose digital computer- the Electronic Numerical Integrator and computer (ENIAC) was built. This computer weighed 30 tons and had 18,000 vacuum tubes which were used for processing.
    [Show full text]
  • IAR Systems Brings Functional Safety Tools to RISC-V with Certification for IEC 61508 and ISO 26262
    Press release Date: October 20, 2020 IAR Systems brings functional safety tools to RISC-V with certification for IEC 61508 and ISO 26262 Stockholm, Sweden—October 20, 2020— IAR Systems®, the future-proof supplier of software tools and services for embedded development, further extends its strong tools offering for RISC-V by announcing a certified version of its development tools. The functional safety edition of IAR Embedded Workbench® for RISC-V will be certified by TÜV SÜD according to the requirements of IEC 61508, the international umbrella standard for functional safety, as well as ISO 26262, which is used for automotive safety-related systems. In addition, the certification covers the international standard IEC 62304, which specifies life cycle requirements for the development of medical software and software within medical devices, and the European railway standards EN 50128 and EN 50657. “We are seeing RISC-V becoming an important architecture not only in broad designs, but specifically in automotive applications,” said Stefan Skarin, CEO, IAR Systems. “By providing our development tools with certification according to ISO 26262, we enable the RISC-V community to further expand and more rapidly bring functional safety designs to the market. As a commercial tools vendor, we are able to provide global technical support as well as invest in keeping our products robust, maintained and qualified. Our certified tools will enable our customers to speed up the path to using RISC-V in safety-critical applications within automotive and other areas.” “We see a strong demand for RISC-V with safety among our customers, and the certification of IAR Embedded Workbench for RISC-V aligns perfectly with that demand,” said Frankwell Lin, President, Andes Technology.
    [Show full text]
  • IAR Systems Supports New Amazon Web Services Iot Microcontroller Operating System Amazon Freertos at Launch
    Press release Date: November 30, 2017 IAR Systems supports new Amazon Web Services IoT Microcontroller Operating System Amazon FreeRTOS at Launch Amazon FreeRTOS will be supported by the leading embedded development toolchain IAR Embedded Workbench Uppsala, Sweden—November 30, 2017—IAR Systems®, a leading supplier of software tools and services for embedded development, announces support for newly launched Internet of Things (IoT) Microcontroller Operating System, Amazon FreeRTOS. Together with Amazon Web Services (AWS), IAR Systems provides developers with easy access to high-performance, pre-integrated development tools for developing and debugging embedded and IoT-connected applications based on Amazon FreeRTOS. Amazon FreeRTOS provides tools that developers need to quickly and easily deploy a microcontroller- based connected device and develop an embedded or IoT application without having to worry about the complexity of scaling across millions of devices. Based on the FreeRTOS kernel, Amazon FreeRTOS includes software libraries which make it easy to securely connect devices locally to AWS Greengrass, directly to the cloud, and update them remotely. For new devices, developers can choose to build their embedded and IoT application on a variety of qualified microcontrollers from companies collaborating with AWS and IAR Systems, including Microchip, NXP, STMicroelectronics and Texas Instruments. Since 1983, IAR Systems’ solutions have ensured quality, reliability and efficiency in the development of over one million embedded applications. Now available for Amazon FreeRTOS users, development tools from IAR Systems deliver leading code optimizations and extensive debugging functionality. The technology is coupled with professional technical support offered globally. “AWS is pleased to be teamed with IAR Systems to provide developers with access to a high performance, pre-integrated set of development tools for developing and debugging connected applications,” says Richard Barry, Principal Engineer, Amazon Web Services, Inc.
    [Show full text]
  • Strict Protection for Virtual Function Calls in COTS C++ Binaries
    vfGuard: Strict Protection for Virtual Function Calls in COTS C++ Binaries Aravind Prakash Xunchao Hu Heng Yin Department of EECS Department of EECS Department of EECS Syracuse University Syracuse University Syracuse University [email protected] [email protected] [email protected] Abstract—Control-Flow Integrity (CFI) is an important se- these binary-only solutions are unfortunately coarse-grained curity property that needs to be enforced to prevent control- and permissive. flow hijacking attacks. Recent attacks have demonstrated that existing CFI protections for COTS binaries are too permissive, While coarse-grained CFI solutions have significantly re- and vulnerable to sophisticated code reusing attacks. Accounting duced the attack surface, recent efforts by Goktas¸¨ et al. [9] for control flow restrictions imposed at higher levels of semantics and Carlini [10] have demonstrated that coarse-grained CFI is key to increasing CFI precision. In this paper, we aim to provide solutions are too permissive, and can be bypassed by reusing more stringent protection for virtual function calls in COTS large gadgets whose starting addresses are allowed by these C++ binaries by recovering C++ level semantics. To achieve this solutions. The primary reason for such permissiveness is the goal, we recover C++ semantics, including VTables and virtual lack of higher level program semantics that introduce certain callsites. With the extracted C++ semantics, we construct a sound mandates on the control flow. For example, given a class CFI policy and further improve the policy precision by devising two filters, namely “Nested Call Filter” and “Calling Convention inheritance, target of a virtual function dispatch in C++ must Filter”.
    [Show full text]
  • A Modular Soft Processor Core in VHDL
    A Modular Soft Processor Core in VHDL Jack Whitham 2002-2003 This is a Third Year project submitted for the degree of MEng in the Department of Computer Science at the University of York. The project will attempt to demonstrate that a modular soft processor core can be designed and implemented on an FPGA, and that the core can be optimised to run a particular embedded application using a minimal amount of FPGA space. The word count of this project (as counted by the Unix wc command after detex was run on the LaTeX source) is 33647 words. This includes all text in the main report and Appendices A, B and C. Excluding source code, the project is 70 pages in length. i Contents I. Introduction 1 1. Background and Literature 1 1.1. Soft Processor Cores . 1 1.2. A Field Programmable Gate Array . 1 1.3. VHSIC Hardware Definition Language (VHDL) . 2 1.4. The Motorola 68020 . 2 II. High-level Project Decisions 3 2. Should the design be based on an existing one? 3 3. Which processor should the soft core be based upon? 3 4. Which processor should be chosen? 3 5. Restating the aims of the project in terms of the chosen processor 4 III. Modular Processor Design Decisions 4 6. Processor Design 4 6.1. Alternatives to a complete processor implementation . 4 6.2. A real processor . 5 6.3. Instruction Decoder and Control Logic . 5 6.4. Arithmetic and Logic Unit (ALU) . 7 6.5. Register File . 7 6.6. Links between Components .
    [Show full text]
  • Assignment Solutions
    Week 1: Assignment Solutions 1. Which of the following statements are true? a. The ENIAC computer was built using mechanical relays. b. Harvard Mark1 computer was built using mechanical relays. c. PASCALINE computer could multiply and divide numbers by repeated addition and subtraction. d. Charles Babbage built his automatic computing engine in 19th century. Solution: ((b) and (c)) ENIAC was built using vacuum tubes. Charles Babbage designed his automatic computing engine but could not built it. 2. Which of the following statements are true for Moore’s law? a. Moore’s law predicts that power dissipation will double every 18 months. b. Moore’s law predicts that the number of transistors per chip will double every 18 months. c. Moore’s law predicts that the speed of VLSI circuits will double every 18 months. d. None of the above. Solution: (b) Moore’s law only predicts that number of transistors per chip will double every 18 months. 3. Which of the following generates the necessary signals required to execute an instruction in a computer? a. Arithmetic and Logic Unit b. Memory Unit c. Control Unit d. Input/Output Unit Solution: (c) Control unit acts as the nerve center of a computer and generates the necessary control signals required to execute an instruction. 4. An instruction ADD R1, A is stored at memory location 4004H. R1 is a processor register and A is a memory location with address 400CH. Each instruction is 32-bit long. What will be the values of PC, IR and MAR during execution of the instruction? a.
    [Show full text]
  • Tricore Architecture Manual for a Detailed Discussion of Instruction Set Encoding and Semantics
    User’s Manual, v2.3, Feb. 2007 TriCore 32-bit Unified Processor Core Embedded Applications Binary Interface (EABI) Microcontrollers Edition 2007-02 Published by Infineon Technologies AG 81726 München, Germany © Infineon Technologies AG 2007. 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. User’s Manual, v2.3, Feb.
    [Show full text]
  • Register Are Used to Quickly Accept, Store, and Transfer Data And
    Register are used to quickly accept, store, and transfer data and instructions that are being used immediately by the CPU, there are various types of Registers those are used for various purpose. Among of the some Mostly used Registers named as AC or Accumulator, Data Register or DR, the AR or Address Register, program counter (PC), Memory Data Register (MDR) ,Index register,Memory Buffer Register. These Registers are used for performing the various Operations. While we are working on the System then these Registers are used by the CPU for Performing the Operations. When We Gives Some Input to the System then the Input will be Stored into the Registers and When the System will gives us the Results after Processing then the Result will also be from the Registers. So that they are used by the CPU for Processing the Data which is given by the User. Registers Perform:- 1) Fetch: The Fetch Operation is used for taking the instructions those are given by the user and the Instructions those are stored into the Main Memory will be fetch by using Registers. 2) Decode: The Decode Operation is used for interpreting the Instructions means the Instructions are decoded means the CPU will find out which Operation is to be performed on the Instructions. 3) Execute: The Execute Operation is performed by the CPU. And Results those are produced by the CPU are then Stored into the Memory and after that they are displayed on the user Screen. Types of Registers are as Followings 1. MAR stand for Memory Address Register This register holds the memory addresses of data and instructions.
    [Show full text]
  • IAR Embedded Workbench® for ARM
    IAR Embedded Workbench® for ARM IAR Embedded Workbench is a set of highly sophisticated • Binary compatibility with other EABI compliant tools and easy-to-use development tools for embedded applica- • Automatic checking of MISRA C rules (MISRA C:2004) tions. It integrates the IAR C/C++ Compiler™, assembler, • Language extensions for embedded applications with linker, librarian, text editor, project manager, and C-SPY® target-speciic support Debugger in an integrated development environment • Advanced inline assembler • Support for ARM, Thumb1 and Thumb-2 processor modes (IDE). With its built-in chip-specific code optimizer, IAR • Support for the VFP9-S loating-point co-processor Embedded Workbench generates very efficient and reliable • Support for 4 Gbyte applications in all processor modes code for ARM devices. In addition to this solid technology, • Support for 64-bit long long IAR Systems also provides professional worldwide technical • 32- and 64-bit loating-point types in standard IEEE format support. • Reentrant code • Position Independent Code and Data (PIC/PID) MODULAR AND EXTENSIBLE IDE • Multiple levels of optimizations on code size and execution • A seamlessly integrated environment for building and speed allowing different transformations enabled, such as debugging embedded applications function inlining, loop unrolling etc. • Powerful project management allowing multiple projects in one workspace STATE-OF-THE-ART C-SPY® DEBUGGER • Build integration with IAR visualSTATE • Complex code and data breakpoints • Hierarchical project
    [Show full text]
  • Tools from IAR Systems for Freescale Kinetis Microcontrollers
    Tools from IAR Systems for Freescale Kinetis Microcontrollers IAR Embedded Workbench IAR KickStart Kit for Kinetis IIAR Embedded Workbench is a set of highly sophisticated and easy- IAR KickStart kit for Kinetis K60 contains all the necessary hardware to-use software development tools for Freescale Kinetis. It integrates and software for designing, developing, integrating and testing applica- the IAR C/C++ Compiler, assembler, linker, librarian, text editor, project tions. It includes: manager, and C-SPY Debugger in an integrated development environ- • 32-bit MCU module with MK60N512 MCU ment (IDE). With its built-in chip-specific code optimizer, IAR Embedded • Two elevator modules that provide power regulation circuitry, Workbench generates efficient and reliable FLASHable code for Kinetis standardized signal assignments, and act as common backplane for microcontrollers. all assembled Tower System modules Highlights: • Serial peripheral module with Ethernet, USB, RS232/485, and • Integration of Freescale MQX Software Solutions CAN interface circuitry • Power debugging for minimized power consumption • Prototyping module featuring ample perfboard area for custom • Example projects for MXQ and Tower kit circuitry • Trace debugging supporting ETM and SWD • IAR J-Link Lite for Cortex-M - a small JTAG-emulator with SWD/ • Automatic project configuration for all Kinetis devices SWO debugging support for Cortex-M devices • DVD with software development tools, example projects & RTOS BSPs, training materials and collateral • Quick Start Guide Debug probes IAR J-Link/J-Link Ultra IAR J-Link and IAR J-Link Ultra are compatible high speed JTAG/SWD probes for Kinetis microcontrollers. IAR J-Link Ultra brings better per- formance and is better suited for power debugging compared to IAR J- Link.
    [Show full text]