Creating an application
ARM DUI 0529C Copyright © 2010-2011 ARM. All rights reserved. 3-2
ID080411 Non-Confidential
3.1 Using the compilation tools
A typical application development might involve the following:
C/C++ source code for the main application (
armcc
)
assembly source code for near-hardware components (
armasm
), such as interrupt service
routines
linking all objects together to generate an image (
armlink
)
converting an image to flash format in plain binary, Intel Hex, and Motorola-S formats
(
fromelf
).
The following figure shows how the compilation tools are used for the development of a typical
application.
Figure 3-1 A typical tool usage flow diagram
3.1.1 See also
Tasks
Using the compiler on page 3-3
Using the linker on page 3-5
Using the assembler on page 3-6
Using the fromelf image converter on page 3-7.
Flash format
.s
armcc
armasm
C/C++ ARM
and Thumb
Assembly
code
armlink
fromelf
Image
Object codeSource code
code
data
debug
Plain binary
Intel Hex
Motorola-S
.o data
.o data
.c
code
debug
code
debug
Creating an application
ARM DUI 0529C Copyright © 2010-2011 ARM. All rights reserved. 3-3
ID080411 Non-Confidential
3.2 Using the compiler
The compiler,
armcc
, can compile C and C++ source code into ARM and Thumb code.
Typically, you invoke the compiler as follows:
armcc [options] ifile_1 ... ifile_n
You can specify one or more input files.
3.2.1 Compiling example
To compile the C++ example source file
shapes.cpp
:
1. Compile the C++ file
shapes.cpp
with the following command:
armcc --cpp --debug -c -O1 shapes.cpp -o shapes.o
The following options are commonly used:
-c
Tells the compiler to compile only, and not link.
-cpp
Tells the compiler that the source is C++.
--debug
Tells the compiler to add debug tables for source-level debugging.
-O1
Tells the compiler to generate code with restricted optimizations
applied to give a satisfactory debug view with good code density and
performance.
-o filename
Tells the compiler to create an object file with the specified
filename
.
Note
Be aware that
--arm
is the default compiler option.
2. Link the file:
armlink shapes.o --info totals -o shapes.axf
3. Use an ELF, DWARF 2, and DWARF 3 compatible debugger to load and run the image.
See the
readme.txt
file that accompanies the example for more information.
3.2.2 Compiling for ARM code
The following compiler options generate ARM code:
--arm
Tells the compiler to generate ARM code in preference to Thumb code. However,
#pragma thumb
overrides this option.
This is the default compiler option.
--arm_only
Forces the compiler to generate only ARM code. The compiler behaves as if
Thumb is absent from the target architecture. Any
#pragma thumb
declarations are
ignored.
3.2.3 Compiling for Thumb code
To build a Thumb version use:
armcc --thumb ...
Creating an application
ARM DUI 0529C Copyright © 2010-2011 ARM. All rights reserved. 3-4
ID080411 Non-Confidential
where:
--thumb
Tells the compiler to generate Thumb code in preference to ARM code.
However,
#pragma arm
overrides this option.
3.2.4 See also
Tasks
Using the linker on page 3-5.
Using the Compiler:
Chapter 3 Getting started with the Compiler.
Reference
Compiler Reference:
Chapter 3 Compiler Command-line Options
--arm on page 3-15
--arm_only on page 3-23
-c on page 3-31
--debug, --no_debug on page 3-55
-g on page 3-103
-o filename on page 3-152
-Onum on page 3-154
--thumb on page 3-194
#pragma arm on page 5-82
#pragma thumb on page 5-110.

RS41P-KT-30000

Mfr. #:
Manufacturer:
Description:
RVDS 4.1 PROFESSIONAL WNL
Lifecycle:
New from this manufacturer.
Delivery:
DHL FedEx Ups TNT EMS
Payment:
T/T Paypal Visa MoneyGram Western Union

Products related to this Datasheet