IAR C/C++ Compiler Reference Guide for V850
Total Page:16
File Type:pdf, Size:1020Kb
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