ARM® Compiler toolchain Developing Software for ARM Processors

Version 5.01

List of Topics

Conventions and feedback
Key Features of ARM Architecture Versions
About the ARM architectures
Multiprocessing systems
Considerations when designing software for a multiprocessing system
Tightly coupled memory
Memory management
Thumb-2 technology
ARM and Thumb floating-point build options (ARMv6 and earlier)
ARM and Thumb floating-point build options (ARMv7 and later)
ARM architecture v4T
ARM architecture v5TE
ARM architecture v6
ARM architecture v6-M
ARM architecture v7-A
ARM architecture v7-R
ARM architecture v7-M
Embedded Software Development
About embedded software development
Default compilation tool behavior
C library structure
Default memory map
Application startup
Tailoring the C library to your target hardware
Tailoring the image memory map to your target hardware
Scatter-loading description file
Root regions
Placing the stack and heap
Run-time memory models
Scatter-loading file with link to bit-band objects
Reset and initialization
The vector table
ROM and RAM remapping
Local memory setup considerations
Stack pointer initialization
Hardware initialization
Execution mode considerations
Target hardware and the memory map
Mixing C, C++, and Assembly Language
Instruction intrinsics, inline and embedded assembler
Access to C global variables from assembly code
Including system C header files from C++
Including your own C header files from C++
Mixed-language programming
Rules for calling between C, C++, and assembly language
Rules for calling C++ functions from C and assembly language
Information specific to C++
Examples of calling between languages
Calls to assembly language from C
Calls to C from assembly language
Calls to C from C++
Calls to assembly language from C++
Calls to C++ from C
Calls to C++ from assembly language
Calls to C++ from C or assembly language
Passing a reference between C and C++
Interworking ARM and Thumb
About interworking
When to use interworking
Assembly language interworking
C and C++ interworking
Pointers to functions in Thumb state
Using two versions of the same function
Assembly language interworking example
Interworking using veneers
C and C++ language interworking
C, C++, and assembly language interworking using veneers
Handling Processor Exceptions
About processor exceptions
Exception handling process
Types of exception in ARMv6 and earlier, ARMv7-A and ARMv7-R profiles
Vector table for ARMv6 and earlier, ARMv7-A and ARMv7-R profiles
Processor modes and registers in ARMv6 and earlier, ARMv7-A and ARMv7-R profiles
Use of System mode for exception handling
The processor response to an exception
Return from an exception handler
Reset handlers
Data Abort handler
Interrupt handlers and levels of external interrupt
Reentrant interrupt handlers
Example interrupt handlers in assembly language
Single-channel DMA transfer
Dual-channel DMA transfer
Interrupt prioritization
Context switch
SVC handlers
Determining the SVC to be called
SVC handlers in assembly language
SVC handlers in C and assembly language
Using SVCs in Supervisor mode
Calling SVCs from an application
Calling SVCs dynamically from an application
Prefetch Abort handler
Undefined instruction handlers
ARMv6-M and ARMv7-M profiles
Main and Process Stacks
Types of exceptions in the microcontroller profiles
Vector table for ARMv6-M and ARMv7-M profiles
Vector Table Offset Register (ARMv7-M only)
Writing the exception table for ARMv6-M and ARMv7-M profiles
The Nested Vectored Interrupt Controller
Handling an exception
Configuring the System Control Space registers
Configuring individual IRQs
Supervisor calls
System timer
Configuring SysTick
Debug Communications Channel
About the Debug Communications Channel
DCC communication between target and host debug tools
Interrupt-driven debug communications
Access from Thumb state
What is semihosting?
The semihosting interface
Can I change the semihosting operation numbers?
Semihosting operations
Debug agent interaction SVCs
angel_SWIreason_EnterSVC (0x17)
angel_SWIreason_ReportException (0x18)
SYS_CLOSE (0x02)
SYS_CLOCK (0x10)
SYS_ERRNO (0x13)
SYS_ISTTY (0x09)
SYS_OPEN (0x01)
SYS_READ (0x06)
SYS_READC (0x07)
SYS_TIME (0x11)
SYS_WRITE (0x05)
SYS_WRITE0 (0x04)
Revisions for Developing Software for ARM Processors

Proprietary Notice

Words and logos marked with ® or ™ are registered trademarks or trademarks of ARM® in the EU and other countries, except as otherwise stated below in this proprietary notice. Other brands and names mentioned herein may be the trademarks of their respective owners.

Neither the whole nor any part of the information contained in, or the product described in, this collection may be adapted or reproduced in any material form except with the prior written permission of the copyright holder.

The product described in this collection is subject to continuous developments and improvements. All particulars of the product and its use contained in this collection are given by ARM in good faith. However, all warranties implied or expressed, including but not limited to implied warranties of merchantability, or fitness for purpose, are excluded.

This collection is intended only to assist the reader in the use of the product. ARM shall not be liable for any loss or damage arising from the use of any information in this collection, or any error or omission in such information, or any incorrect use of the product.

Where the term ARM is used it means “ARM or any of its subsidiaries as appropriate”.

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.

Product Status

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

Revision History
Revision AMay 2010ARM Compiler toolchain v4.1 Release
Revision B07 October 2010Update 1 for ARM Compiler toolchain v4.1
Revision C28 January 2011Update 2 for ARM Compiler toolchain v4.1 Patch 3
Revision D30 April 2011ARM Compiler toolchain v5.0 Release
Revision E29 July 2011Update 1 for ARM Compiler toolchain v5.0
Revision F30 September 2011ARM Compiler toolchain v5.01 Release
Revision G29 February 2012Document update 1 for ARM Compiler toolchain v5.01 Release
Copyright © 2010-2012 ARM. All rights reserved.ARM DUI 0471G