ARM® Compiler Software Development Guide

Version 6.6


Table of Contents

Preface
About this book
Using this book
Glossary
Typographic conventions
Feedback
Other information
1 Introducing the Toolchain
1.1 Toolchain overview
1.2 Support level definitions
1.3 LLVM component versions and language compatibility
1.4 Common ARM Compiler toolchain options
1.5 "Hello world" example
1.6 Passing options from the compiler to the linker
2 Diagnostics
2.1 Understanding diagnostics
2.2 Options for controlling diagnostics with armclang
2.3 Pragmas for controlling diagnostics with armclang
2.4 Options for controlling diagnostics with the other tools
3 Compiling C and C++ Code
3.1 Specifying a target architecture, processor, and instruction set
3.2 Using inline assembly code
3.3 Using intrinsics
3.4 Preventing the use of floating-point instructions and registers
3.5 Bare-metal Position Independent Executables
3.6 Execute-only memory
3.7 Building applications for execute-only memory
4 Assembling Assembly Code
4.1 Assembling ARM and GNU syntax assembly code
4.2 Preprocessing assembly code
5 Linking Object Files to Produce an Executable
5.1 Linking object files to produce an executable
6 Optimization
6.1 Optimizing for code size or performance
6.2 Optimizing across modules with link time optimization
6.2.1 Enabling link time optimization
6.2.2 Restrictions with link time optimization
6.3 How optimization affects the debug experience
7 Coding Considerations
7.1 Optimization of loop termination in C code
7.2 Loop unrolling in C code
7.3 Effect of the volatile keyword on compiler optimization
7.4 Stack use in C and C++
7.5 Methods of minimizing function parameter passing overhead
7.6 Inline functions
7.7 Integer division-by-zero errors in C code
7.8 Infinite Loops
8 Mapping code and data to target memory
8.1 Overlay support in ARM® Compiler
8.2 Automatic overlay support
8.2.1 Automatically placing code sections in overlay regions
8.2.2 Overlay veneer
8.2.3 Overlay data tables
8.2.4 Limitations of automatic overlay support
8.2.5 Writing an overlay manager for automatically placed overlays
8.3 Manual overlay support
8.3.1 Manually placing code sections in overlay regions
9 Building Secure and Non-secure Images Using ARMv8-M Security Extensions
9.1 Overview of building Secure and Non-secure images
9.2 Building a Secure image using the ARMv8-M Security Extensions
9.3 Building a Non-secure image that can call a Secure image
9.4 Building a Secure image using a previously generated import library

List of Figures

1-1 Compiler toolchain
1-2 Integration boundaries in ARM Compiler 6.
6-1 Link time optimization

List of Tables

1-1 LLVM component versions
1-2 Language support levels
1-3 armclang common options
1-4 armlink common options
1-5 armar common options
1-6 fromelf common options
1-7 armasm common options
1-8 armclang linker control options
3-1 Compiling for different combinations of architecture, processor, and instruction set
7-1 C code for incrementing and decrementing loops
7-2 C disassembly for incrementing and decrementing loops
7-3 C code for rolled and unrolled bit-counting loops
7-4 Disassembly for rolled and unrolled bit-counting loops
7-5 C code for nonvolatile and volatile buffer loops
7-6 Disassembly for nonvolatile and volatile buffer loop
8-1 Using relative offset in overlays

Release Information

Document History
Issue Date Confidentiality Change
A 14 March 2014 Non-Confidential ARM Compiler v6.00 Release
B 15 December 2014 Non-Confidential ARM Compiler v6.01 Release
C 30 June 2015 Non-Confidential ARM Compiler v6.02 Release
D 18 November 2015 Non-Confidential ARM Compiler v6.3 Release
E 24 February 2016 Non-Confidential ARM Compiler v6.4 Release
F 29 June 2016 Non-Confidential ARM Compiler v6.5 Release
G 04 November 2016 Non-Confidential ARM Compiler v6.6 Release

Non-Confidential Proprietary Notice

This document is protected by copyright and other related rights and the practice or implementation of the information contained in this document may be protected by one or more patents or pending patent applications. No part of this document may be reproduced in any form by any means without the express prior written permission of ARM. No license, express or implied, by estoppel or otherwise to any intellectual property rights is granted by this document unless specifically stated.

Your access to the information in this document is conditional upon your acceptance that you will not use or permit others to use the information for the purposes of determining whether implementations infringe any third party patents.

THIS DOCUMENT IS PROVIDED “AS IS”. ARM PROVIDES NO REPRESENTATIONS AND NO WARRANTIES, EXPRESS, IMPLIED OR STATUTORY, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF MERCHANTABILITY, SATISFACTORY QUALITY, NON-INFRINGEMENT OR FITNESS FOR A PARTICULAR PURPOSE WITH RESPECT TO THE DOCUMENT. For the avoidance of doubt, ARM makes no representation with respect to, and has undertaken no analysis to identify or understand the scope and content of, third party patents, copyrights, trade secrets, or other rights.

This document may include technical inaccuracies or typographical errors.

TO THE EXTENT NOT PROHIBITED BY LAW, IN NO EVENT WILL ARM BE LIABLE FOR ANY DAMAGES, INCLUDING WITHOUT LIMITATION ANY DIRECT, INDIRECT, SPECIAL, INCIDENTAL, PUNITIVE, OR CONSEQUENTIAL DAMAGES, HOWEVER CAUSED AND REGARDLESS OF THE THEORY OF LIABILITY, ARISING OUT OF ANY USE OF THIS DOCUMENT, EVEN IF ARM HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.

This document consists solely of commercial items. You shall be responsible for ensuring that any use, duplication or disclosure of this document complies fully with any relevant export laws and regulations to assure that this document or any portion thereof is not exported, directly or indirectly, in violation of such export laws. Use of the word “partner” in reference to ARM’s customers is not intended to create or refer to any partnership relationship with any other company. ARM may make changes to this document at any time and without notice.

If any of the provisions contained in these terms conflict with any of the provisions of any signed written agreement covering this document with ARM, then the signed written agreement prevails over and supersedes the conflicting provisions of these terms. This document may be translated into other languages for convenience, and you agree that if there is any conflict between the English version of this document and any translation, the terms of the English version of the Agreement shall prevail.

Words and logos marked with ® or ™ are registered trademarks or trademarks of ARM Limited or its affiliates in the EU and/or elsewhere. All rights reserved. Other brands and names mentioned in this document may be the trademarks of their respective owners. Please follow ARM’s trademark usage guidelines at http://www.arm.com/about/trademark-usage-guidelines.php

Copyright © 2014-2016, ARM Limited or its affiliates. All rights reserved.

ARM Limited. Company 02557590 registered in England.

110 Fulbourn Road, Cambridge, England CB1 9NJ.

LES-PRE-20349

Confidentiality Status

This document is Non-Confidential. The right to use, copy and disclose this document may be subject to license restrictions in accordance with the terms of the agreement entered into by ARM and the party that ARM delivered this document to.

Unrestricted Access is an ARM internal classification.

Product Status

The information in this document is Final, that is for a developed product.

Web Address

Non-ConfidentialPDF file icon PDF versionARM DUI0773G
Copyright © 2014-2016 ARM Limited or its affiliates. All rights reserved.