logo资料库

IAR编译器手册.pdf

第1页 / 共412页
第2页 / 共412页
第3页 / 共412页
第4页 / 共412页
第5页 / 共412页
第6页 / 共412页
第7页 / 共412页
第8页 / 共412页
资料共412页,剩余部分请下载后查看
Brief contents
Contents
Tables
Preface
Who should read this guide
How to use this guide
What this guide contains
Part 1. Using the build tools
Part 2. Reference information
Glossary
Other documentation
Further reading
Document conventions
Typographic conventions
Naming conventions
Part 1. Using the build tools
Introduction to the IAR build tools
The IAR build tools-an overview
IAR C/C++ Compiler
IAR Assembler
The IAR ILINK Linker
Specific ELF tools
External tools
IAR language overview
Device support
Supported ARM devices
Preconfigured support files
Header files for I/O
Device description files
Examples for getting started
Special support for embedded systems
Extended keywords
Pragma directives
Predefined symbols
Special function types
Accessing low-level features
Developing embedded applications
Developing embedded software using IAR build tools
Mapping of internal and external memory
Communication with peripheral units
Event handling
System startup
Real-time operating systems
Interoperability with other build tools
The build process-an overview
The translation process
The linking process
After linking
Application execution-an overview
The initialization phase
The execution phase
The termination phase
Basic project configuration
Processor configuration
Processor variant
CPU mode
Interworking
VFP and floating-point arithmetic
Byte order
Optimization for speed and size
Runtime environment
Setting up for the runtime environment in the IDE
Setting up for the runtime environment from the command line
Setting library and runtime environment options
Data storage
Introduction
Different ways to store data
Auto variables-on the stack
The stack
Advantages
Potential problems
Dynamic memory on the heap
Potential problems
Functions
Function-related extensions
ARM and Thumb code
Execution in RAM
Primitives for interrupts, concurrency, and OS-related programming
Interrupt functions
Installing exception functions
Interrupts and fast interrupts
Nested interrupts
Software interrupts
Calling a software interrupt function
The software interrupt handler and functions
The software interrupt functions
Setting up the software interrupt stack pointer
Interrupt operations
Interrupts for ARM Cortex-M
C++ and special function types
Linking using ILINK
Linking-an overview
Modules and sections
The linking process
Placing code and data-the linker configuration file
A simple example of a configuration file
Initialization at system startup
The initialization process
Linking your application
Linking considerations
Choosing a linker configuration file
Defining your own memory areas
Adding an additional region
Merging different areas into one region
Adding a region in a new memory
Defining the unit size for a new memory
Sharing memories
Placing sections
Placing a section at a specific address in memory
Placing a section first or last in a region
Define and place your own sections
Reserving space in RAM
Keeping modules
Keeping symbols and sections
Application startup
Setting up the stack
Setting up the heap
Setting up the atexit limit
Changing the default initialization
Choosing packing algorithm
Overriding default copy-initialize function
Manual initialization
Initializing code-copying ROM to RAM
Running all code from RAM
Interaction between ILINK and the application
Standard library handling
Producing other output formats than ELF/DWARF
Veneers
Hints for troubleshooting
Relocation errors
Possible solutions
The DLIB runtime environment
Introduction to the runtime environment
Runtime environment functionality
Library selection
Situations that require library building
Library configurations
Low-level interface for debug support
Using a prebuilt library
Library filename syntax
Library files for C/C++ standard library functions
Library files for runtime support functions
Library files for debug support functions
Customizing a prebuilt library without rebuilding
Choosing formatters for printf and scanf
Choosing printf formatter
Specifying the print formatter in the IDE
Specifying printf formatter from the command line
Choosing scanf formatter
Specifying scanf formatter in the IDE
Specifying scanf formatter from the command line
Overriding library modules
Overriding library modules using the IDE
Overriding library modules from the command line
Building and using a customized library
Setting up a library project
Modifying the library functionality
Modifying the library configuration file
Using a customized library
System startup and termination
System startup
System termination
C-SPY interface to system termination
Customizing system initialization
_ _low_level_init
Modifying the file cstartup.s
Standard streams for input and output
Implementing low-level character input and output
Example of using _ _write and _ _read
Configuration symbols for printf and scanf
Customizing formatting capabilities
File input and output
Locale
Locale support in prebuilt libraries
Customizing the locale support
Locale configuration symbols
Building a library without support for locale interface
Building a library with support for locale interface
Changing locales at runtime
Example
Environment interaction
Signal and raise
Time
Strtod
Assert
Atexit
C-SPY runtime interface
Low-level debugger runtime interface
The debugger terminal I/O window
Speeding up terminal output
Checking module consistency
Runtime model attributes
Using runtime model attributes
Assembler language interface
Mixing C and assembler
Intrinsic functions
Mixing C and assembler modules
Inline assembler
Calling assembler routines from C
Creating skeleton code
Compiling the code
The output file
Calling assembler routines from C++
Calling convention
Function declarations
Using C linkage in C++ source code
Preserved versus scratch registers
Scratch registers
Preserved registers
Special registers
Function entrance
Hidden parameters
Register parameters
Stack parameters and layout
Function exit
Registers used for returning values
Stack layout at function exit
Return address handling
Examples
Call frame information
Using C++
Overview
Standard Embedded C++
Extended Embedded C++
Enabling C++ support
Feature descriptions
Classes
Functions
Templates
The standard template library
Variants of casts
Mutable
Namespace
The STD namespace
Pointer to member functions
Using interrupts and EC++ destructors
C++ language extensions
Application-related considerations
Output format considerations
Stack considerations
Exception stacks
Heap considerations
Heap size and standard I/O
Interaction between the tools and your application
Checksum calculation
Calculating a checksum
Creating a place for the calculated checksum
Running ichecksum
Adding a checksum function to your source code
A function for checksum calculation
Checksum calculation
Things to remember
AEABI compliance
Linking AEABI compliant modules using the IAR ILINK Linker
Linking AEABI compliant modules using a linker from a different vendor
Enabling AEABI compliance in the compiler
Efficient coding for embedded applications
Selecting data types
Using efficient data types
Floating-point types
Alignment of elements in a structure
Anonymous structs and unions
Controlling data and function placement in memory
Data placement at an absolute location
Examples
C++ considerations
Data and function placement in sections
Examples of placing variables in named sections
Examples of placing functions in named sections
Controlling compiler optimizations
Scope for performed optimizations
Multi-file compilation units
Optimization levels
Speed versus size
Fine-tuning enabled transformations
Common subexpression elimination
Loop unrolling
Function inlining
Code motion
Type-based alias analysis
Static clustering
Instruction scheduling
Writing efficient code
Saving stack space and RAM memory
Function prototypes
Prototyped style
Kernighan & Ritchie style
Integer types and bit negation
Protecting simultaneously accessed variables
Accessing special function registers
Passing values between C and assembler objects
Non-initialized variables
Part 2. Reference information
External interface details
Invocation syntax
Compiler invocation syntax
ILINK invocation syntax
Passing options
Environment variables
Include file search procedure
Compiler output
Error return codes
ILINK output
Diagnostics
Message format for the compiler
Message format for the linker
Severity levels
Remark
Warning
Error
Fatal error
Setting the severity level
Internal error
Compiler options
Options syntax
Types of options
Rules for specifying parameters
Rules for optional parameters
Rules for mandatory parameters
Rules for options with both optional and mandatory parameters
Rules for specifying a filename or directory as parameters
Additional rules
Summary of compiler options
Descriptions of options
--aapcs
--aeabi
--arm
--char_is_signed
--cpu
--cpu_mode
-D
--debug, -r
--dependencies
--diag_error
--diag_remark
--diag_suppress
--diag_warning
--diagnostics_tables
--discard_unused_publics
--dlib_config
-e
--ec++
--eec++
--enable_multibytes
--endian
--enum_is_int
--error_limit
-f
--fpu
--header_context
-I
--interwork
-l
--legacy
--mfc
--migration_preprocessor_extensions
--no_clustering
--no_code_motion
--no_cse
--no_fragments
--no_guard_calls
--no_inline
--no_path_in_file_macros
--no_scheduling
--no_tbaa
--no_typedefs_in_diagnostics
--no_unaligned_access
--no_unroll
--no_warnings
--no_wrap_diagnostics
-O
-o, --output
--only_stdout
--output, -o
--predef_macros
--preinclude
--preprocess
--public_equ
-r, --debug
--remarks
--require_prototypes
--section
--separate_cluster_for_initialized_variables
--silent
--strict_ansi
--thumb
--warnings_affect_exit_code
--warnings_are_errors
Linker options
Summary of linker options
Descriptions of options
--BE8
--BE32
--config
--config_def
--cpp_init_routine
--cpu
--define_symbol
--diag_error
--diag_remark
--diag_suppress
--diag_warning
--diagnostics_tables
--entry
--error_limit
--export_builtin_config
-f
--force_output
--image_input
--keep
--log
--log_file
--mangled_names_in_messages
--map
--no_fragments
--no_library_search
--no_locals
--no_remove
--no_veneers
--no_warnings
--no_wrap_diagnostics
-o, --output
--only_stdout
--ose_load_module
--output, -o
--pi_veneers
--place_holder
--redirect
--remarks
--semihosting
--silent
--strip
--warnings_affect_exit_code
--warnings_are_errors
Data representation
Alignment
Alignment on the ARM core
Byte order
Basic data types
Integer types
Bool
The enum type
The char type
The wchar_t type
Bitfields
Floating-point types
32-bit floating-point format
64-bit floating-point format
Representation of special floating-point numbers
Pointer types
Function pointers
Data pointers
Casting
size_t
ptrdiff_t
intptr_t
uintptr_t
Structure types
Alignment
General layout
Packed structure types
Type qualifiers
Declaring objects volatile
Definition of access to volatile objects
Rules for accesses
Declaring objects const
Data types in C++
Compiler extensions
Compiler extensions overview
Enabling language extensions
C language extensions
Important language extensions
Useful language extensions
Inline assembler
Compound literals
Incomplete arrays at end of structs
Hexadecimal floating-point constants
Designated initializers in structures and arrays
Minor language extensions
Extended keywords
General syntax rules for extended keywords
Type attributes
Syntax for type attributes used on data objects
Syntax for type attributes on data pointers
Syntax for type attributes on functions
Object attributes
Syntax for object attributes
Summary of extended keywords
Descriptions of extended keywords
_ _arm
_ _big_endian
_ _fiq
_ _interwork
_ _intrinsic
_ _irq
_ _little_endian
_ _nested
_ _no_init
_ _ramfunc
_ _noreturn
_ _packed
_ _root
_ _swi
_ _thumb
_ _weak
Pragma directives
Summary of pragma directives
Descriptions of pragma directives
bitfields
data_alignment
diag_default
diag_error
diag_remark
diag_suppress
diag_warning
include_alias
inline
language
location
message
object_attribute
optimize
pack
_ _printf_args
required
rtmodel
_ _scanf_args
section
swi_number
type_attribute
Intrinsic functions
Summary of intrinsic functions
Descriptions of intrinsic functions
_ _CLZ
_ _disable_fiq
_ _disable_interrupt
_ _disable_irq
_ _DMB
_ _DSB
_ _enable_fiq
_ _enable_interrupt
_ _enable_irq
_ _get_BASEPRI
_ _get_CONTROL
_ _get_CPSR
_ _get_FAULTMASK
_ _get_interrupt_state
_ _get_PRIMASK
_ _ISB
_ _LDREX
_ _MCR
_ _MRC
_ _no_operation
_ _QADD
_ _QADD8
_ _QADD16
_ _QASX
_ _QDADD
_ _QDSUB
_ _QFlag
_ _QSUB
_ _QSUB8
_ _QSUB16
_ _QSAX
_ _reset_Q_flag
_ _REV
_ _REVSH
_ _SADD8
_ _SADD16
_ _SASX
_ _SEL
_ _set_BASEPRI
_ _set_CONTROL
_ _set_CPSR
_ _set_FAULTMASK
_ _set_interrupt_state
_ _set_PRIMASK
_ _SHADD8
_ _SHADD16
_ _SHASX
_ _SHSUB8
_ _SHSUB16
_ _SHSAX
_ _SMUL
_ _SSUB8
_ _SSUB16
_ _SSAX
_ _STREX
_ _UADD8
_ _UADD16
_ _UASX
_ _UHADD8
_ _UHADD16
_ _UHASX
_ _UQADD8
_ _UQADD16
_ _UQASX
_ _UQSUB8
_ _UQSUB16
_ _UQSAX
_ _USAX
_ _USUB8
_ _USUB16
The preprocessor
Overview of the preprocessor
Descriptions of predefined preprocessor symbols
_ _TID_ _
Descriptions of miscellaneous preprocessor extensions
NDEBUG
_Pragma()
#warning message
_ _VA_ARGS_ _
Library functions
Introduction
Header files
Library object files
Reentrancy
IAR DLIB Library
C header files
C++ header files
Embedded C++
Extended Embedded C++ standard template library
Using standard C libraries in C++
Library functions as intrinsic functions
Added C functionality
ctype.h
inttypes.h
math.h
stdbool.h
stdint.h
stdio.h
stdlib.h
wchar.h
wctype.h
The linker configuration file
Overview
Defining memories and regions
Define memory directive
Define region directive
Regions
Region literal
Region expression
Empty region
Section handling
Define block directive
Define overlay directive
Initialize directive
Do not initialize directive
Keep directive
Place at directive
Place in directive
Section selection
Section-selectors
Extended-selectors
Using symbols, expressions, and numbers
Define symbol directive
Export directive
Expressions
Numbers
Structural configuration
If directive
Include directive
Section reference
Summary of sections
Descriptions of sections and blocks
.bss
CSTACK
.cstart
.data
.data_init
.difunct
HEAP
.iar.dynexit
.intvec
IRQ_STACK
.noinit
.rodata
.text
IAR utilities
The IAR Archive Builder-iarchive
Invocation syntax
Parameters
Example
Summary of iarchive options
Descriptions of options
-o
-f
--verbose, -V
Diagnostic messages
La001: could not open file filename
La002: illegal path pathname
La003: filename is not an ELF file
La004: ar header field width exceeded: string has more than n characters
Ms003: could not open file filename for writing
Ms004: problem writing to file filename
Ms005: problem closing file filename
The IAR ELF Tool-ielftool
Invocation syntax
Parameters
Example
Summary of ielftool options
Descriptions of options
--bin
--checksum
--fill
--ihex
--silent
--simple
--srec
--srec-len
--srec-s3only
--strip
--verbose
The IAR ELF Dumper for ARM-ielfdumparm
Invocation syntax
Parameters
Summary of ielfdumparm options
Descriptions of options
--all
-o, --output
--section, -s
--raw
The IAR Absolute Symbol Exporter-isymexport
Invocation syntax
Parameters
Summary of isymexport options
Descriptions of options
--edit
Steering files
Syntax
Example
Show directive
Hide directive
Rename directive
Diagnostic messages
Es001: could not open file filename
Es002: illegal path pathname
Es003: format error: message
Es004: no input file
Es005: no output file
Es006: too many input files
Es007: input file is not an ELF executable
Es008: unknown directive: directive
Es009: unexpected end of file
Es010: unexpected end of line
Es011: unexpected text after end of directive
Es012: expected text
Es013: pattern can contain at most one * or ?
Es014: rename patterns have different wildcards
Es014: ambiguous pattern match: symbol matches more than one rename pattern
Implementation-defined behavior
Descriptions of implementation-defined behavior
Translation
Diagnostics (5.1.1.3)
Environment
Arguments to main (5.1.2.2.2.1)
Interactive devices (5.1.2.3)
Identifiers
Significant characters without external linkage (6.1.2)
Significant characters with external linkage (6.1.2)
Case distinctions are significant (6.1.2)
Characters
Source and execution character sets (5.2.1)
Bits per character in execution character set (5.2.4.2.1)
Mapping of characters (6.1.3.4)
Unrepresented character constants (6.1.3.4)
Character constant with more than one character (6.1.3.4)
Converting multibyte characters (6.1.3.4)
Range of 'plain' char (6.2.1.1)
Integers
Range of integer values (6.1.2.5)
Demotion of integers (6.2.1.2)
Signed bitwise operations (6.3)
Sign of the remainder on integer division (6.3.5)
Negative valued signed right shifts (6.3.7)
Floating point
Representation of floating-point values (6.1.2.5)
Converting integer values to floating-point values (6.2.1.3)
Demoting floating-point values (6.2.1.4)
Arrays and pointers
size_t (6.3.3.4, 7.1.1)
Conversion from/to pointers (6.3.4)
ptrdiff_t (6.3.6, 7.1.1)
Registers
Honoring the register keyword (6.5.1)
Structures, unions, enumerations, and bitfields
Improper access to a union (6.3.2.3)
Padding and alignment of structure members (6.5.2.1)
Sign of 'plain' bitfields (6.5.2.1)
Allocation order of bitfields within a unit (6.5.2.1)
Can bitfields straddle a storage-unit boundary (6.5.2.1)
Integer type chosen to represent enumeration types (6.5.2.2)
Qualifiers
Access to volatile objects (6.5.3)
Declarators
Maximum numbers of declarators (6.5.4)
Statements
Maximum number of case statements (6.6.4.2)
Preprocessing directives
Character constants and conditional inclusion (6.8.1)
Including bracketed filenames (6.8.2)
Including quoted filenames (6.8.2)
Character sequences (6.8.2)
Recognized pragma directives (6.8.6)
Default _ _DATE_ _ and _ _TIME_ _ (6.8.8)
IAR DLIB Library functions
NULL macro (7.1.6)
Diagnostic printed by the assert function (7.2)
Domain errors (7.5.1)
Underflow of floating-point values sets errno to ERANGE (7.5.1)
fmod() functionality (7.5.6.4)
signal() (7.7.1.1)
Terminating newline character (7.9.2)
Blank lines (7.9.2)
Null characters appended to data written to binary streams (7.9.2)
Files (7.9.3)
remove() (7.9.4.1)
rename() (7.9.4.2)
%p in printf() (7.9.6.1)
%p in scanf() (7.9.6.2)
Reading ranges in scanf() (7.9.6.2)
File position errors (7.9.9.1, 7.9.9.4)
Message generated by perror() (7.9.10.4)
Allocating zero bytes of memory (7.10.3)
Behavior of abort() (7.10.4.1)
Behavior of exit() (7.10.4.3)
Environment (7.10.4.4)
system() (7.10.4.5)
Message returned by strerror() (7.11.6.2)
The time zone (7.12.1)
clock() (7.12.2.1)
Glossary
A
B
C
D
E
F
G
H
I
K
L
M
N
O
P
Q
R
S
T
U
V
W
X
Z
Index
A
B
C
D
E
F
G
H
I
K
L
M
N
O
P
Q
R
S
T
U
V
W
X
Z
Symbols
Numerics
IAR C/C++ Development Guide Compiling and linking for Advanced RISC Machines Ltd’s ARM® Cores DARM-2
COPYRIGHT NOTICE Copyright © 1999–2008 IAR Systems AB. No part of this document may be reproduced without the prior written consent of IAR Systems AB. The software described in this document is furnished under a license and may only be used or copied in accordance with the terms of such a license. DISCLAIMER The information in this document is subject to change without notice and does not represent a commitment on any part of IAR Systems. While the information contained herein is assumed to be accurate, IAR Systems assumes no responsibility for any errors or omissions. In no event shall IAR Systems, its employees, its contractors, or the authors of this document be liable for special, direct, indirect, or consequential damage, losses, costs, charges, claims, demands, claim for lost profits, fees, or expenses of any nature or kind. TRADEMARKS IAR Systems, IAR Embedded Workbench, C-SPY, visualSTATE, From Idea To Target, IAR KickStart Kit, IAR PowerPac, IAR YellowSuite, IAR Advanced Development Kit, IAR, and the IAR Systems logotype are trademarks or registered trademarks owned by IAR Systems AB. J-Link is a trademark licensed to IAR Systems AB. Microsoft and Windows are registered trademarks of Microsoft Corporation. ARM, Thumb, and Cortex are registered trademarks of Advanced RISC Machines Ltd. All other product names are trademarks or registered trademarks of their respective owners. EDITION NOTICE Second edition: June 2008 Part number: DARM-2 This guide applies to version 5.2x of IAR Embedded Workbench® for ARM. The IAR C/C++ Development Guide for ARM® replaces all versions of the ARM® IAR C/C++ Compiler Reference Guide and the IAR Linker and Library Tools Reference Guide. Internal reference: ISUD, T7, 5.3.0. DARM-2
Brief contents Tables .................................................................................................................... xxv Preface ................................................................................................................ xxvii Part 1. Using the build tools ..................................................... 1 Introduction to the IAR build tools .......................................................... 3 Developing embedded applications ........................................................... 9 Data storage ...................................................................................................... 25 Functions ............................................................................................................... 29 Linking using ILINK ........................................................................................ 37 Linking your application ................................................................................ 45 The DLIB runtime environment .............................................................. 59 Assembler language interface ................................................................... 89 Using C++ .......................................................................................................... 103 Application-related considerations ....................................................... 111 Efficient coding for embedded applications ...................................... 121 Part 2. Reference information ........................................... 139 External interface details ............................................................................ 141 Compiler options ........................................................................................... 149 Linker options .................................................................................................. 181 Data representation ...................................................................................... 199 Compiler extensions .................................................................................... 211 Extended keywords ....................................................................................... 221 iii DARM-2
Pragma directives ............................................................................................ 233 Intrinsic functions ........................................................................................... 247 The preprocessor ........................................................................................... 265 Library functions ............................................................................................. 271 The linker configuration file ...................................................................... 279 Section reference ............................................................................................ 299 IAR utilities ........................................................................................................ 303 Implementation-defined behavior .......................................................... 321 Glossary .............................................................................................................. 333 Index ..................................................................................................................... 355 iv IAR C/C++ Development Guide Compiling and linking DARM-2
Contents Tables .................................................................................................................... xxv Preface ................................................................................................................ xxvii Who should read this guide ...........................................................xxvii How to use this guide ......................................................................xxvii What this guide contains ..............................................................xxviii Other documentation ........................................................................xxix Further reading ................................................................................. xxx Document conventions .....................................................................xxxi Typographic conventions ................................................................xxxi Naming conventions ......................................................................xxxii Part 1. Using the build tools .................................................... 1 Introduction to the IAR build tools .......................................................... 3 The IAR build tools—an overview ..................................................... 3 IAR C/C++ Compiler ........................................................................... 3 IAR Assembler ..................................................................................... 4 The IAR ILINK Linker ........................................................................ 4 Specific ELF tools ................................................................................ 4 External tools ....................................................................................... 5 IAR language overview ........................................................................... 5 Device support ........................................................................................... 6 Supported ARM devices ...................................................................... 6 Preconfigured support files .................................................................. 6 Examples for getting started ................................................................ 6 Special support for embedded systems .......................................... 7 Extended keywords .............................................................................. 7 Pragma directives ................................................................................. 7 Predefined symbols .............................................................................. 7 Special function types .......................................................................... 7 Accessing low-level features ............................................................... 8 v DARM-2
Developing embedded applications ........................................................... 9 Developing embedded software using IAR build tools ............ 9 Mapping of internal and external memory ........................................... 9 Communication with peripheral units ................................................ 10 Event handling ................................................................................... 10 System startup .................................................................................... 10 Real-time operating systems .............................................................. 10 Interoperability with other build tools ............................................... 11 The build process—an overview ...................................................... 11 The translation process ....................................................................... 11 The linking process ............................................................................ 12 After linking ....................................................................................... 14 Application execution—an overview ............................................. 14 The initialization phase ...................................................................... 15 The execution phase ........................................................................... 19 The termination phase ........................................................................ 19 Basic project configuration ................................................................. 19 Processor configuration ...................................................................... 20 Optimization for speed and size ......................................................... 21 Runtime environment ......................................................................... 22 Data storage ...................................................................................................... 25 Introduction ............................................................................................. 25 Different ways to store data ............................................................... 25 Auto variables—on the stack ............................................................ 26 The stack ............................................................................................ 26 Dynamic memory on the heap ........................................................ 27 Functions ............................................................................................................... 29 Function-related extensions .............................................................. 29 ARM and Thumb code ........................................................................ 29 Execution in RAM ................................................................................... 30 vi IAR C/C++ Development Guide Compiling and linking DARM-2
Contents Primitives for interrupts, concurrency, and OS-related programming ............................................................................................ 30 Interrupt functions ............................................................................. 31 Installing exception functions ............................................................ 31 Interrupts and fast interrupts .............................................................. 32 Nested interrupts ................................................................................ 33 Software interrupts ............................................................................. 34 Interrupt operations ............................................................................ 35 Interrupts for ARM Cortex-M ............................................................ 36 C++ and special function types ......................................................... 36 Linking using ILINK ........................................................................................ 37 Linking—an overview ............................................................................ 37 Modules and sections ............................................................................ 38 The linking process ................................................................................ 39 Placing code and data—the linker configuration file .............. 40 A simple example of a configuration file ........................................... 41 Initialization at system startup ......................................................... 43 The initialization process ................................................................... 44 Linking your application ................................................................................ 45 Linking considerations .......................................................................... 45 Choosing a linker configuration file .................................................. 45 Defining your own memory areas ...................................................... 46 Placing sections .................................................................................. 47 Reserving space in RAM ................................................................... 49 Keeping modules ................................................................................ 49 Keeping symbols and sections ........................................................... 49 Application startup ............................................................................. 50 Setting up the stack ............................................................................ 50 Setting up the heap ............................................................................. 50 Setting up the atexit limit ................................................................... 50 Changing the default initialization ..................................................... 51 Interaction between ILINK and the application ................................. 54 Standard library handling ................................................................... 55 vii DARM-2
Producing other output formats than ELF/DWARF .......................... 55 Veneers ............................................................................................... 55 Hints for troubleshooting .................................................................. 55 Relocation errors ................................................................................ 56 The DLIB runtime environment .............................................................. 59 Introduction to the runtime environment .................................. 59 Runtime environment functionality ................................................... 59 Library selection ................................................................................ 60 Situations that require library building .............................................. 61 Library configurations ....................................................................... 61 Low-level interface for debug support ............................................... 62 Using a prebuilt library ........................................................................ 62 Library filename syntax ..................................................................... 63 Customizing a prebuilt library without rebuilding ............................ 64 Choosing formatters for printf and scanf ..................................... 65 Choosing printf formatter ................................................................... 65 Choosing scanf formatter .................................................................. 66 Overriding library modules ............................................................... 67 Building and using a customized library ....................................... 69 Setting up a library project ................................................................. 69 Modifying the library functionality .................................................... 69 Using a customized library ................................................................ 70 System startup and termination ...................................................... 70 System startup .................................................................................... 71 System termination ............................................................................ 73 Customizing system initialization ................................................... 74 __low_level_init ............................................................................... 74 Modifying the file cstartup.s ............................................................. 75 Standard streams for input and output ........................................ 75 Implementing low-level character input and output .......................... 75 Configuration symbols for printf and scanf ................................. 77 Customizing formatting capabilities .................................................. 78 File input and output ............................................................................. 78 viii IAR C/C++ Development Guide Compiling and linking DARM-2
分享到:
收藏