ARM® Compiler Software Development Guide

Version 5.05


Table of Contents

Preface
About this book
Using this book
Typographic conventions
Feedback
Feedback on this product
Feedback on content
1 Key Features of ARM Architecture Versions
1.1 About the ARM architectures
1.2 Multiprocessing systems
1.3 Considerations when designing software for a multiprocessing system
1.4 Tightly coupled memory
1.5 Memory management
1.6 Thumb-2 technology
1.7 ARM architecture profiles
1.8 ARM architecture v4T
1.9 ARM architecture v5TE
1.10 ARM architecture v6
1.11 ARM architecture v6-M
1.12 ARM architecture v7-A
1.13 ARM architecture v7-R
1.14 ARM architecture v7-M
1.15 Build options for floating-point arithmetic and linkage
1.16 Floating-point build options in ARMv6 and earlier
1.17 Floating-point build options in ARMv7 and later
2 Embedded Software Development
2.1 About embedded software development
2.2 Default compilation tool behavior
2.3 C library structure
2.4 Default memory map
2.5 Application startup
2.6 Tailoring the C library to your target hardware
2.7 Tailoring the image memory map to your target hardware
2.8 About the scatter-loading description syntax
2.9 Root regions
2.10 Placing the stack and heap
2.11 Run-time memory models
2.12 Scatter file with link to bit-band objects
2.13 Reset and initialization
2.14 The vector table
2.15 ROM and RAM remapping
2.16 Local memory setup considerations
2.17 Stack pointer initialization
2.18 Hardware initialization
2.19 Execution mode considerations
2.20 Target hardware and the memory map
2.21 Execute-only memory
2.22 Building applications for execute-only memory
3 Mixing C, C++, and Assembly Language
3.1 Instruction intrinsics, inline and embedded assembler
3.2 Access to C global variables from assembly code
3.3 Including system C header files from C++
3.4 Including your own C header files from C++
3.5 Mixed-language programming
3.6 Rules for calling between C, C++, and assembly language
3.7 Rules for calling C++ functions from C and assembly language
3.8 Information specific to C++
3.9 Calls to assembly language from C
3.10 Calls to C from assembly language
3.11 Calls to C from C++
3.12 Calls to assembly language from C++
3.13 Calls to C++ from C
3.14 Calls to C++ from assembly language
3.15 Passing a reference between C and C++
3.16 Calls to C++ from C or assembly language
4 Interworking ARM and Thumb
4.1 About interworking
4.2 When to use interworking
4.3 Assembly language interworking
4.4 C and C++ interworking
4.5 Pointers to functions in Thumb state
4.6 Assembly language interworking example
4.7 Interworking using veneers
4.8 C and C++ language interworking
4.9 C, C++, and assembly language interworking using veneers
5 Handling Processor Exceptions
5.1 About processor exceptions
5.2 Exception handling process
5.3 Types of exception in ARMv6 and earlier, ARMv7-A and ARMv7-R profiles
5.4 Vector table for ARMv6 and earlier, ARMv7-A and ARMv7-R profiles
5.5 Processor modes and registers in ARMv6 and earlier, ARMv7-A and ARMv7-R profiles
5.6 Use of System mode for exception handling
5.7 The processor response to an exception
5.8 Return from an exception handler
5.9 Reset handlers
5.10 Data Abort handler
5.11 Interrupt handlers and levels of external interrupt
5.12 Reentrant interrupt handlers
5.13 Single-channel DMA transfer
5.14 Dual-channel DMA transfer
5.15 Interrupt prioritization
5.16 Context switch
5.17 Determining the SVC to be called
5.18 Determining the instruction set state from an SVC handler
5.19 SVC handlers in assembly language
5.20 SVC handlers in C and assembly language
5.21 Using SVCs in Supervisor mode
5.22 Calling SVCs from an application
5.23 Calling SVCs dynamically from an application
5.24 Prefetch Abort handler
5.25 Undefined instruction handlers
5.26 ARMv6-M and ARMv7-M profiles
5.27 Main and Process stacks
5.28 Types of exceptions in the microcontroller profiles
5.29 Vector table for ARMv6-M and ARMv7-M profiles
5.30 Vector Table Offset Register (ARMv7-M only)
5.31 Writing the exception table for ARMv6-M and ARMv7-M profiles
5.32 The Nested Vectored Interrupt Controller
5.33 Handling an exception
5.34 Configuring the System Control Space registers
5.35 Configuring individual IRQs
5.36 Supervisor calls
5.37 System timer
5.38 Configuring SysTick
6 Debug Communications Channel
6.1 About the Debug Communications Channel
6.2 DCC communication between target and host debug tools
6.3 Interrupt-driven debug communications
6.4 Access from Thumb state
7 What is Semihosting?
7.1 What is semihosting?
7.2 The semihosting interface
7.3 Can I change the semihosting operation numbers?
7.4 Debug agent interaction SVCs
7.5 angel_SWIreason_EnterSVC (0x17)
7.6 angel_SWIreason_ReportException (0x18)
7.7 SYS_CLOSE (0x02)
7.8 SYS_CLOCK (0x10)
7.9 SYS_ELAPSED (0x30)
7.10 SYS_ERRNO (0x13)
7.11 SYS_FLEN (0x0C)
7.12 SYS_GET_CMDLINE (0x15)
7.13 SYS_HEAPINFO (0x16)
7.14 SYS_ISERROR (0x08)
7.15 SYS_ISTTY (0x09)
7.16 SYS_OPEN (0x01)
7.17 SYS_READ (0x06)
7.18 SYS_READC (0x07)
7.19 SYS_REMOVE (0x0E)
7.20 SYS_RENAME (0x0F)
7.21 SYS_SEEK (0x0A)
7.22 SYS_SYSTEM (0x12)
7.23 SYS_TICKFREQ (0x31)
7.24 SYS_TIME (0x11)
7.25 SYS_TMPNAM (0x0D)
7.26 SYS_WRITE (0x05)
7.27 SYS_WRITEC (0x03)
7.28 SYS_WRITE0 (0x04)
A Software Development Guide Document Revisions
A.1 Revisions for Software Development Guide

