Keil Logo

Arm Compiler User Guide

Arm® Compiler User Guide

Version 6.12


Table of Contents

Preface
About this book
Using this book
Glossary
Typographic conventions
Feedback
Other information
1 Getting Started
1.1 Introduction to Arm® Compiler 6
1.2 Installing Arm® Compiler
1.3 Accessing Arm® Compiler from Arm® Development Studio
1.4 Accessing Arm® Compiler from the Arm® Keil® µVision® IDE
1.5 Compiling a Hello World example
1.6 Using the integrated assembler
1.7 Running bare-metal images
1.8 Architectures supported by Arm® Compiler
2 Using Common Compiler Options
2.1 Mandatory armclang options
2.2 Common Arm® Compiler toolchain options
2.3 Selecting source language options
2.4 Selecting optimization options
2.5 Building to aid debugging
2.6 Linking object files to produce an executable
2.7 Linker options for mapping code and data to target memory
2.8 Passing options from the compiler to the linker
2.9 Controlling diagnostic messages
2.10 Selecting floating-point options
2.11 Compilation tools command-line option rules
3 Writing Optimized Code
3.1 Effect of the volatile keyword on compiler optimization
3.2 Optimizing loops
3.3 Inlining functions
3.4 Stack use in C and C++
3.5 Packing data structures
3.6 Optimizing for code size or performance
3.7 Methods of minimizing function parameter passing overhead
3.8 Optimizing across modules with link time optimization
3.8.1 Enabling link time optimization
3.8.2 Restrictions with link time optimization
3.8.3 Removing unused code across multiple object files
3.9 How optimization affects the debug experience
4 Assembling Assembly Code
4.1 Assembling armasm and GNU syntax assembly code
4.2 Preprocessing assembly code
5 Using Assembly and Intrinsics in C or C++ Code
5.1 Using intrinsics
5.2 Writing inline assembly code
5.3 Calling assembly functions from C and C++
6 Mapping Code and Data to the Target
6.1 What the linker does to create an image
6.1.1 What you can control with a scatter file
6.2 Placing data items for target peripherals with a scatter file
6.3 Placing the stack and heap with a scatter file
6.4 Root region
6.4.1 Effect of the ABSOLUTE attribute on a root region
6.4.2 Effect of the FIXED attribute on a root region
6.5 Placing functions and data in a named section
6.6 Placing functions and data at specific addresses
6.6.1 Placing __at sections at a specific address
6.6.2 Restrictions on placing __at sections
6.6.3 Automatically placing __at sections
6.6.4 Manually placing __at sections
6.6.5 Placing a key in flash memory with an __at section
6.6.6 Placing constants at fixed locations
6.6.7 Placing jump tables in ROM
6.6.8 Placing a variable at a specific address without scatter-loading
6.6.9 Placing a variable at a specific address with scatter-loading
6.7 Bare-metal Position Independent Executables
6.8 Placement of Arm® C and C++ library code
6.8.1 Placing code in a root region
6.8.2 Placing Arm® C library code
6.8.3 Placing Arm® C++ library code
6.9 Placement of unassigned sections
6.9.1 Default rules for placing unassigned sections
6.9.2 Command-line options for controlling the placement of unassigned sections
6.9.3 Prioritizing the placement of unassigned sections
6.9.4 Specify the maximum region size permitted for placing unassigned sections
6.9.5 Examples of using placement algorithms for .ANY sections
6.9.6 Example of next_fit algorithm showing behavior of full regions, selectors, and priority
6.9.7 Examples of using sorting algorithms for .ANY sections
6.9.8 Behavior when .ANY sections overflow because of linker-generated content
6.10 Placing veneers with a scatter file
6.11 Preprocessing a scatter file
6.11.1 Default behavior for armclang -E in a scatter file
6.11.2 Using other preprocessors in a scatter file
6.12 Reserving an empty block of memory
6.12.1 Characteristics of a reserved empty block of memory
6.12.2 Example of reserving an empty block of memory
6.13 Aligning regions to page boundaries
6.14 Aligning execution regions and input sections
7 Overlays
7.1 Overlay support in Arm® Compiler
7.2 Automatic overlay support
7.2.1 Automatically placing code sections in overlay regions
7.2.2 Overlay veneer
7.2.3 Overlay data tables
7.2.4 Limitations of automatic overlay support
7.2.5 Writing an overlay manager for automatically placed overlays
7.3 Manual overlay support
7.3.1 Manually placing code sections in overlay regions
7.3.2 Writing an overlay manager for manually placed overlays
8 Embedded Software Development
8.1 About embedded software development
8.2 Default compilation tool behavior
8.3 C library structure
8.4 Default memory map
8.5 Application startup
8.6 Tailoring the C library to your target hardware
8.7 Reimplementing C library functions
8.8 Tailoring the image memory map to your target hardware
8.9 About the scatter-loading description syntax
8.10 Root regions
8.11 Placing the stack and heap
8.12 Run-time memory models
8.13 Reset and initialization
8.14 The vector table
8.15 ROM and RAM remapping
8.16 Local memory setup considerations
8.17 Stack pointer initialization
8.18 Hardware initialization
8.19 Execution mode considerations
8.20 Target hardware and the memory map
8.21 Execute-only memory
8.22 Building applications for execute-only memory
8.23 Vector table for ARMv6 and earlier, ARMv7-A and ARMv7-R profiles
8.24 Vector table for M-profile architectures
8.25 Vector Table Offset Register
8.26 Integer division-by-zero errors in C code
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
A Supporting reference information
A.1 Support level definitions
A.2 Standards compliance in Arm® Compiler
A.3 Compliance with the ABI for the Arm® Architecture (Base Standard)
A.4 GCC compatibility provided by Arm® Compiler 6
A.5 Locale support in Arm® Compiler
A.6 Toolchain environment variables
A.7 Clang and LLVM documentation
A.8 Further reading

Release Information

Document History
Issue Date Confidentiality Change
0606-00 04 November 2016 Non-Confidential Arm Compiler v6.6 Release
0607-00 05 April 2017 Non-Confidential Arm Compiler v6.7 Release
0608-00 30 July 2017 Non-Confidential Arm Compiler v6.8 Release.
0609-00 25 October 2017 Non-Confidential Arm Compiler v6.9 Release.
0610-00 14 March 2018 Non-Confidential Arm Compiler v6.10 Release.
0611-00 25 October 2018 Non-Confidential Arm Compiler v6.11 Release.
0612-00 27 February 2019 Non-Confidential Arm Compiler v6.12 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 click through or signed written agreement covering this document with Arm, then the click through or 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.

The Arm corporate logo and words marked with ® or ™ are registered trademarks or trademarks of Arm Limited (or its subsidiaries) in the US 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/company/policies/trademarks.

Copyright © 2016–2019 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 version100748_0612_00_en
Copyright © 2016–2019 Arm Limited or its affiliates. All rights reserved. 
  Arm logo
Important information

This site uses cookies to store information on your computer. By continuing to use our site, you consent to our cookies.

Change Settings

Privacy Policy Update

Arm’s Privacy Policy has been updated. By continuing to use our site, you consent to Arm’s Privacy Policy. Please review our Privacy Policy to learn more about our collection, use and transfers
of your data.