RealView® Compilation Tools Developer Guide

Version 4.0


Table of Contents

Preface
About this book
Intended audience
Using this book
Typographical conventions
Further reading
Feedback
Feedback on RealView Compilation Tools
Feedback on this book
1. Introduction
1.1. About RealView Compilation Tools
1.2. Using the examples
2. Developing for ARM Processors
2.1. About the ARM architectures
2.1.1. Multiprocessing systems
2.1.2. Tightly coupled memory
2.1.3. Memory management
2.1.4. Thumb-2
2.1.5. Floating-point build options
2.2. ARM architecture v4T
2.2.1. Key features
2.2.2. Alignment support
2.2.3. Endian support
2.3. ARM architecture v5TE
2.3.1. Key features
2.3.2. Alignment support
2.3.3. Endian support
2.4. ARM architecture v6
2.4.1. Key features
2.4.2. Alignment support
2.4.3. Endian support
2.5. ARM architecture v6-M
2.5.1. Key features
2.5.2. Alignment support
2.5.3. Endian support
2.6. ARM architecture v7-A
2.6.1. Key features
2.6.2. Alignment support
2.6.3. Endian support
2.7. ARM architecture v7-R
2.7.1. Key features
2.7.2. Alignment support
2.7.3. Endian support
2.8. ARM architecture v7-M
2.8.1. Key features
2.8.2. Alignment support
2.8.3. Endian support
3. Embedded Software Development
3.1. About embedded software development
3.1.1. Example code
3.2. Default compilation tool behavior
3.2.1. C library structure
3.2.2. Default memory map
3.2.3. Application startup
3.3. Tailoring the C library to your target hardware
3.4. Tailoring the image memory map to your target hardware
3.4.1. Scatter‑loading description file
3.4.2. Root regions
3.4.3. Placing the stack and heap
3.5. Reset and initialization
3.5.1. The vector table
3.5.2. ROM and RAM remapping
3.5.3. Local memory setup considerations
3.5.4. Stack pointer initialization
3.5.5. Hardware initialization
3.5.6. Execution mode considerations
3.6. Target hardware and the memory map
4. Mixing C, C++, and Assembly Language
4.1. Using instruction intrinsics, inline and embedded assembler
4.2. Accessing C global variables from assembly code
4.3. Using C header files from C++
4.3.1. Including system C header files
4.3.2. Including your own C header files
4.4. Calling between C, C++, and ARM assembly language
4.4.1. General rules for calling between languages
4.4.2. Information specific to C++
4.4.3. Examples of calling between languages
5. Interworking ARM and Thumb
5.1. About interworking
5.1.1. When to use interworking
5.2. Assembly language interworking
5.3. C and C++ interworking
5.3.1. Pointers to functions in Thumb state
5.3.2. Using two versions of the same function
5.4. Interworking examples
6. Handling Processor Exceptions
6.1. About processor exceptions
6.2. ARMv6 and earlier, ARMv7-A and ARMv7-R profiles
6.2.1. Types of exception
6.2.2. The vector table
6.2.3. Processor modes and registers
6.2.4. Handling an exception
6.2.5. Reset handlers
6.2.6. Data Abort handler
6.2.7. Interrupt handlers
6.2.8. SVC handlers
6.2.9. Prefetch Abort handler
6.2.10. Undefined instruction handlers
6.3. ARMv6-M and ARMv7-M profiles
6.3.1. Main and Process Stacks
6.3.2. Types of exception
6.3.3. The vector table
6.3.4. The Nested Vectored Interrupt Controller
6.3.5. Handling an exception
6.3.6. Configuring the System Control Space registers
6.3.7. Configuring individual IRQs
6.3.8. Supervisor calls
6.3.9. System timer
7. Debug Communications Channel
7.1. About the Debug Communications Channel
7.2. DCC communication between target and host debug tools
7.2.1. Interrupt‑driven debug communications
7.3. Access from Thumb state
8. Semihosting
8.1. About semihosting
8.1.1. What is semihosting?
8.1.2. The semihosting interface
8.2. Semihosting implementation
8.2.1. RealView ARMulator ISS
8.2.2. RealView ICE
8.2.3. Instruction Set System Model
8.2.4. RealMonitor
8.3. Semihosting operations
8.3.1. angel_SWIreason_EnterSVC (0x17)
8.3.2. angel_SWIreason_ReportException (0x18)
8.3.3. SYS_CLOSE (0x02)
8.3.4. SYS_CLOCK (0x10)
8.3.5. SYS_ELAPSED (0x30)
8.3.6. SYS_ERRNO (0x13)
8.3.7. SYS_FLEN (0x0C)
8.3.8. SYS_GET_CMDLINE (0x15)
8.3.9. SYS_HEAPINFO (0x16)
8.3.10. SYS_ISERROR (0x08)
8.3.11. SYS_ISTTY (0x09)
8.3.12. SYS_OPEN (0x01)
8.3.13. SYS_READ (0x06)
8.3.14. SYS_READC (0x07)
8.3.15. SYS_REMOVE (0x0E)
8.3.16. SYS_RENAME (0x0F)
8.3.17. SYS_SEEK (0x0A)
8.3.18. SYS_SYSTEM (0x12)
8.3.19. SYS_TICKFREQ (0x31)
8.3.20. SYS_TIME (0x11)
8.3.21. SYS_TMPNAM (0x0D)
8.3.22. SYS_WRITE (0x05)
8.3.23. SYS_WRITEC (0x03)
8.3.24. SYS_WRITE0 (0x04)
8.4. Debug agent interaction SVCs

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 document may be adapted or reproduced in any material form except with the prior written permission of the copyright holder.

The product described in this document is subject to continuous developments and improvements. All particulars of the product and its use contained in this document 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 document 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 document, 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.

Unrestricted Access is an ARM internal classification.

Product Status

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

Revision History
Revision AAugust 2002Release 1.2
Revision BJanuary 2003Release 2.0
Revision CSeptember 2003Release 2.0.1 for ARM® RealView® Developer Suite
Revision DJanuary 2004Release 2.1 for RealView Developer Suite
Revision EDecember 2004Release 2.2 for RealView Developer Suite
Revision FMay 2005Release 2.2 SP1 for RealView Developer Suite
Revision GMarch 2006Release 3.0 for RealView Development Suite
Revision HMarch 2007Release 3.1 for RealView Development Suite
Revision ISeptember 2008Release 4.0 for RealView Development Suite
Revision I23 January 2009Update 1 for RealView Development Suite v4.0
Revision J10 December 2010Update 2 for RealView Development Suite v4.0
Copyright © 2002-2010 ARM. All rights reserved.ARM DUI 0203J
Non-ConfidentialID101213