Crosscore Embedded Studio 2.2.0 C/C++ Compiler Manual for SHARC
Total Page:16
File Type:pdf, Size:1020Kb
CrossCore Embedded Studio 2.2.0 C/C++ Compiler Manual for SHARC Processors Revision 1.5, February 2016 Part Number 82-100117-01 Analog Devices, Inc. One Technology Way Norwood, MA 02062-9106 Copyright Information ©2016 Analog Devices, Inc., ALL RIGHTS RESERVED. This document may not be reproduced in any form without prior, express written consent from Analog Devices, Inc. Printed in the USA. Disclaimer Analog Devices, Inc. reserves the right to change this product without prior notice. Information furnished by Ana- log Devices is believed to be accurate and reliable. However, no responsibility is assumed by Analog Devices for its use; nor for any infringement of patents or other rights of third parties which may result from its use. No license is granted by implication or otherwise under the patent rights of Analog Devices, Inc. Trademark and Service Mark Notice The Analog Devices logo, Blackfin, CrossCore, EngineerZone, EZ-Board, EZ-KIT, EZ-KIT Lite, EZ-Extender, SHARC, and VisualDSP++ are registered trademarks of Analog Devices, Inc. Blackfin+, SHARC+, and EZ-KIT Mini are trademarks of Analog Devices, Inc. All other brand and product names are trademarks or service marks of their respective owners. CrossCore Embedded Studio 2.2.0 i Contents Preface Purpose of This Manual................................................................................................................................. 1±1 Intended Audience......................................................................................................................................... 1±1 Manual Contents........................................................................................................................................... 1±1 What's New in this Manual ........................................................................................................................... 1±2 Technical Support.......................................................................................................................................... 1±2 Supported Processors ..................................................................................................................................... 1±3 Product Information...................................................................................................................................... 1±3 Analog Devices Website.............................................................................................................................. 1±3 EngineerZone ............................................................................................................................................. 1±3 Notation Conventions ................................................................................................................................... 1±3 Compiler C/C++ Compiler Overview............................................................................................................................ 2±2 Compiler Components ............................................................................................................................... 2±3 Compiler Command-Line Interface............................................................................................................... 2±4 Running the Compiler................................................................................................................................ 2±5 Processor Features....................................................................................................................................... 2±7 Compiler Command-Line Switches............................................................................................................ 2±9 C/C++ Mode Selection Switch Descriptions.......................................................................................... 2±17 C/C++ Compiler Common Switch Descriptions ................................................................................... 2±18 C Mode (MISRA) Compiler Switch Descriptions ................................................................................. 2±57 C++ Mode Compiler Switch Descriptions............................................................................................. 2±59 Environment Variables Used by the Compiler .......................................................................................... 2±62 Data Type and Data Type Sizes ................................................................................................................ 2±62 Integer Data Types................................................................................................................................ 2±64 ii CrossCore Embedded Studio 2.2.0 Floating-Point Data Types..................................................................................................................... 2±64 Optimization Control............................................................................................................................... 2±65 Optimization Levels .............................................................................................................................. 2±65 Interprocedural Analysis........................................................................................................................ 2±67 Controlling Silicon Revision and Anomaly Workarounds Within the Compiler ....................................... 2±68 Using the -si-revision Switch......................................................................................................... 2±68 Using the -workaround Switch........................................................................................................... 2±69 Using the -no-workaround Switch..................................................................................................... 2±69 Interactions Between the Silicon Revision and Workaround Switches ................................................... 2±70 Anomalies in Assembly Sources............................................................................................................. 2±70 Using Byte-Addressing................................................................................................................................. 2±70 Building Byte-Addressed Applications From C/C++ ................................................................................. 2±71 Data Formats and Calling Conventions.................................................................................................... 2±71 Sizes of Native Types............................................................................................................................. 2±71 Endianness ............................................................................................................................................ 2±72 Symbol Names ...................................................................................................................................... 2±73 Byte-Addressed Memory Alias............................................................................................................... 2±73 Changes to Call-Preserved Registers...................................................................................................... 2±74 Mixed Char-Size Applications................................................................................................................... 2±74 Building a Mixed Char-Size Application................................................................................................ 2±74 How to Use Different Char Sizes Together............................................................................................ 2±75 Type Coercions...................................................................................................................................... 2±76 Simple Interfaces................................................................................................................................... 2±76 Constructing Complex Byte-Addressed and Word-Addressed Interfaces ................................................... 2±77 The byte_addressed and word_addressed Keywords .............................................................................. 2±77 Prohibited Constructs in Interface Regions ........................................................................................... 2±79 Using Sub-Word Types in Word-Addressed Code.................................................................................. 2±80 Use of typedefs ...................................................................................................................................... 2±80 Function Pointers.................................................................................................................................. 2±81 Using Byte-Addressed and Word-Addressed Interfaces with C++.............................................................. 2±81 Assembly Code ......................................................................................................................................... 2±82 CrossCore Embedded Studio 2.2.0 iii Memory Alias Spaces Compared ........................................................................................................... 2±83 Using Word-Addressed Assembly Code Within a Byte-Addressed Application ...................................... 2±83 Char-Size Agnostic Assembly Code ......................................................................................................