List of Figures

2-1 C library structure
2-2 Default memory map
2-3 Linker placement rules
2-4 Default initialization sequence
2-5 Retargeting the C library
2-6 Scatter-loading description syntax
2-7 One-region model
2-8 Two-region model
2-9 Initialization sequence
5-1 Handling an exception
5-2 PCB layout
5-3 ARM SVC instruction
5-4 Thumb SVC instruction
5-5 Accessing the Supervisor mode stack
6-1 DCC communication between target and host debug tools
7-1 Semihosting overview

List of Tables

1-1 Key features
1-2 Useful command-line options for ARMv4T
1-3 Useful command-line options for ARMv5TE
1-4 Useful command-line options for ARMv6
1-5 One-byte alignment
1-6 Useful command-line options for ARMv6-M
1-7 Useful command-line options for ARMv7-A
1-8 Useful command-line options for ARMv7-R
1-9 Useful command-line options for ARMv7-M
1-10 Interrupt intrinsics
2-1 ARMv7-M bit-band regions and aliases
3-1 Differences between instruction intrinsics, inline and embedded assembler
5-1 Exception types in priority order for ARMv6 and earlier, ARMv7-A and ARMv7-R profiles
5-2 Exception types in priority order for the microcontroller profiles
5-3 Registers available for configuring SysTick
7-1 Hardware vector reason codes
7-2 Software reason codes
7-3 Value of mode
A-1 Differences between issue J and issue K
A-2 Differences between issue I and issue J
A-3 Differences between issue H and issue I
A-4 Differences between issue G and issue H
A-5 Differences between issue F and issue G
A-6 Differences between issue D and issue F
A-7 Differences between issue C and issue D
A-8 Differences between issue B and issue C
A-9 Differences between issue A and issue B

Release information

Document History
Issue Date Confidentiality Change
A 28 May 2010 Non-Confidential ARM Compiler v4.1 Release
B 30 September 2010 Non-Confidential Update 1 for ARM Compiler v4.1
C 28 January 2011 Non-Confidential Update 2 for ARM Compiler v4.1 Patch 3
D 30 April 2011 Non-Confidential ARM Compiler v5.0 Release
E 29 July 2011 Non-Confidential Update 1 for ARM Compiler v5.0
F 30 September 2011 Non-Confidential ARM Compiler v5.01 Release
G 29 February 2012 Non-Confidential Document update 1 for ARM Compiler v5.01 Release
H 27 July 2012 Non-Confidential ARM Compiler v5.02 Release
I 31 January 2013 Non-Confidential ARM Compiler v5.03 Release
J 27 November 2013 Non-Confidential ARM Compiler v5.04 Release
K 10 September 2014 Non-Confidential ARM Compiler v5.05 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.
Copyright © [2010-2014], 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 DUI0471K
Copyright © 2010-2014 ARM. All rights reserved.