EWARM DevelopmentGuide - ENU
EWARM DevelopmentGuide - ENU
EWARM DevelopmentGuide - ENU
Guide
Compiling and Linking
DARM-25
COPYRIGHT NOTICE
© 1999–2019 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, Embedded Trust, C-Trust, IAR Connect,
C-SPY, C-RUN, C-STAT, IAR Visual State, IAR KickStart Kit, I-jet, I-jet Trace,
I-scope, IAR Academy, IAR, and the logotype of IAR Systems are trademarks or
registered trademarks owned by IAR Systems AB.
Microsoft and Windows are registered trademarks of Microsoft Corporation.
Arm, Cortex, Thumb, and TrustZone are registered trademarks of Arm Limited.
EmbeddedICE is a trademark of Arm Limited. uC/OS-II and uC/OS-III are trademarks
of Micrium, Inc. CMX-RTX is a trademark of CMX Systems, Inc. ThreadX is a
trademark of Express Logic. RTXC is a trademark of Quadros Systems. Fusion is a
trademark of Unicoi Systems.
Renesas Synergy is a trademark of Renesas Electronics Corporation.
Adobe and Acrobat Reader are registered trademarks of Adobe Systems Incorporated.
All other product names are trademarks or registered trademarks of their respective
owners.
EDITION NOTICE
Twenty-fifth edition: May 2019
Part number: DARM-25
This guide applies to version 8.40.x of IAR Embedded Workbench® for Arm.
Internal reference: BB5, csrct2010.1, V_110411, INIT.
AFE1_AFE2-1:1
Brief contents
Tables ..................................................................................................................... 41
Preface .................................................................................................................... 43
Functions ............................................................................................................... 77
AFE1_AFE2-1:1
Pragma directives ........................................................................................... 383
AFE1_AFE2-1:1
Contents
Tables ..................................................................................................................... 41
Preface .................................................................................................................... 43
Who should read this guide ............................................................... 43
Required knowledge .......................................................................... 43
How to use this guide .......................................................................... 43
What this guide contains ................................................................... 44
Part 1. Using the build tools ............................................................... 44
Part 2. Reference information ............................................................ 44
Other documentation ........................................................................... 45
User and reference guides .................................................................. 46
The online help system ...................................................................... 46
Further reading ................................................................................... 47
Web sites ............................................................................................ 47
Document conventions ........................................................................ 48
Typographic conventions ................................................................... 48
Naming conventions .......................................................................... 49
AFE1_AFE2-1:1
Special support for embedded systems ........................................ 57
Extended keywords ............................................................................ 57
Pragma directives ............................................................................... 57
Predefined symbols ............................................................................ 57
Accessing low-level features ............................................................. 57
Introduction ............................................................................................. 73
Different ways to store data ............................................................... 73
Storage of auto variables and parameters .................................. 74
The stack ............................................................................................ 74
Dynamic memory on the heap ........................................................ 75
Potential problems .............................................................................. 75
AFE1_AFE2-1:1
Contents
Functions ............................................................................................................... 77
AFE1_AFE2-1:1
Result of an analysis—the map file contents ................................... 100
Specifying additional stack usage information ................................ 101
Limitations ....................................................................................... 103
Situations where warnings are issued .............................................. 104
Call graph log ................................................................................... 104
Call graph XML output .................................................................... 105
AFE1_AFE2-1:1
Contents
AFE1_AFE2-1:1
__read .............................................................................................. 154
remove .............................................................................................. 155
rename .............................................................................................. 156
signal ................................................................................................ 156
system ............................................................................................... 157
__time32, __time64 ......................................................................... 157
__write ............................................................................................. 157
Configuration symbols for file input and output .............................. 159
Locale ............................................................................................... 159
Managing a multithreaded environment .................................... 160
Multithread support in the DLIB runtime environment ................... 161
Enabling multithread support ........................................................... 162
C++ exceptions in threads ................................................................ 162
AFE1_AFE2-1:1
Contents
11
AFE1_AFE2-1:1
Interaction between the tools and your application ............. 209
Checksum calculation for verifying image integrity .............. 210
Briefly about checksum calculation ................................................. 211
Calculating and verifying a checksum ............................................. 212
Troubleshooting checksum calculation ............................................ 217
AEABI compliance ............................................................................... 218
Linking AEABI-compliant modules using the IAR ILINK linker .. 219
Linking AEABI-compliant modules using a third-party linker ....... 220
Enabling AEABI compliance in the compiler ................................. 220
CMSIS integration ................................................................................ 221
CMSIS DSP library .......................................................................... 221
Customizing the CMSIS DSP library .............................................. 221
Building with CMSIS on the command line .................................... 221
Building with CMSIS in the IDE ..................................................... 222
Arm TrustZone® .................................................................................. 222
An example using the Armv8-M Security Extensions (CMSE) ...... 223
Patching symbol definitions using $Super$$ and $Sub$$ ... 225
An example using the $Super$$ and $Sub$$ patterns ..................... 225
AFE1_AFE2-1:1
Contents
13
AFE1_AFE2-1:1
Compiler options ........................................................................................... 259
AFE1_AFE2-1:1
Contents
15
AFE1_AFE2-1:1
--no_tbaa .......................................................................................... 293
--no_typedefs_in_diagnostics .......................................................... 293
--no_unaligned_access ..................................................................... 293
--no_uniform_attribute_syntax ........................................................ 294
--no_unroll ....................................................................................... 294
--no_var_align .................................................................................. 295
--no_warnings .................................................................................. 295
--no_wrap_diagnostics ..................................................................... 295
--nonportable_path_warnings .......................................................... 296
-O ..................................................................................................... 296
--only_stdout .................................................................................... 297
--output, -o ....................................................................................... 297
--pending_instantiations ................................................................... 297
--predef_macros ............................................................................... 298
--preinclude ..................................................................................... 298
--preprocess ...................................................................................... 299
--public_equ ..................................................................................... 299
--relaxed_fp ...................................................................................... 299
--remarks .......................................................................................... 300
--require_prototypes ......................................................................... 300
--ropi ................................................................................................. 301
--ropi_cb ........................................................................................... 301
--rwpi ................................................................................................ 302
--rwpi_near ....................................................................................... 302
--section ............................................................................................ 303
--silent .............................................................................................. 303
--source_encoding ............................................................................ 304
--stack_protection ............................................................................. 304
--strict ............................................................................................... 304
--system_include_dir ........................................................................ 305
--text_out .......................................................................................... 305
--thumb ............................................................................................. 306
--uniform_attribute_syntax .............................................................. 306
--use_c++_inline .............................................................................. 306
AFE1_AFE2-1:1
Contents
17
AFE1_AFE2-1:1
--entry ............................................................................................... 324
--entry_list_in_address_order .......................................................... 324
--error_limit ...................................................................................... 325
--exception_tables ............................................................................ 325
--export_builtin_config .................................................................... 326
--extra_init ........................................................................................ 326
-f ....................................................................................................... 326
--f ...................................................................................................... 327
--force_exceptions ............................................................................ 327
--force_output ................................................................................... 328
--fpu .................................................................................................. 328
--image_input ................................................................................... 328
--import_cmse_lib_in ....................................................................... 329
--import_cmse_lib_out ..................................................................... 329
--inline .............................................................................................. 330
--keep ............................................................................................... 330
--log .................................................................................................. 331
--log_file ........................................................................................... 331
--mangled_names_in_messages ....................................................... 332
--manual_dynamic_initialization ..................................................... 332
--map ................................................................................................ 332
--merge_duplicate_sections ............................................................. 333
--no_bom .......................................................................................... 334
--no_dynamic_rtti_elimination ........................................................ 334
--no_entry ......................................................................................... 334
--no_exceptions ................................................................................ 335
--no_fragments ................................................................................. 335
--no_free_heap ................................................................................. 335
--no_inline ........................................................................................ 336
--no_library_search .......................................................................... 336
--no_literal_pool ............................................................................... 336
--no_locals ........................................................................................ 337
--no_range_reservations ................................................................... 337
--no_remove ..................................................................................... 337
AFE1_AFE2-1:1
Contents
19
AFE1_AFE2-1:1
Byte order ................................................................................................ 350
Basic data types—integer types .................................................... 351
Integer types—an overview ............................................................. 351
Bool .................................................................................................. 351
The enum type .................................................................................. 352
The char type ................................................................................... 352
The wchar_t type ............................................................................. 352
The char16_t type ............................................................................. 352
The char32_t type ............................................................................. 352
Bitfields ............................................................................................ 352
Basic data types—floating-point types ....................................... 356
Floating-point environment .............................................................. 357
32-bit floating-point format ............................................................. 357
64-bit floating-point format ............................................................. 357
Representation of special floating-point numbers ........................... 358
Pointer types .......................................................................................... 358
Function pointers .............................................................................. 358
Data pointers .................................................................................... 358
Casting ............................................................................................. 359
Structure types ..................................................................................... 359
Alignment of structure types ............................................................ 359
General layout ................................................................................. 360
Packed structure types ..................................................................... 360
Type qualifiers ........................................................................................ 361
Declaring objects volatile ................................................................ 361
Declaring objects volatile and const ................................................ 362
Declaring objects const .................................................................... 363
Data types in C++ ................................................................................. 363
Extended keywords ...................................................................................... 365
AFE1_AFE2-1:1
Contents
21
AFE1_AFE2-1:1
data_alignment ................................................................................. 388
default_function_attributes .............................................................. 389
default_variable_attributes ............................................................... 390
deprecated ........................................................................................ 391
diag_default ...................................................................................... 391
diag_error ......................................................................................... 392
diag_remark ..................................................................................... 392
diag_suppress ................................................................................... 393
diag_warning .................................................................................... 393
error .................................................................................................. 393
function_category ............................................................................. 394
include_alias ..................................................................................... 394
inline ................................................................................................. 395
language ........................................................................................... 395
location ............................................................................................. 396
message ............................................................................................ 397
no_stack_protect .............................................................................. 398
object_attribute ................................................................................. 398
optimize ............................................................................................ 398
pack ................................................................................................. 400
__printf_args .................................................................................... 401
public_equ ........................................................................................ 401
required ............................................................................................ 401
rtmodel ............................................................................................. 402
__scanf_args .................................................................................... 403
section .............................................................................................. 403
stack_protect .................................................................................... 404
STDC CX_LIMITED_RANGE ....................................................... 404
STDC FENV_ACCESS ................................................................... 404
STDC FP_CONTRACT .................................................................. 405
swi_number ...................................................................................... 405
type_attribute ................................................................................... 406
unroll ................................................................................................ 406
vectorize ........................................................................................... 407
AFE1_AFE2-1:1
Contents
23
AFE1_AFE2-1:1
__CLZ .............................................................................................. 417
__crc32b .......................................................................................... 417
__crc32h .......................................................................................... 417
__crc32w .......................................................................................... 417
__crc32d .......................................................................................... 417
__crc32cb ......................................................................................... 418
__crc32ch ......................................................................................... 418
__crc32cw ........................................................................................ 418
__crc32cd ......................................................................................... 418
__disable_fiq .................................................................................... 418
__disable_interrupt .......................................................................... 418
__disable_irq .................................................................................... 419
__DMB ............................................................................................ 419
__DSB .............................................................................................. 419
__enable_fiq .................................................................................... 419
__enable_interrupt ........................................................................... 420
__enable_irq .................................................................................... 420
__fma ............................................................................................... 420
__fmaf .............................................................................................. 420
__get_BASEPRI .............................................................................. 420
__get_CONTROL ............................................................................ 421
__get_CPSR ..................................................................................... 421
__get_FAULTMASK ...................................................................... 421
__get_FPSCR .................................................................................. 421
__get_interrupt_state ....................................................................... 422
__get_IPSR ...................................................................................... 422
__get_LR ......................................................................................... 422
__get_MSP ...................................................................................... 423
__get_PRIMASK ............................................................................. 423
__get_PSP ........................................................................................ 423
__get_PSR ....................................................................................... 423
__get_SB .......................................................................................... 423
__get_SP .......................................................................................... 424
__ISB ............................................................................................... 424
AFE1_AFE2-1:1
Contents
25
AFE1_AFE2-1:1
__QSUB8 ......................................................................................... 431
__QSUB16 ....................................................................................... 431
__QCFlag ......................................................................................... 432
__QDOUBLE .................................................................................. 432
__QFlag ........................................................................................... 432
__RBIT ............................................................................................ 432
__reset_Q_flag ................................................................................. 433
__reset_QC_flag .............................................................................. 433
__REV ............................................................................................. 433
__REV16 ......................................................................................... 433
__REVSH ........................................................................................ 433
__rintn .............................................................................................. 433
__rintnf ............................................................................................ 433
__ROR ............................................................................................. 434
__RRX ............................................................................................. 434
__SADD8 ........................................................................................ 434
__SADD16 ...................................................................................... 434
__SASX ........................................................................................... 434
__SSAX ........................................................................................... 434
__SSUB8 ......................................................................................... 434
__SSUB16 ....................................................................................... 434
__SEL .............................................................................................. 435
__set_BASEPRI .............................................................................. 435
__set_CONTROL ............................................................................ 435
__set_CPSR ..................................................................................... 435
__set_FAULTMASK ...................................................................... 436
__set_FPSCR ................................................................................... 436
__set_interrupt_state ........................................................................ 436
__set_LR .......................................................................................... 436
__set_MSP ....................................................................................... 436
__set_PRIMASK ............................................................................. 437
__set_PSP ........................................................................................ 437
__set_SB .......................................................................................... 437
__set_SP .......................................................................................... 437
AFE1_AFE2-1:1
Contents
27
AFE1_AFE2-1:1
__SMUSDX ..................................................................................... 441
__SMUL .......................................................................................... 442
__SMULBB ..................................................................................... 442
__SMULBT ..................................................................................... 442
__SMULTB ..................................................................................... 442
__SMULTT ..................................................................................... 442
__SMULWB .................................................................................... 442
__SMULWT .................................................................................... 442
__sqrt ............................................................................................... 442
__sqrtf .............................................................................................. 442
__SSAT ............................................................................................ 443
__SSAT16 ........................................................................................ 443
__STC .............................................................................................. 444
__STCL ............................................................................................ 444
__STC2 ............................................................................................ 444
__STC2L .......................................................................................... 444
__STC_noidx ................................................................................... 445
__STCL_noidx ................................................................................ 445
__STC2_noidx ................................................................................. 445
__STC2L_noidx .............................................................................. 445
__STREX ......................................................................................... 446
__STREXB ...................................................................................... 446
__STREXD ...................................................................................... 446
__STREXH ...................................................................................... 446
__SWP ............................................................................................. 446
__SWPB .......................................................................................... 446
__SXTAB ........................................................................................ 447
__SXTAB16 .................................................................................... 447
__SXTAH ........................................................................................ 447
__SXTB16 ....................................................................................... 447
__TT ................................................................................................ 447
__TTT .............................................................................................. 447
__TTA .............................................................................................. 447
__TTAT ........................................................................................... 447
AFE1_AFE2-1:1
Contents
29
AFE1_AFE2-1:1
__VFNMS_F32 ............................................................................... 452
__VMINNM_F64 ............................................................................ 453
__VMAXNM_F64 .......................................................................... 453
__VMINNM_F32 ............................................................................ 453
__VMAXNM_F32 .......................................................................... 453
__VRINTA_F64 .............................................................................. 454
__VRINTM_F64 ............................................................................. 454
__VRINTN_F64 .............................................................................. 454
__VRINTP_F64 ............................................................................... 454
__VRINTX_F64 .............................................................................. 454
__VRINTR_F64 .............................................................................. 454
__VRINTZ_F64 .............................................................................. 454
__VRINTA_F32 .............................................................................. 454
__VRINTM_F32 ............................................................................. 454
__VRINTN_F32 .............................................................................. 454
__VRINTP_F32 ............................................................................... 454
__VRINTX_F32 .............................................................................. 454
__VRINTR_F32 .............................................................................. 454
__VRINTZ_F32 .............................................................................. 454
__VSQRT_F64 ................................................................................ 455
__VSQRT_F32 ................................................................................ 455
__WFE ............................................................................................. 456
__WFI .............................................................................................. 456
__YIELD ......................................................................................... 456
AFE1_AFE2-1:1
Contents
31
AFE1_AFE2-1:1
__PRETTY_FUNCTION__ ............................................................ 465
__ROPI__ ........................................................................................ 466
__RTTI__ ........................................................................................ 466
__RWPI__ ....................................................................................... 466
__STDC__ ....................................................................................... 466
__STDC_LIB_EXT1__ ................................................................... 466
__STDC_NO_ATOMICS__ ........................................................... 467
__STDC_NO_THREADS__ ........................................................... 467
__STDC_NO_VLA__ ..................................................................... 467
__STDC_UTF16__ ......................................................................... 467
__STDC_UTF32__ ......................................................................... 467
__STDC_VERSION__ ................................................................... 467
__TIME__ ....................................................................................... 467
__TIMESTAMP__ .......................................................................... 468
__VER__ ......................................................................................... 468
Descriptions of miscellaneous preprocessor extensions ..... 468
NDEBUG ........................................................................................ 468
__STDC_WANT_LIB_EXT1__ ..................................................... 468
#warning message ........................................................................... 469
AFE1_AFE2-1:1
Contents
33
AFE1_AFE2-1:1
Structural configuration .................................................................... 514
error directive ................................................................................... 514
if directive ........................................................................................ 514
include directive ............................................................................... 515
AFE1_AFE2-1:1
Contents
35
AFE1_AFE2-1:1
Hide directive ................................................................................... 545
Rename directive .............................................................................. 545
Diagnostic messages ........................................................................ 546
The IAR ELF Relocatable Object Creator—iexe2obj ........... 547
Invocation syntax ............................................................................. 547
Building the input file ...................................................................... 548
Summary of iexe2obj options .......................................................... 549
Descriptions of options ...................................................................... 549
--a ..................................................................................................... 549
--all ................................................................................................... 550
--bin .................................................................................................. 550
--bin-multi ........................................................................................ 550
--checksum ....................................................................................... 551
--code ............................................................................................... 556
--create ............................................................................................. 556
--delete, -d ........................................................................................ 556
--disasm_data ................................................................................... 557
--edit ................................................................................................. 557
--extract, -x ....................................................................................... 557
-f ....................................................................................................... 558
--fill .................................................................................................. 559
--front_headers ................................................................................. 559
--generate_vfe_header ...................................................................... 560
--hide_symbols ................................................................................. 560
--ihex ................................................................................................ 560
--keep_mode_symbols ..................................................................... 561
--no_bom .......................................................................................... 561
--no_header ...................................................................................... 561
--no_rel_section ............................................................................... 562
--no_strtab ........................................................................................ 562
--no_utf8_in ..................................................................................... 562
--offset .............................................................................................. 563
--output, -o ....................................................................................... 563
--parity .............................................................................................. 564
AFE1_AFE2-1:1
Contents
37
AFE1_AFE2-1:1
Implementation-defined behavior for Standard C++ .................. 579
AFE1_AFE2-1:1
Contents
39
AFE1_AFE2-1:1
IAR C/C++ Development Guide
40 Compiling and Linking for Arm
AFE1_AFE2-1:1
Tables
1: Typographic conventions used in this guide ......................................................... 48
2: Naming conventions used in this guide ................................................................ 49
3: Sections holding initialized data ........................................................................... 96
4: Description of a relocation error ......................................................................... 118
5: Example of runtime model attributes .................................................................. 120
6: Library configurations ......................................................................................... 134
7: Formatters for printf ............................................................................................ 140
8: Formatters for scanf ............................................................................................ 141
9: Library objects using TLS ................................................................................... 161
10: Inline assembler operand constraints ................................................................ 167
11: Supported constraint modifiers ......................................................................... 169
12: List of valid clobbers ......................................................................................... 170
13: Operand modifiers and transformations ............................................................ 171
14: Registers used for passing parameters .............................................................. 178
15: Registers used for returning values ................................................................... 180
16: Call frame information resources defined in a names block ............................. 183
17: Language extensions ......................................................................................... 188
18: Section operators and their symbols ................................................................. 191
19: Exception stacks for Arm7/9/11, Cortex-A, and Cortex-R ............................... 207
20: Memory ranges for TrustZone example ............................................................ 224
21: Compiler optimization levels ............................................................................ 236
22: Compiler environment variables ....................................................................... 251
23: ILINK environment variables ........................................................................... 251
24: Error return codes .............................................................................................. 253
25: Compiler options summary ............................................................................... 261
26: Linker options summary ................................................................................... 311
27: Integer types ...................................................................................................... 351
28: Floating-point types .......................................................................................... 356
29: Extended keywords summary ........................................................................... 368
30: Pragma directives summary .............................................................................. 383
31: Traditional Standard C header files—DLIB ..................................................... 474
41
AFE1_AFE2-1:1
32: C++ header files ................................................................................................ 475
33: New Standard C header files—DLIB ............................................................... 478
34: Examples of section selector specifications ...................................................... 508
35: Section summary ............................................................................................... 517
36: iarchive parameters ........................................................................................... 532
37: iarchive commands summary ............................................................................ 532
38: iarchive options summary ................................................................................. 533
39: ielftool parameters ............................................................................................. 535
40: ielftool options summary ................................................................................... 536
41: ielfdumparm parameters .................................................................................... 537
42: ielfdumparm options summary ......................................................................... 537
43: iobjmanip parameters ........................................................................................ 538
44: iobjmanip options summary .............................................................................. 539
45: isymexport parameters ...................................................................................... 542
46: isymexport options summary ............................................................................ 543
47: iexe2obj parameters .......................................................................................... 548
48: iexe2obj options summary ................................................................................ 549
49: Execution character sets and their encodings .................................................... 580
50: C++ implementation quantities ......................................................................... 595
51: Execution character sets and their encodings .................................................... 602
52: Translation of multibyte characters in the extended source character set ......... 615
53: Message returned by strerror()—DLIB runtime environment .......................... 617
54: Execution character sets and their encodings .................................................... 620
55: Message returned by strerror()—DLIB runtime environment .......................... 629
AFE1_AFE2-1:1
Preface
Welcome to the IAR C/C++ Development Guide for Arm. The purpose of this
guide is to provide you with detailed reference information that can help you
to use the build tools to best suit your application requirements. This guide
also gives you suggestions on coding techniques so that you can develop
applications with maximum efficiency.
REQUIRED KNOWLEDGE
To use the tools in IAR Embedded Workbench, you should have working knowledge of:
● The architecture and instruction set of the Arm core you are using (refer to the chip
manufacturer's documentation)
● The C or C++ programming language
● Application development for embedded systems
● The operating system of your host computer.
For more information about the other development tools incorporated in the IDE, refer
to their respective documentation, see Other documentation, page 45.
43
AFE1_AFE2-1:1
What this guide contains
AFE1_AFE2-1:1
Preface
search procedure, and the different types of compiler and linker output. The chapter
also describes how the diagnostic system works.
● Compiler options explains how to set options, gives a summary of the options, and
contains detailed reference information for each compiler option.
● Linker options gives a summary of the options, and contains detailed reference
information for each linker option.
● Data representation describes the available data types, pointers, and structure types.
This chapter also gives information about type and object attributes.
● Extended keywords gives reference information about each of the Arm-specific
keywords that are extensions to the standard C/C++ language.
● Pragma directives gives reference information about the pragma directives.
● Intrinsic functions gives reference information about functions to use for accessing
Arm-specific low-level features.
● The preprocessor gives a brief overview of the preprocessor, including reference
information about the different preprocessor directives, symbols, and other related
information.
● C/C++ standard library functions gives an introduction to the C or C++ library
functions, and summarizes the header files.
● The linker configuration file describes the purpose of the linker configuration file,
and describes its contents.
● Section reference gives reference information about the use of sections.
● The stack usage control file describes the syntax and semantics of stack usage
control files.
● IAR utilities describes the IAR utilities that handle the ELF and DWARF object
formats.
● Implementation-defined behavior for Standard C++ describes how the compiler
handles the implementation-defined areas of Standard C++.
● Implementation-defined behavior for Standard C describes how the compiler
handles the implementation-defined areas of Standard C.
● Implementation-defined behavior for C89 describes how the compiler handles the
implementation-defined areas of the C language standard C89.
Other documentation
User documentation is available as hypertext PDFs and as a context-sensitive online
help system in HTML format. You can access the documentation from the Information
Center or from the Help menu in the IAR Embedded Workbench IDE. The online help
system is also available via the F1 key.
45
AFE1_AFE2-1:1
Other documentation
AFE1_AFE2-1:1
Preface
● C-STAT
● MISRA C
FURTHER READING
These books might be of interest to you when using the IAR Systems development tools:
● Seal, David, and David Jagger. ARM Architecture Reference Manual.
Addison-Wesley.
● Barr, Michael, and Andy Oram, ed. Programming Embedded Systems in C and
C++. O’Reilly & Associates.
● Furber, Steve. ARM System-on-Chip Architecture. Addison-Wesley.
● Harbison, Samuel P. and Guy L. Steele (contributor). C: A Reference Manual.
Prentice Hall.
● Labrosse, Jean J. Embedded Systems Building Blocks: Complete and Ready-To-Use
Modules in C. R&D Books.
● Mann, Bernhard. C für Mikrocontroller. Franzis-Verlag. [Written in German.]
● Meyers, Scott. Effective C++. Addison-Wesley.
● Meyers, Scott. More Effective C++. Addison-Wesley.
● Meyers, Scott. Effective STL. Addison-Wesley.
● Sloss, Andrew N. et al, ARM System Developer's Guide: Designing and Optimizing
System Software. Morgan Kaufmann.
● Sutter, Herb. Exceptional C++: 47 Engineering Puzzles, Programming Problems,
and Solutions. Addison-Wesley.
The web site isocpp.org also has a list of recommended books about C++ programming.
WEB SITES
Recommended web sites:
● The chip manufacturer’s web site.
● The Arm Limited web site, www.arm.com, that contains information and news
about the Arm cores.
● The IAR Systems web site, www.iar.com, that holds application notes and other
product information.
● The web site of the C standardization working group,
www.open-std.org/jtc1/sc22/wg14.
● The web site of the C++ Standards Committee, www.open-std.org/jtc1/sc22/wg21.
● The C++ programming language web site, isocpp.org. This web site also has a list
of recommended books about C++ programming.
47
AFE1_AFE2-1:1
Document conventions
Document conventions
When, in the IAR Systems documentation, we refer to the programming language C, the
text also applies to C++, unless otherwise stated.
When referring to a directory in your product installation, for example arm\doc, the full
path to the location is assumed, for example c:\Program Files\IAR
Systems\Embedded Workbench N.n\arm\doc, where the initial digit of the version
number reflects the initial digit of the version number of the IAR Embedded Workbench
shared components.
TYPOGRAPHIC CONVENTIONS
The IAR Systems documentation set uses the following typographic conventions:
Style Used for
computer • Source code examples and file paths.
• Text on the command line.
• Binary, hexadecimal, and octal numbers.
parameter A placeholder for an actual value used as a parameter, for example
filename.h where filename represents the name of the file.
[option] An optional part of a linker or stack usage control directive, where [
and ] are not part of the actual directive, but any [, ], {, or } are part
of the directive syntax.
{option} A mandatory part of a linker or stack usage control directive, where {
and } are not part of the actual directive, but any [, ], {, or } are part
of the directive syntax.
[option] An optional part of a command line option or pragma directive.
[a|b|c] An optional part of a command line option or pragma directive with
alternatives.
{a|b|c} A mandatory part of a command line option or pragma directive with
alternatives.
bold Names of menus, menu commands, buttons, and dialog boxes that
appear on the screen.
italic • A cross-reference within this guide or to another guide.
• Emphasis.
… An ellipsis indicates that the previous item can be repeated an arbitrary
number of times.
Table 1: Typographic conventions used in this guide
AFE1_AFE2-1:1
Preface
Identifies warnings.
NAMING CONVENTIONS
The following naming conventions are used for the products and tools from IAR
Systems®, when referred to in the documentation:
Brand name Generic term
IAR Embedded Workbench® for Arm IAR Embedded Workbench®
IAR Embedded Workbench® IDE for Arm the IDE
IAR C-SPY® Debugger for Arm C-SPY, the debugger
IAR C-SPY® Simulator the simulator
IAR C/C++ Compiler™ for Arm the compiler
IAR Assembler™ for Arm the assembler
IAR ILINK Linker™ ILINK, the linker
IAR DLIB Runtime Environment™ the DLIB runtime environment
Table 2: Naming conventions used in this guide
49
AFE1_AFE2-1:1
Document conventions
AFE1_AFE2-1:1
Part 1. Using the build
tools
This part of the IAR C/C++ Development Guide for Arm includes these
chapters:
● Data storage
● Functions
● Using C
● Using C++
● Application-related considerations
51
52
Introduction to the IAR
build tools
● The IAR build tools—an overview
● Device support
53
AFE1_AFE2-1:1
The IAR build tools—an overview
IAR ASSEMBLER
The IAR Assembler for Arm is a powerful relocating macro assembler with a versatile
set of directives and expression operators. The assembler features a built-in C language
preprocessor, and supports conditional assembly.
The IAR Assembler for Arm uses the same mnemonics and operand syntax as the Arm
Limited Arm Assembler, which simplifies the migration of existing code. For more
information, see the IAR Assembler User Guide for Arm.
EXTERNAL TOOLS
For information about how to extend the tool chain in the IDE, see the IDE Project
Management and Building Guide for Arm.
AFE1_AFE2-1:1
Introduction to the IAR build tools
Device support
To get a smooth start with your product development, the IAR product installation
comes with a wide range of device-specific support.
55
AFE1_AFE2-1:1
Device support
AFE1_AFE2-1:1
Introduction to the IAR build tools
EXTENDED KEYWORDS
The compiler provides a set of keywords that can be used for configuring how the code
is generated. For example, there are keywords for controlling how to access and store
data objects, as well as for controlling how a function should work internally and how
it should be called/returned.
By default, language extensions are enabled in the IDE.
The command line option -e makes the extended keywords available, and reserves them
so that they cannot be used as variable names. See -e, page 278 for additional
information.
For more information, see the chapter Extended keywords. See also Data storage and
Functions.
PRAGMA DIRECTIVES
The pragma directives control the behavior of the compiler, for example how it allocates
memory, whether it allows extended keywords, and whether it issues warning messages.
The pragma directives are always enabled in the compiler. They are consistent with
standard C, and are useful when you want to make sure that the source code is portable.
For more information about the pragma directives, see the chapter Pragma directives.
PREDEFINED SYMBOLS
With the predefined preprocessor symbols, you can inspect your compile-time
environment, for example time of compilation or the build number of the compiler.
For more information about the predefined symbols, see the chapter The preprocessor.
57
AFE1_AFE2-1:1
Special support for embedded systems
AFE1_AFE2-1:1
Developing embedded
applications
● Developing embedded software using IAR build tools
MAPPING OF MEMORY
Embedded systems typically contain various types of memory, such as on-chip RAM,
external DRAM or SRAM, ROM, EEPROM, or flash memory.
As an embedded software developer, you must understand the features of the different
types of memory. For example, on-chip RAM is often faster than other types of
memories, and variables that are accessed often would in time-critical applications
benefit from being placed here. Conversely, some configuration data might be seldom
accessed but must maintain its value after power off, so it should be saved in EEPROM
or flash memory.
For efficient memory usage, the compiler provides several mechanisms for controlling
placement of functions and data objects in memory. For more information, see
Controlling data and function placement in memory, page 230.
The linker places sections of code and data in memory according to the directives you
specify in the linker configuration file, see Placing code and data—the linker
configuration file, page 93.
59
AFE1_AFE2-1:1
Developing embedded software using IAR build tools
EVENT HANDLING
In embedded systems, using interrupts is a method for handling external events
immediately, for example, detecting that a button was pressed. In general, when an
interrupt occurs in the code, the core immediately stops executing the code it runs, and
starts executing an interrupt routine instead.
The compiler provides various primitives for managing hardware and software
interrupts, which means that you can write your interrupt routines in C, see Interrupt
functions for Cortex-M devices, page 79 and Interrupt functions for Arm7/9/11,
Cortex-A, and Cortex-R devices, page 80.
SYSTEM STARTUP
In all embedded systems, system startup code is executed to initialize the system—both
the hardware and the software system—before the main function of the application is
called. The CPU imposes this by starting execution from a fixed memory address.
As an embedded software developer, you must ensure that the startup code is located at
the dedicated memory addresses, or can be accessed using a pointer from the vector
table. This means that startup code and the initial vector table must be placed in
non-volatile memory, such as ROM, EPROM, or flash.
A C/C++ application further needs to initialize all global variables. This initialization is
handled by the linker in conjunction with the system startup code. For more information,
see Application execution—an overview, page 64.
AFE1_AFE2-1:1
Developing embedded applications
more deterministic and can reduce power consumption by using the CPU efficiently and
putting the CPU in a lower-power state when idle.
Using an RTOS can make your program easier to read and maintain, and in many cases
smaller as well. Application code can be cleanly separated into tasks that are
independent of each other. This makes teamwork easier, as the development work can
be easily split into separate tasks which are handled by one developer or a group of
developers.
Finally, using an RTOS reduces the hardware dependence and creates a clean interface
to the application, making it easier to port the program to different target hardware.
See also Managing a multithreaded environment, page 160.
61
AFE1_AFE2-1:1
The build process—an overview
After the translation, you can choose to pack any number of modules into an archive, or
in other words, a library. The important reason you should use libraries is that each
module in a library is conditionally linked in the application, or in other words, is only
included in the application if the module is used directly or indirectly by a module
supplied as an object file. Optionally, you can create a library, then use the IAR utility
iarchive.
AFE1_AFE2-1:1
Developing embedded applications
Note: Modules produced by a toolset from another vendor can be included in the build
as well. Be aware that this might also require a compiler utility library from the same
vendor.
The IAR ILINK Linker (ilinkarm.exe) is used for building the final application.
Normally, the linker requires the following information as input:
● Several object files and possibly certain libraries
● A program start label (set by default)
● The linker configuration file that describes placement of code and data in the
memory of the target system
This illustration shows the linking process:
Note: The Standard C/C++ library contains support routines for the compiler, and the
implementation of the C/C++ standard library functions.
While linking, the linker might produce error messages and logging messages on
stdout and stderr. The log messages are useful for understanding why an application
was linked the way it was, for example, why a module was included or a section
removed.
For more information about the procedure performed by the linker, see The linking
process in detail, page 91.
63
AFE1_AFE2-1:1
Application execution—an overview
AFTER LINKING
The IAR ILINK Linker produces an absolute object file in ELF format that contains the
executable image. After linking, the produced absolute executable image can be used
for:
● Loading into the IAR C-SPY Debugger or any other compatible external debugger
that reads ELF and DWARF.
● Programming to a flash/PROM using a flash/PROM programmer. Before this is
possible, the actual bytes in the image must be converted into the standard Motorola
32-bit S-record format or the Intel Hex-32 format. For this, use ielftool, see The
IAR ELF Tool—ielftool, page 535.
This illustration shows the possible uses of the absolute output ELF/DWARF file:
AFE1_AFE2-1:1
Developing embedded applications
65
AFE1_AFE2-1:1
Application execution—an overview
AFE1_AFE2-1:1
Developing embedded applications
2 Then, memories that should be zero-initialized are cleared, in other words, filled with
zeros:
67
AFE1_AFE2-1:1
Application execution—an overview
For more information about each stage, see System startup and termination, page 145.
For more information about data initialization, see Initialization at system startup, page
96.
AFE1_AFE2-1:1
Developing embedded applications
You must also specify some critical options, see Basic project configuration, page 69.
On the command line, the following line can be used for starting the linker:
ilinkarm myfile.o myfile2.o -o a.out --config my_configfile.icf
In this example, myfile.o and myfile2.o are object files, and my_configfile.icf
is the linker configuration file. The option -o specifies the name of the output file.
Note: By default, the label where the application starts is __iar_program_start.
You can use the --entry command line option to change this.
When building a project, the IAR Embedded Workbench IDE can produce extensive
build information in the Build messages window. This information can be useful, for
example, as a base for producing batch files for building on the command line. You can
copy the information and paste it in a text file. To activate extensive build information,
right-click in the Build messages window, and select All on the context menu.
69
AFE1_AFE2-1:1
Basic project configuration
In addition to these settings, you can use many other options and settings to fine-tune
the result even further. For information about how to set options and for a list of all
available options, see the chapters Compiler options, Linker options, and the IDE
Project Management and Building Guide for Arm, respectively.
PROCESSOR CONFIGURATION
To make the compiler generate optimum code, you should configure it for the Arm core
you are using.
Processor variant
The IAR C/C++ Compiler for Arm supports most 32-bit Arm cores and devices. All
supported cores support Thumb instructions and 64-bit multiply instructions. The object
code that the compiler generates is not always binary compatible between the cores,
therefore it is crucial to specify a processor option to the compiler. The default core is
Cortex-M3.
See the IDE Project Management and Building Guide for Arm, for information about
setting the Processor variant option in the IDE.
Use the --cpu option to specify the Arm core. For syntax information, see --arm, page
268 and --thumb, page 305.
Byte order
The compiler supports the big-endian and little-endian byte order. All user and library
modules in your application must use the same byte order.
See the IDE Project Management and Building Guide for Arm for information about
setting the Endian mode option in the IDE.
Use the --endian option to specify the byte order for your project. For syntax
information, see --endian, page 279.
AFE1_AFE2-1:1
Developing embedded applications
71
AFE1_AFE2-1:1
Basic project configuration
AFE1_AFE2-1:1
Data storage
● Introduction
Introduction
An Arm core can address 4 Gbytes of continuous memory, ranging from 0x00000000
to 0xFFFFFFFF. Different types of physical memory can be placed in the memory
range. A typical application will have both read-only memory (ROM) and read/write
memory (RAM). In addition, some parts of the memory range contain processor control
registers and peripheral units.
73
AFE1_AFE2-1:1
Storage of auto variables and parameters
THE STACK
The stack can contain:
● Local variables and parameters not stored in registers
● Temporary results of expressions
● The return value of a function (unless it is passed in registers)
● Processor state during interrupts
● Processor registers that should be restored before the function returns (callee-save
registers).
● Canaries, used in stack-protected functions. See Stack protection, page 87.
The stack is a fixed block of memory, divided into two parts. The first part contains
allocated memory used by the function that called the current function, and the function
that called it, etc. The second part contains free memory that can be allocated. The
borderline between the two areas is called the top of stack and is represented by the stack
pointer, which is a dedicated processor register. Memory is allocated on the stack by
moving the stack pointer.
A function should never refer to the memory in the area of the stack that contains free
memory. The reason is that if an interrupt occurs, the called interrupt function can
allocate, modify, and—of course—deallocate memory on the stack.
See also Stack considerations, page 206 and Setting up stack memory, page 111.
Advantages
The main advantage of the stack is that functions in different parts of the program can
use the same memory space to store their data. Unlike a heap, a stack will never become
fragmented or suffer from memory leaks.
It is possible for a function to call itself either directly or indirectly—a recursive
function—and each invocation can store its own data on the stack.
AFE1_AFE2-1:1
Data storage
Potential problems
The way the stack works makes it impossible to store data that is supposed to live after
the function returns. The following function demonstrates a common programming
mistake. It returns a pointer to the variable x, a variable that ceases to exist when the
function returns.
int *MyFunction()
{
int x;
/* Do something here. */
return &x; /* Incorrect */
}
Another problem is the risk of running out of stack space. This will happen when one
function calls another, which in turn calls a third, etc., and the sum of the stack usage of
each function is larger than the size of the stack. The risk is higher if large data objects
are stored on the stack, or when recursive functions are used.
POTENTIAL PROBLEMS
Applications that use heap-allocated data objects must be carefully designed, as it is
easy to end up in a situation where it is not possible to allocate objects on the heap.
The heap can become exhausted if your application uses too much memory. It can also
become full if memory that no longer is in use was not released.
For each allocated memory block, a few bytes of data for administrative purposes is
required. For applications that allocate a large number of small blocks, this
administrative overhead can be substantial.
There is also the matter of fragmentation; this means a heap where small sections of free
memory is separated by memory used by allocated objects. It is not possible to allocate
75
AFE1_AFE2-1:1
Dynamic memory on the heap
a new object if no piece of free memory is large enough for the object, even though the
sum of the sizes of the free memory exceeds the size of the object.
Unfortunately, fragmentation tends to increase as memory is allocated and released. For
this reason, applications that are designed to run for a long time should try to avoid using
memory allocated on the heap.
AFE1_AFE2-1:1
Functions
● Function-related extensions
● Execution in RAM
● Inlining functions
● Stack protection
● TrustZone interface
Function-related extensions
In addition to supporting Standard C, the compiler provides several extensions for
writing functions in C. Using these, you can:
● Generate code for the different CPU modes Arm and Thumb.
● Execute functions in RAM
● Write interrupt functions for the different devices
● Control function inlining
● Facilitate function optimization
● Access hardware features.
● Create interface functions for TrustZone
The compiler uses compiler options, extended keywords, pragma directives, and
intrinsic functions to support this.
For more information about optimizations, see Efficient coding for embedded
applications, page 227. For information about the available intrinsic functions for
accessing hardware operations, see the chapter Intrinsic functions.
77
AFE1_AFE2-1:1
Arm and Thumb code
Execution in RAM
The __ramfunc keyword makes a function execute in RAM. In other words it places
the function in a section that has read/write attributes. The function is copied from ROM
to RAM at system startup just like any initialized variable, see System startup and
termination, page 145.
The keyword is specified before the return type:
__ramfunc void foo(void);
If a function declared __ramfunc tries to access ROM, the compiler will issue a
warning.
If the whole memory area used for code and constants is disabled—for example, when
the whole flash memory is being erased—only functions and data stored in RAM may
be used. Interrupts must be disabled unless the interrupt vector and the interrupt service
routines are also stored in RAM.
String literals and other constants can be avoided by using initialized variables. For
example, the following lines:
__ramfunc void test()
{
/* myc: initializer in ROM */
const int myc[] = { 10, 20 };
AFE1_AFE2-1:1
Functions
msg(hello);
}
For more information, see Initializing code—copying ROM to RAM, page 115.
The vector table is implemented as an array. It should always have the name
__vector_table, because the C-SPY debugger looks for that symbol when
determining where the vector table is located.
79
AFE1_AFE2-1:1
Interrupt functions for Arm7/9/11, Cortex-A, and Cortex-R devices
The predefined exception functions are defined as weak symbols. A weak symbol is
only included by the linker as long as no duplicate symbol is found. If another symbol
is defined with the same name, it will take precedence. Your application can therefore
simply define its own exception function by just defining it using the correct name from
the list above. If you need other interrupts or other exception handlers, you must make
a copy of the cstartup_M.c or cstartup_M.s file and make the proper addition to
the vector table.
The intrinsic functions __get_CPSR and __set_CPSR are not available when you
compile for Cortex-M. Instead, if you need to get or set values of these or other registers,
you can use inline assembler. For more information, see Passing values between C and
assembler objects, page 244.
Note: Cortex-M has a different interrupt mechanism than other Arm devices, and for
these devices a different set of primitives is available. For more information, see
Interrupt functions for Cortex-M devices, page 79.
INTERRUPT FUNCTIONS
In embedded systems, using interrupts is a method for handling external events
immediately, for example, detecting that a button was pressed.
AFE1_AFE2-1:1
Functions
All interrupt functions must be compiled in Arm mode—if you are using Thumb mode,
use the __arm extended keyword or the #pragma type_attribute=__arm directive
to override the default behavior. This is not applicable for Cortex-M devices.
For more information about the interrupt vector table, see the Arm cores documentation.
Note: An interrupt function must have the return type void, and it cannot specify any
parameters.
81
AFE1_AFE2-1:1
Interrupt functions for Arm7/9/11, Cortex-A, and Cortex-R devices
The predefined functions are defined as weak symbols. A weak symbol is only included
by the linker as long as no duplicate symbol is found. If another symbol is defined with
the same name, it will take precedence. Your application can therefore simply define its
own exception function by just defining it using the correct name.
These exception function names are defined in cstartup.s and referred to by the
library exception vector code:
Undefined_Handler
SWI_Handler
Prefetch_Handler
Abort_Handler
IRQ_Handler
FIQ_Handler
To implement your own exception handler, define a function using the appropriate
exception function name from the list above.
For example, to add an interrupt function in C, it is sufficient to define an interrupt
function named IRQ_Handler:
__irq __arm void IRQ_Handler()
{
}
An interrupt function must have C linkage, read more in Calling convention, page 175.
If you use C++, an interrupt function could look, for example, like this:
extern "C"
{
__irq __arm void IRQ_Handler(void);
}
__irq __arm void IRQ_Handler(void)
{
}
AFE1_AFE2-1:1
Functions
● To declare a fast interrupt function, use the __fiq extended keyword or the
#pragma type_attribute=__fiq directive. For syntax information, see __fiq,
page 371, and type_attribute, page 406, respectively.
Note: An interrupt function (irq) and a fast interrupt function (fiq) must have a return
type of void and cannot have any parameters. A software interrupt function (swi) may
have parameters and return values. By default, only four registers, R0–R3, can be used
for parameters and only the registers R0–R1 can be used for return values.
NESTED INTERRUPTS
Interrupts are automatically disabled by the Arm core prior to entering an interrupt
handler. If an interrupt handler re-enables interrupts, calls functions, and another
interrupt occurs, then the return address of the interrupted function—stored in LR—is
overwritten when the second IRQ is taken. In addition, the contents of SPSR will be
destroyed when the second interrupt occurs. The __irq keyword itself does not save
and restore LR and SPSR. To make an interrupt handler perform the necessary steps
needed when handling nested interrupts, the keyword __nested must be used in
addition to __irq. The function prolog—function entrance sequence—that the
compiler generates for nested interrupt handlers will switch from IRQ mode to system
mode. Make sure that both the IRQ stack and system stack is set up. If you use the
default cstartup.s file, both stacks are correctly set up.
Compiler-generated interrupt handlers that allow nested interrupts are supported for
IRQ interrupts only. The FIQ interrupts are designed to be serviced quickly, which in
most cases mean that the overhead of nested interrupts would be too high.
This example shows how to use nested interrupts with the Arm vectored interrupt
controller (VIC):
__irq __nested __arm void interrupt_handler(void)
{
void (*interrupt_task)();
unsigned int vector;
(*interrupt_task)();
}
83
AFE1_AFE2-1:1
Interrupt functions for Arm7/9/11, Cortex-A, and Cortex-R devices
Note: The __nested keyword requires the processor mode to be in either User or
System mode.
SOFTWARE INTERRUPTS
Software interrupt functions are slightly more complex than other interrupt functions, in
the way that they need a software interrupt handler (a dispatcher), are invoked (called)
from running application software, and that they accept arguments and have return
values. The mechanisms for calling a software interrupt function and how the software
interrupt handler dispatches the call to the actual software interrupt function is described
here.
In this case, the assembler instruction SVC 0x23 will be generated where the function
is called.
Software interrupt functions follow the same calling convention regarding parameters
and return values as an ordinary function, except for the stack usage, see Calling
convention, page 175.
For more information, see __swi, page 378, and swi_number, page 405, respectively.
AFE1_AFE2-1:1
Functions
specific software interrupt function. The #pragma swi_number directive is not needed
in the interrupt function definition.
For more information, see __swi, page 378.
INTERRUPT OPERATIONS
An interrupt function is called when an external event occurs. Normally it is called
immediately while another function is executing. When the interrupt function has
finished executing, it returns to the original function. It is imperative that the
environment of the interrupted function is restored—this includes the value of processor
registers and the processor status register.
When an interrupt occurs, the following actions are performed:
● The operating mode is changed corresponding to the particular exception
● The address of the instruction following the exception entry instruction is saved in
R14 of the new mode
● The old value of the CPSR is saved in the SPSR of the new mode
● Interrupt requests are disabled by setting bit 7 of the CPSR and, if the exception is a
fast interrupt, further fast interrupts are disabled by setting bit 6 of the CPSR
● The PC is forced to begin executing at the relevant vector address.
For example, if an interrupt for vector 0x18 occurs, the processor will start to execute
code at address 0x18. The memory area that is used as start location for interrupts is
called the interrupt vector table. The content of the interrupt vector is normally a branch
instruction jumping to the interrupt routine.
Note: If the interrupt function enables interrupts, the special processor registers needed
to return from the interrupt routine must be assumed to be destroyed. For this reason they
must be stored by the interrupt routine to be restored before it returns. This is handled
automatically if the __nested keyword is used.
85
AFE1_AFE2-1:1
Inlining functions
Inlining functions
Function inlining means that a function, whose definition is known at compile time, is
integrated into the body of its caller to eliminate the overhead of the function call. This
optimization, which is performed at optimization level High, normally reduces
execution time, but might increase the code size. The resulting code might become more
difficult to debug. Whether the inlining actually occurs is subject to the compiler’s
heuristics.
The compiler heuristically decides which functions to inline. Different heuristics are
used when optimizing for speed, size, or when balancing between size and speed.
Normally, code size does not increase when optimizing for size.
AFE1_AFE2-1:1
Functions
Stack protection
In software, a stack buffer overflow occurs when a program writes to a memory address
on the program’s call stack outside of the intended data structure, which is usually a
fixed-length buffer. The result is, almost always, corruption of nearby data, and it can
even change which function to return to. If it is deliberate, it is often called stack
smashing. One method to guard against stack buffer overflow is to use stack canaries,
named for their analogy to the use of canaries in coal mines.
87
AFE1_AFE2-1:1
TrustZone interface
TrustZone interface
TrustZone for Arm V8-M needs some compiler support to create a secure interface
between the secure and the non-secure code. For this purpose, there are two function
type attributes that control how code is generated: __cmse_nonsecure_entry and
__cmse_nonsecure_call. For more information, see Arm TrustZone®, page 222.
AFE1_AFE2-1:1
Linking using ILINK
● Linking—an overview
Linking—an overview
The IAR ILINK Linker is a powerful, flexible software tool for use in the development
of embedded applications. It is equally well suited for linking small, single-file, absolute
assembler programs as it is for linking large, relocatable, multi-module, C/C++, or
mixed C/C++ and assembler programs.
The linker combines one or more relocatable object files—produced by the IAR
Systems compiler or assembler—with selected parts of one or more object libraries to
produce an executable image in the industry-standard format Executable and Linking
Format (ELF).
The linker will automatically load only those library modules—user libraries and
Standard C or C++ library variants—that are actually needed by the application you are
linking. Furthermore, the linker eliminates duplicate sections and sections that are not
required.
ILINK can link both Arm and Thumb code, as well as a combination of them. By
automatically inserting additional instructions (veneers), ILINK will assure that the
destination will be reached for any calls and branches, and that the processor state is
switched when required. For more details about how to generate veneers, see Veneers,
page 117.
The linker uses a configuration file where you can specify separate locations for code
and data areas of your target system memory map. This file also supports automatic
handling of the application’s initialization phase, which means initializing global
variable areas and code areas by copying initializers and possibly decompressing them
as well.
89
AFE1_AFE2-1:1
Modules and sections
The final output produced by ILINK is an absolute object file containing the executable
image in the ELF (including DWARF for debug information) format. The file can be
downloaded to C-SPY or any other compatible debugger that supports ELF/DWARF, or
it can be stored in EPROM or flash.
To handle ELF files, various tools are included. For information about included utilities,
see Specific ELF tools, page 54.
In each category, sections can be further divided into those that contain code and those
that contain data, resulting in four main categories:
AFE1_AFE2-1:1
Linking using ILINK
91
AFE1_AFE2-1:1
The linking process in detail
typically used for inline and template functions. If you need to override some of the
non-weak definitions from a library module, you must ensure that the library
module is not included (typically by providing alternate definitions for all the
symbols your application uses in that library module).
● Determine which sections/section fragments from the included modules to include
in the application. Only those sections/section fragments that are actually needed by
the application are included. There are several ways to determine of which
sections/section fragments that are needed, for example, the __root object
attribute, the #pragma required directive, and the keep linker directive. In case
of duplicate sections, only one is included.
● Where appropriate, arrange for the initialization of initialized variables and code in
RAM. The initialize directive causes the linker to create extra sections to
enable copying from ROM to RAM. Each section that will be initialized by copying
is divided into two sections—one for the ROM part, and one for the RAM part. If
manual initialization is not used, the linker also arranges for the startup code to
perform the initialization.
● Determine where to place each section according to the section placement directives
in the linker configuration file. Sections that are to be initialized by copying appear
twice in the matching against placement directives, once for the ROM part and once
for the RAM part, with different attributes. During the placement, the linker also
adds any required veneers to make a code reference reach its destination or to
switch CPU modes.
● Produce an absolute file that contains the executable image and any debug
information provided. The contents of each needed section in the relocatable input
files is calculated using the relocation information supplied in its file and the
addresses determined when placing sections. This process can result in one or more
relocation failures if some of the requirements for a particular section are not met,
for instance if placement resulted in the destination address for a PC-relative jump
instruction being out of range for that instruction.
● Optionally, produce a map file that lists the result of the section placement, the
address of each global symbol, and finally, a summary of memory usage for each
module and library.
AFE1_AFE2-1:1
Linking using ILINK
During the linking, ILINK might produce error and logging messages on stdout and
stderr. The log messages are useful for understanding why an application was linked
as it was. For example, why a module or section (or section fragment) was included.
Note: To see the actual content of an ELF object file, use ielfdumparm. See The IAR
ELF Dumper—ielfdump, page 536.
93
AFE1_AFE2-1:1
Placing code and data—the linker configuration file
The file consists of a sequence of declarative directives. This means that the linking
process will be governed by all directives at the same time.
To use the same source code with different derivatives, just rebuild the code with the
appropriate configuration file.
/* Create a stack */
define block STACK with size = 0x1000, alignment = 8 { };
/* Handle initialization */
initialize by copy { readwrite }; /* Initialize RW sections */
This configuration file defines one addressable memory Mem with the maximum of
4 Gbytes of memory. Furthermore, it defines a ROM region and a RAM region in Mem,
namely ROM and RAM. Each region has the size of 64 Kbytes.
The file then creates an empty block called STACK with a size of 4 Kbytes in which the
application stack will reside. To create a block is the basic method which you can use to
AFE1_AFE2-1:1
Linking using ILINK
get detailed control of placement, size, etc. It can be used for grouping sections, but also
as in this example, to specify the size and placement of an area of memory.
Next, the file defines how to handle the initialization of variables, read/write type
(readwrite) sections. In this example, the initializers are placed in ROM and copied at
startup of the application to the RAM area. By default, ILINK may compress the
initializers if this appears to be advantageous.
The last part of the configuration file handles the actual placement of all the sections into
the available regions. First, the startup code—defined to reside in the read-only
(readonly) section .cstartup—is placed at the start of the ROM region, that is at
address 0x10000.
Note: The part within {} is referred to as section selection and it selects the sections for
which the directive should be applied to. Then the rest of the read-only sections are
placed in the ROM region.
Note: The section selection { readonly section .cstartup } takes precedence
over the more generic section selection { readonly }.
Finally, the read/write (readwrite) sections and the STACK block are placed in the RAM
region.
This illustration gives a schematic overview of how the application is placed in memory:
95
AFE1_AFE2-1:1
Initialization at system startup
In addition to these standard directives, a configuration file can contain directives that
define how to:
● Map a memory that can be addressed in multiple ways
● Handle conditional directives
● Create symbols with values that can be used in the application
● More in detail, select the sections a directive should be applied to
● More in detail, initialize code and data.
For more details and examples about customizing the linker configuration file, see the
chapter Linking your application.
For more information about the linker configuration file, see the chapter The linker
configuration file.
Categories of Section
Source Section type Section name
declared data content
Zero-initialized int i; Read/write .bss None
data data, zero-init
Zero-initialized int i = 0; Read/write .bss None
data data, zero-init
Initialized data int i = 6; Read/write .data The
(non-zero) data initializer
Non-initialized __no_init int i; Read/write .noinit None
data data, zero-init
Constants const int i = 6; Read-only data .rodata The
constant
Code __ramfunc void Read/write .textrw The code
myfunc() {} code
Table 3: Sections holding initialized data
AFE1_AFE2-1:1
Linking using ILINK
Note: Clustering of static variables might group zero-initialized variables together with
initialized data in .data. The compiler can decide to place constants in the .text
section to avoid loading the address of a constant from a constant table.
For information about all supported sections, see the chapter Section reference.
Note: When compressed initializers are used (see initialize directive, page 498), the
contents sections (that is, sections with the _init suffix) are not listed as separate
sections in the map file. Instead, they are combined into aggregates of “initializer bytes”.
You can place the contents sections the usual way in the linker configuration file,
however, this affects the placement—and possibly the number—of the “initializer
bytes” aggregates.
97
AFE1_AFE2-1:1
Stack usage analysis
For more information about and examples of how to configure the initialization, see
Linking considerations, page 107.
If you put this into your linker configuration file, you must also mention the CPP_INIT
block in one of the section placement directives. If you wish to select where the
linker-created block is placed, you can use a section selector with the name
".init_array".
AFE1_AFE2-1:1
Linking using ILINK
The analysis is only accurate if there is accurate stack usage information for each
function in the application.
In general, the compiler will generate this information for each C function, but if there
are indirect calls—calls using function pointers—in your application, you must supply
a list of possible functions that can be called from each calling function.
If you use a stack usage control file, you can also supply stack usage information for
functions in modules that do not have stack usage information.
You can use the check that directive in your stack usage control file to check that the
stack usage calculated by the linker does not exceed the stack space you have allocated.
99
AFE1_AFE2-1:1
Stack usage analysis
When linking, the linker emits an error if the check fails. In this example, an error will
be emitted if the sum of the following exceeds the size of the MY_STACK block:
● The maximum stack usage in the category Program entry (the main program).
● The sum of each individual maximum stack usage in the category interrupt
(assuming that all interrupt routines need space at the same time).
● A safety margin of 100 bytes (to account for stack usage not visible to the analysis).
See also check that directive, page 510 and Stack considerations, page 206.
Program entry
"__iar_program_start": 0x000085ac
Maximum call chain 168 bytes
AFE1_AFE2-1:1
Linking using ILINK
"__iar_program_start" 0
"__cmain" 0
"main" 8
"printf" 24
"_PrintfTiny" 56
"_Prout" 16
"putchar" 16
"__write" 0
"__dwrite" 0
"__iar_sh_stdout" 24
"__iar_get_ttio" 24
"__iar_lookup_ttioh" 0
interrupt
"FaultHandler": 0x00008434
"FaultHandler" 32
interrupt
"IRQHandler": 0x00008424
"IRQHandler" 24
"do_something" in suexample.o [1] 80
The summary contains the depth of the deepest call chain in each category as well as the
sum of the depths of the deepest call chains in that category.
Each call graph root belongs to a call graph root category to enable convenient
calculations in check that directives.
101
AFE1_AFE2-1:1
Stack usage analysis
function. Typically, you do this if stack usage information is missing, for example
in an assembler module. In your suc file you can, for example, write like this:
function MyFunc: 32,
calls MyFunc2,
calls MyFunc3, MyFunc4: 16;
AFE1_AFE2-1:1
Linking using ILINK
control file. Use the no calls from directive in your suc file, for example, like
this:
no calls from [file.o] to MyFunc13, MyFunc14;
● Instead of specifying stack usage information about assembler modules in a stack
usage control file, you can annotate the assembler source with call frame
information. For more information, see the IAR Assembler User Guide for Arm.
For more information, see the chapter The stack usage control file.
LIMITATIONS
Apart from missing or incorrect stack usage information, there are also other sources of
inaccuracy in the analysis:
● The linker cannot always identify all functions in object modules that lack stack
usage information. In particular, this might be a problem with object modules
written in assembly language or produced by non-IAR tools. You can provide stack
usage information for such modules using a stack usage control file, and for
assembly language modules you can also annotate the assembler source code with
CFI directives to provide stack usage information. See the IAR Assembler User
Guide for Arm.
● If you use inline assembler to change the frame size or to perform function calls,
this will not be reflected in the analysis.
● Extra space consumed by other sources (the processor, an operating system, etc) is
not accounted for.
● Source code that uses exceptions is not supported.
● If you use other forms of function calls, like software interrupts, they will not be
reflected in the call graph.
● Using multi-file compilation (--mfc) can interfere with using a stack usage control
file to specify properties of module-local functions in the involved files.
Note: Stack usage analysis produces a worst case result. The program might not actually
ever end up in the maximum call chain, by design, or by coincidence. In particular, the
set of possible destinations for a virtual function call in C++ might sometimes include
implementations of the function in question which cannot, in fact, be called from that
point in the code.
Stack usage analysis is only a complement to actual measurement. If the result is
important, you need to perform independent validation of the results of the analysis.
103
AFE1_AFE2-1:1
Stack usage analysis
AFE1_AFE2-1:1
Linking using ILINK
Example output:
Program entry:
0 __iar_program_start [168]
0 __cmain [168]
0 __iar_data_init3 [16]
8 __iar_zero_init3 [8]
16 - [0]
8 __iar_copy_init3 [8]
16 - [0]
0 __low_level_init [0]
0 main [168]
8 printf [160]
32 _PrintfTiny [136]
88 _Prout [80]
104 putchar [64]
120 __write [48]
120 __dwrite [48]
120 __iar_sh_stdout [48]
144 __iar_get_ttio [24]
168 __iar_lookup_ttioh [0]
120 __iar_sh_write [24]
144 - [0]
88 __aeabi_uidiv [0]
88 __aeabi_idiv0 [0]
88 strlen [0]
0 exit [8]
0 _exit [8]
0 __exit [8]
0 __iar_close_ttio [8]
8 __iar_lookup_ttioh [0] ***
0 __exit [8] ***
105
AFE1_AFE2-1:1
Stack usage analysis
to that function. It is intended to be input for post-processing tools and is not particularly
human-readable.
For more information about the XML format used, see the callGraph.txt file in your
product installation.
AFE1_AFE2-1:1
Linking your application
● Linking considerations
● Linker optimizations
Linking considerations
Before you can link your application, you must set up the configuration required by
ILINK. Typically, you must consider:
● Choosing a linker configuration file, page 107
● Defining your own memory areas, page 108
● Placing sections, page 109
● Reserving space in RAM, page 110
● Keeping modules, page 111
● Keeping symbols and sections, page 111
● Application startup, page 111
● Setting up stack memory, page 111
● Setting up heap memory, page 112
● Setting up the atexit limit, page 112
● Changing the default initialization, page 112
● Interaction between ILINK and the application, page 116
● Standard library handling, page 116
● Producing other output formats than ELF/DWARF, page 117
● Veneers, page 117
107
AFE1_AFE2-1:1
Linking considerations
The files contain the information required by ILINK. The only change, if any, you will
normally have to make to the supplied configuration file is to customize the start and end
addresses of each region so they fit the target system memory map. If, for example, your
application uses additional external RAM, you must also add details about the external
RAM memory area.
For some devices, device-specific configuration files are automatically selected.
To edit a linker configuration file, use the editor in the IDE, or any other suitable editor.
Alternatively, choose Project>Options>Linker and click the Edit button on the Config
page to open the dedicated linker configuration file editor.
Do not change the original template file. We recommend that you make a copy in the
working directory, and modify the copy instead. If you are using the linker configuration
file editor in the IDE, the IDE will make a copy for you.
Each project in the IDE should have a reference to one, and only one, linker
configuration file. This file can be edited, but for the majority of all projects it is
sufficient to configure the vital parameters in Project>Options>Linker>Config.
AFE1_AFE2-1:1
Linking your application
or equivalently
define region ROM2 = Mem:[from 0x80000 to 0xC7FFF]
–Mem:[from 0xA0000 to 0xBFFFF];
PLACING SECTIONS
The default configuration file that you selected places all predefined sections in memory,
but there are situations when you might want to modify this. For example, if you want
to place the section that holds constant symbols in the CONSTANT region instead of in
the default place. In this case, use the place in directive, for example:
/* Place sections with readonly content in the ROM region */
place in ROM {readonly};
Note: Placing a section—used by the IAR build tools—in a different memory which use
a different way of referring to its content, will fail.
For the result of each placement directive after linking, inspect the placement summary
in the map file (the command line option --map).
109
AFE1_AFE2-1:1
Linking considerations
To place your new section, the original place in ROM {readonly}; directive is
sufficient.
However, to place the section MyOwnSection explicitly, update the linker configuration
file with a place in directive, for example:
/* Place MyOwnSection in the ROM region */
place in ROM {readonly section MyOwnSection};
To retrieve the start of the allocated memory from the application, the source code could
look like this:
/* Define a section for temporary storage. */
#pragma section = "TempStorage"
char *GetTempStorageStartAddress()
{
/* Return start address of section TempStorage. */
return __section_begin("TempStorage");
}
AFE1_AFE2-1:1
Linking your application
KEEPING MODULES
If a module is linked as an object file, it is always kept. That is, it will contribute to the
linked application. However, if a module is part of a library, it is included only if it is
symbolically referred to from other parts of the application. This is true, even if the
library module contains a root symbol. To assure that such a library module is always
included, use iarchive to extract the module from the library, see The IAR Archive
Tool—iarchive, page 531.
For information about included and excluded modules, inspect the log file (the
command line option --log modules).
For more information about modules, see Modules and sections, page 90.
APPLICATION STARTUP
By default, the point where the application starts execution is defined by the
__iar_program_start label, which is defined to point at the start of the cstartup.s
file. The label is also communicated via ELF to any debugger that is used.
To change the start point of the application to another label, use the ILINK option
--entry, see --entry, page 324.
111
AFE1_AFE2-1:1
Linking considerations
For more information about the stack, see Stack considerations, page 206.
Specify the appropriate size for your application. If you use a heap, you must allocate at
least 50 bytes for it.
Suppressing initialization
If you do not want the linker to arrange for initialization by copying, for some or all
sections, make sure that those sections do not match a pattern in an initialize by
copy directive—or use an except clause to exclude them from matching. If you do not
want any initialization by copying at all, you can omit the initialize by copy
directive entirely.
This can be useful if your application, or just your variables, are loaded into RAM by
some other mechanism before application startup.
AFE1_AFE2-1:1
Linking your application
For more information about the available packing algorithms, see initialize directive,
page 498.
Manual initialization
In the usual case, the initialize by copy directive is used for making the linker
arrange for initialization by copying—with or without packing—of sections with
content at application startup. The linker achieves this by logically creating an
initialization section for each such section, holding the content of the section, and
turning the original section into a section without content. Then, the linker adds table
elements to the initialization table so that the initialization will be performed at
application startup. You can use initialize manually to suppress the creation of
table elements to take control over when and how the elements are copied. This is useful
for overlays, but also in other circumstances.
For sections without content (zero-initialized sections), the situation is reversed. The
linker arranges for zero initialization of all such sections at application startup, except
for those that are mentioned in a do not initialize directive.
you can use this source code example to initialize the section:
#pragma section = "MYSECTION"
#pragma section = "MYSECTION_init"
void DoInit()
{
char * from = __section_begin("MYSECTION_init");
char * to = __section_begin("MYSECTION");
memcpy(to, from, __section_size("MYSECTION"));
}
This piece of source code takes advantage of the fact that if you use __section_begin
(and related operators) with a section name, an automatic block is created by the linker
for those sections.
113
AFE1_AFE2-1:1
Linking considerations
Note: Automatic blocks override the normal section selection process and forces
everything that matches the section name to form on block.
You must also place the two new blocks using one of the section placement directives,
the block MYBLOCK in RAM and the block MYBLOCK_init in ROM.
Then you can initialize the sections using the same source code as in the previous
example, only with MYBLOCK instead of MYSECTION.
Overlay example
This is a simple overlay example that takes advantage of automatic block creation:
initialize manually { section MYOVERLAY* };
You must also place overlay MYOVERLAY somewhere in RAM. The copying could
look like this:
#pragma section = "MYOVERLAY"
#pragma section = "MYOVERLAY1_init"
#pragma section = "MYOVERLAY2_init"
void SwitchToOverlay1()
{
char * from = __section_begin("MYOVERLAY1_init");
char * to = __section_begin("MYOVERLAY");
memcpy(to, from, __section_size("MYOVERLAY1_init"));
}
void SwitchToOverlay2()
{
char * from = __section_begin("MYOVERLAY2_init");
char * to = __section_begin("MYOVERLAY");
memcpy(to, from, __section_size("MYOVERLAY2_init"));
}
AFE1_AFE2-1:1
Linking your application
If you need to place the RAMCODE functions in some particular location, you must
mention them in a placement directive, otherwise they will be placed together with other
read/write sections.
If you need to control the manner and/or time of copying, you must use an initialize
manually directive instead. See Manual initialization, page 113.
If the functions need to run without accessing the flash/ROM, you can use the
__ramfunc keyword when compiling. See Execution in RAM, page 78.
The readwrite pattern will match all statically initialized variables and arrange for
them to be initialized at startup. The readonly pattern will do the same for all read-only
code and data, except for code and data needed for the initialization.
Because the function __low_level_init, if present, is called before initialization, it
and anything it needs, will not be copied from ROM to RAM either. In some
circumstances—for example, if the ROM contents are no longer available to the
program after startup—you might need to avoid using the same functions during startup
and in the rest of the code.
If anything else should not be copied, include it in an except clause. This can apply to,
for example, the interrupt vector table.
115
AFE1_AFE2-1:1
Linking considerations
It is also recommended to exclude the C++ dynamic initialization table from being
copied to RAM, as it is typically only read once and then never referenced again. For
example, like this:
initialize by copy { readonly, readwrite }
except { section .intvec, /* Don’t copy
interrupt table */
section .init_array }; /* Don’t copy
C++ init table */
AFE1_AFE2-1:1
Linking your application
VENEERS
Veneers are small sequences of code inserted by the linker to bridge the gap when a call
instruction does not reach its destination or cannot switch to the correct mode.
Code for veneers can be inserted between any caller and called function. As a result, the
R12 register must be treated as a scratch register at function calls, including functions
written in assembler. This also applies to jumps.
RELOCATION ERRORS
For each instruction that cannot be relocated correctly, ILINK will generate a relocation
error. This can occur for instructions where the target is out of reach or is of an
incompatible type, or for many other reasons.
117
AFE1_AFE2-1:1
Hints for troubleshooting
AFE1_AFE2-1:1
Linking your application
Possible solutions
In this case, the distance from the instruction in myfunc to __read is too long for the
branch instruction.
Possible solutions include ensuring that the two .text sections are allocated closer to
each other or using some other calling mechanism that can reach the required distance.
It is also possible that the referring function tried to refer to the wrong target and that
this caused the range error.
Different range errors have different solutions. Usually, the solution is a variant of the
ones presented above, in other words modifying either the code or the section
placement.
119
AFE1_AFE2-1:1
Checking module consistency
Example
In this table, the object files could (but do not have to) define the two runtime attributes
color and taste:
In this case, file1 cannot be linked with any of the other files, since the runtime
attribute color does not match. Also, file4 and file5 cannot be linked together,
because the taste runtime attribute does not match.
On the other hand, file2 and file3 can be linked with each other, and with either
file4 or file5, but not with both.
Alternatively, you can also use the rtmodel assembler directive to specify runtime
model attributes in your assembler source code. For example:
rtmodel "uart", "mode1"
Note: Key names that start with two underscores are reserved by the compiler. For more
information about the syntax, see rtmodel, page 402 and the IAR Assembler User Guide
for Arm.
At link time, the IAR ILINK Linker checks module consistency by ensuring that
modules with conflicting runtime attributes will not be used together. If conflicts are
detected, an error is issued.
AFE1_AFE2-1:1
Linking your application
Linker optimizations
This section contains information about:
● Virtual function elimination, page 121
● Small function inlining, page 121
● Duplicate section merging, page 121
121
AFE1_AFE2-1:1
Linker optimizations
AFE1_AFE2-1:1
The DLIB runtime
environment
● Introduction to the runtime environment
123
AFE1_AFE2-1:1
Introduction to the runtime environment
The runtime library is delivered both as a prebuilt library and (depending on your
product package) as source files. The prebuilt libraries are available in different
configurations to meet various needs, see Runtime library configurations, page 134.
You can find the libraries in the product subdirectories arm\lib and arm\src\lib,
respectively.
For more information about the library, see the chapter C/C++ standard library
functions.
AFE1_AFE2-1:1
The DLIB runtime environment
125
AFE1_AFE2-1:1
Introduction to the runtime environment
implemented, or if you need to debug constructions in your application that use stdin
and stdout without the actual hardware device for input and output being available.
See Setting up your runtime environment, page 127 and The semihosting mechanism,
page 142.
For example, if your application calls the functions printf and fputc in the standard
I/O interface, the implementations of those functions both call the low-level function
__write to output individual characters. To make them work, you just need to provide
an implementation of the __write function—either by implementing it yourself, or by
using a third-party implementation.
AFE1_AFE2-1:1
The DLIB runtime environment
For information about how to override library modules with your own implementations,
see Overriding library modules, page 131. See also The DLIB low-level I/O interface,
page 149 for information about the functions that are part of the interface.
127
AFE1_AFE2-1:1
Setting up the runtime environment
3 On the Library Options page, select Auto with multibyte support or Auto without
multibyte support for both Printf formatter and Scanf formatter. This means that
the linker will automatically choose the appropriate formatters based on information
from the compiler. For more information about the available formatters and how to
choose one manually, see Formatters for printf, page 139 and Formatters for scanf,
page 141, respectively.
4 To enable C-SPY emulated I/O, choose Project>Options>General Options>Library
Configuration and choose Semihosted (--semihosted) or IAR breakpoint
(--semihosting=iar_breakpoint).
Note: For some Cortex-M devices it is also possible to direct stdout/stderr via
SWO. This can significantly improve stdout/stderr performance compared to
semihosting. For hardware requirements, see the C-SPY® Debugging Guide for Arm.
To enable stdout via SWO on the command line, use the linker option --redirect
__iar_sh_stdout=__iar_sh_stdout_swo.
To enable stdout via SWO in the IDE, select the Semihosted option and the
stdout/stderr via SWO option.
See Briefly about C-SPY emulated I/O, page 125 and The semihosting mechanism, page
142.
5 On some systems, terminal output might be slow because the host computer and the
target system must communicate for each character.
For this reason, a replacement for the __write function called __write_buffered is
included in the runtime library. This module buffers the output and sends it to the
debugger one line at a time, speeding up the output.
Note: This function uses about 80 bytes of RAM memory.
To use this feature in the IDE, choose Project>Options>General Options>Library
Options 1 and select the option Buffered terminal output.
To enable this function on the command line, add this to the linker command line:
--redirect __write=__write_buffered
6 Some math functions are available in different versions: default versions, smaller than
the default versions, and larger but more accurate than default versions. Consider
which versions you should use.
For more information, see Math functions, page 143.
7 When you build your project, a suitable prebuilt library and library configuration file
are automatically used based on the project settings you made.
AFE1_AFE2-1:1
The DLIB runtime environment
For information about which project settings affect the choice of library file, see
Runtime library configurations, page 134.
You have now set up a runtime environment that can be used while developing your
application source code.
129
AFE1_AFE2-1:1
Setting up the runtime environment
3 When you have implemented your functions of the low-level I/O interface, you must
add your version of these functions to your project. For information about this, see
Overriding library modules, page 131.
Note: If you have implemented a DLIB low-level I/O interface function and added it to
a project that you have built with support for C-SPY emulated I/O, your low-level
function will be used and not the functions provided with C-SPY emulated I/O. For
example, if you implement your own version of __write, output to the C-SPY
Terminal I/O window will not be supported. See Briefly about C-SPY emulated I/O,
page 125.
4 Before you can execute your application on your target system, you must rebuild your
project with a Release build configuration. This means that the linker will not include
the C-SPY emulated I/O mechanism and the low-level I/O functions it provides. If your
application calls any of the low-level functions of the standard I/O interface, either
directly or indirectly, and your project does not contain these, the linker will issue an
error for every missing low-level function.
Note: The NDEBUG symbol is defined in a Release build configuration, which means
asserts will no longer be generated. For more information, see __aeabi_assert, page
150.
AFE1_AFE2-1:1
The DLIB runtime environment
131
AFE1_AFE2-1:1
Setting up the runtime environment
AFE1_AFE2-1:1
The DLIB runtime environment
To build IAR Embedded Workbench projects from the command line, use the IAR
Command Line Build Utility (iarbuild.exe). However, no make or batch files for
building the library from the command line are provided. For information about the
build process and the IAR Command Line Build Utility, see the IDE Project
Management and Building Guide for Arm.
To use the customized runtime library in your application project:
1 In the IDE, choose Project>Options>General Options and click the Library
Configuration tab.
2 From the Library drop-down menu, choose Custom.
3 In the Configuration file text box, locate your library configuration file.
4 Click the Library tab, also in the Linker category. Use the Additional libraries text
box to locate your library file.
133
AFE1_AFE2-1:1
Additional information on the runtime environment
Note: In addition to these predefined library configurations, you can provide your own
configuration, see Customizing and building your own runtime library, page 131
If you do not specify a library configuration explicitly you will get the default
configuration. If you use a prebuilt runtime library, a configuration file that matches the
runtime library file will automatically be used. See Setting up the runtime environment,
page 127.
To override the default library configuration, use one of these methods:
1 Use a prebuilt configuration of your choice—to specify a runtime configuration
explicitly:
Choose Project>Options>General Options>Library Configuration>Library and
change the default setting.
Use the --dlib_config compiler option, see --dlib_config, page 276.
The prebuilt libraries are based on the default configurations, see Runtime library
configurations, page 134.
2 If you have built your own customized library, choose Project>Options>Library
Configuration>Library and choose Custom to use your own configuration. For more
information, see Customizing and building your own runtime library, page 131.
AFE1_AFE2-1:1
The DLIB runtime environment
135
AFE1_AFE2-1:1
Additional information on the runtime environment
AFE1_AFE2-1:1
The DLIB runtime environment
You can find the library object files in the directory arm\lib\ and the library
configuration files in the directory arm\inc\.
137
AFE1_AFE2-1:1
Additional information on the runtime environment
The names of the library files are constructed in the following way:
dl{architecture}_{cpu-mode}{byte-order}{lib-config}[rwpi].a
AFE1_AFE2-1:1
The DLIB runtime environment
Library files for timezone and daylight saving time support functions
These are the functions with support for timezone and daylight saving time
functionality.
The names of the library files are constructed in the following way:
tz{architecture}_{cpu-mode}{byte-order}[rwpi].a
or
sh{architecture}_{byte-order}.a
or
sh{6Mx|7Mx|7Sx}_{l|b}.a
139
AFE1_AFE2-1:1
Additional information on the runtime environment
AFE1_AFE2-1:1
The DLIB runtime environment
If the compiler does not recognize multibyte support, you can enable it:
Select Project>Options>General Options>Library Options 1>Enable multibyte
support.
Use the linker option --printf_multibytes.
141
AFE1_AFE2-1:1
Additional information on the runtime environment
If the compiler does not recognize multibyte support, you can enable it:
Select Project>Options>General Options>Library Options 1>Enable multibyte
support.
Use the linker option --scanf_multibytes.
AFE1_AFE2-1:1
The DLIB runtime environment
other purposes than semihosting, the handling of this breakpoint will cause a severe
performance penalty for each such call. IAR breakpoint is a way to get around this. By
using a special function call instead of an SVC instruction to perform semihosting, the
semihosting breakpoint can be set on that special function instead. This means that
semihosting will not interfere with other uses of the Supervisor Call vector.
Note: IAR breakpoint is an IAR-specific extension of the semihosting standard. If you
link your application with libraries built with toolchains from other vendors than IAR
Systems and use IAR breakpoint, semihosting calls made from code in those libraries
will not work.
MATH FUNCTIONS
Some C/C++ standard library math functions are available in different versions:
● The default versions
● Smaller versions (but less accurate)
● More accurate versions (but larger).
Smaller versions
The functions cos, exp, log, log2, log10, pow, sin, and tan exist in additional,
smaller versions in the library. They are about 20% smaller and about 20% faster than
the default versions. The functions handle INF and NaN values. The drawbacks are that
they almost always lose some precision and they do not have the same input range as the
default versions.
The names of the functions are constructed like:
__iar_xxx_small<f|l>
where f is used for float variants, l is used for long double variants, and no suffix
is used for double variants.
To specify individual math functions from the command line:
1 Redirect the default function names to these names when linking, using these options:
--redirect sin=__iar_sin_small
--redirect cos=__iar_cos_small
--redirect tan=__iar_tan_small
--redirect log=__iar_log_small
--redirect log2=__iar_log2_small
--redirect log10=__iar_log10_small
--redirect exp=__iar_exp_small
--redirect pow=__iar_pow_small
143
AFE1_AFE2-1:1
Additional information on the runtime environment
--redirect sinf=__iar_sin_smallf
--redirect cosf=__iar_cos_smallf
--redirect tanf=__iar_tan_smallf
--redirect logf=__iar_log_smallf
--redirect log2f=__iar_log2_smallf
--redirect log10f=__iar_log10_smallf
--redirect expf=__iar_exp_smallf
--redirect powf=__iar_pow_smallf
--redirect sinl=__iar_sin_smalll
--redirect cosl=__iar_cos_smalll
--redirect tanl=__iar_tan_smalll
--redirect logl=__iar_log_smalll
--redirect log2l=__iar_log2_smalll
--redirect log10l=__iar_log10_smalll
--redirect expl=__iar_exp_smalll
--redirect powl=__iar_pow_smalll
where f is used for float variants, l is used for long double variants, and no suffix
is used for double variants.
To specify individual math functions from the command line:
1 Redirect the default function names to these names when linking, using these options:
--redirect sin=__iar_sin_accurate
--redirect cos=__iar_cos_accurate
--redirect tan=__iar_tan_accurate
--redirect pow=__iar_pow_accurate
--redirect sinf=__iar_sin_accuratef
--redirect cosf=__iar_cos_accuratef
--redirect tanf=__iar_tan_accuratef
--redirect powf=__iar_pow_accuratef
--redirect sinl=__iar_sin_accuratel
--redirect cosl=__iar_cos_accuratel
--redirect tanl=__iar_tan_accuratel
--redirect powl=__iar_pow_accuratel
AFE1_AFE2-1:1
The DLIB runtime environment
System startup
During system startup, an initialization sequence is executed before the main function
is entered. This sequence performs initializations required for the target hardware and
the C/C++ environment.
For the hardware initialization, it looks like this:
● When the CPU is reset it will start executing at the program entry label
__iar_program_start in the system startup code.
● The stack pointer is initialized to the end of the CSTACK block
● For Arm7/9/11, Cortex-A, and Cortex-R devices, exception stack pointers are
initialized to the end of each corresponding section
● The function __low_level_init is called if you defined it, giving the application
a chance to perform early initializations.
145
AFE1_AFE2-1:1
Additional information on the runtime environment
● Static and global variables are initialized. That is, zero-initialized variables are
cleared and the values of other initialized variables are copied from ROM to RAM
memory. This step is skipped if __low_level_init returns zero. For more
information, see Initialization at system startup, page 96.
● Static C++ objects are constructed
● The main function is called, which starts the application.
For information about the initialization phase, see Application execution—an overview,
page 64.
AFE1_AFE2-1:1
The DLIB runtime environment
System termination
This illustration shows the different ways an embedded application can terminate in a
controlled way:
147
AFE1_AFE2-1:1
Additional information on the runtime environment
quick_exit function is equivalent to the _Exit function, except that it calls each
function passed to at_quick_exit before calling __exit.
If you want your application to do anything extra at exit, for example, resetting the
system (and if using atexit is not sufficient), you can write your own implementation
of the __exit(int) function.
The library files that you can override with your own versions are located in the
arm\src\lib directory. See Overriding library modules, page 131.
SYSTEM INITIALIZATION
It is likely that you need to adapt the system initialization. For example, your application
might need to initialize memory-mapped special function registers (SFRs), or omit the
default initialization of data sections performed by the system startup code.
You can do this by implementing your own version of the routine __low_level_init,
which is called from the cmain.s file before the data sections are initialized. Modifying
the cmain.s file directly should be avoided.
For Cortex-M, the code for handling system startup is located in the source files
cstartup_M.s and low_level_init.c, located in the arm\src\lib directory.
For other Arm devices, the code for handling system startup is located in the source files
cstartup.s and low_level_init.c, located in the arm\src\lib directory.
Note that normally, you do not need to customize either of the files cmain.s or
cexit.s.
Customizing __low_level_init
A skeleton low-level initialization file is supplied with the product:
low_level_init.c.
Note: Static initialized variables cannot be used within the file, because variable
initialization has not been performed at this point.
AFE1_AFE2-1:1
The DLIB runtime environment
abort
__aeabi_assert
clock
__close
__exit
getenv
__getzone
__lseek
__open
raise
__read
149
AFE1_AFE2-1:1
Additional information on the runtime environment
remove
rename
signal
system
__time32, __time64
__write
Note: You should normally not use the low-level functions prefixed with __ directly in
your application. Instead you should use the standard library functions that use these
functions. For example, to write to stdout, you should use standard library functions
like printf or puts, which in turn calls the low-level function __write. If you have
forgot to implement a low-level function and your application calls that function via a
standard library function, the linker issues an error when you link in release build
configuration.
Note: If you implement your own variants of the functions in this interface, your
variants will be used even though you have enabled C-SPY emulated I/O, see Briefly
about C-SPY emulated I/O, page 125.
abort
Source file arm\src\lib\runtime\abort.c
Declared in stdlib.h
__aeabi_assert
Source file arm\src\lib\runtime\assert.c
Declared in assert.h
AFE1_AFE2-1:1
The DLIB runtime environment
C-SPY debug action Notifies the C-SPY debugger about the failed assert.
Default implementation Failed asserts are reported by the function __aeabi_assert. By default, it prints an
error message and calls abort. If this is not the behavior you require, you can
implement your own version of the function.
The assert macro is defined in the header file assert.h. To turn off assertions, define
the symbol NDEBUG.
In the IDE, the symbol NDEBUG is by default defined in a Release project and not defined
in a Debug project. If you build from the command line, you must explicitly define the
symbol according to your needs. See NDEBUG, page 468.
clock
Source file arm\src\lib\time\clock.c
Declared in time.h
__close
Source file arm\src\lib\file\close.c
Declared in LowLevelIOInterface.h
C-SPY debug action Closes the associated host file on the host computer.
151
AFE1_AFE2-1:1
Additional information on the runtime environment
__exit
Source file arm\src\lib\runtime\xxexit.c
Declared in LowLevelIOInterface.h
C-SPY debug action Notifies that the end of the application was reached.
getenv
Source file arm\src\lib\runtime\getenv.c
arm\src\lib\runtime\environ.c
Default implementation The getenv function in the library searches the string pointed to by the global variable
__environ, for the key that was passed as argument. If the key is found, the value of it
is returned, otherwise 0 (zero) is returned. By default, the string is empty.
To create or edit keys in the string, you must create a sequence of null-terminated strings
where each string has the format:
key=value\0
End the string with an extra null character (if you use a C string, this is added
automatically). Assign the created sequence of strings to the __environ variable.
For example:
const char MyEnv[] = "Key=Value\0Key2=Value2\0";
__environ = MyEnv;
AFE1_AFE2-1:1
The DLIB runtime environment
If you need a more sophisticated environment variable handling, you should implement
your own getenv, and possibly putenv function.
Note: The putenv function is not required by the standard, and the library does not
provide an implementation of it.
__getzone
Source file arm\src\lib\time\getzone.c
Declared in LowLevelIOInterface.h
See also Briefly about retargeting, page 126 and --timezone_lib, page 344.
For more information, see the source file getzone.c.
__lseek
Source file arm\src\lib\file\lseek.c
Declared in LowLevelIOInterface.h
Description Low-level function for changing the location of the next access in an open file.
C-SPY debug action Searches in the associated host file on the host computer.
153
AFE1_AFE2-1:1
Additional information on the runtime environment
__open
Source file arm\src\lib\file\open.c
Declared in LowLevelIOInterface.h
raise
Source file arm\src\lib\runtime\raise.c
Declared in signal.h
Default implementation Calls the signal handler for the raised signal, or terminates with call to
__exit(EXIT_FAILURE).
__read
Source file arm\src\lib\file\read.c
Declared in LowLevelIOInterface.h
Description Low-level function that reads characters from stdin and from files.
C-SPY debug action Directs stdin to the Terminal I/O window. All other files will read the associated host
file.
AFE1_AFE2-1:1
The DLIB runtime environment
Example The code in this example uses memory-mapped I/O to read from a keyboard, whose port
is assumed to be located at 0x1000:
#include <stddef.h>
#include <LowLevelIOInterface.h>
*buf++ = c;
++nChars;
}
return nChars;
}
For information about the handles associated with the streams, see Retargeting—
Adapting for your target system, page 129.
For information about the @ operator, see Controlling data and function placement in
memory, page 230.
remove
Source file arm\src\lib\file\remove.c
155
AFE1_AFE2-1:1
Additional information on the runtime environment
Declared in stdio.h
rename
Source file arm\src\lib\file\rename.c
Declared in stdio.h
signal
Source file arm\src\lib\runtime\signal.c
Declared in signal.h
Default implementation As specified by Standard C. You might want to modify this behavior if the environment
supports some kind of asynchronous signals.
AFE1_AFE2-1:1
The DLIB runtime environment
system
Source file arm\src\lib\runtime\system.c
Declared in stdlib.h
C-SPY debug action Notifies the C-SPY debugger that system has been called and then returns -1.
Default implementation The system function available in the library returns 0 if a null pointer is passed to it to
indicate that there is no command processor, otherwise it returns -1 to indicate failure.
If this is not the functionality that you require, you can implement your own version.
This does not require that you rebuild the library.
__time32, __time64
Source file arm\src\lib\time\time.c
arm\src\lib\time\time64.c
Declared in time.h
__write
Source file arm\src\lib\file\write.c
Declared in LowLevelIOInterface.h
C-SPY debug action Directs stdout and stderr to the Terminal I/O window. All other files will write to
the associated host file.
157
AFE1_AFE2-1:1
Additional information on the runtime environment
Example The code in this example uses memory-mapped I/O to write to an LCD display, whose
port is assumed to be located at address 0x1000:
#include <stddef.h>
#include <LowLevelIOInterface.h>
return nChars;
}
For information about the handles associated with the streams, see Retargeting—
Adapting for your target system, page 129.
AFE1_AFE2-1:1
The DLIB runtime environment
LOCALE
Locale is a part of the C language that allows language and country-specific settings for
several areas, such as currency symbols, date and time, and multibyte character
encoding.
Depending on which library configuration you are using, you get different levels of
locale support. However, the more locale support, the larger your code will get. It is
therefore necessary to consider what level of support your application needs. See
Runtime library configurations, page 134.
The DLIB runtime library can be used in two main modes:
● Using a full library configuration that has a locale interface, which makes it possible
to switch between different locales during runtime
The application starts with the C locale. To use another locale, you must call the
setlocale function or use the corresponding mechanisms in C++. The locales that
the application can use are set up at linkage.
● Using a normal library configuration that does not have a locale interface, where the
C locale is hardwired into the application.
Note: If multibytes are to be printed, you must make sure that the implementation of
__write in the DLIB low-level I/O interface can handle them.
Use the linker option --keep with the tag of the locale as the parameter, for example:
--keep _Locale_cs_CZ_iso8859_2
159
AFE1_AFE2-1:1
Managing a multithreaded environment
The line contains the full locale name, the encoding for the locale, the abbreviated locale
name, and the tag to be used as parameter to the linker option --keep.
or
lang_REGION.encoding
The lang part specifies the language code, and the REGION part specifies a region
qualifier, and encoding specifies the multibyte character encoding that should be used.
The available encodings are ISO-8859-1, ISO-8859-2, ISO-8859-4, ISO-8859-5,
ISO-8859-7, ISO-8859-8, ISO-8859-9, ISO-8859-15, CP932, and UTF-8.
For a complete list of the available locales and their respective encoding, see the file
SupportedLocales.json in the arm\config directory.
Example
This example sets the locale configuration symbols to Swedish to be used in Finland and
UTF8 multibyte character encoding:
setlocale (LC_ALL, "sv_FI.UTF8");
AFE1_AFE2-1:1
The DLIB runtime environment
static variables containing the object state must reside in a variable area local to that
thread. This area is commonly named thread-local storage (TLS).
The low-level implementations of locks and TLS are system-specific, and is not
included in the DLIB runtime environment. If you are using an RTOS, check if it
provides some or all of the required functions. Otherwise, you must provide your own.
Note: If you are using printf/scanf (or any variants) with formatters, each individual
formatter will be guarded, but the complete printf/scanf invocation will not be
guarded.
If C++ is used in a runtime environment with multithread support, the compiler option
--guard_calls must be used to make sure that function-static variables with dynamic
initializers are not initialized simultaneously by several threads.
161
AFE1_AFE2-1:1
Managing a multithreaded environment
AFE1_AFE2-1:1
Assembler language
interface
● Mixing C and assembler
● Calling convention
INTRINSIC FUNCTIONS
The compiler provides a few predefined functions that allow direct access to low-level
processor operations without having to use the assembler language. These functions are
known as intrinsic functions. They can be useful in, for example, time-critical routines.
An intrinsic function looks like a normal function call, but it is really a built-in function
that the compiler recognizes. The intrinsic functions compile into inline code, either as
a single instruction, or as a short sequence of instructions.
For more information about the available intrinsic functions, see the chapter Intrinsic
functions.
163
AFE1_AFE2-1:1
Mixing C and assembler
This causes some overhead in the form of function call and return instruction sequences,
and the compiler will regard some registers as scratch registers. In many cases, the
overhead of the extra instructions can be removed by the optimizer.
An important advantage is that you will have a well-defined interface between what the
compiler produces and what you write in assembler. When using inline assembler, you
will not have any guarantees that your inline assembler lines do not interfere with the
compiler generated code.
When an application is written partly in assembler language and partly in C or C++, you
are faced with several questions:
● How should the assembler code be written so that it can be called from C?
● Where does the assembler code find its parameters, and how is the return value
passed back to the caller?
● How should assembler code call functions written in C?
● How are global C variables accessed from code written in assembler language?
● Why does not the debugger display the call stack when assembler code is being
debugged?
The first question is discussed in the section Calling assembler routines from C, page
172. The following two are covered in the section Calling convention, page 175.
The answer to the final question is that the call stack can be displayed when you run
assembler code in the debugger. However, the debugger requires information about the
call frame, which must be supplied as annotations in the assembler source file. For more
information, see Call frame information, page 182.
The recommended method for mixing C or C++ and assembler modules is described in
Calling assembler routines from C, page 172, and Calling assembler routines from
C++, page 175, respectively.
INLINE ASSEMBLER
Inline assembler can be used for inserting assembler instructions directly into a C or
C++ function. Typically, this can be useful if you need to:
● Access hardware resources that are not accessible in C (in other words, when there
is no definition for an SFR or there is no suitable intrinsic function available).
● Manually write a time-critical sequence of code that if written in C will not have the
right timing.
● Manually write a speed-critical sequence of code that if written in C will be too
slow.
An inline assembler statement is similar to a C function in that it can take input
arguments (input operands), have return values (output operands), and read or write to
AFE1_AFE2-1:1
Assembler language interface
C symbols (via the operands). An inline assembler statement can also declare clobbered
resources, that is, values in registers and memory that have been overwritten.
Limitations
Most things you can to do in normal assembler language are also possible with inline
assembler, with the following differences:
● Alignment cannot be controlled—this means, for example, that DC32 directives
might be misaligned.
● The only accepted register synonyms are SP (for R13), LR (for R14), and PC (for
R15).
● In general, assembler directives will cause errors or have no meaning. However,
data definition directives will work as expected.
● Resources used (registers, memory, etc) that are also used by the C compiler must
be declared as operands or clobbered resources.
● If you do not want to risk that the inline assembler statement to be optimized away
by the compiler, you must declare it volatile.
● Accessing a C symbol or using a constant expression requires the use of operands.
● Dependencies between the expressions for the operands might result in an error.
● The pseudo-instruction LDR Rd, =expr is not available from inline assembler.
165
AFE1_AFE2-1:1
Mixing C and assembler
The following example—for Arm mode—demonstrates the risks of using the asm
keyword without operands and clobbers:
int Add(int term1, int term2)
{
asm("adds r0,r0,r1");
return term1;
}
In this example:
● The function Add assumes that values are passed and returned in registers in a way
that they might not always be, for example, if the function is inlined.
● The s in the adds instruction implies that the condition flags are updated, which
you specify using the cc clobber operand. Otherwise, the compiler will assume that
the condition flags are not modified.
Inline assembler without using operands or clobbered resources is therefore often best
avoided. The compiler will issue a remark for them.
Syntax The syntax of an inline assembler statement is (similar to the one used by GNU GCC):
asm [volatile]( string [assembler-interface])
A string can contain one or more operations, separated by \n. Each operation can be
a valid assembler instruction or a data definition assembler directive prefixed by an
optional label. There can be no whitespace before the label and it must be followed by :.
For example:
asm("label:nop\n"
"b label");
Note: Any labels you define in the inline assembler statement will be local to that
statement. You can use this for loops or conditional code.
If you define a label in an inline assembler statement using two colons—for example,
"label:: nop\n"—instead of one, the label will be public, not only in the inline
assembler statement, but in the module as well. This feature is intended for testing only.
AFE1_AFE2-1:1
Assembler language interface
Operands An inline assembler statement can have one input and one output comma-separated list
of operands. Each operand consists of an optional symbolic name in brackets, a quoted
constraint, followed by a C expression in parentheses.
For example:
int Add(int term1, int term2)
{
int sum;
asm("add %0,%1,%2"
: "=r"(sum)
: "r" (term1), "r" (term2));
return sum;
}
In this example, the assembler instruction uses one output operand, sum, two input
operands, term1 and term2, and no clobbered resources.
It is possible to omit any list by leaving it empty. For example:
int matrix[M][N];
Operand constraints
Constraint Description
r Uses a general purpose register for the expression:
R0-R12, R14 (for Arm and Thumb2)
R0-R7 (for Thumb1)
l R0-R7 (only valid for Thumb1)
Table 10: Inline assembler operand constraints
167
AFE1_AFE2-1:1
Mixing C and assembler
Constraint Description
Rp Uses a pair of general purpose registers, for example R0, R1
i An immediate integer operand with a constant value. Symbolic
constants are allowed.
j A 16-bit constant suitable for a MOVW instruction (valid for Arm and
Thumb2).
n An immediate operand, alias for i.
I An immediate constant valid for a data processing instruction (for Arm
and Thumb2), or a constant in the range 0 to 255 (for Thumb1).
J An immediate constant in the range -4095 to 4095 (for Arm and
Thumb2), or a constant in the range -255 to -1 (for Thumb1).
K An immediate constant that satisfies the I constraint if inverted (for
Arm and Thumb2), or a constant that satisfies the I constraint
multiplied by any power of 2 (for Thumb1).
L An immediate constant that satisfies the I constraint if negated (for
Arm and Thumb2), or a constant in the range -7 to 7 (for Thumb1).
M An immediate constant that is a multiple of 4 in the range 0 to 1020
(only valid for Thumb1).
N An immediate constant in the range 0 to 31 (only valid for Thumb1).
O An immediate constant that is a multiple of 4 in the range -508 to 508
(only valid for Thumb1).
t An S register.
w A D register.
q A Q register.
Dv A 32-bit floating-point immediate constant for the VMOV.F32
instruction.
Dy A 64-bit floating-point immediate constant for the VMOV.F64
instruction.
v2S ... v4Q A vector of 2, 3, or 4 consecutive S, D, or Q registers. For example,
v4Q is a vector of four Q registers. The vectors do not overlap, so the
available v4Q register vectors are Q0-Q3, Q4-Q7, Q8-Q11, and
Q12-Q15.
Table 10: Inline assembler operand constraints (Continued)
Constraint modifiers Constraint modifiers can be used together with a constraint to modify its meaning. This
table lists the supported constraint modifiers:
AFE1_AFE2-1:1
Assembler language interface
Modifier Description
= Write-only operand
+ Read-write operand
& Early clobber output operand which is written to before the instruction
has processed all the input operands.
Table 11: Supported constraint modifiers
Referring to operands Assembler instructions refer to operands by prefixing their order number with %. The
first operand has order number 0 and is referred to by %0.
If the operand has a symbolic name, you can refer to it using the syntax
%[operand.name]. Symbolic operand names are in a separate namespace from C/C++
code and can be the same as a C/C++ variable names. Each operand name must however
be unique in each assembler statement. For example:
int Add(int term1, int term2)
{
int sum;
asm("add %[Rd],%[Rn],%[Rm]"
: [Rd]"=r"(sum)
: [Rn]"r" (term1), [Rm]"r" (term2));
return sum;
}
Input operands Input operands cannot have any constraint modifiers, but they can have any valid C
expression as long as the type of the expression fits the register.
The C expression will be evaluated just before any of the assembler instructions in the
inline assembler statement and assigned to the constraint, for example, a register.
Output operands Output operands must have = as a constraint modifier and the C expression must be an
l-value and specify a writable location. For example, =r for a write-only general purpose
register. The constraint will be assigned to the evaluated C expression (as an l-value)
immediately after the last assembler instruction in the inline assembler statement. Input
operands are assumed to be consumed before output is produced and the compiler may
use the same register for an input and output operand. To prohibit this, prefix the output
constraint with & to make it an early clobber resource, for example, =&r. This will ensure
that the output operand will be allocated in a different register than the input operands.
Input/output operands An operand that should be used both for input and output must be listed as an output
operand and have the + modifier. The C expression must be an l-value and specify a
169
AFE1_AFE2-1:1
Mixing C and assembler
writable location. The location will be read immediately before any assembler
instructions and it will be written to right after the last assembler instruction.
This is an example of using a read-write operand:
int Double(int value)
{
asm("add %0,%0,%0" : "+r"(value));
return value;
}
In the example above, the input value for value will be placed in a general purpose
register. After the assembler statement, the result from the ADD instruction will be placed
in the same register.
Clobbered resources An inline assembler statement can have a list of clobbered resources.
"resource1", "resource2", ...
Specify clobbered resources to inform the compiler about which resources the inline
assembler statement destroys. Any value that resides in a clobbered resource and that is
needed after the inline assembler statement will be reloaded.
Clobbered resources will not be used as input or output operands.
This is an example of how to use clobbered resources:
int Add(int term1, int term2)
{
int sum;
asm("adds %0,%1,%2"
: "=r"(sum)
: "r" (term1), "r" (term2)
: "cc");
return sum;
}
In this example, the condition codes will be modified by the ADDS instruction.
Therefore, "cc" must be listed in the clobber list.
This table lists valid clobbered resources:
Clobber Description
R0-R12, R14for Arm mode and Thumb2 General purpose registers
R0-R7, R12, R14 for Thumb1
Table 12: List of valid clobbers
AFE1_AFE2-1:1
Assembler language interface
Clobber Description
S0-S31, D0-D31, Q0-Q15 Floating-point registers
cc The condition flags (N, Z, V, and C)
memory To be used if the instructions modify any
memory. This will avoid keeping memory
values cached in registers across the inline
assembler statement.
Table 12: List of valid clobbers (Continued)
Operand modifiers An operand modifier is a single letter between the % and the operand number, which is
used for transforming the operand.
In the example below, the modifiers L and H are used for accessing the least and most
significant 16 bits, respectively, of an immediate operand:
int Mov32()
{
int a;
asm("movw %0,%L1 \n"
"movt %0,%H1 \n" : "=r"(a) : "i"(0x12345678UL));
return a;
}
Some operand modifiers can be combined, in which case each letter will transform the
result from the previous modifier. This table describes the transformation performed by
each valid modifier:
Modifier Description
L The lowest-numbered register of a register pair, or the low 16 bits of an
immediate constant.
H The highest-numbered register of a register pair, or the high 16 bits of
an immediate constant.
c For an immediate operand, an integer or symbol address without a
preceding # sign. Cannot be transformed by additional operand
modifiers.
B For an immediate operand, the bitwise inverse of integer or symbol
without a preceding # sign. Cannot be transformed by additional
operand modifiers.
Q The least significant register of a register pair.
R The most significant register of a register pair.
Table 13: Operand modifiers and transformations
171
AFE1_AFE2-1:1
Calling assembler routines from C
Modifier Description
M For a register or a register pair, the register list suitable for ldm or
stm. Cannot be transformed by additional operand modifiers.
a Transforms a register Rn into a memory operand [Rn,#0] suitable
for pld.
b The low S register part of a D register.
p The high S register part of a D register.
e The low D register part of a Q register, or the low register in a vector of
Neon registers.
f The high D register part of a Q register, or the high register in a vector
of Neon registers.
h For a (vector of) D or Q registers, the corresponding list of D registers
within curly braces. For example, Q0 becomes {D0,D1}. Cannot be
transformed by additional operand modifiers.
y S register as indexed D register, for example S7 becomes D3[1].
Cannot be transformed by additional operand modifiers.
Table 13: Operand modifiers and transformations (Continued)
asm("strex %0,%2,[%1]"
: "=&r"(failed)
: "r"(location), "r"(value)
: "memory");
return failed;
}
AFE1_AFE2-1:1
Assembler language interface
One way of fulfilling these requirements is to create skeleton code in C, compile it, and
study the assembler list file.
int main()
{
int locInt = gInt;
gInt = Func(locInt, gChar);
return 0;
}
Note: In this example, we use a low optimization level when compiling the code to show
local and global variable access. If a higher level of optimization is used, the required
references to local variables could be removed during the optimization. The actual
function declaration is not changed by the optimization level.
173
AFE1_AFE2-1:1
Calling assembler routines from C
Output assembler file option and its suboption Include source. Also, be sure to specify
a low level of optimization.
Use these options to compile the skeleton code:
iccarm skeleton.c -lA . -On -e
The -lA option creates an assembler language output file including C or C++ source
lines as assembler comments. The . (period) specifies that the assembler file should be
named in the same way as the C or C++ module (skeleton), but with the filename
extension s. The -On option means that no optimization will be used and -e enables
language extensions. In addition, make sure to use relevant compiler options, usually the
same as you use for other C or C++ source files in your project.
The result is the assembler source output file skeleton.s.
Note: The -lA option creates a list file containing call frame information (CFI)
directives, which can be useful if you intend to study these directives and how they are
used. If you only want to study the calling convention, you can exclude the CFI
directives from the list file.
In the IDE, to exclude the CFI directives from the list file, choose
Project>Options>C/C++ Compiler>List and deselect the suboption Include call
frame information.
On the command line, to exclude the CFI directives from the list file, use the option -lB
instead of -lA.
Note: CFI information must be included in the source code to make the C-SPY Call
Stack window work.
AFE1_AFE2-1:1
Assembler language interface
The following example shows how to achieve the equivalent to a non-static member
function, which means that the implicit this pointer must be made explicit. It is also
possible to “wrap” the call to the assembler routine in a member function. Use an inline
member function to remove the overhead of the extra call—this assumes that function
inlining is enabled:
class MyClass;
extern "C"
{
void DoIt(MyClass *ptr, int arg);
}
class MyClass
{
public:
inline void DoIt(int arg)
{
::DoIt(this, arg);
}
};
Calling convention
A calling convention is the way a function in a program calls another function. The
compiler handles this automatically, but, if a function is written in assembler language,
you must know where and how its parameters can be found, how to return to the program
location from where it was called, and how to return the resulting value.
175
AFE1_AFE2-1:1
Calling convention
FUNCTION DECLARATIONS
In C, a function must be declared in order for the compiler to know how to call it. A
declaration could look as follows:
int MyFunction(int first, char * second);
This means that the function takes two parameters: an integer and a pointer to a
character. The function returns a value, an integer.
In the general case, this is the only knowledge that the compiler has about a function.
Therefore, it must be able to deduce the calling convention from this information.
AFE1_AFE2-1:1
Assembler language interface
It is often practical to share header files between C and C++. This is an example of a
declaration that declares a function with C linkage in both C and C++:
#ifdef __cplusplus
extern "C"
{
#endif
int F(int);
#ifdef __cplusplus
}
#endif
Scratch registers
Any function is permitted to destroy the contents of a scratch register. If a function needs
the register value after a call to another function, it must store it during the call, for
example, on the stack.
Any of the registers R0 to R3, and R12, can be used as a scratch register by the function.
Note: R12 is also a scratch register when calling between assembler functions because
of automatically inserted instructions for veneers.
Preserved registers
Preserved registers, on the other hand, are preserved across function calls. The called
function can use the register for other purposes, but must save the value before using the
register and restore it at the exit of the function.
The registers R4 through to R11 are preserved registers. They are preserved by the called
function.
Special registers
For some registers, you must consider certain prerequisites:
● The stack pointer register, R13/SP, must at all times point to or below the last
element on the stack. In the eventuality of an interrupt, everything below the point
the stack pointer points to, can be destroyed. At function entry and exit, the stack
pointer must be 8-byte aligned. In the function, the stack pointer must always be
word aligned. At exit, SP must have the same value as it had at the entry.
177
AFE1_AFE2-1:1
Calling convention
FUNCTION ENTRANCE
Parameters can be passed to a function using one of these basic methods:
● In registers
● On the stack
It is much more efficient to use registers than to take a detour via memory, so the calling
convention is designed to use registers as much as possible. Only a limited number of
registers can be used for passing parameters—when no more registers are available, the
remaining parameters are passed on the stack. These exceptions to the rules apply:
● Interrupt functions cannot take any parameters, except software interrupt functions
that accept parameters and have return values
● Software interrupt functions cannot use the stack in the same way as ordinary
functions. When an SVC instruction is executed, the processor switches to
supervisor mode where the supervisor stack is used. Arguments can therefore not be
passed on the stack if your application is not running in supervisor mode previous to
the interrupt.
Hidden parameters
In addition to the parameters visible in a function declaration and definition, there can
be hidden parameters:
● If the function returns a structure larger than 32 bits, the memory location where the
structure is to be stored is passed as an extra parameter. Notice that it is always
treated as the first parameter.
● If the function is a non-static C++ member function, then the this pointer is passed
as the first parameter (but placed after the return structure pointer, if there is one).
For more information, see Calling assembler routines from C, page 172.
Register parameters
AFE1_AFE2-1:1
Assembler language interface
FUNCTION EXIT
A function can return a value to the function or program that called it, or it can have the
return type void.
The return value of a function, if any, can be scalar (such as integers and pointers),
floating-point, or a structure.
179
AFE1_AFE2-1:1
Calling convention
If the returned value is smaller than 32 bits, the value is sign or zero-extended to 32 bits.
; Do something here.
end
AFE1_AFE2-1:1
Assembler language interface
EXAMPLES
The following section shows a series of declaration examples and the corresponding
calling conventions. The complexity of the examples increases toward the end.
Example 1
Assume this function declaration:
int add1(int);
This function takes one parameter in the register R0, and the return value is passed back
to its caller in the register R0.
This assembler routine is compatible with the declaration—it will return a value that is
one number higher than the value of its parameter:
name return
section .text:CODE
add r0, r0, #1
bx lr
end
Example 2
This example shows how structures are passed on the stack. Assume these declarations:
struct MyStruct
{
short a;
short b;
short c;
short d;
short e;
};
The values of the structure members a, b, c, and d are passed in registers R0-R3. The
last structure member e and the integer parameter y are passed on the stack. The calling
function must reserve eight bytes on the top of the stack and copy the contents of the two
stack parameters to that location. The return value is passed back to its caller in the
register R0.
181
AFE1_AFE2-1:1
Call frame information
Example 3
The function below will return a structure of type struct MyStruct.
struct MyStruct
{
int mA[20];
};
It is the responsibility of the calling function to allocate a memory location for the return
value and pass a pointer to it as a hidden first parameter. The pointer to the location
where the return value should be stored is passed in R0. The parameter x is passed in R1.
Assume that the function instead was declared to return a pointer to the structure:
struct MyStruct *MyFunction(int x);
In this case, the return value is a scalar, so there is no hidden parameter. The parameter
x is passed in R0, and the return value is returned in R0.
CFI DIRECTIVES
The CFI directives provide C-SPY with information about the state of the calling
function(s). Most important of this is the return address, and the value of the stack
pointer at the entry of the function or assembler routine. Given this information, C-SPY
can reconstruct the state for the calling function, and thereby unwind the stack.
A full description about the calling convention might require extensive call frame
information. In many cases, a more limited approach will suffice.
When describing the call frame information, the following three components must be
present:
● A names block describing the available resources to be tracked
AFE1_AFE2-1:1
Assembler language interface
Resource Description
CFA R13 The call frames of the stack
R0–R12 Processor general-purpose 32-bit registers
R13 Stack pointer, SP
R14 Link register, LR
D0-D31 Vector Floating Point (VFP) 64-bit coprocessor register
CPSR Current program status register
SPSR Saved program status register
Table 16: Call frame information resources defined in a names block
2 Compile the C source code, and make sure to create a list file that contains call frame
information—the CFI directives.
On the command line, use the option -lA.
183
AFE1_AFE2-1:1
Call frame information
For the source code in this example, the list file looks like this:
NAME Cfi
EXTERN F
PUBLIC cfiExample
SECTION `.text`:CODE:NOROOT(2)
CFI Block cfiBlock0 Using cfiCommon0
CFI Function cfiExample
ARM
cfiExample:
PUSH {R4,LR}
CFI R14 Frame(CFA, -4)
CFI R4 Frame(CFA, -8)
AFE1_AFE2-1:1
Assembler language interface
END
185
AFE1_AFE2-1:1
Call frame information
AFE1_AFE2-1:1
Using C
● C language overview
● Extensions overview
C language overview
The IAR C/C++ Compiler for Arm supports the INCITS/ISO/IEC 9899:2018 standard,
also known as C18. C18 addresses defects in C11 (INCITS/ISO/IEC 9899:2012)
without introducing any new language features. This means that the C11 standard is also
supported. In this guide, the C18 standard is referred to as Standard C and is the default
standard used in the compiler. This standard is stricter than C89.
The compiler will accept source code written in the C18 standard or a superset thereof.
In addition, the compiler also supports the ISO 9899:1990 standard (including all
technical corrigenda and addenda), also known as C94, C90, C89, and ANSI C. In this
guide, this standard is referred to as C89. Use the --c89 compiler option to enable this
standard.
With Standard C enabled, the IAR C/C++ Compiler for Arm can compile all C18/C11
source code files, except for those that depend on thread-related system header files.
Annex K (Bounds-checking interfaces) of the C standard is supported. See Bounds
checking functionality, page 133.
For an overview of the differences between the various versions of the C standard, see
the Wikipedia articles C18 (C standard revision), C11 (C standard revision), or C99.
Extensions overview
The compiler offers the features of Standard C and a wide set of extensions, ranging
from features specifically tailored for efficient programming in the embedded industry
to the relaxation of some minor standards issues.
This is an overview of the available extensions:
● IAR C language extensions
For information about available language extensions, see IAR C language extensions,
page 189. For more information about the extended keywords, see the chapter
187
AFE1_AFE2-1:1
Extensions overview
Extended keywords. For information about C++, the two levels of support for the
language, and C++ language extensions, see the chapter Using C++.
● Pragma directives
The #pragma directive is defined by Standard C and is a mechanism for using
vendor-specific extensions in a controlled way to make sure that the source code is
still portable.
The compiler provides a set of predefined pragma directives, which can be used for
controlling the behavior of the compiler, for example, how it allocates memory,
whether it allows extended keywords, and whether it outputs warning messages.
Most pragma directives are preprocessed, which means that macros are substituted
in a pragma directive. The pragma directives are always enabled in the compiler. For
several of them there is also a corresponding C/C++ language extension. For
information about available pragma directives, see the chapter Pragma directives.
● Preprocessor extensions
The preprocessor of the compiler adheres to Standard C. The compiler also makes
several preprocessor-related extensions available to you. For more information, see
the chapter The preprocessor.
● Intrinsic functions
The intrinsic functions provide direct access to low-level processor operations and
can be useful in, for example, time-critical routines. The intrinsic functions compile
into inline code, either as a single instruction or as a short sequence of instructions.
For more information about using intrinsic functions, see Mixing C and assembler,
page 163. For information about available functions, see the chapter Intrinsic
functions.
● Library functions
The DLIB runtime environment provides the C and C++ library definitions in the
C/C++ standard library that apply to embedded systems. For more information, see
DLIB runtime environment—implementation details, page 473.
Note: Any use of these extensions, except for the pragma directives, makes your source
code inconsistent with Standard C.
AFE1_AFE2-1:1
Using C
189
AFE1_AFE2-1:1
IAR C language extensions
#pragma pack, and the #pragma data_alignment directives are available. If you
want to check the alignment of an object, use the __ALIGNOF__() operator.
The __ALIGNOF__ operator is used for accessing the alignment of an object. It takes
one of two forms:
● __ALIGNOF__ (type)
● __ALIGNOF__ (expression)
In the second form, the expression is not evaluated.
See also the Standard C file stdalign.h.
● Bitfields and non-standard types
In Standard C, a bitfield must be of the type int or unsigned int. Using IAR C
language extensions, any integer type or enumeration can be used. The advantage is
that the struct will sometimes be smaller. For more information, see Bitfields, page
352.
__section_begin Returns the address of the first byte of the named section or
block.
__section_end Returns the address of the first byte after the named section
or block.
__section_size Returns the size of the named section or block in bytes.
The operators can be used on named sections or on named blocks defined in the linker
configuration file.
These operators behave syntactically as if declared like:
void * __section_begin(char const * section)
void * __section_end(char const * section)
size_t __section_size(char const * section)
When you use the @ operator or the #pragma location directive to place a data object
or a function in a user-defined section, or when you use named blocks in the linker
configuration file, the section operators can be used for getting the start and end address
of the memory range where the sections or blocks were placed.
AFE1_AFE2-1:1
Using C
The named section must be a string literal and it must have been declared earlier with
the #pragma section directive. The type of the __section_begin operator is a
pointer to void. Note that you must enable language extensions to use these operators.
The operators are implemented in terms of symbols with dedicated names, and will
appear in the linker map file under these names:
Operator Symbol
__section_begin(sec) sec$$Base
__section_end(sec) sec$$Limit
__section_size(sec) sec$$Length
Table 18: Section operators and their symbols
Note: The linker will not necessarily place sections with the same name consecutively
when these operators are not used. Using one of these operators (or the equivalent
symbols) will cause the linker to behave as if the sections were in a named block. This
is to assure that the sections are placed consecutively, so that the operators can be
assigned meaningful values. If this is in conflict with the section placement as specified
in the linker configuration file, the linker will issue an error.
Example
In this example, the type of the __section_begin operator is void *.
#pragma section="MYSECTION"
...
section_start_address = __section_begin("MYSECTION");
RELAXATIONS TO STANDARD C
This section lists and briefly describes the relaxation of some Standard C issues and also
some useful but minor syntax extensions:
● Arrays of incomplete types
An array can have an incomplete struct, union, or enum type as its element type.
The types must be completed before the array is used (if it is), or by the end of the
compilation unit (if it is not).
● Forward declaration of enum types
The extensions allow you to first declare the name of an enum and later resolve it by
specifying the brace-enclosed list.
● Accepting missing semicolon at the end of a struct or union specifier
A warning—instead of an error—is issued if the semicolon at the end of a struct
or union specifier is missing.
191
AFE1_AFE2-1:1
IAR C language extensions
AFE1_AFE2-1:1
Using C
● Empty declarations
An empty declaration (a semicolon by itself) is allowed, but a remark is issued
(provided that remarks are enabled).
● Single-value initialization
Standard C requires that all initializer expressions of static arrays, structs, and unions
are enclosed in braces.
Single-value initializers are allowed to appear without braces, but a warning is
issued. The compiler accepts this expression:
struct str
{
int a;
} x = 10;
● Declarations in other scopes
External and static declarations in other scopes are visible. In the following example,
the variable y can be used at the end of the function, even though it should only be
visible in the body of the if statement. A warning is issued.
int test(int x)
{
if (x)
{
extern int y;
y = 1;
}
return y;
}
● Static functions in function and block scopes
Static functions may be declared in function and block scopes. Their declarations are
moved to the file scope.
● Numbers scanned according to the syntax for numbers
Numbers are scanned according to the syntax for numbers rather than the
pp-number syntax. Therefore, 0x123e+1 is scanned as three tokens instead of one
valid token. (If the --strict option is used, the pp-number syntax is used instead.)
● Empty translation unit
A translation unit (input file) might be empty of declarations.
● Assignment of pointer types
Assignment of pointer types is allowed in cases where the destination type has added
type qualifiers that are not at the top level, for example, int ** to const int **.
Comparisons and pointer difference of such pairs of pointer types are also allowed.
A warning is issued.
193
AFE1_AFE2-1:1
IAR C language extensions
AFE1_AFE2-1:1
Using C++
● Overview—Standard C++
Overview—Standard C++
The IAR C++ implementation fully complies with the ISO/IEC 14882:2015 C++
standard, except for source code that depends on thread-related system headers.
Atomic operations are available for cores where the instruction set supports them. See
Atomic operations, page 479.
The ISO/IEC 14882:2015 C++ standard is also known as C++14. In this guide, this
standard is referred to as Standard C++.
The IAR C/C++ compiler accepts source code written in the C++14 standard or a
superset thereof.
For an overview of the differences between the various versions of the C++ standard, see
the Wikipedia articles C++17, C++14, C++11, or C++ (for information about C++98).
Even if support is enabled while compiling, the linker can avoid including the extra code
and tables in the final application. If no part of your application actually throws an
exception, the code and tables supporting the use of exceptions are not included in the
application code image. Also, if dynamic runtime type information constructs
195
AFE1_AFE2-1:1
Overview—Standard C++
(dynamic_cast/typeid) are not used with polymorphic types, the objects needed to
support them are not included in the application code image. To control this behavior,
use the linker options --no_exceptions, --force_exceptions, and
--no_dynamic_rtti_elimination.
EXCEPTION HANDLING
Exception handling can be divided into three parts:
● Exception raise mechanisms—in C++ they are the throw and rethrow
expressions.
● Exception catch mechanisms—in C++ they are the try–catch statements, the
exception specifications for a function, and the implicit catch to prevent an
exception leaking out from main.
AFE1_AFE2-1:1
Using C++
197
AFE1_AFE2-1:1
Enabling support for C++
TEMPLATES
C++ supports templates according to the C++ standard. The implementation uses a
two-phase lookup which means that the keyword typename must be inserted wherever
needed. Furthermore, at each use of a template, the definitions of all possible templates
must be visible. This means that the definitions of all templates must be in include files
or in the actual source file.
FUNCTION TYPES
A function type with extern "C" linkage is compatible with a function that has C++
linkage.
AFE1_AFE2-1:1
Using C++
Example
extern "C"
{
typedef void (*FpC)(void); // A C function typedef
}
FpC F1;
FpCpp F2;
void MyF(FpC);
void MyG()
{
MyF(F1); // Always works
MyF(F2); // FpCpp is compatible with FpC
}
If you call set_new_handler with a non-NULL new handler, the provided new
handler will be called by operator new if the operator new fails to allocate enough
memory. The new handler must then make more memory available and return, or abort
execution in some manner. If exceptions are enabled, the new handler can also throw a
199
AFE1_AFE2-1:1
C++ language extensions
std::bad_alloc exception. The nothrow variant of operator new will only return
NULL in the presence of a new handler if exceptions are enabled and the new handler
throws std::bad_alloc.
AFE1_AFE2-1:1
Using C++
● In the declaration of a class member, a qualified name can be used, for example:
struct A
{
int A::F(); // Possible when using IAR language extensions
int G(); // According to the standard
};
● It is permitted to use an implicit type conversion between a pointer to a function
with C linkage (extern "C") and a pointer to a function with C++ linkage
(extern "C++"), for example:
extern "C" void F(); // Function with C linkage
void (*PF)() // PF points to a function with C++ linkage
= &F; // Implicit conversion of function pointer.
According to the standard, the pointer must be explicitly converted.
● If the second or third operands in a construction that contains the ? operator are
string literals or wide string literals—which in C++ are constants—the operands can
be implicitly converted to char * or wchar_t *, for example:
bool X;
class A
{
public:
U; // OK -- references to A::i and A::j are allowed.
};
In addition, this extension also permits anonymous classes and anonymous structs,
as long as they have no C++ features—for example, no static data members or
201
AFE1_AFE2-1:1
C++ language extensions
class C
{
public:
friend S; // Okay (requires S to be in scope)
friend ST; // Okay (same as "friend S;")
// friend S const; // Error, cv-qualifiers cannot
// appear directly
};
● It is allowed to specify an array with no size or size 0 as the last member of a struct.
For example:
typedef struct
{
int i;
char ir[0]; // Zero-length array
};
typedef struct
{
int i;
char ir[]; // Zero-length array
};
● Arrays of incomplete types
An array can have an incomplete struct, union, enum, or class type as its element
type. The types must be completed before the array is used—if it is— or by the end
of the compilation unit—if it is not.
● Concatenating strings
Mixed string literal concatenations are accepted.
wchar_t * str = "a" L "b";
AFE1_AFE2-1:1
Using C++
● Trailing comma
A trailing comma in the definition of an enumeration type is silently accepted.
Except where noted, all of the extensions described for C are also allowed in C++ mode.
Note: If you use any of these constructions without first enabling language extensions,
errors are issued.
203
AFE1_AFE2-1:1
Porting code from EC++ or EEC++
AFE1_AFE2-1:1
Application-related
considerations
● Output format considerations
● Stack considerations
● Heap considerations
● AEABI compliance
● CMSIS integration
● Arm TrustZone®
● Plain binary
● Motorola S-records
● Intel hex.
For a complete list of supported output formats, run ielftool without options.
Note: ielftool can also be used for other types of transformations, such as filling and
calculating checksums in the absolute image.
205
AFE1_AFE2-1:1
Stack considerations
The source code for ielftool is provided in the arm/src directory. For more
information about ielftool, see The IAR ELF Tool—ielftool, page 535.
Stack considerations
To make your application use stack memory efficiently, there are some considerations
to be made.
STACK ALIGNMENT
The default cstartup code automatically initializes all stacks to an 8-byte aligned
address.
For more information about aligning the stack, see Calling convention, page 175 and
more specifically Special registers, page 177 and Stack parameters and layout, page
179.
EXCEPTION STACK
Cortex-M does not have individual exception stacks. By default, all exception stacks are
placed in the CSTACK section.
The Arm7/9/11, Cortex-A, and Cortex-R devices support five exception modes which
are entered when different exceptions occur. Each exception mode has its own stack to
avoid corrupting the System/User mode stack.
AFE1_AFE2-1:1
Application-related considerations
The table shows proposed stack names for the various exception stacks, but any name
can be used:
Processor mode Proposed stack section name Description
Supervisor SVC_STACK Operation system stack.
IRQ IRQ_STACK Stack for general-purpose (IRQ)
interrupt handlers.
FIQ FIQ_STACK Stack for high-speed (FIQ)
interrupt handlers.
Undefined UND_STACK Stack for undefined instruction
interrupts. Supports software
emulation of hardware
coprocessors and instruction set
extensions.
Abort ABT_STACK Stack for instruction fetch and data
access memory abort interrupt
handlers.
Table 19: Exception stacks for Arm7/9/11, Cortex-A, and Cortex-R
For each processor mode where a stack is needed, a separate stack pointer must be
initialized in your startup code, and section placement should be done in the linker
configuration file. The IRQ and FIQ stacks are the only exception stacks which are
preconfigured in the supplied cstartup.s and lnkarm.icf files, but other exception
stacks can easily be added.
To view any of these stacks in the Stack window available in the IDE, these
preconfigured section names must be used instead of user-defined section names.
Heap considerations
The heap contains dynamic data allocated by use of the C function malloc (or a
corresponding function) or the C++ operator new.
If your application uses dynamic memory allocation, you should be familiar with:
● The use of advanced, basic, and no-free heap memory allocation
● Linker sections used for the heap
● Allocating the heap size, see Setting up heap memory, page 112.
207
AFE1_AFE2-1:1
Heap considerations
● If there are calls to heap memory allocation routines in your application, but no calls
to heap deallocation routines, the linker automatically chooses the no-free heap.
● If there are calls to heap memory allocation routines in your application, the linker
automatically chooses the advanced heap.
● If there are calls to heap memory allocation routines in, for example, the library, the
linker automatically chooses the basic heap.
Note: If your product has a size-limited KickStart license, the basic heap is
automatically chosen.
You can use a linker option to explicitly specify which handler you want to use:
● The basic heap (--basic_heap) is a simple heap allocator, suitable for use in
applications that do not use the heap very much. In particular, it can be used in
applications that only allocate heap memory and never free it. The basic heap is not
particularly speedy, and using it in applications that repeatedly free memory is quite
likely to lead to unneeded fragmentation of the heap. The code for the basic heap is
significantly smaller than that for the advanced heap. See --basic_heap, page 316.
● The advanced heap (--advanced_heap) provides efficient memory management
for applications that use the heap extensively. In particular, applications that
repeatedly allocate and free memory will likely get less overhead in both space and
time. The code for the advanced heap is significantly larger than that for the basic
heap. See --advanced_heap, page 315. For information about the definition, see
iar_dlmalloc.h, page 480.
● The no-free heap (--no_free_heap) is the smallest possible heap implementation.
This heap does not support free or realloc. See --no_free_heap, page 335.
AFE1_AFE2-1:1
Application-related considerations
/* Export of symbol */
export symbol MY_HEAP_SIZE;
209
AFE1_AFE2-1:1
Checksum calculation for verifying image integrity
char *MyHeap()
{
/* First get start of statically allocated section, */
char *p = __section_begin("MYHEAP");
AFE1_AFE2-1:1
Application-related considerations
211
AFE1_AFE2-1:1
Checksum calculation for verifying image integrity
● If several checksums are used, you should place them in sections with unique
names and use unique symbol names.
● A checksum should never be calculated on a memory range that contains a
checksum or a software breakpoint.
● Algorithm and size of checksum
You should consider which algorithm is most suitable in your case. There are two
basic choices, Sum—a simple arithmetic algorithm—or CRC—which is the most
commonly used algorithm. For CRC there are different sizes to choose for the
checksum, 2, 4, or 8 bytes where the predefined polynomials are wide enough to suit
the size, for more error detecting power. The predefined polynomials work well for
most, but possibly not for all data sets. If not, you can specify your own polynomial.
If you just want a decent error detecting mechanism, use the predefined CRC
algorithm for your checksum size, typically CRC16 or CRC32.
Note: For an n-bit polynomial, the n:th bit is always considered to be set. For a 16-bit
polynomial—for example, CRC16—this means that 0x11021 is the same as
0x1021.
For more information about selecting an appropriate polynomial for data sets with
non-uniform distribution, see for example section 3.5.3 in Tannenbaum, A.S.,
Computer Networks, Prentice Hall 1981, ISBN: 0131646990.
● Fill
Every byte in the checksum range must have a well-defined value before the
checksum can be calculated. Typically, bytes with unknown values are pad bytes that
have been added for alignment. This means that you must specify which fill pattern
to be used during calculation, typically 0xFF or 0x00.
● Initial value
The checksum must always have an explicit initial value.
In addition to these mandatory details, there might be other details to consider.
Typically, this might happen when you have a third-party checksum, you want the
checksum be compliant with the Rocksoft™ checksum model, or when you use
hardware support for generating a checksum during runtime. ielftool also provides
support for controlling alignment, complement, bit order, byte order within words, and
checksum unit size.
AFE1_AFE2-1:1
Application-related considerations
Note: If you instead are using the IDE (and not the command line), the __checksum,
__checksum_begin, and __checksum_end symbols, and the .checksum section are
automatically allocated when you calculate the checksum, which means that you can
skip this step.
You can allocate the memory location in two ways:
● By creating a global C/C++ or assembler constant symbol with a proper size,
residing in a specific section—in this example, .checksum
● By using the linker option --place_holder.
For example, to allocate a 2-byte space for the symbol __checksum in the section
.checksum, with alignment 4, specify:
--place_holder __checksum,2,.checksum,4
2 The .checksum section will only be included in your application if the section appears
to be needed. If the checksum is not needed by the application itself, use the linker
option --keep=_ _checksum (or the linker directive keep) to force the section to be
included.
Alternatively, choose Project>Options>Linker>Output and specify __checksum:
3 To control the placement of the .checksum section, you must modify the linker
configuration file. For example, it can look like this (note the handling of the block
CHECKSUM):
213
AFE1_AFE2-1:1
Checksum calculation for verifying image integrity
Note: It is possible to skip this step, but in that case the .checksum section will
automatically be placed with other read-only data.
4 When configuring ielftool to calculate a checksum, there are some basic choices to
make:
● Checksum algorithm
Choose which checksum algorithm you want to use. In this example, the CRC16
algorithm is used.
● Memory range
Using the IDE, you can specify one memory range for which the checksum should
be calculated. From the command line, you can specify any ranges.
● Fill pattern
Specify a fill pattern—typically 0xFF or 0x00—for bytes with unknown values. The
fill pattern will be used in all checksum ranges.
For more information, see Briefly about checksum calculation, page 211.
To run ielftool from the IDE, choose Project>Options>Linker>Checksum and
make your settings, for example:
In the simplest case, you can ignore (or leave with default settings) these options:
Complement, Bit order, Reverse byte order within word, and Checksum unit size.
To run ielftool from the command line, specify the command, for example, like this:
ielftool --fill=0x00;0x8002–0x8FFF
--checksum=__checksum:2,crc16;0x8002–0x8FFF sourceFile.out
destinationFile.out
AFE1_AFE2-1:1
Application-related considerations
Note: ielftool needs an unstripped input ELF image. If you use the linker option
--strip, remove it and use the ielftooloption --strip instead.
The checksum will be created later on when you build your project and will be
automatically placed in the specified symbol __checksum in the section .checksum.
5 You can specify several ranges instead of only one range.
If you are using the IDE, perform these steps:
● Choose Project>Options>Linker>Checksum and make sure to deselect Fill
unused code memory.
● Choose Project>Options>Build Actions and specify the ranges together with the
rest of the required commands in the Post-build command line text field, for
example like this:
$TOOLKIT_DIR$\bin\ielftool $PROJ_DIR$\debug\exe\output.out
$PROJ_DIR$\debug\exe\output.out
--fill 0x0;0x0-0x3FF;0x8002-0x8FFF
--checksum=__checksum:2,crc16;0x0-0x3FF;0x8002-0x8FFF
In your example, replace output.out with the name of your output file.
If you are using the command line, specify the ranges, for example like this:
ielftool output.out output.out --fill 0x0;0x0-0x3FF;0x8002-0x8FFF
--checksum=__checksum:2,crc16;0x0-0x3FF;0x8002-0x8FFF
In your example, replace output.out with the name of your output file.
215
AFE1_AFE2-1:1
Checksum calculation for verifying image integrity
6 Add a function for checksum calculation to your source code. Make sure that the
function uses the same algorithm and settings as for the checksum calculated by
ielftool. For example, a slow variant of the crc16 algorithm but with small memory
footprint (in contrast to the fast variant that uses more memory):
unsigned short SmallCrc16(uint16_t
sum,
unsigned char *p,
unsigned int len)
{
while (len--)
{
int i;
unsigned char byte = *(p++);
You can find the source code for this checksum algorithm in the arm\src\linker
directory of your product installation.
7 Make sure that your application also contains a call to the function that calculates the
checksum, compares the two checksums, and takes appropriate action if the checksum
values do not match.
This code gives an example of how the checksum can be calculated for your application
and to be compared with the ielftool generated checksum:
AFE1_AFE2-1:1
Application-related considerations
void TestChecksum()
{
unsigned short calc = 0;
unsigned char zeros[2] = {0, 0};
/* Checksum is correct */
}
217
AFE1_AFE2-1:1
AEABI compliance
● Verify that the exact same memory range or ranges are used in both checksum
calculations.
To help you do this, ielftool lists the ranges for which the checksum is calculated
on stdout about the exact addresses that were used and the order in which they were
accessed.
● Make sure that all checksum symbols are excluded from all checksum calculations.
Compare the checksum placement with the checksum range and make sure they do
not overlap. You can find information in the Build message window after ielftool
has generated a checksum.
● Verify that the checksum calculations use the same polynomial.
● Verify that the bits in the bytes are processed in the same order in both checksum
calculations, from the least to the most significant bit or the other way around. You
control this with the Bit order option (or from the command line, the -m parameter
of the --checksum option).
● If you are using the small variant of CRC, check whether you need to feed
additional bytes into the algorithm.
The number of zeros to add at the end of the byte sequence must match the size of
the checksum, in other words, one zero for a 1-byte checksum, two zeros for a 2-byte
checksum, four zeros for a 4-byte checksum, and eight zeros for an 8-byte checksum.
● Any breakpoints in flash memory change the content of the flash. This means that
the checksum which is calculated by your application will no longer match the
initial checksum calculated by ielftool. To make the two checksums match
again, you must disable all your breakpoints in flash and any breakpoints set in flash
by C-SPY internally. The stack plugin and the debugger option Run to both require
C-SPY to set breakpoints. Read more about possible breakpoint consumers in the
C-SPY® Debugging Guide for Arm.
● By default, a symbol that you have allocated in memory by using the linker option
--place_holder is considered by C-SPY to be of the type int. If the size of the
checksum is different than the size of an int, you can change the display format of
the checksum symbol to match its size.
In the C-SPY Watch window, select the symbol and choose Show As from the
context menu. Choose the display format that matches the size of the checksum
symbol.
AEABI compliance
The IAR build tools for Arm support the Embedded Application Binary Interface for
Arm, AEABI, defined by Arm Limited. This interface is based on the Intel IA64 ABI
interface. The advantage of adhering to AEABI is that any such module can be linked
AFE1_AFE2-1:1
Application-related considerations
with any other AEABI-compliant module, even modules produced by tools provided by
other vendors.
The IAR build tools for Arm support the following parts of the AEABI:
The IAR build tools only support a bare metal platform, that is a ROM-based system
that lacks an explicit operating system.
Note:
● The AEABI is specified for C89 only
● The AEABI does not specify C++ library compatibility
● Neither the size of an enum or of wchar_t is constant in the AEABI.
If AEABI compliance is enabled, certain preprocessor constants become real constant
variables instead.
219
AFE1_AFE2-1:1
AEABI compliance
● If full I/O is needed, make sure to link with a Full library configuration in the
standard library
Potential incompatibilities include but are not limited to:
● The size of enum
● The size of wchar_t
● The calling convention
● The instruction set used.
When linking AEABI-compliant modules, also consider the information in the chapters
Linking using ILINK and Linking your application.
AFE1_AFE2-1:1
Application-related considerations
including a system header file, and make sure that the symbol AEABI_PORTABLE is set
to non-zero after the inclusion of the header file:
#define _AEABI_PORTABILITY_LEVEL 1
#undef _AEABI_PORTABLE
#include <header.h>
#ifndef _AEABI_PORTABLE
#error "header.h not AEABI compatible"
#endif
CMSIS integration
The arm\CMSIS subdirectory contains CMSIS (Cortex Microcontroller Software
Interface Standard) and CMSIS DSP header and library files, and documentation. For
more information, see http://www.arm.com/cmsis.
The special header file inc\c\cmsis_iar.h is provided as a CMSIS adaptation of the
current version of the IAR C/C++ Compiler.
where <0|3|4> selects the Cortex–M variant, <l|b> selects the byte order, and [f]
indicates that the library is built for FPU (Cortex–M4 only).
The libraries for Cortex-M4 are also applicable to Cortex-M7.
221
AFE1_AFE2-1:1
Arm TrustZone®
With the DSP library, for Cortex-M4, little-endian, and with FPU
iccarm --endian=little --cpu=Cortex-M4 --fpu=VFPv4_sp -I
$EW_DIR$\arm\CMSIS\Include -D ARM_MATH_CM4
ilinkarm $EW_DIR$\arm\CMSIS\Lib\IAR\iar_cortexM3l_math.a
Arm TrustZone®
The Arm TrustZone® technology is a System on Chip (SOC) and CPU system-wide
approach to security.
The Arm TrustZone for ArmV8-M adds a security extension (CMSE) to the Armv8-M
core. This extension includes two modes of execution—secure and non-secure. It also
adds memory protection and instructions for validating memory access and controlled
transition between the two modes.
To use TrustZone for Armv8-M, build two separate images—one for secure mode and
one for non-secure mode. The secure image can export function entries that can be used
by the non-secure image.
The IAR build tools support TrustZone by means of intrinsic functions, linker options,
compiler options, predefined preprocessor symbols, extended keywords, and the section
Veneer$$CMSE.
You can find the data types and utility functions needed for working with TrustZone in
the header file arm_cmse.h.
The function type attributes __cmse_nonsecure_call and
__cmse_nonsecure_entry add code to clear the used registers when calling from
secure code to non-secure code.
The IAR build tools follow the standard interface for development tools targeting
Cortex-M Security Extensions (CMSE), with the following exceptions:
● Variadic secure entry functions are not allowed.
● Secure entry functions with parameters or return values that do not fit in registers
are not allowed.
AFE1_AFE2-1:1
Application-related considerations
● Non-secure calls with parameters or return values that do not fit in registers are not
allowed.
● Non-secure calls with parameters or return values in floating-point registers.
● The compiler option --cmse requires the architecture Armv8-M with security
extensions, and is not supported when building ROPI (read-only
position-independent) images or RWPI (read-write position-independent) images.
For more information about Arm TrustZone, see www.arm.com.
Note: You must build the secure project before building the non-secure project.
There are two entry functions in hello_s, available to hello_ns via secure gateways
in a non-secure callable region:
● secure_hello: Prints a greeting, in the style of the classic Hello world
example.
● register_secure_goodbye: A callback that returns a string printed on exiting
the secure part.
The linker will automatically generate the code for the needed secure gateways and
place them in the section Veneers$$CMSE.
To set up and build the example:
1 Open the example workspace hello_s.eww located in
arm\src\ARMv8M_Secure\Hello_Secure.
223
AFE1_AFE2-1:1
Arm TrustZone®
by the secure part to set up and interact with the non-secure part. In this example, this is
done with the following code in nonsecure_hello.c:
/* Interface towards the secure part */
#pragma location=NON_SECURE_ENTRY_TABLE
__root const non_secure_init_t init_table =
{
__iar_data_init3, /* initialization function */
__section_end("CSTACK"), /* non-secure stack */
main_ns /* non-secure main */
};
4 When the secure project is built, the linker will automatically generate an import
library file for the non-secure part that only includes references to functions in the
secure part that can be called from the non-secure part. Specify this file by using
Project>Options>Linker>Output>TrustZone import library.
5 Build the secure project.
6 Include the TrustZone import library file manually in the project hello_ns by
specifying an additional library: Project>Options>Linker>Library>Additional
libraries.
7 Build the non-secure project.
8 The secure project must specify the non-secure project output file as an extra image
that should be loaded by the debugger. To do this, use
Project>Options>Debugger>Images>Download extra images.
To debug the example:
1 To debug in the simulator, set the hello_s project as the active project by
right-clicking on the project and choosing Set as Active.
2 Choose Project>Options>Debugger>Driver and select Simulator.
3 Choose Simulator>Memory Configuration. Make sure that the option Use ranges
based on is deselected.
4 Select Use manual ranges and add the following new ranges:
AFE1_AFE2-1:1
Application-related considerations
225
AFE1_AFE2-1:1
Patching symbol definitions using $Super$$ and $Sub$$
AFE1_AFE2-1:1
Efficient coding for
embedded applications
● Selecting data types
227
AFE1_AFE2-1:1
Selecting data types
FLOATING-POINT TYPES
Using floating-point types on a microprocessor without a math coprocessor is
inefficient, both in terms of code size and execution speed. Therefore, you should
consider replacing code that uses floating-point operations with code that uses integers,
because these are more efficient.
The compiler supports two floating-point formats—32 and 64 bits. The 32-bit
floating-point type float is more efficient in terms of code size and execution speed.
However, the 64-bit format double supports higher precision and larger numbers.
In the compiler, the floating-point type float always uses the 32-bit format, and the
type double always uses the 64-bit format.
Unless the application requires the extra precision that 64-bit floating-point numbers
give, we recommend using 32-bit floating-point numbers instead.
By default, a floating-point constant in the source code is treated as being of the type
double. This can cause innocent-looking expressions to be evaluated in double
precision. In the example below a is converted from a float to a double, the double
constant 1.0 is added and the result is converted back to a float:
double Test(float a)
{
return a + 1.0;
}
To treat a floating-point constant as a float rather than as a double, add the suffix f
to it, for example:
double Test(float a)
{
return a + 1.0f;
}
For more information about floating-point types, see Basic data types—floating-point
types, page 356.
AFE1_AFE2-1:1
Efficient coding for embedded applications
Example
In this example, the members in the anonymous union can be accessed, in function F,
without explicitly specifying the union name:
struct S
{
char mTag;
union
{
long mL;
float mF;
};
} St;
void F(void)
{
St.mL = 5;
}
229
AFE1_AFE2-1:1
Controlling data and function placement in memory
The member names must be unique in the surrounding scope. Having an anonymous
struct or union at file scope, as a global, external, or static variable is also allowed.
This could for instance be used for declaring I/O registers, as in this example:
__no_init volatile
union
{
unsigned char IOPORT;
struct
{
unsigned char way: 1;
unsigned char out: 1;
};
} @ 0x1000;
This declares an I/O register byte IOPORT at address 0x1000. The I/O register has 2 bits
declared, Way and Out—both the inner structure and the outer union are anonymous.
Anonymous structures and unions are implemented in terms of objects named after the
first field, with a prefix _A_ to place the name in the implementation part of the
namespace. In this example, the anonymous union will be implemented through an
object named _A_IOPORT.
AFE1_AFE2-1:1
Efficient coding for embedded applications
● The @ operator and the #pragma location directive for section placement.
Using the @ operator or the #pragma location directive, you can place individual
functions, variables, and constants in named sections. The placement of these
sections can then be controlled by linker directives. For more information, see Data
and function placement in sections, page 232.
● The @ operator and the #pragma location directive for register placement
Use the @ operator or the #pragma location directive to place individual global
and static variables in registers. The variables must be declared __no_init. This is
useful for individual data objects that must be located in a specific register.
● Using the --section option, you can set the default segment for functions,
variables, and constants in a particular module. For more information, see --section,
page 302.
Examples
In this example, a __no_init declared variable is placed at an absolute address. This
is useful for interfacing between multiple processes, applications, etc:
__no_init volatile char alpha @ 0xFF2000;/* OK */
The next example contains two const declared objects. The first one is not initialized,
and the second one is initialized to a specific value. (The first case is useful for
configuration parameters, because they are accessible from an external interface.) Both
231
AFE1_AFE2-1:1
Controlling data and function placement in memory
objects are placed in ROM. Note that in the second case, the compiler is not obliged to
actually read from the variable, because the value is known.
#pragma location=0xFF2002
__no_init const int beta; /* OK */
In the first case, the value is not initialized by the compiler—the value must be set by
other means. The typical use is for configurations where the values are loaded to ROM
separately, or for special function registers that are read-only.
__no_init int epsilon @ 0xFF2007; /* Error, misaligned. */
C++ considerations
In C++, module scoped const variables are static (module local), whereas in C they are
global. This means that each module that declares a certain const variable will contain
a separate variable with this name. If you link an application with several such modules
all containing (via a header file), for instance, the declaration:
volatile const __no_init int x @ 0x100; /* Bad in C++ */
the linker will report that more than one variable is located at address 0x100.
To avoid this problem and make the process the same in C and C++, you should declare
these variables extern, for example:
/* The extern keyword makes x public. */
extern volatile const __no_init int x @ 0x100;
Note: C++ static member variables can be placed at an absolute address just like any
other static variable.
AFE1_AFE2-1:1
Efficient coding for embedded applications
Note: Take care when explicitly placing a variable or function in a predefined section
other than the one used by default. This is useful in some situations, but incorrect
placement can result in anything from error messages during compilation and linking to
a malfunctioning application. Carefully consider the circumstances—there might be
strict requirements on the declaration and use of the function or variable.
The location of the sections can be controlled from the linker configuration file.
For more information about sections, see the chapter Section reference.
#pragma location="MY_CONSTANTS"
const int beta = 42; /* OK */
The linker will normally arrange for the correct type of initialization for each variable.
If you want to control or suppress automatic initialization, you can use the initialize
and do not initialize directives in the linker configuration file.
#pragma location="MY_FUNCTIONS"
void h(void);
233
AFE1_AFE2-1:1
Controlling compiler optimizations
the range R4–R11 (R9 cannot be specified in combination with the --rwpi command
line option).
A variable can be placed in a register only if it is declared as __no_init, has file scope,
and its size is four bytes. A variable placed in a register does not have a memory address,
so the address operator & cannot be used.
Within a module where a variable is placed in a register, the specified register will only
be used for accessing that variable. The value of the variable is preserved across function
calls to other modules because the registers R4–R11 are callee saved, and as such they
are restored when execution returns. However, the value of a variable placed in a register
is not always preserved as expected:
● In an exception handler or library callback routine (such as the comparator function
passed to qsort) the value might not be preserved. The value will be preserved if
the command line option --lock_regs is used for locking the register in all
modules of the application, including library modules.
● In a fast interrupt handler, the value of a variable in R8–R11 is not preserved from
outside the handler, because these registers are banked.
● The longjmp function and C++ exceptions might restore variables placed in
registers to old values, unlike other variables with static storage duration which are
not restored.
The linker does not prevent modules from placing different variables in the same
register. Variables in different modules can be placed in the same register, and another
module could use the register for other purposes.
Note: A variable placed in a register should be defined in an include file, to be included
in every module that uses the variable. An unused definition in a module will cause the
register to not be used in that module.
AFE1_AFE2-1:1
Efficient coding for embedded applications
235
AFE1_AFE2-1:1
Controlling compiler optimizations
OPTIMIZATION LEVELS
The compiler supports different levels of optimizations. This table lists optimizations
that are typically performed on each level:
Optimization level Description
None (Best debug support) Variables live through their entire scope
Low Same as above but variables only live for as long as they are
needed, not necessarily through their entire scope
Medium Same as above, and:
Live-dead analysis and optimization
Dead code elimination
Redundant label elimination
Redundant branch elimination
Code hoisting
Peephole optimization
Some register content analysis and optimization
Common subexpression elimination
Code motion
Static clustering
High (Balanced) Same as above, and:
Instruction scheduling
Cross jumping
Advanced register content analysis and optimization
Loop unrolling
Function inlining
Type-based alias analysis
Table 21: Compiler optimization levels
Note: Some of the performed optimizations can be individually enabled or disabled. For
more information, see Fine-tuning enabled transformations, page 237.
A high level of optimization might result in increased compile time, and will also most
likely make debugging more difficult, because it is less clear how the generated code
relates to the source code. For example, at the low, medium, and high optimization
levels, variables do not live through their entire scope, which means processor registers
used for storing variables can be reused immediately after they were last used. Due to
this, the C-SPY Watch window might not be able to display the value of the variable
throughout its scope, or even occasionally display an incorrect value. At any time, if you
experience difficulties when debugging your code, try lowering the optimization level.
AFE1_AFE2-1:1
Efficient coding for embedded applications
237
AFE1_AFE2-1:1
Controlling compiler optimizations
● Static clustering
● Instruction scheduling.
Loop unrolling
Loop unrolling means that the code body of a loop, whose number of iterations can be
determined at compile time, is duplicated. Loop unrolling reduces the loop overhead by
amortizing it over several iterations.
This optimization is most efficient for smaller loops, where the loop overhead can be a
substantial part of the total loop body.
Loop unrolling, which can be performed at optimization level High, normally reduces
execution time, but increases code size. The resulting code might also be difficult to
debug.
The compiler heuristically decides which loops to unroll. Only relatively small loops
where the loop overhead reduction is noticeable will be unrolled. Different heuristics are
used when optimizing for speed, size, or when balancing between size and speed.
Note: This option has no effect at optimization levels None, Low, and Medium.
To disable loop unrolling, use the command line option --no_unroll, see --no_unroll,
page 294.
Function inlining
Function inlining means that a function, whose definition is known at compile time, is
integrated into the body of its caller to eliminate the overhead of the call. This
optimization normally reduces execution time, but might increase the code size.
For more information, see Inlining functions, page 86.
Code motion
Evaluation of loop-invariant expressions and common subexpressions are moved to
avoid redundant re-evaluation. This optimization, which is performed at optimization
AFE1_AFE2-1:1
Efficient coding for embedded applications
level Medium and above, normally reduces code size and execution time. The resulting
code might however be difficult to debug.
Note: This option has no effect at optimization levels below Medium.
For more information about the command line option, see --no_code_motion, page 287.
Example
short F(short *p1, long *p2)
{
*p2 = 0;
*p1 = 1;
return *p2;
}
With type-based alias analysis, it is assumed that a write access to the short pointed to
by p1 cannot affect the long value that p2 points to. Therefore, it is known at compile
time that this function returns 0. However, in non-standard-conforming C or C++ code
these pointers could overlap each other by being part of the same union. If you use
explicit casts, you can also force pointers of different pointer types to point to the same
memory location.
Static clustering
When static clustering is enabled, static and global variables that are defined within the
same module are arranged so that variables that are accessed in the same function are
239
AFE1_AFE2-1:1
Facilitating good code generation
stored close to each other. This makes it possible for the compiler to use the same base
pointer for several accesses.
Note: This option has no effect at optimization levels None and Low.
For more information about the command line option, see --no_clustering, page 286.
Instruction scheduling
The compiler features an instruction scheduler to increase the performance of the
generated code. To achieve that goal, the scheduler rearranges the instructions to
minimize the number of pipeline stalls emanating from resource conflicts within the
microprocessor.
For more information about the command line option, see --no_scheduling, page 291.
AFE1_AFE2-1:1
Efficient coding for embedded applications
Second, the optimizer can no longer assume that the local variable is unaffected
over function calls.
● Module-local variables—variables that are declared static—are preferred over
global variables (non-static). Also, avoid taking the address of frequently accessed
static variables.
● The compiler is capable of inlining functions, see Function inlining, page 238. To
maximize the effect of the inlining transformation, it is good practice to place the
definitions of small functions called from more than one module in the header file
rather than in the implementation file. Alternatively, you can use multi-file
compilation. For more information, see Multi-file compilation units, page 235.
● Avoid using inline assembler without operands and clobbered resources. Instead,
use SFRs or intrinsic functions if available. Otherwise, use inline assembler with
operands and clobbered resources or write a separate module in assembler
language. For more information, see Mixing C and assembler, page 163.
FUNCTION PROTOTYPES
It is possible to declare and define functions using one of two different styles:
● Prototyped
● Kernighan & Ritchie C (K&R C)
Both styles are valid C, however it is strongly recommended to use the prototyped style,
and provide a prototype declaration for each public function in a header that is included
both in the compilation unit defining the function and in all compilation units using it.
The compiler will not perform type checking on parameters passed to functions declared
using K&R style. Using prototype declarations will also result in more efficient code in
some cases, as there is no need for type promotion for these functions.
To make the compiler require that all function definitions use the prototyped style, and
that all public functions have been declared before being defined, use the
Project>Options>C/C++ Compiler>Language 1>Require prototypes compiler
option (--require_prototypes).
241
AFE1_AFE2-1:1
Facilitating good code generation
Prototyped style
In prototyped function declarations, the type for each parameter must be specified.
int Test(char, int); /* Declaration */
AFE1_AFE2-1:1
Efficient coding for embedded applications
Here, the test is always false. On the right hand side, 0x80 is 0x00000080, and
~0x00000080 becomes 0xFFFFFF7F. On the left hand side, c1 is an 8-bit unsigned
character, so it cannot be larger than 255. Also, it cannot be negative, which means that
the integral promoted value can never have the topmost 24 bits set.
243
AFE1_AFE2-1:1
Facilitating good code generation
void Test()
{
/* Whole register access */
mwctl2 = 0x1234;
/* Bitfield accesses */
mwctl2bit.edw = 1;
mwctl2bit.lepl = 3;
}
You can also use the header files as templates when you create new header files for other
Arm devices.
The general purpose register is used for getting and setting the value of the special
purpose register APSR. The same method can also be used for accessing other special
purpose registers and specific instructions.
To read more about inline assembler, see Inline assembler, page 164.
NON-INITIALIZED VARIABLES
Normally, the runtime environment will initialize all global and static variables when the
application is started.
The compiler supports the declaration of variables that will not be initialized, using the
__no_init type modifier. They can be specified either as a keyword or using the
AFE1_AFE2-1:1
Efficient coding for embedded applications
245
AFE1_AFE2-1:1
Facilitating good code generation
AFE1_AFE2-1:1
Part 2. Reference
information
This part of the IAR C/C++ Development Guide for Arm contains these
chapters:
● Compiler options
● Linker options
● Data representation
● Extended keywords
● Pragma directives
● Intrinsic functions
● The preprocessor
● Section reference
● IAR utilities
247
248
External interface details
● Invocation syntax
● Compiler output
● ILINK output
● Text encodings
● Reserved identifiers
● Diagnostics
Invocation syntax
You can use the compiler and linker either from the IDE or from the command line. See
the IDE Project Management and Building Guide for Arm for information about using
the build tools from the IDE.
For example, when compiling the source file prog.c, use this command to generate an
object file with debug information:
iccarm prog.c --debug
The source file can be a C or C++ file, typically with the filename extension c or cpp,
respectively. If no filename extension is specified, the file to be compiled must have the
extension c.
Generally, the order of options on the command line, both relative to each other and to
the source filename, is not significant. There is, however, one exception: when you use
the -I option, the directories are searched in the same order as they are specified on the
command line.
249
AFE1_AFE2-1:1
Invocation syntax
If you run the compiler from the command line without any arguments, the compiler
version number and all available options including brief descriptions are directed to
stdout and displayed on the screen.
If no filename extension is specified for the linker configuration file, the configuration
file must have the extension icf.
Generally, the order of arguments on the command line is not significant. There is,
however, one exception: when you supply several libraries, the libraries are searched in
the same order that they are specified on the command line. The default libraries are
always searched last.
The output executable image will be placed in a file named a.out, unless the -o option
is used.
If you run ILINK from the command line without any arguments, the ILINK version
number and all available options including brief descriptions are directed to stdout and
displayed on the screen.
PASSING OPTIONS
There are three different ways of passing options to the compiler and to ILINK:
● Directly from the command line
Specify the options on the command line after the iccarm or ilinkarm commands,
see Invocation syntax, page 249.
● Via environment variables
The compiler and linker automatically append the value of the environment variables
to every command line, see Environment variables, page 251.
● Via a text file, using the -f option, see -f, page 280.
For general guidelines for the option syntax, an options summary, and a detailed
description of each option, see the chapter Compiler options.
AFE1_AFE2-1:1
External interface details
ENVIRONMENT VARIABLES
These environment variables can be used with the compiler:
Environment variable Description
C_INCLUDE Specifies directories to search for include files, for example:
C_INCLUDE=c:\program files\iar systems\embedded
workbench 8.n\arm\inc;c:\headers
QCCARM Specifies command line options, for example: QCCARM=-lA
asm.lst
Table 22: Compiler environment variables
251
AFE1_AFE2-1:1
Compiler output
it searches the directory of the source file in which the #include statement occurs,
and then performs the same sequence as for angle-bracketed filenames.
If there are nested #include files, the compiler starts searching the directory of the file
that was last included, iterating upwards for each included file, searching the source file
directory last. For example:
src.c in directory dir\src
#include "src.h"
...
src.h in directory dir\include
#include "config.h"
...
When dir\exe is the current directory, use this command for compilation:
iccarm ..\src\src.c -I..\include -I..\debugconfig
Then the following directories are searched in the order listed below for the file
config.h, which in this example is located in the dir\debugconfig directory:
Use angle brackets for standard header files, like stdio.h, and double quotes for files
that are part of your application.
Note: Both \ and / can be used as directory delimiters.
For more information, see Overview of the preprocessor, page 457.
Compiler output
The compiler can produce the following output:
● A linkable object file
The object files produced by the compiler use the industry-standard format ELF. By
default, the object file has the filename extension o.
● Optional list files
Various kinds of list files can be specified using the compiler option -l, see -l, page
283. By default, these files will have the filename extension lst.
AFE1_AFE2-1:1
External interface details
253
AFE1_AFE2-1:1
ILINK output
ILINK output
ILINK can produce the following output:
● An absolute executable image
The final output produced by the IAR ILINK Linker is an absolute object file
containing the executable image that can be put into an EPROM, downloaded to a
hardware emulator, or executed on your PC using the IAR C-SPY Debugger
Simulator. By default, the file has the filename extension out. The output format is
always in ELF, which optionally includes debug information in the DWARF format.
● Optional logging information
During operation, ILINK logs its decisions on stdout, and optionally to a file. For
example, if a library is searched, whether a required symbol is found in a library
module, or whether a module will be part of the output. Timing information for each
ILINK subsystem is also logged.
● Optional map files
A linker map file—containing summaries of linkage, runtime attributes, memory,
and placement, as well as an entry list— can be generated by the ILINK option
--map, see --map, page 332. By default, the map file has the filename extension map.
● Diagnostic messages
Diagnostic messages are directed to stderr and displayed on the screen, as well as
printed in the optional map file. For more information about diagnostic messages, see
Diagnostics, page 256.
● Error return codes
ILINK returns status information to the operating system which can be tested in a
batch file, see Error return codes, page 253.
● Size information about used memory and amount of time
Information about the generated amount of bytes for functions and data for each
memory is directed to stdout and displayed on the screen.
● An import library for use when building a non-secure image, a relocatable ELF
object module containing symbols and their addresses. See the linker option
--import_cmse_lib_out, page 329.
Text encodings
Text files read or written by IAR tools can use a variety of text encodings:
● Raw
This is a backward-compatibility mode for C/C++ source files. Only 7-bit ASCII
characters can be used in symbol names. Other characters can only be used in
AFE1_AFE2-1:1
External interface details
comments, literals, etc. This is the default source file encoding if there is no Byte
Order Mark (BOM).
● The system default locale
The locale that you have configured your Windows OS to use.
● UTF-8
Unicode encoded as a sequence of 8-bit bytes, with or without a Byte Order Mark.
● UTF-16
Unicode encoded as a sequence of 16-bit words using a big-endian or little-endian
representation. These files always start with a Byte Order Mark.
In any encoding other than Raw, you can use Unicode characters of the appropriate kind
(alphabetic, numeric, etc) in the names of symbols.
When an IAR tool reads a text file with a Byte Order Mark, it will use the appropriate
Unicode encoding, regardless of the any options set for input file encoding.
For source files without a Byte Order Mark, the compiler will use the Raw encoding,
unless you specify the compiler option --source_encoding. See --source_encoding,
page 303.
For source files without a Byte Order Mark, the assembler will use the Raw encoding
unless you specify the assembler option --source_encoding.
For other text input files, like the extended command line (.xcl files), without a Byte
Order Mark, the IAR tools will use the system default locale unless you specify the
compiler option --utf8_text_in, in which case UTF-8 will be used. See
--utf8_text_in, page 307.
For compiler list files and preprocessor output, the same encoding as the main source
file will be used by default. Other tools that generate text output will use the UTF-8
encoding by default. You can change this by using the compiler options --text_out
and --no_bom. See --text_out, page 305 and --no_bom, page 286.
'x', "xx" Characters in untyped character and string literals are copied
verbatim, using the same encoding as in the source file.
u8"xx" Characters in UTF-8 string literals are converted to UTF-8.
u'x', u"xx" Characters in UTF-16 character and string literals are converted
to UTF-16.
255
AFE1_AFE2-1:1
Reserved identifiers
U'x', U"xx" Characters in UTF-32 character and string literals are converted
to UTF-32.
L'x', L"xx" Characters in wide character and string literals are converted to
UTF-32.
Reserved identifiers
Some identifiers are reserved for use by the implementation. Some of the more
important identifiers that the C/C++ standards reserve for any use are:
● Identifiers that contain a double underscore (__)
● Identifiers that begin with an underscore followed by an uppercase letter
In addition to this, the IAR tools reserve for any use:
● Identifiers that contain a double dollar sign ($$)
● Identifiers that contain a question mark (?)
More specific reservations are in effect in particular circumstances, see the C/C++
standards for more information.
Diagnostics
This section describes the format of the diagnostic messages and explains how
diagnostic messages are divided into different levels of severity.
filename The name of the source file in which the issue was encountered
linenumber The line number at which the compiler detected the issue
level The level of seriousness of the issue
tag A unique tag that identifies the diagnostic message
message An explanation, possibly several lines long
AFE1_AFE2-1:1
External interface details
Diagnostic messages are displayed on the screen, as well as printed in the optional list
file.
Use the option --diagnostics_tables to list all possible compiler diagnostic
messages.
Diagnostic messages are displayed on the screen and printed in the optional map file.
Use the option --diagnostics_tables to list all possible linker diagnostic messages.
SEVERITY LEVELS
The diagnostic messages are divided into different levels of severity:
Remark
A diagnostic message that is produced when the compiler or linker finds a construct that
can possibly lead to erroneous behavior in the generated code. Remarks are by default
not issued, but can be enabled, see --remarks, page 300.
Warning
A diagnostic message that is produced when the compiler or linker finds a potential
problem which is of concern, but which does not prevent completion of the compilation
or linking. Warnings can be disabled by use of the command line option
--no_warnings, see --no_warnings, page 295.
Error
A diagnostic message that is produced when the compiler or linker finds a serious error.
An error will produce a non-zero exit code.
257
AFE1_AFE2-1:1
Diagnostics
Fatal error
A diagnostic message produced when the compiler finds a condition that not only
prevents code generation, but also makes further processing pointless. After the message
is issued, compilation terminates. A fatal error will produce a non-zero exit code.
INTERNAL ERROR
An internal error is a diagnostic message that signals that there was a serious and
unexpected failure due to a fault in the compiler or linker. It is produced using this form:
Internal error: message
AFE1_AFE2-1:1
Compiler options
● Options syntax
Options syntax
Compiler options are parameters you can specify to change the default behavior of the
compiler. You can specify options from the command line—which is described in more
detail in this section—and from within the IDE.
See the online help system for information about the compiler options available in the
IDE and how to set them.
TYPES OF OPTIONS
There are two types of names for command line options, short names and long names.
Some options have both.
● A short option name consists of one character, and it can have parameters. You
specify it with a single dash, for example -e
● A long option name consists of one or several words joined by underscores, and it
can have parameters. You specify it with double dashes, for example
--char_is_signed.
For information about the different methods for passing options, see Passing options,
page 250.
259
AFE1_AFE2-1:1
Options syntax
For options with a long name and an optional parameter, any parameter should be
specified with a preceding equal sign (=), for example:
--misrac2004=n
For options with a long name and a mandatory parameter, the parameter can be specified
either with a preceding equal sign (=) or with a preceding space, for example:
--diagnostics_tables=MyDiagnostics.lst
or
--diagnostics_tables MyDiagnostics.lst
AFE1_AFE2-1:1
Compiler options
● For options that take a filename as the destination for output, the parameter can be
specified as a path without a specified filename. The compiler stores the output in
that directory, in a file with an extension according to the option. The filename will
be the same as the name of the compiled source file, unless a different name was
specified with the option -o, in which case that name is used. For example:
iccarm prog.c -l ..\listings\
The produced list file will have the default name ..\listings\prog.lst
● The current directory is specified with a period (.). For example:
iccarm prog.c -l .
● / can be used instead of \ as the directory delimiter.
● By specifying -, input files and output files can be redirected to the standard input
and output stream, respectively. For example:
iccarm prog.c -l -
Additional rules
These rules also apply:
● When an option takes a parameter, the parameter cannot start with a dash (-)
followed by another character. Instead, you can prefix the parameter with two
dashes—this example will create a list file called -r:
iccarm prog.c -l ---r
● For options that accept multiple arguments of the same type, the arguments can be
provided as a comma-separated list (without a space), for example:
--diag_warning=Be0001,Be0002
Alternatively, the option can be repeated for each argument, for example:
--diag_warning=Be0001
--diag_warning=Be0002
261
AFE1_AFE2-1:1
Summary of compiler options
AFE1_AFE2-1:1
Compiler options
263
AFE1_AFE2-1:1
Summary of compiler options
AFE1_AFE2-1:1
Compiler options
265
AFE1_AFE2-1:1
Descriptions of compiler options
AFE1_AFE2-1:1
Compiler options
--aapcs
Syntax aapcs={std|vfp}
Parameters
std Processor registers are used for floating-point parameters and
return values in function calls according to standard AAPCS.
std is the default when the software FPU is selected.
--aeabi
Syntax --aeabi
See also AEABI compliance, page 218 and --guard_calls, page 282.
To set this option, use Project>Options>C/C++ Compiler>Extra Options.
--align_sp_on_irq
Syntax --align_sp_on_irq
Description Use this option to align the stack pointer (SP) on entry to __irq declared functions.
This is especially useful for nested interrupts, where the interrupted code uses the same
SP as the interrupt handler. This means that the stack might only have 4-byte alignment,
instead of the 8-byte alignment required by AEABI (and some instructions generated by
the compiler for some cores).
267
AFE1_AFE2-1:1
Descriptions of compiler options
--arm
Syntax --arm
--c89
Syntax --c89
Description Use this option to enable the C89 C dialect instead of Standard C.
Note: This option is mandatory when the MISRA C checking is enabled.
--char_is_signed
Syntax --char_is_signed
Description By default, the compiler interprets the plain char type as unsigned. Use this option to
make the compiler interpret the plain char type as signed instead. This can be useful
when you, for example, want to maintain compatibility with another compiler.
Note: The runtime library is compiled without the --char_is_signed option and
cannot be used with code that is compiled with this option.
Project>Options>C/C++ Compiler>Language 2>Plain ‘char’ is
AFE1_AFE2-1:1
Compiler options
--char_is_unsigned
Syntax --char_is_unsigned
Description Use this option to make the compiler interpret the plain char type as unsigned. This is
the default interpretation of the plain char type.
Project>Options>C/C++ Compiler>Language 2>Plain ‘char’ is
--cmse
Syntax --cmse
Description This option enables language extensions for TrustZone for Armv8-M. Use this option
for object files that are to be linked in a secure image. The option allows the use of
instructions, keywords, and types that are not available for non-secure code:
● The function attributes _cmse_nonsecure_call and _cmse_nonsecure_entry.
● The functions for CMSE have names with the prefix cmse_, and are defined in the
header file arm_cmse.h.
Note: To use this option, you must first select the option Project>Options>General
Options>Target>TrustZone.
See also Arm TrustZone®, page 222 and ARMv8-M Security Extensions: Requirements on
Development Tools (ARM-ECM-0359818).
To set this option, use Project>Options>C/C++ Compiler>Extra Options.
--cpu
Syntax --cpu=core|list
Parameters
core Specifies a specific processor variant
list Lists all supported values for the option --cpu
Description Use this option to select the architecture or processor variant for which the code is to be
generated.
The default core is Cortex-M3.
269
AFE1_AFE2-1:1
Descriptions of compiler options
AFE1_AFE2-1:1
Compiler options
--cpu_mode
Syntax --cpu_mode={arm|a|thumb|t}
Parameters
arm, a (default) Selects the arm mode as the default mode for functions
thumb, t Selects the thumb mode as the default mode for functions
Description Use this option to select the default mode for functions.
Project>Options>General Options>Target>Processor mode
--c++
Syntax --c++
Description By default, the language supported by the compiler is C. If you use Standard C++, you
must use this option to set the language the compiler uses to C++.
-D
Syntax -D symbol[=value]
Parameters
symbol The name of the preprocessor symbol
value The value of the preprocessor symbol
Description Use this option to define a preprocessor symbol. If no value is specified, 1 is used. This
option can be used one or more times on the command line.
The option -D has the same effect as a #define statement at the top of the source file:
-Dsymbol
271
AFE1_AFE2-1:1
Descriptions of compiler options
is equivalent to:
#define symbol 1
--debug, -r
Syntax --debug
-r
Description Use the --debug or -r option to make the compiler include information in the object
modules required by the IAR C-SPY® Debugger and other symbolic debuggers.
Note: Including debug information will make the object files larger than otherwise.
Project>Options>C/C++ Compiler>Output>Generate debug information
--dependencies
Syntax --dependencies[=[i|m|n][s]] {filename|directory|+}
Parameters
i (default) Lists only the names of files
m Lists in makefile style (multiple rules)
n Lists in makefile style (one rule)
s Suppresses system files
+ Gives the same output as -o, but with the filename extension d
See also Rules for specifying a filename or directory as parameters, page 260.
Description Use this option to make the compiler list the names of all source and header files opened
for input into a file with the default filename extension i.
AFE1_AFE2-1:1
Compiler options
If --dependencies=m is used, the output is in makefile style. For each input file, one
line containing a makefile dependency rule is produced. Each line consists of the name
of the object file, a colon, a space, and the name of an input file. For example:
foo.o: c:\iar\product\include\stdio.h
foo.o: d:\myproject\include\foo.h
That is, in addition to producing an object file, the command also produces a
dependency file in makefile style—in this example, using the extension .d.
2 Include all the dependency files in the makefile using, for example:
-include $(sources:.c=.d)
Because of the dash (-) it works the first time, when the .d files do not yet exist.
This option is not available in the IDE.
--deprecated_feature_warnings
Syntax --deprecated_feature_warnings=[+|-]feature[,[+|-]feature,...]
Parameters
feature A feature can be attribute_syntax or
segment_pragmas.
Description Use this option to disable or enable warnings for the use of a deprecated feature. The
deprecated features are:
● attribute_syntax
See --uniform_attribute_syntax, page 305, --no_uniform_attribute_syntax, page
294, and Syntax for type attributes used on data objects, page 366.
273
AFE1_AFE2-1:1
Descriptions of compiler options
● segment_pragmas
See the pragma directives dataseg, constseg, and memory. Use the #pragma
location and #pragma default_variable_attributes directives instead.
Because the deprecated features will be removed in a future version of the IAR C/C++
compiler, it is prudent to remove the use of them in your source code. To do this, enable
warnings for a deprecated feature. For each warning, rewrite your code so that the
deprecated feature is no longer used.
To set this option, use Project>Options>C/C++ Compiler>Extra Options.
--diag_error
Syntax --diag_error=tag[,tag,...]
Parameters
tag The number of a diagnostic message, for example, the
message number Pe117
Description Use this option to reclassify certain diagnostic messages as errors. An error indicates a
violation of the C or C++ language rules, of such severity that object code will not be
generated. The exit code will be non-zero. This option may be used more than once on
the command line.
Project>Options>C/C++ Compiler>Diagnostics>Treat these as errors
--diag_remark
Syntax --diag_remark=tag[,tag,...]
Parameters
tag The number of a diagnostic message, for example, the
message number Pe177
Description Use this option to reclassify certain diagnostic messages as remarks. A remark is the
least severe type of diagnostic message and indicates a source code construction that
may cause strange behavior in the generated code. This option may be used more than
once on the command line.
Note: By default, remarks are not displayed—use the --remarks option to display
them.
AFE1_AFE2-1:1
Compiler options
--diag_suppress
Syntax --diag_suppress=tag[,tag,...]
Parameters
tag The number of a diagnostic message, for example, the
message number Pe117
Description Use this option to suppress certain diagnostic messages. These messages will not be
displayed. This option may be used more than once on the command line.
Project>Options>C/C++ Compiler>Diagnostics>Suppress these diagnostics
--diag_warning
Syntax --diag_warning=tag[,tag,...]
Parameters
tag The number of a diagnostic message, for example, the
message number Pe826
Description Use this option to reclassify certain diagnostic messages as warnings. A warning
indicates an error or omission that is of concern, but which will not cause the compiler
to stop before compilation is completed. This option may be used more than once on the
command line.
Project>Options>C/C++ Compiler>Diagnostics>Treat these as warnings
--diagnostics_tables
Syntax --diagnostics_tables {filename|directory}
Parameters See Rules for specifying a filename or directory as parameters, page 260.
275
AFE1_AFE2-1:1
Descriptions of compiler options
Description Use this option to list all possible diagnostic messages to a named file. This can be
convenient, for example, if you have used a pragma directive to suppress or change the
severity level of any diagnostic messages, but forgot to document why.
Typically, this option cannot be given together with other options.
To set this option, use Project>Options>C/C++ Compiler>Extra Options.
--discard_unused_publics
Syntax --discard_unused_publics
Description Use this option to discard unused public functions and variables when compiling with
the --mfc compiler option.
Note: Do not use this option only on parts of the application, as necessary symbols
might be removed from the generated output. Use the object attribute __root to keep
symbols that are used from outside the compilation unit, for example, interrupt handlers.
If the symbol does not have the __root attribute and is defined in the library, the library
definition will be used instead.
See also --mfc, page 285 and Multi-file compilation units, page 235.
Project>Options>C/C++ Compiler>Discard unused publics
--dlib_config
Syntax --dlib_config filename.h|config
Parameters
filename A DLIB configuration header file, see Rules for specifying a
filename or directory as parameters, page 260.
config The default configuration file for the specified configuration
will be used. Choose between:
none, no configuration will be used
AFE1_AFE2-1:1
Compiler options
Description Use this option to specify which library configuration to use, either by specifying an
explicit file or by specifying a library configuration—in which case the default file for
that library configuration will be used. Make sure that you specify a configuration that
corresponds to the library you are using. If you do not specify this option, the default
library configuration file will be used.
All prebuilt runtime libraries are delivered with corresponding configuration files. You
can find the library object files in the directory arm\lib and the library configuration
files in the directory arm\inc\c. For examples and information about prebuilt runtime
libraries, see Prebuilt runtime libraries, page 135.
If you build your own customized runtime library, you should also create a
corresponding customized library configuration file, which must be specified to the
compiler. For more information, see Customizing and building your own runtime
library, page 131.
To set related options, choose:
Project>Options>General Options>Library Configuration
--do_explicit_zero_opt_in_named_sections
Syntax --do_explicit_zero_opt_in_named_sections
Description By default, the compiler treats static initialization of variables explicitly and implicitly
initialized to zero the same, except for variables which are to be placed in user-named
sections. For these variables, an explicit zero initialization is treated as a copy
initialization, that is the same way as variables statically initialized to something other
than zero.
Use this option to disable the exception for variables in user-named sections, and thus
treat explicit initializations to zero as zero initializations, not copy initializations.
277
AFE1_AFE2-1:1
Descriptions of compiler options
-e
Syntax -e
Description In the command line version of the compiler, language extensions are disabled by
default. If you use language extensions such as extended keywords and anonymous
structs and unions in your source code, you must use this option to enable them.
Note: The -e option and the --strict option cannot be used at the same time.
--enable_hardware_workaround
Syntax --enable_hardware_workaround=waid[,waid...]
Parameters
waid The ID number of the workaround to enable. For a list of
available workarounds to enable, see the release notes.
Description Use this option to make the compiler generate a workaround for a specific hardware
problem.
See also The release notes for the compiler for a list of available parameters.
To set this option, use Project>Options>C/C++ Compiler>Extra Options.
--enable_restrict
Syntax --enable_restrict
Description Enables the Standard C keyword restrict in C89 and C++. By default, restrict is
recognized in Standard C and __restrict is always recognized.
This option can be useful for improving analysis precision during optimization.
To set this option, use Project>Options>C/C++ Compiler>Extra options
AFE1_AFE2-1:1
Compiler options
--endian
Syntax --endian=
Parameters
big, b Specifies big-endian as the default byte order
little, l (default) Specifies little-endian as the default byte order
Description Use this option to specify the byte order of the generated code and data. By default, the
compiler generates code in little-endian byte order.
--enum_is_int
Syntax --enum_is_int
Description Use this option to force the size of all enumeration types to be at least 4 bytes.
Note: This option will not consider the fact that an enum type can be larger than an
integer type.
--error_limit
Syntax --error_limit=n
Parameters
n The number of errors before the compiler stops the
compilation. n must be a positive integer. 0 indicates no
limit.
Description Use the --error_limit option to specify the number of errors allowed before the
compiler stops the compilation. By default, 100 errors are allowed.
279
AFE1_AFE2-1:1
Descriptions of compiler options
-f
Syntax -f filename
Parameters See Rules for specifying a filename or directory as parameters, page 260.
Description Use this option to make the compiler read command line options from the named file,
with the default filename extension xcl.
In the command file, you format the items exactly as if they were on the command line
itself, except that you may use multiple lines, because the newline character acts just as
a space or tab character.
Both C and C++ style comments are allowed in the file. Double quotes behave in the
same way as in the Microsoft Windows command line environment.
--f
Syntax --f filename
Parameters See Rules for specifying a filename or directory as parameters, page 260.
Description Use this option to make the compiler read command line options from the named file,
with the default filename extension xcl.
In the command file, you format the items exactly as if they were on the command line
itself, except that you may use multiple lines, because the newline character acts just as
a space or tab character.
Both C and C++ style comments are allowed in the file. Double quotes behave in the
same way as in the Microsoft Windows command line environment.
If you use the compiler option --dependencies, extended command line files
specified using --f will generate a dependency, but those specified using -f will not
generate a dependency.
AFE1_AFE2-1:1
Compiler options
--fpu
Syntax --fpu={name|list|none}
Parameters
name The target FPU architecture.
list Lists all supported values for the --fpu option.
none (default) No FPU.
Description Use this option to generate code that performs floating-point operations using a Floating
Point Unit (FPU). By selecting an FPU, you will override the use of the software
floating-point library for all supported floating-point operations.
The name of a target FPU is constructed in one of these ways:
● none: No FPU (default)
● fp-architecture: Base variant of the specified architecture
● fp-architecture-SP: Single-precision variant
● fp-architecture_D16: Variant with 16 D registers
● fp_architecture_Fp16: Variant with half-precision extensions
281
AFE1_AFE2-1:1
Descriptions of compiler options
--guard_calls
Syntax --guard_calls
Description Use this option to enable guards for function static variable initialization. This option
should be used in a threaded C++ environment.
--header_context
Syntax --header_context
Description Occasionally, to find the cause of a problem it is necessary to know which header file
that was included from which source line. Use this option to list, for each diagnostic
message, not only the source position of the problem, but also the entire include stack at
that point.
This option is not available in the IDE.
-I
Syntax -I path
Parameters
path The search path for #include files
Description Use this option to specify the search paths for #include files. This option can be used
more than once on the command line.
AFE1_AFE2-1:1
Compiler options
-l
Syntax -l[a|A|b|B|c|C|D][N][H] {filename|directory}
Parameters
a (default) Assembler list file
A Assembler list file with C or C++ source as comments
b Basic assembler list file. This file has the same contents as a
list file produced with -la, except that no extra
compiler-generated information (runtime model attributes,
call frame information, frame size information) is included *
B Basic assembler list file. This file has the same contents as a
list file produced with -lA, except that no extra compiler
generated information (runtime model attributes, call frame
information, frame size information) is included *
c C or C++ list file
C (default) C or C++ list file with assembler source as comments
D C or C++ list file with assembler source as comments, but
without instruction offsets and hexadecimal byte values
N No diagnostics in file
H Include source lines from header files in output. Without this
option, only source lines from the primary source file are
included
* This makes the list file less useful as input to the assembler, but more useful for reading
by a human.
See also Rules for specifying a filename or directory as parameters, page 260.
--lock_regs
Syntax --lock_regs=register
283
AFE1_AFE2-1:1
Descriptions of compiler options
Parameters
registers A comma-separated list of register names and register
intervals to be locked, in the range R4–R11.
Description Use this option to prevent the compiler from generating code that uses the specified
registers.
Example --lock_regs=R4
--lock_regs=R8—R11
--lock_regs=R4,R8—R11
--macro_positions_in_diagnostics
Syntax --macro_positions_in_diagnostics
Description Use this option to obtain position references inside macros in diagnostic messages. This
is useful for detecting incorrect source code constructs in macros.
To set this option, use Project>Options>C/C++ Compiler>Extra Options.
--make_all_definitions_weak
Syntax --make_all_definitions_weak
Description Turns all variable and function definitions in the compilation unit into weak definitions.
Note: Normally, it is better to use extended keywords or pragma directives to turn
individual variable and function definitions into weak definitions.
AFE1_AFE2-1:1
Compiler options
--max_cost_constexpr_call
Syntax --max_cost_constexpr_call=limit
Parameters
limit The number of calls and loop iterations. The default is 2000000.
Description Use this option to specify an upper limit for the cost for folding a top-level constexpr
call (function or constructor). The cost is a combination of the number of calls
interpreted and the number of loop iterations preformed during the interpretation of a
top-level call.
To set this option, use Project>Options>C/C++ Compiler>Extra Options.
--max_depth_constexpr_call
Syntax --max_depth_constexpr_call=limit
Parameters
limit The depth of recursion. The default is 1000.
Description Use this option to specify the maximum depth of recursion for folding a top-level
constexpr call (function or constructor).
--mfc
Syntax --mfc
Description Use this option to enable multi-file compilation. This means that the compiler compiles
one or several source files specified on the command line as one unit, which enhances
interprocedural optimizations.
Note: The compiler will generate one object file per input source code file, where the
first object file contains all relevant data and the other ones are empty. If you want only
the first file to be produced, use the -o compiler option and specify a certain output file.
285
AFE1_AFE2-1:1
Descriptions of compiler options
See also --discard_unused_publics, page 276, --output, -o, page 297, and Multi-file compilation
units, page 235.
Project>Options>C/C++ Compiler>Multi-file compilation
--no_alignment_reduction
Syntax --no_alignment_reduction
Description Some simple Thumb/Thumb2 functions can be 2-byte aligned. Use this option to keep
those functions 4-byte aligned.
This option has no effect when compiling for Arm mode.
To set this option, use Project>Options>C/C++ Compiler>Extra Options.
--no_bom
Syntax --no_bom
Description Use this option to omit the Byte Order Mark (BOM) when generating a UTF-8 output
file.
See also --text_out, page 305, and Text encodings, page 254.
Project>Options>C/C++ Compiler>Encodings>Text output file encoding
--no_clustering
Syntax --no_clustering
AFE1_AFE2-1:1
Compiler options
--no_code_motion
Syntax --no_code_motion
--no_const_align
Syntax --no_const_align
Description By default, the compiler uses alignment 4 for objects with a size of 4 bytes or more. Use
this option to make the compiler align const objects based on the alignment of their
type.
For example, a string literal will get alignment 1, because it is an array with elements of
the type const char which has alignment 1. Using this option might save ROM space,
possibly at the expense of processing speed.
--no_cse
Syntax --no_cse
287
AFE1_AFE2-1:1
Descriptions of compiler options
--no_exceptions
Syntax --no_exceptions
Description Use this option to disable exception support in the C++ language. Exception statements
like throw and try–catch, and exception specifications on function definitions will
generate an error message. Exception specifications on function declarations are
ignored. The option is only valid when used together with the --c++ compiler option.
If exceptions are not used in your application, it is recommended to disable support for
them by using this option, because exceptions cause a rather large increase in code size.
See also Exception handling, page 196 and __EXCEPTIONS__, page 464.
Project>Options>C/C++ Compiler>Language 1>C++
and
Project>Options>C/C++ Compiler>Language 1>C++ dialect>C++>With
exceptions
--no_fragments
Syntax --no_fragments
Description Use this option to disable section fragment handling. Normally, the toolset uses IAR
proprietary information for transferring section fragment information to the linker. The
linker uses this information to remove unused code and data, and further minimize the
size of the executable image. When you use this option, this information is not output in
the object files.
--no_inline
Syntax --no_inline
AFE1_AFE2-1:1
Compiler options
Project>Options>C/C++ Compiler>Optimizations>Enable
transformations>Function inlining
--no_literal_pool
Syntax --no_literal_pool
Description Use this option to generate code that should run from a memory region where it is not
allowed to read data, only to execute code.
When this option is used, the compiler will construct addresses and large constants with
the MOV32 pseudo instruction instead of using a literal pool: switch statements are no
longer translated using tables, and constant data is placed in the .rodata section.
This option also affects the automatic library selection performed by the linker. An
IAR-specific ELF attribute is used for determining whether libraries compiled with this
option should be used.
This option is only allowed for Armv6-M and Armv7 cores, and can be combined with
the options --ropi or --rwpi only for Armv7 cores.
--no_loop_align
Syntax --no_loop_align
Description Use this option to disable the 4-byte alignment of labels in loops. This option is only
useful in Thumb2 mode.
In Arm/Thumb1 mode, this option is enabled but does not perform anything.
289
AFE1_AFE2-1:1
Descriptions of compiler options
--no_mem_idioms
Syntax --no_mem_idioms
Description Use this option to make the compiler not optimize code sequences that clear, set, or copy
a memory region. These memory access patterns (idioms) can otherwise be aggressively
optimized, in some cases using calls to the runtime library. In principle, the
transformation can involve more than a library call.
To set this option, use Project>Options>C/C++ Compiler>Extra Options.
--no_path_in_file_macros
Syntax --no_path_in_file_macros
Description Use this option to exclude the path from the return value of the predefined preprocessor
symbols __FILE__ and __BASE_FILE__.
--no_rtti
Syntax --no_rtti
Description Use this option to disable the runtime type information (RTTI) support in the C++
language. RTTI statements like dynamic_cast and typeid will generate an error
message. This option is only valid when used together with the --c++ compiler option.
See also Using C++, page 195 and __RTTI__, page 466.
Project>Options>C/C++ Compiler>Language 1>C++
and
Project>Options>C/C++ Compiler>Language 1>C++ dialect>C++>With RTTI
AFE1_AFE2-1:1
Compiler options
--no_rw_dynamic_init
Syntax --no_rw_dynamic_init
--no_scheduling
Syntax --no_scheduling
--no_size_constraints
Syntax --no_size_constraints
Description Use this option to relax the normal restrictions for code size expansion when optimizing
for high speed.
Note: This option has no effect unless used with -Ohs.
291
AFE1_AFE2-1:1
Descriptions of compiler options
--no_static_destruction
Syntax --no_static_destruction
Description Normally, the compiler emits code to destroy C++ static variables that require
destruction at program exit. Sometimes, such destruction is not needed.
Use this option to suppress the emission of such code.
--no_system_include
Syntax --no_system_include
Description By default, the compiler automatically locates the system include files. Use this option
to disable the automatic search for system include files. In this case, you might need to
set up the search path by using the -I compiler option.
--no_tbaa
Syntax --no_tbaa
AFE1_AFE2-1:1
Compiler options
--no_typedefs_in_diagnostics
Syntax --no_typedefs_in_diagnostics
Description Use this option to disable the use of typedef names in diagnostics. Normally, when a
type is mentioned in a message from the compiler, most commonly in a diagnostic
message of some kind, the typedef names that were used in the original declaration are
used whenever they make the resulting text shorter.
--no_unaligned_access
Syntax --no_unaligned_access
Description Use this option to make the compiler avoid unaligned accesses. Data accesses are
usually performed aligned for improved performance. However, some accesses, most
notably when reading from or writing to packed data structures, might be unaligned.
When using this option, all such accesses will be performed using a smaller data size to
avoid any unaligned accesses. This option is only useful for Armv6 architectures and
higher.
For the architectures Armv7-M and Armv8-M.mainline, the hardware support for
unaligned access can be controlled by software. There are variants of library routines for
these architectures that are faster when unaligned access is supported in hardware
(symbols with the prefix __iar_unaligned_). The IAR linker will not use these
variants if any of the input modules does not allow unaligned access.
293
AFE1_AFE2-1:1
Descriptions of compiler options
--no_uniform_attribute_syntax
Syntax --no_uniform_attribute_syntax
Description Use this option to apply the default syntax rules to IAR type attributes specified before
a type specifier.
See also --uniform_attribute_syntax, page 305 and Syntax for type attributes used on data
objects, page 366.
To set this option, use Project>Options>C/C++ Compiler>Extra Options.
--no_unroll
Syntax --no_unroll
--no_var_align
Syntax --no_var_align
Description By default, the compiler uses alignment 4 for variable objects with a size of 4 bytes or
more. Use this option to make the compiler align variable objects based on the alignment
of their type.
For example, a char array will get alignment 1, because its elements of the type char
have alignment 1. Using this option might save RAM space, possibly at the expense of
processing speed.
AFE1_AFE2-1:1
Compiler options
--no_warnings
Syntax --no_warnings
Description By default, the compiler issues warning messages. Use this option to disable all warning
messages.
This option is not available in the IDE.
--no_wrap_diagnostics
Syntax --no_wrap_diagnostics
Description By default, long lines in diagnostic messages are broken into several lines to make the
message easier to read. Use this option to disable line wrapping of diagnostic messages.
This option is not available in the IDE.
--nonportable_path_warnings
Syntax --nonportable_path_warnings
Description Use this option to make the compiler generate a warning when characters in the path
used for opening a source file or header file are lower case instead of upper case, or vice
versa, compared with the path in the file system.
This option is not available in the IDE.
-O
Syntax -O[n|l|m|h|hs|hz]
Parameters
n None* (Best debug support)
l (default) Low*
295
AFE1_AFE2-1:1
Descriptions of compiler options
m Medium
h High, balanced
*The most important difference between None and Low is that at None, all non-static
variables will live during their entire scope.
Description Use this option to set the optimization level to be used by the compiler when optimizing
the code. If no optimization option is specified, the optimization level is used by default.
If only -O is used without any parameter, the optimization level High balanced is used.
A low level of optimization makes it relatively easy to follow the program flow in the
debugger, and, conversely, a high level of optimization makes it relatively hard.
At high optimization levels, when favoring speed or size (-Ohs or -Ohz), the compiler
will emit AEABI attributes indicating the requested optimization goal. This information
can be used by the linker to select smaller or faster variants of DLIB library functions.
● If a module referencing a function is compiled with -Ohs, and the DLIB library
contains a fast variant, that variant is used.
● If all modules referencing a function are compiled with -Ohz, and the DLIB library
contains a small variant, that variant is used.
For example, using -Ohz for Cortex-M0 will result in the use of a smaller AEABI
library routine for integer division.
--only_stdout
Syntax --only_stdout
Description Use this option to make the compiler use the standard output stream (stdout), and
messages that are normally directed to the error output stream (stderr).
This option is not available in the IDE.
AFE1_AFE2-1:1
Compiler options
--output, -o
Syntax --output {filename|directory}
-o {filename|directory}
Parameters See Rules for specifying a filename or directory as parameters, page 260.
Description By default, the object code output produced by the compiler is located in a file with the
same name as the source file, but with the extension o. Use this option to explicitly
specify a different output filename for the object code output.
This option is not available in the IDE.
--pending_instantiations
Syntax --pending_instantiations number
Parameters
number An integer that specifies the limit, where 64 is default. If 0
is used, there is no limit.
Description Use this option to specify the maximum number of instantiations of a given C++
template that is allowed to be in process of being instantiated at a given time. This is
used for detecting recursive instantiations.
Project>Options>C/C++ Compiler>Extra Options
--predef_macros
Syntax --predef_macros {filename|directory}
Parameters See Rules for specifying a filename or directory as parameters, page 260.
Description Use this option to list all symbols defined by the compiler or on the command line.
(Symbols defined in the source code are not listed.) When using this option, make sure
to also use the same options as for the rest of your project.
If a filename is specified, the compiler stores the output in that file. If a directory is
specified, the compiler stores the output in that directory, in a file with the predef
filename extension.
297
AFE1_AFE2-1:1
Descriptions of compiler options
Note: This option requires that you specify a source file on the command line.
This option is not available in the IDE.
--preinclude
Syntax --preinclude includefile
Parameters See Rules for specifying a filename or directory as parameters, page 260.
Description Use this option to make the compiler read the specified include file before it starts to
read the source file. This is useful if you want to change something in the source code
for the entire application, for instance if you want to define a new symbol.
Project>Options>C/C++ Compiler>Preprocessor>Preinclude file
--preprocess
Syntax --preprocess[=[c][n][s]] {filename|directory}
Parameters
c Include comments
n Preprocess only
s Suppress #line directives
See also Rules for specifying a filename or directory as parameters, page 260.
--public_equ
Syntax --public_equ symbol[=value]
Parameters
symbol The name of the assembler symbol to be defined
AFE1_AFE2-1:1
Compiler options
Description This option is equivalent to defining a label in assembler language using the EQU
directive and exporting it using the PUBLIC directive. This option can be used more than
once on the command line.
This option is not available in the IDE.
--relaxed_fp
Syntax --relaxed_fp
Description Use this option to allow the compiler to relax the language rules and perform more
aggressive optimization of floating-point expressions. This option improves
performance for floating-point expressions that fulfill these conditions:
● The expression consists of both single and double-precision values
● The double-precision values can be converted to single precision without loss of
accuracy
● The result of the expression is converted to single precision.
Note: Performing the calculation in single precision instead of double precision might
cause a loss of accuracy.
The C standard states that 3.0 in this example has the type double and therefore the
whole expression should be evaluated in double precision. However, when the
--relaxed_fp option is used, 3.0 will be converted to float and the whole expression
can be evaluated in float precision.
To set related options, choose:
Project>Options>C/C++ Compiler>Language 2>Floating-point semantics
299
AFE1_AFE2-1:1
Descriptions of compiler options
--remarks
Syntax --remarks
Description The least severe diagnostic messages are called remarks. A remark indicates a source
code construct that may cause strange behavior in the generated code. By default, the
compiler does not generate remarks. Use this option to make the compiler generate
remarks.
--require_prototypes
Syntax --require_prototypes
Description Use this option to force the compiler to verify that all functions have proper prototypes.
Using this option means that code containing any of the following will generate an error:
● A function call of a function with no declaration, or with a Kernighan & Ritchie
C declaration
● A function definition of a public function with no previous prototype declaration
● An indirect function call through a function pointer with a type that does not include
a prototype.
Project>Options>C/C++ Compiler>Language 1>Require prototypes
--ropi
Syntax --ropi
Description Use this option to make the compiler generate code that uses PC-relative references to
address code and read-only data.
When this option is used, these limitations apply:
● C++ constructions cannot be used
● The object attribute __ramfunc cannot be used
AFE1_AFE2-1:1
Compiler options
● Pointer constants cannot be initialized with the address of another constant, a string
literal, or a function. However, writable variables can be initialized to constant
addresses at runtime.
Consider using movable blocks in the linker configuration file. See define block
directive, page 492.
See also --no_rw_dynamic_init, page 291, and Description of predefined preprocessor symbols,
page 458.
Project>Options>C/C++ Compiler>Code>Code and read-only data (ropi)
--ropi_cb
Syntax --ropi_cb
Description Use this option to make all accesses to constant data, base-addressed relative to the
register R8.
Use --ropi_cb together with --ropi to activate a variant of ROPI that uses the Arm
core register R8 as the base address for read-only data, instead of using the PC. This is
useful, for example, when using ROPI in code that runs from execute-only memory,
which is enabled if you compile and link with --no_literal_pool.
Note:
● The use of --ropi_cb is not AEABI-compliant.
● There is no provided setup of the register R8. This must be handled by your
application.
To set this option, use Project>Options>C/C++ Compiler>Extra Options.
--rwpi
Syntax --rwpi
Description Use this option to make the compiler generate code that uses the offset from the static
base register (R9) to address-writable data.
When this option is used, these limitations apply:
● The object attribute __ramfunc cannot be used
301
AFE1_AFE2-1:1
Descriptions of compiler options
See also --no_rw_dynamic_init, page 291, and Description of predefined preprocessor symbols,
page 458.
Project>Options>C/C++ Compiler>Code>Read/write data (rwpi)
--rwpi_near
Syntax --rwpi_near
Description Use this option to make the compiler generate code that uses the offset from the static
base register (R9) to address-writable data.
When this option is used, these limitations apply
● The object attribute __ramfunc cannot be used.
● Pointer constants cannot be initialized with the address of a writable variable.
However, static writable variables can be initialized to writable addresses at
runtime.
● A maximum of 64 Kbytes of read/write memory can be addressed.
See also --no_rw_dynamic_init, page 291 and Description of predefined preprocessor symbols,
page 458.
To set this option, use Project>Options>C/C++ Compiler>Extra Options.
--section
Syntax --section OldName=NewName
Description The compiler places functions and data objects into named sections which are referred
to by the IAR ILINK Linker. Use this option to change the name of the section OldName
to NewName.
This is useful if you want to place your code or data in different address ranges and you
find the @ notation, alternatively the #pragma location directive, insufficient.
AFE1_AFE2-1:1
Compiler options
Note: Any changes to the section names require corresponding modifications in the
linker configuration file.
See also Controlling data and function placement in memory, page 230.
Project>Options>C/C++ Compiler>Output>Code section name
--silent
Syntax --silent
Description By default, the compiler issues introductory messages and a final statistics report. Use
this option to make the compiler operate without sending these messages to the standard
output stream (normally the screen).
This option does not affect the display of error and warning messages.
This option is not available in the IDE.
--source_encoding
Syntax --source_encoding {locale|utf8}
Parameters
locale The default source encoding is the system locale encoding.
utf8 The default source encoding is the UTF-8 encoding.
Description When reading a source file with no Byte Order Mark (BOM), use this option to specify
the encoding. If this option is not specified and the source file does not have a BOM, the
Raw encoding will be used.
303
AFE1_AFE2-1:1
Descriptions of compiler options
--stack_protection
Syntax --stack_protection
Description Use this option to enable stack protection for the functions that are considered to need it.
--strict
Syntax --strict
Description By default, the compiler accepts a relaxed superset of Standard C and C++. Use this
option to ensure that the source code of your application instead conforms to strict
Standard C and C++.
Note: The -e option and the --strict option cannot be used at the same time.
--system_include_dir
Syntax --system_include_dir path
Parameters
path The path to the system include files, see Rules for specifying
a filename or directory as parameters, page 260.
Description By default, the compiler automatically locates the system include files. Use this option
to explicitly specify a different path to the system include files. This might be useful if
you have not installed IAR Embedded Workbench in the default location.
AFE1_AFE2-1:1
Compiler options
--text_out
Syntax --text_out {utf8|utf16le|utf16be|locale}
Parameters
utf8 Uses the UTF-8 encoding
utf16le Uses the UTF-16 little-endian encoding
utf16be Uses the UTF-16 big-endian encoding
locale Uses the system locale encoding
Description Use this option to specify the encoding to be used when generating a text output file.
The default for the compiler list files is to use the same encoding as the main source file.
The default for all other text files is UTF-8 with a Byte Order Mark (BOM).
If you want text output in UTF-8 encoding without a BOM, use the option --no_bom.
See also --no_bom, page 286 and Text encodings, page 254.
Project>Options>C/C++ Compiler>Encodings>Text output file encoding
--thumb
Syntax --thumb
--uniform_attribute_syntax
Syntax --uniform_attribute_syntax
Description By default, an IAR type attribute specified before the type specifier applies to the object
or typedef itself, and not to the type specifier, as const and volatile do. If you specify
this option, IAR type attributes obey the same syntax rules as const and volatile.
The default for IAR type attributes is to not use uniform attribute syntax.
305
AFE1_AFE2-1:1
Descriptions of compiler options
See also --no_uniform_attribute_syntax, page 294 and Syntax for type attributes used on data
objects, page 366.
To set this option, use Project>Options>C/C++ Compiler>Extra Options.
--use_c++_inline
Syntax --use_c++_inline
Description Standard C uses slightly different semantics for the inline keyword than C++ does.
Use this option if you want C++ semantics when you are using C.
--use_paths_as_written
Syntax --use_paths_as_written
Description By default, the compiler ensures that all paths in the debug information are absolute,
even if not originally specified that way.
If you use this option, paths that were originally specified as relative will be relative in
the debug information.
The paths affected by this option are:
● the paths to source files
● the paths to header files that are found using an include path that was specified as
relative
To set this option, use Project>Options>C/C++ Compiler>Extra Options.
--use_unix_directory_separators
Syntax --use_unix_directory_separators
Description Use this option to make DWARF debug information use / (instead of \) as directory
separators in file paths.
AFE1_AFE2-1:1
Compiler options
This option can be useful if you have a debugger that requires directory separators in
UNIX style.
To set this option, use Project>Options>C/C++ Compiler>Extra Options.
--utf8_text_in
Syntax --utf8_text_in
Description Use this option to specify that the compiler shall use UTF-8 encoding when reading a
text input file with no Byte Order Mark (BOM).
Note: This option does not apply to source files.
--vectorize
Syntax --vectorize
--version
Syntax --version
Description Use this option to make the compiler send version information to the console and then
exit.
This option is not available in the IDE.
307
AFE1_AFE2-1:1
Descriptions of compiler options
--vla
Syntax --vla
Description Use this option to enable support for C99 variable length arrays. Such arrays are located
on the heap. This option requires Standard C and cannot be used together with the
--c89 compiler option.
Note: --vla should not be used together with the longjmp library function, as that can
lead to memory leakages.
--warn_about_c_style_casts
Syntax --warn_about_c_style_casts
Description Use this option to make the compiler warn when C-style casts are used in C++ source
code.
This option is not available in the IDE.
--warnings_affect_exit_code
Syntax --warnings_affect_exit_code
Description By default, the exit code is not affected by warnings, because only errors produce a
non-zero exit code. With this option, warnings will also generate a non-zero exit code.
This option is not available in the IDE.
--warnings_are_errors
Syntax --warnings_are_errors
Description Use this option to make the compiler treat all warnings as errors. If the compiler
encounters an error, no object code is generated. Warnings that have been changed into
remarks are not treated as errors.
AFE1_AFE2-1:1
Compiler options
Note: Any diagnostic messages that have been reclassified as warnings by the option
--diag_warning or the #pragma diag_warning directive will also be treated as
errors when --warnings_are_errors is used.
309
AFE1_AFE2-1:1
Descriptions of compiler options
AFE1_AFE2-1:1
Linker options
● Summary of linker options
311
AFE1_AFE2-1:1
Summary of linker options
AFE1_AFE2-1:1
Linker options
313
AFE1_AFE2-1:1
Summary of linker options
AFE1_AFE2-1:1
Linker options
--advanced_heap
Syntax --advanced_heap
315
AFE1_AFE2-1:1
Descriptions of linker options
--basic_heap
Syntax --basic_heap
--BE8
Syntax --BE8
Description Use this option to specify the Byte Invariant Addressing mode.
This means that the linker reverses the byte order of the instructions, resulting in
little-endian code and big-endian data. This is the default byte addressing mode for
Armv6 big-endian images. This is the only mode available for Arm v6M and Arm v7
with big-endian images.
Byte Invariant Addressing mode is only available on Arm processors that support
Armv6, Arm v6M, and Arm v7.
See also Byte order, page 70, Byte order, page 350, --BE32, page 316, and --endian, page 279.
Project>Options>General Options>Target>Endian mode
--BE32
Syntax --BE32
See also Byte order, page 70, Byte order, page 350, --BE8, page 316, and --endian, page 279.
Project>Options>General Options>Target>Endian mode
AFE1_AFE2-1:1
Linker options
--call_graph
Syntax --call_graph {filename|directory}
Parameters See Rules for specifying a filename or directory as parameters, page 260.
Description Use this option to produce a call graph file. If no filename extension is specified, the
extension cgx is used. This option can only be used once on the command line.
Using this option enables stack usage analysis in the linker.
--config
Syntax --config filename
Parameters See Rules for specifying a filename or directory as parameters, page 260.
Description Use this option to specify the configuration file to be used by the linker (the default
filename extension is icf). If no configuration file is specified, a default configuration
is used. This option can only be used once on the command line.
--config_def
Syntax --config_def symbol=constant_value
Parameters
symbol The name of the symbol to be used in the configuration file.
constant_value The constant value of the configuration symbol.
Description Use this option to define a constant configuration symbol to be used in the configuration
file. This option has the same effect as the define symbol directive in the linker
configuration file. This option can be used more than once on the command line.
317
AFE1_AFE2-1:1
Descriptions of linker options
See also --define_symbol, page 320 and Interaction between ILINK and the application, page
116.
Project>Options>Linker>Config>Defined symbols for configuration file
--config_search
Syntax --config_search path
Parameters
path A path to a directory where the linker should search for
linker configuration include files.
Description Use this option to specify more directories to search for files when processing an
include directive in a linker configuration file.
By default, the linker searches for configuration include files only in the system
configuration directory. To specify more than one search directory, use this option for
each path.
--cpp_init_routine
Syntax --cpp_init_routine routine
Parameters
routine A user-defined C++ dynamic initialization routine.
Description When using the IAR C/C++ compiler and the standard library, C++ dynamic
initialization is handled automatically. In other cases you might need to use this option.
If any sections with the section type INIT_ARRAY or PREINIT_ARRAY are included in
your application, the C++ dynamic initialization routine is considered to be needed. By
default, this routine is named __iar_cstart_call_ctors and is called by the startup
code in the standard library. Use this option if you require another routine to handle the
initialization, for instance if you are not using the standard library.
AFE1_AFE2-1:1
Linker options
--cpu
Syntax --cpu=core
Parameters
core Specifies a specific processor variant
Description Use this option to select the processor variant to link your application for. The default is
to use a processor or architecture compatible with the object file attributes.
--default_to_complex_ranges
Syntax --default_to_complex_ranges
Description Normally, if initialize directives in a linker configuration file do not specify simple
ranges or complex ranges, the linker uses simple ranges if the associated
section placement directives use single range regions.
Use this option to make the linker always use complex ranges by default. This was
the behavior of the linker before the introduction of simple ranges and complex
ranges.
319
AFE1_AFE2-1:1
Descriptions of linker options
--define_symbol
Syntax --define_symbol symbol=constant_value
Parameters
symbol The name of the constant symbol that can be used by the
application.
constant_value The constant value of the symbol.
Description Use this option to define a constant symbol, that is a label, that can be used by your
application. This option can be used more than once on the command line.
Note: This option is different from the define symbol directive.
See also --config_def, page 317 and Interaction between ILINK and the application, page 116.
Project>Options>Linker>#define>Defined symbols
--dependencies
Syntax --dependencies[=[i|m]] {filename|directory}
Parameters
i (default) Lists only the names of files
m Lists in makefile style
See also Rules for specifying a filename or directory as parameters, page 260.
Description Use this option to make the linker list the names of the linker configuration, object, and
library files opened for input into a file with the default filename extension i.
If --dependencies=m is used, the output is in makefile style. For each input file, one
line containing a makefile dependency rule is produced. Each line consists of the name
of the output file, a colon, a space, and the name of an input file. For example:
a.out: c:\myproject\foo.o
a.out: d:\myproject\bar.o
AFE1_AFE2-1:1
Linker options
--diag_error
Syntax --diag_error=tag[,tag,...]
Parameters
tag The number of a diagnostic message, for example, the
message number Pe117
Description Use this option to reclassify certain diagnostic messages as errors. An error indicates a
problem of such severity that an executable image will not be generated. The exit code
will be non-zero. This option may be used more than once on the command line.
Project>Options>Linker>Diagnostics>Treat these as errors
--diag_remark
Syntax --diag_remark=tag[,tag,...]
Parameters
tag The number of a diagnostic message, for example, the
message number Go109
Description Use this option to reclassify certain diagnostic messages as remarks. A remark is the
least severe type of diagnostic message and indicates a construction that may cause
strange behavior in the executable image.
Note: Not all diagnostic messages can be reclassified. This option may be used more
than once on the command line.
Note: By default, remarks are not displayed—use the --remarks option to display
them.
Project>Options>Linker>Diagnostics>Treat these as remarks
321
AFE1_AFE2-1:1
Descriptions of linker options
--diag_suppress
Syntax --diag_suppress=tag[,tag,...]
Parameters
tag The number of a diagnostic message, for example, the
message number Pa180
Description Use this option to suppress certain diagnostic messages. These messages will not be
displayed. This option may be used more than once on the command line.
Note: Not all diagnostic messages can be reclassified.
Project>Options>Linker>Diagnostics>Suppress these diagnostics
--diag_warning
Syntax --diag_warning=tag[,tag,...]
Parameters
tag The number of a diagnostic message, for example, the
message number Li004
Description Use this option to reclassify certain diagnostic messages as warnings. A warning
indicates an error or omission that is of concern, but which will not cause the linker to
stop before linking is completed. This option may be used more than once on the
command line.
Note: Not all diagnostic messages can be reclassified.
Project>Options>Linker>Diagnostics>Treat these as warnings
--diagnostics_tables
Syntax --diagnostics_tables {filename|directory}
Parameters See Rules for specifying a filename or directory as parameters, page 260.
Description Use this option to list all possible diagnostic messages in a named file. This can be
convenient, for example, if you have used a pragma directive to suppress or change the
severity level of any diagnostic messages, but forgot to document why.
AFE1_AFE2-1:1
Linker options
--do_segment_pad
Syntax --do_segment_pad
Description Use this option to extend each ELF segment in the executable file with content, to make
it an even multiple of 4 bytes long (if possible). Some runtime library routines might
access memory in units of 4 bytes, and might, if the right data object is placed last in an
ELF segment, access memory outside the strict bounds of the segment. If you are
executing in an environment where this is a problem, you can use this option to extend
the ELF segments appropriately so that this is not a problem.
This option is not available in the IDE.
--enable_hardware_workaround
Syntax --enable_hardware_workaround=waid[waid[...]]
Parameters
waid The ID number of the workaround that you want to
enable. For a list of available workarounds, see the release
notes available in the Information Center.
Description Use this option to make the linker generate a workaround for a specific hardware
problem.
See also The release notes for the linker for a list of available parameters.
To set this option, use Project>Options>Linker>Extra Options.
--enable_stack_usage
Syntax --enable_stack_usage
Description Use this option to enable stack usage analysis. If a linker map file is produced, a stack
usage chapter is included in the map file.
323
AFE1_AFE2-1:1
Descriptions of linker options
--entry
Syntax --entry symbol
Parameters
symbol The name of the symbol to be treated as a root symbol and
start label
Description Use this option to make a symbol be treated as a root symbol and the start label of the
application. This is useful for loaders. If this option is not used, the default start symbol
is __iar_program_start. A root symbol is kept whether or not it is referenced from
the rest of the application, provided its module is included. A module in an object file is
always included but a module part of a library is only included if needed.
Note: The label referred to must be available in your application. You must also make
sure that the reset vector refers to the new start label, for example --redirect
__iar_program_start=_myStartLabel.
--entry_list_in_address_order
Syntax --entry_list_in_address_order
Description Use this option to generate an additional entry list in the map file. This entry list will be
sorted in address order.
To set this option use Project>Options>Linker>Extra Options.
AFE1_AFE2-1:1
Linker options
--error_limit
Syntax --error_limit=n
Parameters
n The number of errors before the linker stops linking. n must
be a positive integer. 0 indicates no limit.
Description Use the --error_limit option to specify the number of errors allowed before the
linker stops the linking. By default, 100 errors are allowed.
This option is not available in the IDE.
--exception_tables
Syntax --exception_tables={nocreate|unwind|cantunwind}
Parameters
nocreate (default) Does not generate entries. Uses the least amount of memory,
but the result is undefined if an exception is propagated
through a function without exception information.
unwind Generates unwind entries that enable an exception to be
correctly propagated through functions without exception
information.
cantunwind Generates no-unwind entries so that any attempt to
propagate an exception through the function will result in a
call to terminate.
Description Use this option to determine what the linker should do with functions that do not have
exception information but which do have correct call frame information.
The compiler ensures that C functions get correct call frame information. For functions
written in assembler language you need to use assembler directives to generate call
frame information.
325
AFE1_AFE2-1:1
Descriptions of linker options
--export_builtin_config
Syntax --export_builtin_config filename
Parameters See Rules for specifying a filename or directory as parameters, page 260.
--extra_init
Syntax --extra_init routine
Parameters
routine A user-defined initialization routine.
Description Use this option to make the linker add an entry for the specified routine at the end of the
initialization table. The routine will be called during system startup, after other
initialization routines have been called and before main is called. No entry is added if
the routine is not defined.
Note: The routine must preserve the value passed to it in register R0.
To set this option, use Project>Options>Linker>Extra Options.
-f
Syntax -f filename
Parameters See Rules for specifying a filename or directory as parameters, page 260.
Description Use this option to make the linker read command line options from the named file, with
the default filename extension xcl.
In the command file, you format the items exactly as if they were on the command line
itself, except that you may use multiple lines, because the newline character acts just as
a space or tab character.
Both C and C++ style comments are allowed in the file. Double quotes behave in the
same way as in the Microsoft Windows command line environment.
AFE1_AFE2-1:1
Linker options
--f
Syntax --f filename
Parameters See Rules for specifying a filename or directory as parameters, page 260.
Description Use this option to make the linker read command line options from the named file, with
the default filename extension xcl.
In the command file, you format the items exactly as if they were on the command line
itself, except that you may use multiple lines, because the newline character acts just as
a space or tab character.
Both C and C++ style comments are allowed in the file. Double quotes behave in the
same way as in the Microsoft Windows command line environment.
If you use the linker option --dependencies, extended command line files specified
using --f will generate a dependency, but those specified using -f will not generate a
dependency.
--force_exceptions
Syntax --force_exceptions
Description Use this option to make the linker include exception tables and exception code even
when the linker heuristics indicate that exceptions are not used.
The linker considers exceptions to be used if there is a throw expression that is not a
rethrow in the included code. If there is no such throw expression in the rest of the
code, the linker arranges for operator new, dynamic_cast, and typeid to call
abort instead of throwing an exception on failure. If you need to catch exceptions from
these constructs but your code contains no other throws, you might need to use this
option.
327
AFE1_AFE2-1:1
Descriptions of linker options
--force_output
Syntax --force_output
Description Use this option to produce an output executable image regardless of any linking errors.
To set this option, use Project>Options>Linker>Extra Options
--fpu
Syntax --fpu=name|none
Parameters
name The target FPU architecture.
none No FPU.
Description Use this option to select the FPU to link your application for. The default is to use an
FPU compatible with the object file attribute.
--image_input
Syntax --image_input filename [,symbol,[section[,alignment]]]
Parameters
filename The pure binary file containing the raw image you want to
link
symbol The symbol which the binary data can be referenced with.
section The section where the binary data will be placed. Default is
.text.
AFE1_AFE2-1:1
Linker options
Description Use this option to link pure binary files in addition to the ordinary input files. The file’s
entire contents are placed in the section, which means it can only contain pure binary
data.
Note: Just as for sections from object files, sections created by using the
--image_input option are not included unless actually needed. You can either specify
a symbol in the option and reference this symbol in your application (or use a --keep
option), or you can specify a section name and use the keep directive in a linker
configuration file to ensure that the section is included.
The contents of the pure binary file bootstrap.abs are placed in the section
CSTARTUPCODE. The section where the contents are placed is 4-byte aligned and will
only be included if your application (or the command line option --keep) includes a
reference to the symbol Bootstrap.
--import_cmse_lib_in
Syntax --import_cmse_lib_in filename
Parameters See Rules for specifying a filename or directory as parameters, page 260.
Description Reads a previous version of the import library and creates gateway veneers with the
same address as given in the import library. Use this option to create a secure image
where each entry function that exists in the provided import library is placed at the same
address in the output import library.
--import_cmse_lib_out
Syntax --import_cmse_lib_out filename|directory
329
AFE1_AFE2-1:1
Descriptions of linker options
Parameters See Rules for specifying a filename or directory as parameters, page 260.
Description Use this option when building a secure image to automatically create an import library
for use in a corresponding non-secure image. The import library consists of a relocatable
ELF object module that contains only a symbol table. Each symbol specifies an absolute
address of a secure gateway for an entry in the section Veneer$$CMSE.
--inline
Syntax --inline
Description Some routines are so small that they can fit in the space of the instruction that calls the
routine. Use this option to make the linker replace the call of a routine with the body of
the routine, where applicable.
--keep
Syntax --keep symbol
Parameters
symbol The name of the symbol to be treated as a root symbol
Description Normally, the linker keeps a symbol only if it is needed by your application. Use this
option to make a symbol always be included in the final application.
Project>Options>Linker>Input>Keep symbols
AFE1_AFE2-1:1
Linker options
--log
Syntax --log topic[,topic,...]
Description Use this option to make the linker log information to stdout. The log information can
be useful for understanding why an executable image became the way it is.
--log_file
Syntax --log_file filename
Parameters See Rules for specifying a filename or directory as parameters, page 260.
Description Use this option to direct the log output to the specified file.
331
AFE1_AFE2-1:1
Descriptions of linker options
--mangled_names_in_messages
Syntax --mangled_names_in_messages
Description Use this option to produce both mangled and unmangled names for C/C++ symbols in
messages. Mangling is a technique used for mapping a complex C name or a C++
name—for example, for overloading—into a simple name. For example, void h(int,
char) becomes _Z1hic.
--manual_dynamic_initialization
Syntax --manual_dynamic_initialization
Description Normally, dynamic initialization (typically initialization of C++ objects with static
storage duration) is performed automatically during application startup. If you use
--manual_dynamic_initialization, you must call
__iar_dynamic_initialization at some later point for this initialization to be
done.
The function __iar_dynamic_initialization is declared in the header file
iar_dynamic_init.h.
--map
Syntax --map {filename|directory}
Description Use this option to produce a linker memory map file. The map file has the default
filename extension map. The map file contains:
● Linking summary in the map file header which lists the version of the linker, the
current date and time, and the command line that was used.
● Runtime attribute summary which lists runtime attributes.
AFE1_AFE2-1:1
Linker options
--merge_duplicate_sections
Syntax --merge_duplicate_sections
Description Use this option to keep only one copy of equivalent read-only sections.
Note: This can cause different functions or constants to have the same address, so an
application that depends on the addresses being different will not work correctly with
this option enabled.
333
AFE1_AFE2-1:1
Descriptions of linker options
--no_bom
Syntax --no_bom
Description Use this option to omit the Byte Order Mark (BOM) when generating a UTF-8 output
file.
See also --text_out, page 343 and Text encodings, page 254.
Project>Options>Linker>Encodings>Text output file encoding
--no_dynamic_rtti_elimination
Syntax --no_dynamic_rtti_elimination
Description Use this option to make the linker include dynamic (polymorphic) runtime type
information (RTTI) data in the application image even when the linker heuristics
indicate that it is not needed.
The linker considers dynamic runtime type information to be needed if there is a
typeid or dynamic_cast expression for a polymorphic type in the included code. By
default, if the linker detects no such expression, RTTI data will not be included just to
make dynamic RTTI requests work.
Note: A typeid expression for a non-polymorphic type results in a direct reference to
a particular RTTI object and will not cause the linker to include any potentially
unneeded objects.
--no_entry
Syntax --no_entry
Description Use this option to set the entry point field to zero for produced ELF files.
Project>Options>Linker>Library>Override default program entry
AFE1_AFE2-1:1
Linker options
--no_exceptions
Syntax --no_exceptions
Description Use this option to make the linker generate an error if there is a throw in the included
code. This option is useful for making sure that your application does not use
exceptions.
--no_fragments
Syntax --no_fragments
Description Use this option to disable section fragment handling. Normally, the toolset uses IAR
proprietary information for transferring section fragment information to the linker. The
linker uses this information to remove unused code and data, and further minimize the
size of the executable image. Use this option to disable the removal of fragments of
sections, instead including or not including each section in its entirety, usually resulting
in a larger application.
--no_free_heap
Syntax --no_free_heap
Description Use this option to use the smallest possible heap implementation. Because this heap
does not support free or realloc, it is only suitable for applications that in the startup
phase allocate heap memory for various buffers, etc, and for applications that never
deallocate memory.
335
AFE1_AFE2-1:1
Descriptions of linker options
--no_inline
Syntax --no_inline func[,func...]
Parameters
func The name of a function symbol
Description Use this option to exclude some functions from small function inlining.
--no_library_search
Syntax --no_library_search
Description Use this option to disable the automatic runtime library search. This option turns off the
automatic inclusion of the correct standard libraries. This is useful, for example, if the
application needs a user-built standard library, etc.
Note: The option disables all steps of the automatic library selection, some of which
might need to be reproduced if you are using the standard libraries. Use the
--log libraries linker option together with automatic library selection enabled to
determine which the steps are.
Project>Options>Linker>Library>Automatic runtime library selection
--no_literal_pool
Syntax --no_literal_pool
Description Use this option for code that should run from a memory region where it is not allowed
to read data, only to execute code.
When this option is used, the linker will use the MOV32 pseudo instruction in a
mode-changing veneer, to avoid using the data bus to load the destination address. The
option also means that libraries compiled with this option will be used.
The option --no_literal_pool is only allowed for Armv6-M and Armv7-M cores.
AFE1_AFE2-1:1
Linker options
--no_locals
Syntax --no_locals
Description Use this option to remove local symbols from the ELF executable image.
Note: This option does not remove any local symbols from the DWARF information in
the executable image.
Project>Options>Linker>Output
--no_range_reservations
Syntax --no_range_reservations
Description Normally, the linker reserves any ranges used by absolute symbols with a non-zero size,
excluding them from consideration for place in commands.
When this option is used, these reservations are disabled, and the linker is free to place
sections in such a way as to overlap the extent of absolute symbols.
To set this option, use Project>Options>Linker>Extra Options.
--no_remove
Syntax --no_remove
Description When this option is used, unused sections are not removed. In other words, each module
that is included in the executable image contains all its original sections.
337
AFE1_AFE2-1:1
Descriptions of linker options
--no_vfe
Syntax --no_vfe
Description Use this option to disable the Virtual Function Elimination optimization. All virtual
functions in all classes with at least one instance will be kept, and Runtime Type
Information data will be kept for all polymorphic classes. Also, no warning message will
be issued for modules that lack VFE information.
See also --vfe, page 346 and Virtual function elimination, page 121.
To set related options, choose:
Project>Options>Linker>Optimizations>PerformC++ Virtual Function
Elimination
--no_warnings
Syntax --no_warnings
Description By default, the linker issues warning messages. Use this option to disable all warning
messages.
This option is not available in the IDE.
--no_wrap_diagnostics
Syntax --no_wrap_diagnostics
Description By default, long lines in diagnostic messages are broken into several lines to make the
message easier to read. Use this option to disable line wrapping of diagnostic messages.
This option is not available in the IDE.
--only_stdout
Syntax --only_stdout
Description Use this option to make the linker use the standard output stream (stdout), and
messages that are normally directed to the error output stream (stderr).
AFE1_AFE2-1:1
Linker options
--output, -o
Syntax --output {filename|directory}
-o {filename|directory}
Parameters See Rules for specifying a filename or directory as parameters, page 260.
Description By default, the object executable image produced by the linker is located in a file with
the name a.out. Use this option to explicitly specify a different output filename, which
by default will have the filename extension out.
Project>Options>Linker>Output>Output file
--pi_veneers
Syntax --pi_veneers
Description Use this option to make the linker generate position-independent veneers. Note that this
type of veneer is larger and slower than normal veneers.
--place_holder
Syntax --place_holder symbol[,size[,section[,alignment]]]
Parameters
symbol The name of the symbol to create
size Size in ROM. Default is 4 bytes
section Section name to use. Default is .text
alignment Alignment of section. Default is 1
339
AFE1_AFE2-1:1
Descriptions of linker options
Description Use this option to reserve a place in ROM to be filled by some other tool, for example,
a checksum calculated by ielftool. Each use of this linker option results in a section
with the specified name, size, and alignment. The symbol can be used by your
application to refer to the section.
Note: Like any other section, sections created by the --place_holder option will only
be included in your application if the section appears to be needed. The --keep linker
option, or the keep linker directive can be used for forcing such section to be included.
--preconfig
Syntax --preconfig filename
Parameters See Rules for specifying a filename or directory as parameters, page 260.
Description Use this option to make the linker read the specified file before reading the linker
configuration file.
To set this option, use Project>Options>Linker>Extra Options.
--printf_multibytes
Syntax --printf_multibytes
Description Use this option to make the linker automatically select a printf formatter that supports
multibytes.
Project>Options>General Options>Library options 1>Printf formatter
--redirect
Syntax --redirect from_symbol=to_symbol
Parameters
from_symbol The name of the source symbol
AFE1_AFE2-1:1
Linker options
Description Use this option to change references to an external symbol so that they refer to another
symbol.
Note: Redirection will normally not affect references within a module.
To set this option, use Project>Options>Linker>Extra Options
--remarks
Syntax --remarks
Description The least severe diagnostic messages are called remarks. A remark indicates a source
code construct that may cause strange behavior in the generated code. By default, the
linker does not generate remarks. Use this option to make the linker generate remarks.
--scanf_multibytes
Syntax --scanf_multibytes
Description Use this option to make the linker automatically select a scanf formatter that supports
multibytes.
Project>Options>General Options>Library options 1>Scanf formatter
--search, -L
Syntax --search path
-L path
Parameters
path A path to a directory where the linker should search for
object and library files.
341
AFE1_AFE2-1:1
Descriptions of linker options
Description Use this option to specify more directories for the linker to search for object and library
files in.
By default, the linker searches for object and library files only in the working directory.
Each use of this option on the command line adds another search directory.
--semihosting
Syntax --semihosting[=iar_breakpoint]
Parameters
iar_breakpoint The IAR-specific mechanism can be used when
debugging applications that use SWI/SVC extensively.
Description Use this option to include the debug interface—breakpoint mechanism—in the output
image. If no parameter is specified, the SWI/SVC mechanism is included for
Arm7/9/11, and the BKPT mechanism is included for Cortex-M.
--silent
Syntax --silent
Description By default, the linker issues introductory messages and a final statistics report. Use this
option to make the linker operate without sending these messages to the standard output
stream (normally the screen).
This option does not affect the display of error and warning messages.
This option is not available in the IDE.
AFE1_AFE2-1:1
Linker options
--stack_usage_control
Syntax --stack_usage_control=filename
Parameters See Rules for specifying a filename or directory as parameters, page 260.
Description Use this option to specify a stack usage control file. This file controls stack usage
analysis, or provides more stack usage information for modules or functions. You can
use this option multiple times to specify multiple stack usage control files. If no filename
extension is specified, the extension suc is used.
Using this option enables stack usage analysis in the linker.
--strip
Syntax --strip
Description By default, the linker retains the debug information from the input object files in the
output executable image. Use this option to remove that information.
To set related options, choose:
Project>Options>Linker>Output>Include debug information in output
--text_out
Syntax --text_out{utf8|utf16le|utf16be|locale}
Parameters
utf8 Uses the UTF-8 encoding
utf16le Uses the UTF-16 little-endian encoding
utf16be Uses the UTF-16 big-endian encoding
locale Uses the system locale encoding
Description Use this option to specify the encoding to be used when generating a text output file.
343
AFE1_AFE2-1:1
Descriptions of linker options
The default for the linker list files is to use the same encoding as the main source file.
The default for all other text files is UTF-8 with a Byte Order Mark (BOM).
If you want text output in UTF-8 encoding without BOM, you can use the option
--no_bom as well.
See also --no_bom, page 334 and Text encodings, page 254.
Project>Options>Linker>Encodings>Text output file encoding
--threaded_lib
Syntax --threaded_lib
Description Use this option to automatically configure the runtime library for use with threads.
Project>Options>General Options>Library Configuration>Enable thread
support in library
--timezone_lib
Syntax --timezone_lib
Description Use this option to enable the time zone and daylight savings time functionality in the
DLIB library.
Note: You need to implement the time zone functionality.
--treat_rvct_modules_as_softfp
Syntax --treat_rvct_modules_as_softfp
Description Use this option to treat all modules generated by RVCT as using the standard (non-VFP)
calling convention.
To set this option, use Project>Options>Linker>Extra Options.
AFE1_AFE2-1:1
Linker options
--use_full_std_template_names
Syntax --use_full_std_template_names
Description In the unmangled names of C++ entities, the linker by default uses shorter names for
some classes. For example, "std::string" instead of
"std::basic_string<char,
std::char_traits<char>,std::allocator<char>>". Use this option to make
the linker instead use the full, unabbreviated names.
This option is not available in the IDE.
--use_optimized_variants
Syntax --use_optimized_variants=no|auto|small|fast
Parameters
no Never uses optimized variants.
auto (default) Uses optimized variants based on attributes in the object
files.
small Always uses a small variant if available.
fast Always uses a fast variant if available.
Description Use this option to control the use of optimized variants of DLIB library functions.
Some DLIB libraries delivered with the product contain optimized variants, such as a
small integer division routing for Cortex-M0, or a fast strcpy implementation for cores
that support the Thumb-2 ISA architecture.
no always uses the default variant.
auto selects a variant based on AEABI attributes that indicate the requested
optimization goal:
● If a module is compiled with -Ohs, and the DLIB library contains a fast variant of a
function that is referenced in the module, that variant is used.
● If all modules referencing a function are compiled with -Ohz, and the DLIB library
contains a small variant of that function, that variant is used.
small uses a small variant if there is one in the DLIB library.
345
AFE1_AFE2-1:1
Descriptions of linker options
--utf8_text_in
Syntax --utf8_text_in
Description Use this option to specify that the linker shall use the UTF-8 encoding when reading a
text input file with no Byte Order Mark (BOM).
Note: This option does not apply to source files.
--version
Syntax --version
Description Use this option to make the linker send version information to the console and then exit.
This option is not available in th IDE.
--vfe
Syntax --vfe=[forced]
Parameters
forced Performs Virtual Function Elimination even if one or more
modules lack the needed virtual function elimination
information.
Description By default, Virtual Function Elimination is always performed but requires that all object
files contain the necessary virtual function elimination information. Use
--vfe=forced to perform Virtual Function Elimination even if one or more modules
do not have the necessary information.
AFE1_AFE2-1:1
Linker options
Forcing the use of Virtual Function Elimination can be unsafe if some of the modules
that lack the needed information perform virtual function calls or use dynamic Runtime
Type Information.
See also --no_vfe, page 338 and Virtual function elimination, page 121.
To set related options, choose:
Project>Options>Linker>Optimizations>Perform C++ Virtual Function
Elimination
--warnings_affect_exit_code
Syntax --warnings_affect_exit_code
Description By default, the exit code is not affected by warnings, because only errors produce a
non-zero exit code. With this option, warnings will also generate a non-zero exit code.
This option is not available in the IDE.
--warnings_are_errors
Syntax --warnings_are_errors
Description Use this option to make the linker treat all warnings as errors. If the linker encounters
an error, no executable image is generated. Warnings that have been changed into
remarks are not treated as errors.
Note: Any diagnostic messages that have been reclassified as warnings by the option
--diag_warning will also be treated as errors when --warnings_are_errors is
used.
--whole_archive
Syntax --whole_archive filename
Parameters See Rules for specifying a filename or directory as parameters, page 260.
347
AFE1_AFE2-1:1
Descriptions of linker options
Description Use this option to make the linker treat every object file in the archive as if it was
specified on the command line. This is useful when an archive contains root content that
is always included from an object file (filename extension o), but only included from an
archive if some entry from the module is referred to.
Example If archive.a contains the object files file1.o, file2.o, and file3.o, using
--whole_archive archive.a is equivalent to specifying file1.o file2.o
file3.o.
AFE1_AFE2-1:1
Data representation
● Alignment
● Byte order
● Pointer types
● Structure types
● Type qualifiers
See the chapter Efficient coding for embedded applications for information about
which data types provide the most efficient code for your application.
Alignment
Every C data object has an alignment that controls how the object can be stored in
memory. Should an object have an alignment of, for example, 4, it must be stored on an
address that is divisible by 4.
The reason for the concept of alignment is that some processors have hardware
limitations for how the memory can be accessed.
Assume that a processor can read 4 bytes of memory using one instruction, but only
when the memory read is placed on an address divisible by 4. Then, 4-byte objects, such
as long integers, will have alignment 4.
Another processor might only be able to read 2 bytes at a time—in that environment, the
alignment for a 4-byte long integer might be 2.
A structure type will have the same alignment as the structure member with the most
strict alignment. To decrease the alignment requirements on the structure and its
members, use #pragma pack or the __packed data type attribute.
349
AFE1_AFE2-1:1
Byte order
All data types must have a size that is a multiple of their alignment. Otherwise, only the
first element of an array would be guaranteed to be placed in accordance with the
alignment requirements. This means that the compiler might add pad bytes at the end of
the structure. For more information about pad bytes, see Packed structure types, page
360.
Note: With the #pragma data_alignment directive, you can increase the alignment
demands on specific variables.
See also the Standard C file stdalign.h.
Byte order
In the little-endian byte order, which is default, the least significant byte is stored at the
lowest address in memory. The most significant byte is stored at the highest address.
In the big-endian byte order, the most significant byte is stored at the lowest address in
memory. The least significant byte is stored at the highest address. If you use the
big-endian byte order, it might be necessary to use the
#pragma bitfields=reversed directive to be compatible with code for other
compilers and I/O register definitions of some devices, see Bitfields, page 352.
Note: There are two variants of the big-endian mode, BE8 and BE32, which you specify
at link time. In BE8 data is big-endian and code is little-endian. In BE32 both data and
code are big-endian. In architectures before v6, the BE32 endian mode is used, and after
v6 the BE8 mode is used. In the v6 (Arm11) architecture, both big-endian modes are
supported.
AFE1_AFE2-1:1
Data representation
BOOL
The bool data type is supported by default in the C++ language. If you have enabled
language extensions, the bool type can also be used in C source code if you include the
file stdbool.h. This will also enable the boolean values false and true.
351
AFE1_AFE2-1:1
Basic data types—integer types
When IAR Systems language extensions are enabled, and in C++, the enum constants
and types can also be of the type long, unsigned long, long long, or unsigned
long long.
To make the compiler use a larger type than it would automatically use, define an enum
constant with a large enough value. For example:
/* Disables usage of the char type for enum */
enum Cards{Spade1, Spade2,
DontUseChar=257};
BITFIELDS
In Standard C, int, signed int, and unsigned int can be used as the base type for
integer bitfields. In standard C++, and in C when language extensions are enabled in the
compiler, any integer or enumeration type can be used as the base type. It is
implementation defined whether a plain integer type (char, short, int, etc) results in
a signed or unsigned bitfield.
In the IAR C/C++ Compiler for Arm, plain integer types are treated as unsigned.
AFE1_AFE2-1:1
Data representation
Bitfields in expressions are treated as int if int can represent all values of the bitfield.
Otherwise, they are treated as the bitfield base type.
Each bitfield is placed in the next suitably aligned container of its base type that has
enough available bits to accommodate the bitfield. Within each container, the bitfield is
placed in the first available byte or bytes, taking the byte order into account. Note that
containers can overlap if needed, as long as they are suitably aligned for their type.
In addition, the compiler supports an alternative bitfield allocation strategy (disjoint
types), where bitfield containers of different types are not allowed to overlap. Using this
allocation strategy, each bitfield is placed in a new container if its type is different from
that of the previous bitfield, or if the bitfield does not fit in the same container as the
previous bitfield. Within each container, the bitfield is placed from the least significant
bit to the most significant bit (disjoint types) or from the most significant bit to the least
significant bit (reverse disjoint types). This allocation strategy will never use less space
than the default allocation strategy (joined types), and can use significantly more space
when mixing bitfield types.
Use the #pragma bitfields directive to choose which bitfield allocation strategy to
use, see bitfields, page 386.
Assume this example:
struct BitfieldExample
{
uint32_t a : 12;
uint16_t b : 3;
uint16_t c : 7;
uint8_t d;
};
For the second bitfield, b, a 16-bit container is needed and because there are still four
bits free at offset 0, the bitfield is placed there.
For the third bitfield, c, as there is now only one bit left in the first 16-bit container, a
new container is allocated at offset 2, and c is placed in the first byte of this container.
The fourth member, d, can be placed in the next available full byte, which is the byte at
offset 3.
353
AFE1_AFE2-1:1
Basic data types—integer types
In little-endian mode, each bitfield is allocated starting from the least significant free bit
of its container to ensure that it is placed into bytes from left to right.
In big-endian mode, each bitfield is allocated starting from the most significant free bit
of its container to ensure that it is placed into bytes from left to right.
To place the second bitfield, b, a new container is allocated at offset 4, because the type
of the bitfield is not the same as that of the previous one. b is placed into the least
significant three bits of this container.
The third bitfield, c, has the same type as b and fits into the same container.
AFE1_AFE2-1:1
Data representation
The fourth member, d, is allocated into the byte at offset 6. d cannot be placed into the
same container as b and c because it is not a bitfield, it is not of the same type, and it
would not fit.
When using reverse order (reverse disjoint types), each bitfield is instead placed starting
from the most significant bit of its container.
This is the layout of bitfield_example in little-endian mode:
355
AFE1_AFE2-1:1
Basic data types—floating-point types
For Cortex-M0 and Cortex-M1, the compiler does not support subnormal numbers. All
operations that should produce subnormal numbers will instead generate zero. For
information about the representation of subnormal numbers for other cores, see
Representation of special floating-point numbers, page 358.
The __fp16 floating-point type is only a storage type. All numerical operations will
operate on values promoted to float.
AFE1_AFE2-1:1
Data representation
FLOATING-POINT ENVIRONMENT
Exception flags for floating-point values are supported for devices with a VFP unit, and
they are defined in the fenv.h file. For devices without a VFP unit, the functions
defined in the fenv.h file exist but have no functionality.
The feraiseexcept function does not raise an inexact floating-point exception
when called with FE_OVERFLOW or FE_UNDERFLOW.
The precision of the float operators (+, -, *, and /) is approximately 7 decimal digits.
The precision of the float operators (+, -, *, and /) is approximately 15 decimal digits.
357
AFE1_AFE2-1:1
Pointer types
Pointer types
The compiler has two basic types of pointers: function pointers and data pointers.
FUNCTION POINTERS
The size of function pointers is always 32 bits, and the range is 0x0-0xFFFFFFFF.
When function pointer types are declared, attributes are inserted before the * sign, for
example:
typedef void (__thumb * IntHandler) (void);
DATA POINTERS
There is one data pointer available. Its size is 32 bits and the range is 0x0–0xFFFFFFFF.
AFE1_AFE2-1:1
Data representation
CASTING
Casts between pointers have these characteristics:
● Casting a value of an integer type to a pointer of a smaller type is performed by
truncation
● Casting a pointer type to a smaller integer type is performed by truncation
● Casting a pointer type to a larger integer type is performed by zero extension
● Casting a data pointer to a function pointer and vice versa is illegal
● Casting a function pointer to an integer type gives an undefined result
● Casting a value of an unsigned integer type to a pointer of a larger type is performed
by zero extension
size_t
size_t is the unsigned integer type of the result of the sizeof operator. In the IAR
C/C++ Compiler for Arm, the type used for size_t is unsigned int.
ptrdiff_t
ptrdiff_t is the signed integer type of the result of subtracting two pointers. In the
IAR C/C++ Compiler for Arm, the type used for ptrdiff_t is the signed integer
variant of the size_t type.
intptr_t
intptr_t is a signed integer type large enough to contain a void *. In the IAR C/C++
Compiler for Arm, the type used for intptr_t is signed long int.
uintptr_t
uintptr_t is equivalent to intptr_t, with the exception that it is unsigned.
Structure types
The members of a struct are stored sequentially in the order in which they are
declared: the first member has the lowest memory address.
359
AFE1_AFE2-1:1
Structure types
GENERAL LAYOUT
Members of a struct are always allocated in the order specified in the declaration.
Each member is placed in the struct according to the specified alignment (offsets).
struct First
{
char c;
short s;
} s;
The alignment of the structure is 2 bytes, and a pad byte must be inserted to give
short s the correct alignment.
#pragma pack()
AFE1_AFE2-1:1
Data representation
The next example declares a new non-packed structure, S2, that contains the structure s
declared in the previous example:
struct S2
{
struct S s;
long l;
};
The structure S will use the memory layout, size, and alignment described in the
previous example. The alignment of the member l is 4, which means that alignment of
the structure S2 will become 4.
For more information, see Alignment of elements in a structure, page 228.
Type qualifiers
According to the C standard, volatile and const are type qualifiers.
361
AFE1_AFE2-1:1
Type qualifiers
● Modified access—where the contents of the object can change in ways not known to
the compiler.
● The compiler considers each read and write access to an object declared volatile
as an access
● The unit for the access is either the entire object or, for accesses to an element in a
composite object—such as an array, struct, class, or union—the element. For
example:
char volatile a;
a = 5; /* A write access */
a += 6; /* First a read then a write access */
● An access to a bitfield is treated as an access to the underlying type
● Adding a const qualifier to a volatile object will make write accesses to the
object impossible. However, the object will be placed in RAM as specified by the C
standard.
However, these rules are not detailed enough to handle the hardware-related
requirements. The rules specific to the IAR C/C++ Compiler for Arm are described
below.
AFE1_AFE2-1:1
Data representation
To store the object in read-only memory instead, but still make it possible to access it as
a const volatile object, declare it with the __ro_placement attribute. See
__ro_placement, page 377.
To store the object in read-only memory instead, but still make it possible to access it as
a const volatile object, define the variable like this:
const volatile int x @ "FLASH";
The compiler will generate the read/write section FLASH. That section should be placed
in ROM and is used for manually initializing the variables when the application starts
up.
Thereafter, the initializers can be reflashed with other values at any time.
363
AFE1_AFE2-1:1
Data types in C++
AFE1_AFE2-1:1
Extended keywords
● General syntax rules for extended keywords
Use the -e compiler option to enable language extensions. See -e, page 278.
TYPE ATTRIBUTES
Type attributes define how a function is called, or how a data object is accessed. This
means that if you use a type attribute, it must be specified both when a function or data
object is defined and when it is declared.
You can either place the type attributes explicitly in your declarations, or use the pragma
directive #pragma type_attribute.
365
AFE1_AFE2-1:1
General syntax rules for extended keywords
You can specify as many type attributes as required for each level of pointer indirection.
packed_int is a typedef for packed integers. The variable q1 can point to such integers.
You can also use the #pragma type_attributes directive to specify type attributes
for a declaration. The type attributes specified in the pragma directive are applied to the
data object or typedef being declared.
#pragma type_attribute=__packed
int * q2;
AFE1_AFE2-1:1
Extended keywords
or
void (__irq __arm * my_fp)(void);
You can also use #pragma type_attribute to specify the function type attributes:
#pragma type_attribute=__irq __arm
void my_handler(void);
OBJECT ATTRIBUTES
Normally, object attributes affect the internal functionality of functions and data objects,
but not directly how the function is called or how the data is accessed. This means that
an object attribute does not normally need to be present in the declaration of an object.
These object attributes are available:
● Object attributes that can be used for variables:
__absolute, __no_alloc, __no_alloc16, __no_alloc_str,
__no_alloc_str16, __no_init, __ro_placement
● Object attributes that can be used for functions and variables:
location, @, __root, __weak
● Object attributes that can be used for functions:
__cmse_nonsecure_entry, __intrinsic, __nested, __noreturn,
__ramfunc, __stackless
You can specify as many object attributes as required for a specific function or data
object.
For more information about location and @, see Controlling data and function
placement in memory, page 230.
367
AFE1_AFE2-1:1
Summary of extended keywords
Note: Object attributes cannot be used in combination with the typedef keyword.
AFE1_AFE2-1:1
Extended keywords
__absolute
Syntax See Syntax for object attributes, page 368.
Description The __absolute keyword makes references to the object use absolute addressing.
The following limitations apply:
● Only available when the --ropi or --rwpi compiler option is used
● Can only be used on external declarations.
__arm
Syntax See Syntax for type attributes used on functions, page 367.
369
AFE1_AFE2-1:1
Descriptions of extended keywords
__big_endian
Syntax See Syntax for type attributes used on data objects, page 366.
Description The __big_endian keyword is used for accessing a variable that is stored in the
big-endian byte order regardless of what byte order the rest of the application uses. The
__big_endian keyword is available when you compile for Armv6 or higher.
Note: This keyword cannot be used on pointers. This attribute cannot be used on arrays.
__cmse_nonsecure_call
Syntax See Syntax for type attributes used on functions, page 367.
AFE1_AFE2-1:1
Extended keywords
__cmse_nonsecure_entry
Syntax See Syntax for object attributes, page 368.
Description The __cmse_nonsecure_entry keyword declares an entry function that can be called
from the non-secure state. The execution state will be cleared before returning to the
caller, to avoid leaking sensitive data to the non-secure state.
The keyword __cmse_nonsecure_entry is not supported for variadic functions or
functions with parameters or return values that do not fit in registers.
The keyword __cmse_nonsecure_entry is only allowed when compiling with
--cmse.
__fiq
Syntax See Syntax for type attributes used on functions, page 367.
Description The __fiq keyword declares a fast interrupt function. All interrupt functions must be
compiled in Arm mode. A function declared __fiq does not accept parameters and
does not have a return value. This keyword is not available when you compile for
Cortex-M devices.
__interwork
Syntax See Syntax for type attributes used on functions, page 367.
Description A function declared __interwork can be called from functions executing in either
Arm or Thumb mode.
Note: All functions are interwork. The keyword exists for compatibility reasons.
371
AFE1_AFE2-1:1
Descriptions of extended keywords
__intrinsic
Description The __intrinsic keyword is reserved for compiler internal use only.
__irq
Syntax See Syntax for type attributes used on functions, page 367.
Description The __irq keyword declares an interrupt function. All interrupt functions must be
compiled in Arm mode. A function declared __irq does not accept parameters and
does not have a return value. This keyword is not available when you compile for
Cortex-M devices.
__little_endian
Syntax See Syntax for type attributes used on data objects, page 366.
Description The __little_endian keyword is used for accessing a variable that is stored in the
little-endian byte order regardless of what byte order the rest of the application uses. The
__little_endian keyword is available when you compile for Armv6 or higher.
Note: This keyword cannot be used on pointers. This attribute cannot be used on arrays.
__nested
Syntax See Syntax for object attributes, page 368.
Description The __nested keyword modifies the enter and exit code of an interrupt function to
allow for nested interrupts. This allows interrupts to be enabled, which means new
interrupts can be served inside an interrupt function, without overwriting the SPSR and
return address in R14. Nested interrupts are only supported for __irq declared
functions.
AFE1_AFE2-1:1
Extended keywords
Note: The __nested keyword requires the processor mode to be in either User or
System mode.
__no_alloc, __no_alloc16
Syntax See Syntax for object attributes, page 368.
Description Use the __no_alloc or __no_alloc16 object attribute on a constant to make the
constant available in the executable file without occupying any space in the linked
application.
You cannot access the contents of such a constant from your application. You can take
its address, which is an integer offset to the section of the constant. The type of the offset
is unsigned long when __no_alloc is used, and unsigned short when
__no_alloc16 is used.
__no_alloc_str, __no_alloc_str16
Syntax __no_alloc_str(string_literal @ section)
and
__no_alloc_str16(string_literal @ section)
where
string_literal The string literal that you want to make available in the
executable file.
section The name of the section to place the string literal in.
373
AFE1_AFE2-1:1
Descriptions of extended keywords
The value of the expression is the offset of the string literal in the section. For
__no_alloc_str, the type of the offset is unsigned long. For __no_alloc_str16,
the type of the offset is unsigned short.
void
foo(int i, double d)
{
DBGPRINTF("The value of i is: %d, the value of d is: %f",i,d);
}
Depending on your debugger and the runtime support, this could produce trace output
on the host computer.
Note: There is no such runtime support in C-SPY, unless you use an external plugin
module.
__no_init
Syntax See Syntax for object attributes, page 368.
Description Use the __no_init keyword to place a data object in non-volatile memory. This means
that the initialization of the variable, for example at system startup, is suppressed.
See also Non-initialized variables, page 244 and do not initialize directive, page 501.
__noreturn
Syntax See Syntax for object attributes, page 368.
Description The __noreturn keyword can be used on a function to inform the compiler that the
function will not return. If you use this keyword on such functions, the compiler can
optimize more efficiently. Examples of functions that do not return are abort and exit.
AFE1_AFE2-1:1
Extended keywords
Note: At optimization levels Medium or High, the __noreturn keyword might cause
incorrect call stack debug information at any point where it can be determined that the
current function cannot return.
Note: The extended keyword __noreturn has the same meaning as the Standard C
keyword _Noreturn or the macro noreturn (if stdnoreturn.h has been included)
and as the Standard C++ attribute [[noreturn]].
__packed
Syntax See Syntax for type attributes used on data objects, page 366. An exception is when the
keyword is used for modifying the structure type in a struct or union declarations,
see below.
Description Use the __packed keyword to specify a data alignment of 1 for a data type. __packed
can be used in two ways:
● When used before the struct or union keyword in a structure definition, the
maximum alignment of each member in the structure is set to 1, eliminating the
need for gaps between the members.
You can also use the __packed keyword with structure declarations, but it is illegal
to refer to a structure type defined without the __packed keyword using a structure
declaration with the __packed keyword.
● When used in any other position, it follows the syntax rules for type attributes, and
affects a type in its entirety. A type with the __packed type attribute is the same as
the type attribute without the __packed type attribute, except that it has a data
alignment of 1. Types that already have an alignment of 1 are not affected by the
__packed type attribute.
A normal pointer can be implicitly converted to a pointer to __packed, but the reverse
conversion requires a cast.
Note: Accessing data types at other alignments than their natural alignment can result
in code that is significantly larger and slower.
Use either __packed or #pragma pack to relax the alignment restrictions for a type
and the objects defined using that type. Mixing __packed and #pragma pack might
lead to unexpected behavior.
375
AFE1_AFE2-1:1
Descriptions of extended keywords
/* NOTE: no __packed: */
struct Y { char ch; int i; };
/* ERROR: Y not defined with __packed: */
__packed struct Y * yp ;
__ramfunc
Syntax See Syntax for object attributes, page 368.
Description The __ramfunc keyword makes a function execute in RAM. Two code sections will be
created: one for the RAM execution (.textrw), and one for the ROM initialization
(.textrw_init).
If a function declared __ramfunc tries to access ROM, the compiler will issue a
warning. This behavior is intended to simplify the creation of upgrade routines, for
instance, rewriting parts of flash memory. If this is not why you have declared the
function __ramfunc, you can safely ignore or disable these warnings.
Functions declared __ramfunc are by default stored in the section named .textrw.
See also The C-SPY® Debugging Guide for Arm to read more about __ramfunc declared
functions in relation to breakpoints.
AFE1_AFE2-1:1
Extended keywords
__ro_placement
Syntax See Syntax for object attributes, page 368.
Description The __ro_placement attribute specifies that a data object should be placed in
read-only memory. There are two cases where you might want to use this object
attribute:
● Data objects declared const volatile are by default placed in read-write
memory. Use the __ro_placement object attribute to place the data object in
read-only memory instead.
● In C++, a data object declared const and that needs dynamic initialization is placed
in read-write memory and initialized at system startup. If you use the
__ro_placement object attribute, the compiler will give an error message if the
data object needs dynamic initialization.
You can only use the __ro_placement object attribute on const objects.
You can use the __ro_placement attribute with C++ objects if the compiler can
optimize the C++ dynamic initialization of the data objects into static initialization. This
is possible only for relatively simple constructors that have been defined in the header
files of the relevant class definitions, so that they are visible to the compiler. If the
compiler cannot find the constructor, or if the constructor is too complex, an error
message will be issued (Error[Go023]) and the compilation will fail.
__root
Syntax See Syntax for object attributes, page 368.
Description A function or variable with the __root attribute is kept whether or not it is referenced
from the rest of the application, provided its module is included. Program modules are
always included and library modules are only included if needed.
See also For more information about root symbols and how they are kept, see Keeping symbols
and sections, page 111.
__stackless
Syntax See Syntax for object attributes, page 368.
377
AFE1_AFE2-1:1
Descriptions of extended keywords
Description The __stackless keyword declares a function that can be called without a working
stack.
A function declared __stackless violates the calling convention in such a way that it
is not possible to return from it. However, the compiler cannot reliably detect if the
function returns and will not issue an error if it does.
__swi
Syntax See Syntax for type attributes used on functions, page 367.
Description The __swi declares a software interrupt function. It inserts an SVC (formerly SWI)
instruction and the specified software interrupt number to make a proper function call.
A function declared __swi accepts arguments and returns values. The __swi keyword
makes the compiler generate the correct return sequence for a specific software interrupt
function. Software interrupt functions follow the same calling convention regarding
parameters and return values as an ordinary function, except for the stack usage.
The __swi keyword also expects a software interrupt number which is specified with
the #pragma swi_number=number directive. The swi_number is used as an
argument to the generated assembler SVC instruction, and can be used by the SVC
interrupt handler, for example SWI_Handler, to select one software interrupt function
in a system containing several such functions.
Note: The software interrupt number should only be specified in the function
declaration—typically, in a header file that you include in the source code file that calls
the interrupt function—not in the function definition.
Note: All interrupt functions must be compiled in Arm mode, except for Cortex-M. Use
either the __arm keyword or the #pragma type_attribute=__arm directive to alter
the default behavior if needed.
Example To declare your software interrupt function, typically in a header file, write for example
like this:
#pragma swi_number=0x23
__swi int swi0x23_function(int a, int b);
...
AFE1_AFE2-1:1
Extended keywords
Somewhere in your application source code, you define your software interrupt
function:
...
__swi __arm int the_actual_swi0x23_function(int a, int b)
{
...
return 42;
}
See also Software interrupts, page 84 and Calling convention, page 175.
__task
Syntax See Syntax for type attributes used on functions, page 367.
Description This keyword allows functions to relax the rules for preserving registers. Typically, the
keyword is used on the start function for a task in an RTOS.
By default, functions save the contents of used preserved registers on the stack upon
entry, and restore them at exit. Functions that are declared __task do not save all
registers, and therefore require less stack space.
Because a function declared __task can corrupt registers that are needed by the calling
function, you should only use __task on functions that do not return or call such a
function from assembler code.
The function main can be declared __task, unless it is explicitly called from the
application. In real-time applications with more than one task, the root function of each
task can be declared __task.
__thumb
Syntax See Syntax for type attributes used on functions, page 367.
379
AFE1_AFE2-1:1
Supported GCC attributes
__weak
Syntax See Syntax for object attributes, page 368.
Description Using the __weak object attribute on an external declaration of a symbol makes all
references to that symbol in the module weak.
Using the __weak object attribute on a public definition of a symbol makes that
definition a weak definition.
The linker will not include a module from a library solely to satisfy weak references to
a symbol, nor will the lack of a definition for a weak reference result in an error. If no
definition is included, the address of the object will be zero.
When linking, a symbol can have any number of weak definitions, and at most one
non-weak definition. If the symbol is needed, and there is a non-weak definition, this
definition will be used. If there is no non-weak definition, one of the weak definitions
will be used.
AFE1_AFE2-1:1
Extended keywords
● aligned
● always_inline
● cmse_nonsecure_call
● cmse_nonsecure_entry
● constructor
● deprecated
● noinline
● noreturn
● packed
● pcs (for IAR type attributes used on functions)
● section
● target (for IAR object attributes used on functions)
● transparent_union
● unused
● used
● volatile
● weak
381
AFE1_AFE2-1:1
Supported GCC attributes
AFE1_AFE2-1:1
Pragma directives
● Summary of pragma directives
383
AFE1_AFE2-1:1
Summary of pragma directives
AFE1_AFE2-1:1
Pragma directives
385
AFE1_AFE2-1:1
Descriptions of pragma directives
Note: For portability reasons, see also Recognized pragma directives (6.10.6), page
607.
bitfields
Syntax #pragma bitfields=disjoint_types|joined_types|
reversed_disjoint_types|reversed|default}
Parameters
disjoint_types Bitfield members are placed from the least significant
bit to the most significant bit in the container type.
Storage containers of bitfields with different base
types will not overlap.
joined_types Bitfield members are placed depending on the byte
order. Storage containers of bitfields will overlap other
structure members. For more information, see
Bitfields, page 352.
reversed_disjoint_types Bitfield members are placed from the most significant
bit to the least significant bit in the container type.
Storage containers of bitfields with different base
types will not overlap.
reversed This is an alias for reversed_disjoint_types.
default Restores the default layout of bitfield members. The
default behavior for the compiler is joined_types.
Description Use this pragma directive to control the layout of bitfield members.
AFE1_AFE2-1:1
Pragma directives
calls
Syntax #pragma calls=arg[, arg...]
Description Use this pragma directive to specify all functions that can be indirectly called in the
following statement. This information can be used for stack usage analysis in the linker.
You can specify individual functions or function categories. Specifying a category is
equivalent to specifying all included functions in that category.
See also function_category, page 394 and Stack usage analysis, page 98.
387
AFE1_AFE2-1:1
Descriptions of pragma directives
call_graph_root
Syntax #pragma call_graph_root[=category]
Parameters
category A string that identifies an optional call graph root category
Description Use this pragma directive to specify that, for stack usage analysis purposes, the
immediately following function is a call graph root. You can also specify an optional
category. The compiler will usually automatically assign a call graph root category to
interrupt and task functions. If you use the #pragma call_graph_root directive on
such a function you will override the default category. You can specify any string as a
category.
data_alignment
Syntax #pragma data_alignment=expression
Parameters
expression A constant which must be a power of two (1, 2, 4, etc.).
Description Use this pragma directive to give the immediately following variable a higher (more
strict) alignment of the start address than it would otherwise have. This directive can be
used on variables with static and automatic storage duration.
When you use this directive on variables with automatic storage duration, there is an
upper limit on the allowed alignment for each function, determined by the calling
convention used.
Note: Normally, the size of a variable is a multiple of its alignment. The
data_alignment directive only affects the alignment of the variable’s start address,
and not its size, and can therefore be used for creating situations where the size is not a
multiple of the alignment.
Note: To comply with the ISO C11 standard and later, it is recommended to use the
alignment specifier _Alignas for C code. To comply with the C++11 standard and later,
it is recommended to use the alignment specifier alignas for C++ code.
AFE1_AFE2-1:1
Pragma directives
default_function_attributes
Syntax #pragma default_function_attributes=[ attribute...]
Parameters
type_attribute See Type attributes, page 365.
object_attribute See Object attributes, page 367.
@ section_name See Data and function placement in sections, page 232.
Description Use this pragma directive to set default section placement, type attributes, and object
attributes for function declarations and definitions. The default settings are only used for
declarations and definitions that do not specify type or object attributes or location in
some other way.
Specifying a default_function_attributes pragma directive with no attributes,
restores the initial state where no such defaults have been applied to function
declarations and definitions.
389
AFE1_AFE2-1:1
Descriptions of pragma directives
default_variable_attributes
Syntax #pragma default_variable_attributes=[ attribute...]
Parameters
type_attribute See Type attributes, page 365.
object_attributes See Object attributes, page 367.
@ section_name See Data and function placement in sections, page 232.
Description Use this pragma directive to set default section placement, type attributes, and object
attributes for declarations and definitions of variables with static storage duration. The
default settings are only used for declarations and definitions that do not specify type or
object attributes or location in some other way.
Specifying a default_variable_attributes pragma directive with no attributes
restores the initial state of no such defaults being applied to variables with static storage
duration.
Note: The extended keyword __packed can be used in two ways: as a normal type
attribute and in a structure type definition. The pragma directive
default_variable_attributes only affects the use of __packed as a type
attribute. Structure definitions are not affected by this pragma directive. See __packed,
page 375.
AFE1_AFE2-1:1
Pragma directives
deprecated
Syntax #pragma deprecated=entity
Description If you place this pragma directive immediately before the declaration of a type, variable,
function, field, or constant, any use of that type, variable, function, field, or constant will
result in a warning.
The deprecated pragma directive has the same effect as the C++ attribute
[[deprecated]], but is available in C as well.
#pragma deprecated
extern int fun(void); // function fun is deprecated
#pragma deprecated
struct xx { // struct xx is deprecated
int x;
};
struct yy {
#pragma deprecated
int y; // field y is deprecated
};
diag_default
Syntax #pragma diag_default=tag[,tag,...]
Parameters
tag The number of a diagnostic message, for example, the
message number Pe177.
391
AFE1_AFE2-1:1
Descriptions of pragma directives
Description Use this pragma directive to change the severity level back to the default, or to the
severity level defined on the command line by any of the options --diag_error,
--diag_remark, --diag_suppress, or --diag_warnings, for the diagnostic
messages specified with the tags. This level remains in effect until changed by another
diagnostic-level pragma directive.
diag_error
Syntax #pragma diag_error=tag[,tag,...]
Parameters
tag The number of a diagnostic message, for example, the
message number Pe177.
Description Use this pragma directive to change the severity level to error for the specified
diagnostics. This level remains in effect until changed by another diagnostic-level
pragma directive.
diag_remark
Syntax #pragma diag_remark=tag[,tag,...]
Parameters
tag The number of a diagnostic message, for example, the
message number Pe177.
Description Use this pragma directive to change the severity level to remark for the specified
diagnostic messages. This level remains in effect until changed by another
diagnostic-level pragma directive.
AFE1_AFE2-1:1
Pragma directives
diag_suppress
Syntax #pragma diag_suppress=tag[,tag,...]
Parameters
tag The number of a diagnostic message, for example, the
message number Pe117.
Description Use this pragma directive to suppress the specified diagnostic messages. This level
remains in effect until changed by another diagnostic-level pragma directive.
diag_warning
Syntax #pragma diag_warning=tag[,tag,...]
Parameters
tag The number of a diagnostic message, for example, the
message number Pe826.
Description Use this pragma directive to change the severity level to warning for the specified
diagnostic messages. This level remains in effect until changed by another
diagnostic-level pragma directive.
error
Syntax #pragma error message
Parameters
message A string that represents the error message.
Description Use this pragma directive to cause an error message when it is parsed. This mechanism
is different from the preprocessor directive #error, because the #pragma error
directive can be included in a preprocessor macro using the _Pragma form of the
directive and only causes an error if the macro is used.
393
AFE1_AFE2-1:1
Descriptions of pragma directives
If FOO_AVAILABLE is zero, an error will be signaled if the FOO macro is used in actual
source code.
function_category
Syntax #pragma function_category=category[, category...]
Parameters
category A string that represents the name of a function category.
Description Use this pragma directive to specify one or more function categories that the
immediately following function belongs to. When used together with #pragma calls,
the function_category directive specifies the destination for indirect calls for stack
usage analysis purposes.
See also calls, page 387 and Stack usage analysis, page 98.
include_alias
Syntax #pragma include_alias ("orig_header" , "subst_header")
#pragma include_alias (<orig_header> , <subst_header>)
Parameters
orig_header The name of a header file for which you want to create an
alias.
subst_header The alias for the original header file.
Description Use this pragma directive to provide an alias for a header file. This is useful for
substituting one header file with another, and for specifying an absolute path to a relative
file.
This pragma directive must appear before the corresponding #include directives and
subst_header must match its corresponding #include directive exactly.
AFE1_AFE2-1:1
Pragma directives
This example will substitute the relative file stdio.h with a counterpart located
according to the specified path.
inline
Syntax #pragma inline[=forced|=never]
Parameters
No parameter Has the same effect as the inline keyword.
forced Disables the compiler’s heuristics and forces inlining.
never Disables the compiler’s heuristics and makes sure that the
function will not be inlined.
Description Use #pragma inline to advise the compiler that the function defined immediately after
the directive should be inlined according to C++ inline semantics.
Specifying #pragma inline=forced will always inline the defined function. If the
compiler fails to inline the function for some reason, for example due to recursion, a
warning message is emitted.
Inlining is normally performed only on the High optimization level. Specifying
#pragma inline=forced will inline the function or result in an error due to recursion
etc.
language
Syntax #pragma language={extended|default|save|restore}
Parameters
extended Enables the IAR Systems language extensions from the first
use of the pragma directive and onward.
395
AFE1_AFE2-1:1
Descriptions of pragma directives
default From the first use of the pragma directive and onward,
restores the settings for the IAR Systems language
extensions to whatever that was specified by compiler
options.
save|restore Saves and restores, respectively, the IAR Systems language
extensions setting around a piece of source code.
Each use of save must be followed by a matching restore
in the same file without any intervening #include directive.
Description Use this pragma directive to control the use of language extensions.
Example At the top of a file that needs to be compiled with IAR Systems extensions enabled:
#pragma language=extended
/* The rest of the file. */
Around a particular part of the source code that needs to be compiled with IAR Systems
extensions enabled, but where the state before the sequence cannot be assumed to be the
same as that specified by the compiler options in use:
#pragma language=save
#pragma language=extended
/* Part of source code. */
#pragma language=restore
location
Syntax #pragma location={address|register|NAME}
Parameters
address The absolute address of the global or static variable or
function for which you want an absolute location.
register An identifier that corresponds to one of the Arm core
registers R4–R11.
NAME A user-defined section name—cannot be a section name
predefined for use by the compiler and linker.
AFE1_AFE2-1:1
Pragma directives
#pragma location=R8
__no_init int TASK; /* TASK is placed in R8 */
#pragma location="FLASH"
char PORT2; /* PORT2 is located in section FLASH */
See also Controlling data and function placement in memory, page 230 and Declare and place
your own sections, page 110.
message
Syntax #pragma message(message)
Parameters
message The message that you want to direct to the standard output
stream.
Description Use this pragma directive to make the compiler print a message to the standard output
stream when the file is compiled.
397
AFE1_AFE2-1:1
Descriptions of pragma directives
no_stack_protect
Syntax #pragma no_stack_protect
Description Use this pragma directive to disable stack protection for the defined function that
follows.
This pragma directive only has effect if the compiler option --stack_protection has
been used.
object_attribute
Syntax #pragma object_attribute=object_attribute[ object_attribute...]
Parameters For information about object attributes that can be used with this pragma directive, see
Object attributes, page 367.
Description Use this pragma directive to add one or more IAR-specific object attributes to the
declaration or definition of a variable or function. Object attributes affect the actual
variable or function and not its type. When you define a variable or function, the union
of the object attributes from all declarations including the definition, is used.
is equivalent to:
__no_init char bar;
See also General syntax rules for extended keywords, page 365.
optimize
Syntax #pragma optimize=[goal][level][vectorize][disable]
AFE1_AFE2-1:1
Pragma directives
Parameters
goal Choose between:
size, optimizes for size
Description Use this pragma directive to decrease the optimization level, or to turn off some specific
optimizations. This pragma directive only affects the function that follows immediately
after the directive.
The parameters size, balanced, speed, and no_size_constraints only have
effect on the high optimization level and only one of them can be used as it is not
possible to optimize for speed and size at the same time. It is also not possible to use
preprocessor macros embedded in this pragma directive. Any such macro will not be
expanded by the preprocessor.
Note: If you use the #pragma optimize directive to specify an optimization level that
is higher than the optimization level you specify using a compiler option, the pragma
directive is ignored.
399
AFE1_AFE2-1:1
Descriptions of pragma directives
#pragma optimize=size
int BigAndSeldomUsed()
{
/* Do something here. */
}
pack
Syntax #pragma pack(n)
#pragma pack()
#pragma pack({push|pop}[,name] [,n])
Parameters
n Sets an optional structure alignment—one of: 1, 2, 4, 8, or 16
Empty list Restores the structure alignment to default
push Sets a temporary structure alignment
pop Restores the structure alignment from a temporarily pushed
alignment
name An optional pushed or popped alignment label
Description Use this pragma directive to specify the maximum alignment of struct and union
members.
The #pragma pack directive affects declarations of structures following the pragma
directive to the next #pragma pack or the end of the compilation unit.
Note: This can result in significantly larger and slower code when accessing members
of the structure.
Use either __packed or #pragma pack to relax the alignment restrictions for a type
and the objects defined using that type. Mixing __packed and #pragma pack might
lead to unexpected behavior.
See also Structure types, page 359 and __packed, page 375.
AFE1_AFE2-1:1
Pragma directives
__printf_args
Syntax #pragma __printf_args
Description Use this pragma directive on a function with a printf-style format string. For any call to
that function, the compiler verifies that the argument to each conversion specifier, for
example %d, is syntactically correct.
You cannot use this pragma directive on functions that are members of an overload set
with more than one member.
public_equ
Syntax #pragma public_equ="symbol",value
Parameters
symbol The name of the assembler symbol to be defined (string).
value The value of the defined assembler symbol (integer constant
expression).
Description Use this pragma directive to define a public assembler label and give it a value.
required
Syntax #pragma required=symbol
Parameters
symbol Any statically linked function or variable.
401
AFE1_AFE2-1:1
Descriptions of pragma directives
Description Use this pragma directive to ensure that a symbol which is needed by a second symbol
is included in the linked output. The directive must be placed immediately before the
second symbol.
Use the directive if the requirement for a symbol is not otherwise visible in the
application, for example, if a variable is only referenced indirectly through the section
it resides in.
#pragma required=copyright
int main()
{
/* Do something here. */
}
Even if the copyright string is not used by the application, it will still be included by the
linker and available in the output.
rtmodel
Syntax #pragma rtmodel="key","value"
Parameters
"key" A text string that specifies the runtime model attribute.
"value" A text string that specifies the value of the runtime model
attribute. Using the special value * is equivalent to not
defining the attribute at all.
Description Use this pragma directive to add a runtime model attribute to a module, which can be
used by the linker to check consistency between modules.
This pragma directive is useful for enforcing consistency between modules. All modules
that are linked together and define the same runtime attribute key must have the same
value for the corresponding key, or the special value *. It can, however, be useful to state
explicitly that the module can handle any runtime model.
A module can have several runtime model definitions.
Note: The predefined compiler runtime model attributes start with a double underscore.
To avoid confusion, this style must not be used in the user-defined attributes.
AFE1_AFE2-1:1
Pragma directives
The linker will generate an error if a module that contains this definition is linked with
a module that does not have the corresponding runtime model attributes defined.
__scanf_args
Syntax #pragma __scanf_args
Description Use this pragma directive on a function with a scanf-style format string. For any call to
that function, the compiler verifies that the argument to each conversion specifier, for
example %d, is syntactically correct.
You cannot use this pragma directive on functions that are members of an overload set
with more than one member.
int GetNumber()
{
int nr;
scanf("%d", &nr); /* Compiler checks that
the argument is a
pointer to an integer */
return nr;
}
section
Syntax #pragma section="NAME"
alias
#pragma segment="NAME"
Parameters
NAME The name of the section.
Description Use this pragma directive to define a section name that can be used by the section
operators __section_begin, __section_end, and __section_size. All section
declarations for a specific section must have the same alignment.
Note: To place variables or functions in a specific section, use the #pragma location
directive or the @ operator.
403
AFE1_AFE2-1:1
Descriptions of pragma directives
See also Dedicated section operators, page 190 and the chapter Linking your application.
stack_protect
Syntax #pragma stack_protect
Description Use this pragma directive to force stack protection for the defined function that follows.
STDC CX_LIMITED_RANGE
Syntax #pragma STDC CX_LIMITED_RANGE {ON|OFF|DEFAULT}
Parameters
ON Normal complex mathematic formulas can be used.
OFF Normal complex mathematic formulas cannot be used.
DEFAULT Sets the default behavior, that is OFF.
Description Use this pragma directive to specify that the compiler can use the normal complex
mathematic formulas for * (multiplication), / (division), and abs.
Note: This directive is required by Standard C. The directive is recognized but has no
effect in the compiler.
STDC FENV_ACCESS
Syntax #pragma STDC FENV_ACCESS {ON|OFF|DEFAULT}
Parameters
ON Source code accesses the floating-point environment.
Note: This argument is not supported by the compiler.
OFF Source code does not access the floating-point environment.
DEFAULT Sets the default behavior, that is OFF.
AFE1_AFE2-1:1
Pragma directives
Description Use this pragma directive to specify whether your source code accesses the
floating-point environment or not.
Note: This directive is required by Standard C.
STDC FP_CONTRACT
Syntax #pragma STDC FP_CONTRACT {ON|OFF|DEFAULT}
Parameters
ON The compiler is allowed to contract floating-point
expressions.
OFF The compiler is not allowed to contract floating-point
expressions.
Note: This argument is not supported by the compiler.
DEFAULT Sets the default behavior, that is ON.
Description Use this pragma directive to specify whether the compiler is allowed to contract
floating-point expressions or not. This directive is required by Standard C.
swi_number
Syntax #pragma swi_number=number
Parameters
number The software interrupt number
Description Use this pragma directive together with the __swi extended keyword. It is used as an
argument to the generated SVC assembler instruction, and is used for selecting one
software interrupt function in a system containing several such functions.
405
AFE1_AFE2-1:1
Descriptions of pragma directives
type_attribute
Syntax #pragma type_attribute=type_attr[ type_attr...]
Parameters For information about type attributes that can be used with this pragma directive, see
Type attributes, page 365.
Description Use this pragma directive to specify IAR-specific type attributes, which are not part of
Standard C. Note however, that a given type attribute might not be applicable to all kind
of objects.
This directive affects the declaration of the identifier, the next variable, or the next
function that follows immediately after the pragma directive.
Example In this example, thumb-mode code is generated for the function foo:
#pragma type_attribute=__thumb
void foo(void)
{
}
unroll
Syntax #pragma unroll=n
Parameters
n The number of loop bodies in the unrolled loop, a constant
integer. #pragma unroll = 1 will prevent the unrolling of
a loop.
Description Use this pragma directive to specify that the loop following immediately after the
directive should be unrolled and that the unrolled loop should have n copies of the loop
body. The pragma directive can only be placed immediately before a for, do, or while
loop, whose number of iterations can be determined at compile time.
Normally, unrolling is most effective for relatively small loops. However, in some cases,
unrolling larger loops can be beneficial if it exposes opportunities for further
AFE1_AFE2-1:1
Pragma directives
optimizations between the unrolled loop iterations, for example, common subexpression
elimination or dead code elimination.
The #pragma unroll directive can be used to force a loop to be unrolled if the
unrolling heuristics are not aggressive enough. The pragma directive can also be used to
reduce the aggressiveness of the unrolling heuristics.
vectorize
Syntax #pragma vectorize [= never]
Parameters
No parameter Enables generation of NEON vector instructions.
never Disables generation of NEON vector instructions.
Description Use this pragma directive to enable or disable generation of NEON vector instructions
for the loop that follows immediately after the pragma directive. This pragma directive
can only be placed immediately before a for, do, or while loop. If the optimization
level is lower than High, the pragma directive has no effect.
weak
Syntax #pragma weak symbol1[=symbol2]
Parameters
symbol1 A function or variable with external linkage.
symbol2 A defined function or variable.
407
AFE1_AFE2-1:1
Descriptions of pragma directives
AFE1_AFE2-1:1
Intrinsic functions
● Summary of intrinsic functions
409
AFE1_AFE2-1:1
Descriptions of IAR Systems intrinsic functions
include the header file arm_neon.h. The functions use vector types that are named
according to this pattern:
<type><size>x<number_of_lanes>_t
where:
● type is int, unsigned int, float, or poly
● size is 8, 16, 32, or 64
● number_of_lanes is 1, 2, 4, 8, or 16.
The total bit width of a vector type is size times number_of_lanes, and should fit in
a D register (64 bits) or a Q register (128 bits).
For example:
__intrinsic float32x2_t vsub_f32(float32x2_t, float32x2_t);
The intrinsic function vsub_f32 inserts a VSUB.F32 instruction that operates on two
64-bit vectors (D registers), each with two elements (lanes) of 32-bit floating-point type.
Some functions use an array of vector types. As an example, the definition of an array
type with four elements of type float32x2_t is:
typedef struct
{
float32x2_t val[4];
}
float32x2x4_t;
__arm_cdp
__arm_cdp2
Syntax void __arm_cdp(__cpid coproc, __cpopcw opc1, __cpreg CRd,
__cpreg CRn, __cpreg CRm, __cpopc opc2);
void __arm_cdp2(__cpid , __cpopw coprocopc1, __cpreg CRd,
__cpreg CRn, __cpreg CRm, __cpopc opc2);
Parameters
coproc The coprocessor number 0..15.
AFE1_AFE2-1:1
Intrinsic functions
Description Inserts the coprocessor-specific data operation instruction CDP or CDP2. The parameters
will be encoded in the instruction and must therefore be constants.
These intrinsic functions are defined according to the Arm C Language Extensions
(ACLE).
__arm_ldc
__arm_ldcl
__arm_ldc2
__arm_ldc2l
Syntax void __arm_ldc(__cpid coproc, __cpreg CRd, const void* p);
void __arm_ldcl(__cpid coproc, __cpreg CRd, const void* p);
void __arm_ldc2(__cpid coproc, __cpreg CRd, const void* p);
void __arm_ldcl2(__cpid coproc, __cpreg CRd, const void* p);
Parameters
coproc The coprocessor number 0..15.
CRd A coprocessor register.
p Pointer to memory that the coprocessor will read from.
Description Inserts the coprocessor load instruction LDC (or one of its variants), which means that a
value will be loaded into a coprocessor register. The parameters coproc,and CRd will
be encoded in the instruction and must therefore be constants.
These intrinsic functions are defined according to the Arm C Language Extensions
(ACLE).
See also __LDC, page 424, __LDCL, page 424, __LDC2, page 424, and __LDC2L, page 424.
411
AFE1_AFE2-1:1
Descriptions of IAR Systems intrinsic functions
__arm_mcr
__arm_mcr2
__arm_mcrr
__arm_mcrr2
Syntax void __arm_mcr(__cpid coproc, __cpopc opc1, __ul src, __cpreg
CRn, __cpreg CRm, __cpopc opc2);
void __arm_mcr2(__cpid coproc, __cpopc opc1, __ul src, __cpreg
CRn, __cpreg CRm, __cpopc opc2);
void __arm_mcrr(__cpid coproc, __cpopc opc1, unsigned long long
src, __cpreg CRm);
void __arm_mcrr2(__cpid coproc, __cpopc opc1, unsigned long long
src, __cpreg CRm);
Parameters
coproc The coprocessor number 0..15.
opc1, opc2 Coprocessor-specific operation code.
src The value to be written to the coprocessor.
CRn, CRm The coprocessor register to read from.
Description Inserts a coprocessor write instruction, MCR, MCR2, MCRR, or MCRR2. The parameters
coproc, opc1, opc2, CRn, and CRm will be encoded in the instruction and must
therefore be constants.
These intrinsic functions are defined according to the Arm C Language Extensions
(ACLE).
See also __MCR, page 426, __MCR2, page 426, __MCRR, page 427, and __MCRR2, page 427.
AFE1_AFE2-1:1
Intrinsic functions
__arm_mrc
__arm_mrc2
__arm_mrrc
__arm_mrrc2
Syntax unsigned int __arm_mrc(__cpid coproc, __cpopc opc1, __cpreg CRn,
__cpreg CRm, __cpopc opc2);
unsigned int __arm_mrc2(__cpid coproc, __cpopc opc1, __cpreg
CRn, __cpreg CRm, __cpopc opc2);
unsigned long long __arm_mrrc(__cpid coproc, __cpopc opc1,
__cpreg CRm);
unsigned long long __arm_mrrc2(__cpid coproc, __cpopc opc1,
__cpreg CRm);
Parameters
coproc The coprocessor number 0..15.
opc1, opc2 Coprocessor-specific operation code.
CRn, CRm The coprocessor register to read from.
Description Inserts a coprocessor read instruction, MRC, MRC2, MRRC, or MRRC2. Returns the value of
the specified coprocessor register. The parameters coproc, opc1, opc2, CRn, and CRm
will be encoded in the instruction and must therefore be constants.
These intrinsic functions are defined according to the Arm C Language Extensions
(ACLE).
See also __MRC, page 428, __MRC2, page 428, __MRRC, page 428, and __MRRC2, page 428.
__arm_rsr
__arm_rsr64
__arm_rsrp
Syntax unsigned int __arm_rsr(sys_reg special_register);
unsigned long long __arm_rsr64(__sys_reg special_register);
413
AFE1_AFE2-1:1
Descriptions of IAR Systems intrinsic functions
Parameters
special_register A string literal specifying a register.
Description Reads a system register. Use a string literal to specify which register to read. For
__arm_rsr and __arm_rsrp, the string literal can specify the name of a system
register accepted in an MRS or VMRS instruction for the architecture specified by the
compiler option --cpu.
For __arm_rsr and __arm_rsrp, the string literal can also specify a 32-bit
coprocessor register, using this format:
coprocessor : opc1 :c CRn :c CRm : opc2
For __arm_rsr64, the string literal can specify a 64-bit coprocessor register using this
format:
coprocessor : opc1 :c CRm
These intrinsic functions are defined according to the Arm C Language Extensions
(ACLE).
__arm_stc
__arm_stcl
__arm_stc2
__arm_stc2l
Syntax void __arm_stc(__cpid coproc, __cpreg CRd, const void* p);
void __arm_stcl(__cpid coproc, __cpreg CRd, const void* p);
void __arm_stc2(__cpid coproc, __cpreg CRd, const void* p);
void __arm_stc2l(__cpid coproc, __cpreg CRd, const void* p);
AFE1_AFE2-1:1
Intrinsic functions
Parameters
coproc The coprocessor number 0..15.
CRd A coprocessor register.
p Pointer to memory that the coprocessor will write to.
Description Inserts the coprocessor store instruction STC (or one of its variants). The parameters
coproc, CRd, and p will be encoded in the instruction and must therefore be constants.
These intrinsic functions are defined according to the Arm C Language Extensions
(ACLE).
See also __STC, page 444, __STCL, page 444, __STC2, page 444, and __STC2L, page 444.
__arm_wsr
__arm_wsr64
__arm_wsrp
Syntax void __arm_wsr(const char * special_reg, _uint32_t value);
void __arm_wsr64(const char * special_reg, uint64_t value);
void __arm_wsrp(const char * special_reg, const void * value);
Parameters
special_reg A string literal specifying a system register.
value The value to write to the system register.
Description Writes to a system register. Use a string literal to specify which register to write to. For
__arm_wsr and __arm_wsrp, the string literal can specify the name of a system
register accepted in an MSR or VMSR instruction for the architecture specified by the
compiler option --cpu.
For __arm_wsr and __arm_wsrp, the string literal can also specify a 32-bit
coprocessor register, using this format:
coprocessor : opc1 :c CRn :c CRm : opc2
For __arm_wsr64, the string literal can specify a 64-bit coprocessor register using this
format:
coprocessor : opc1 :c CRm
415
AFE1_AFE2-1:1
Descriptions of IAR Systems intrinsic functions
These intrinsic functions are defined according to ACLE (Arm C Language Extensions).
__CDP
__CDP2
Syntax void __CDP(__cpid coproc, __cpopcw opc1, __cpreg CRd, __cpreg
CRn, __cpreg CRm, __cpopc opc2);
void __CDP2(__cpid coproc, __cpopcw opc1, __cpreg CRd, __cpreg
CRn, __cpreg CRm, __cpopc opc2);
Parameters
coproc The coprocessor number 0..15.
opc1, opc2 Coprocessor-specific operation codes.
CRd, CRn, CRm Coprocessor registers.
__CLREX
Syntax void __CLREX(void);
AFE1_AFE2-1:1
Intrinsic functions
__CLZ
Syntax unsigned int __CLZ(unsigned int);
Description Inserts a CLZ instruction. If the CLZ instruction is not available, a separate sequence of
instructions is inserted to achieve the same result.
See also The Arm C Language Extensions (ACLE) intrinsic functions __clz, __clzl, and
__clzll.
__crc32b
__crc32h
__crc32w
__crc32d
Syntax unsigned int __crc32b(unsigned int crc, unsigned char data);
unsigned int __crc32h(unsigned int crc, unsigned short data);
unsigned int __crc32w(unsigned int crc, unsigned int data);
unsigned int __crc32d(unsigned int crc, unsigned long long
data);
Description Calculates a CRC32 checksum from a checksum (or initial value) crc and one item of
data.
417
AFE1_AFE2-1:1
Descriptions of IAR Systems intrinsic functions
__crc32cb
__crc32ch
__crc32cw
__crc32cd
Syntax unsigned int __crc32cb(unsigned int crc, unsigned char data);
unsigned int __crc32ch(unsigned int crc, unsigned short data);
unsigned int __crc32cw(unsigned int crc, unsigned int data);
unsigned int __crc32cd(unsigned int crc, unsigned long long
data);
Description Calculates a CRC32C checksum from a checksum (or initial value) crc and one item of
data.
__disable_fiq
Syntax void __disable_fiq(void);
__disable_interrupt
Syntax void __disable_interrupt(void);
Description Disables interrupts. For Cortex-M devices, it raises the execution priority level to 0 by
setting the priority mask bit, PRIMASK. For other devices, it disables interrupt requests
(irq) and fast interrupt requests (fiq).
This intrinsic function can only be used in privileged mode.
AFE1_AFE2-1:1
Intrinsic functions
__disable_irq
Syntax void __disable_irq(void);
__DMB
Syntax void __DMB(void);
Description Inserts a DMB instruction. This intrinsic function requires an Armv6M architecture, or an
Armv7 architecture or higher.
See also The Arm C Language Extensions (ACLE) intrinsic function __dmb.
__DSB
Syntax void __DSB(void);
Description Inserts a DSB instruction. This intrinsic function requires an Armv6M architecture, or an
Armv7 architecture or higher.
See also The Arm C Language Extensions (ACLE) intrinsic function __dsb.
__enable_fiq
Syntax void __enable_fiq(void);
419
AFE1_AFE2-1:1
Descriptions of IAR Systems intrinsic functions
__enable_interrupt
Syntax void __enable_interrupt(void);
Description Enables interrupts. For Cortex-M devices, it resets the execution priority level to default
by clearing the priority mask bit, PRIMASK. For other devices, it enables interrupt
requests (irq) and fast interrupt requests (fiq).
This intrinsic function can only be used in privileged mode.
__enable_irq
Syntax void __enable_irq(void);
__fma
__fmaf
Syntax double __fma(double x, double y, double z);
float __fmaf(float x, float y, float z);
__get_BASEPRI
Syntax unsigned int __get_BASEPRI(void);
Description Returns the value of the BASEPRI register. This intrinsic function can only be used in
privileged mode and it requires a Cortex-M3, Cortex-M4, or Cortex-M7 device.
AFE1_AFE2-1:1
Intrinsic functions
__get_CONTROL
Syntax unsigned int __get_CONTROL(void);
Description Returns the value of the CONTROL register. This intrinsic function can only be used in
privileged mode and it requires a Cortex-M device.
__get_CPSR
Syntax unsigned int __get_CPSR(void);
Description Returns the value of the Arm CPSR (Current Program Status Register). This intrinsic
function can only be used in privileged mode, is not available for Cortex-M devices, and
it requires Arm mode.
__get_FAULTMASK
Syntax unsigned int __get_FAULTMASK(void);
Description Returns the value of the FAULTMASK register. This intrinsic function can only be used in
privileged mode and it requires a Cortex-M3, Cortex-M4, or Cortex-M7 device.
__get_FPSCR
Syntax unsigned int __get_FPSCR(void);
Description Returns the value of FPSCR (floating-point status and control register).
This intrinsic function is only available for devices with a VFP coprocessor.
421
AFE1_AFE2-1:1
Descriptions of IAR Systems intrinsic functions
__get_interrupt_state
Syntax __istate_t __get_interrupt_state(void);
Description Returns the global interrupt state. The return value can be used as an argument to the
__set_interrupt_state intrinsic function, which will restore the interrupt state.
This intrinsic function can only be used in privileged mode, and cannot be used when
using the --aeabi compiler option.
void CriticalFn()
{
__istate_t s = __get_interrupt_state();
__disable_interrupt();
/* Do something here. */
__set_interrupt_state(s);
}
__get_IPSR
Syntax unsigned int __get_IPSR(void);
Description Returns the value of the IPSR register (Interrupt Program Status Register). This intrinsic
function can only be used in privileged mode, and is only available for Cortex-M
devices.
__get_LR
Syntax unsigned int __get_LR(void);
AFE1_AFE2-1:1
Intrinsic functions
__get_MSP
Syntax unsigned int __get_MSP(void);
Description Returns the value of the MSP register (Main Stack Pointer). This intrinsic function can
only be used in privileged mode, and is only available for Cortex-M devices.
__get_PRIMASK
Syntax unsigned int __get_PRIMASK(void);
Description Returns the value of the PRIMASK register. This intrinsic function can only be used in
privileged mode and it requires a Cortex-M device.
__get_PSP
Syntax unsigned int __get_PSP(void);
Description Returns the value of the PSP register (Process Stack Pointer). This intrinsic function can
only be used in privileged mode, and is only available for Cortex-M devices.
__get_PSR
Syntax unsigned int __get_PSR(void);
Description Returns the value of the PSR register (combined Program Status Register). This intrinsic
function can only be used in privileged mode, and is only available for Cortex-M
devices.
__get_SB
Syntax unsigned int __get_SB(void);
423
AFE1_AFE2-1:1
Descriptions of IAR Systems intrinsic functions
__get_SP
Syntax unsigned int __get_SP(void);
__ISB
Syntax void __ISB(void);
Description Inserts an ISB instruction. This intrinsic function requires an Armv6M architecture, or
an Armv7 architecture or higher.
See also The Arm C Language Extensions (ACLE) intrinsic function __isb.
__LDC
__LDCL
__LDC2
__LDC2L
Syntax void __LDCxxx(__ul coproc, __ul CRn, __ul const *src);
Parameters
coproc The coprocessor number 0..15.
CRn The coprocessor register to load.
src A pointer to the data to load.
Description Inserts the coprocessor load instruction LDC—or one of its variants—which means that
a value will be loaded into a coprocessor register. The parameters coproc and CRn will
be encoded in the instruction and must therefore be constants.
The intrinsic functions __LDC and __LDCL require architecture Armv4 or higher for
Arm mode, and Armv6T2 or higher for Thumb mode.
AFE1_AFE2-1:1
Intrinsic functions
The intrinsic functions __LDC2 and __LDC2L require architecture Armv5 or higher for
Arm mode, and Armv6T2 or higher for Thumb mode.
See also __arm_ldc, page 411, __arm_ldcl, page 411, __arm_ldc2, page 411, and __arm_ldc2l,
page 411.
__LDC_noidx
__LDCL_noidx
__LDC2_noidx
__LDC2L_noidx
Syntax void __LDCxxx_noidx(__ul coproc, __ul CRn, __ul const *src, __ul
option);
Parameters
coproc The coprocessor number 0..15.
CRn The coprocessor register to load.
src A pointer to the data to load.
option Additional coprocessor option 0..255.
Description Inserts the coprocessor load instruction LDC, or one of its variants. A value will be
loaded into a coprocessor register. The parameters coproc, CRn, and option will be
encoded in the instruction and must therefore be constants.
The intrinsic functions __LDC_noidx and __LDCL_noidx require architecture Armv4
or higher for Arm mode, and Armv6T2 or higher for Thumb mode.
The intrinsic functions __LDC2_noidx and __LDC2L_noidx require architecture
Armv5 or higher for Arm mode, and Armv6T2 or higher for Thumb mode.
425
AFE1_AFE2-1:1
Descriptions of IAR Systems intrinsic functions
__LDREX
__LDREXB
__LDREXD
__LDREXH
Syntax unsigned int __LDREX(unsigned int *);
unsigned char __LDREXB(unsigned char *);
unsigned long long __LDREXD(unsigned long long *);
unsigned short __LDREXH(unsigned short *);
__MCR
__MCR2
Syntax void __MCR(__ul coproc, __ul opcode_1, __ul src, __ul CRn, __ul
CRm, __ul opcode_2);
void __MCR2(__ul coproc, __ul opcode_1, __ul src, __ul CRn, __ul
CRm, __ul opcode_2);
Parameters
coproc The coprocessor number 0..15.
opcode_1 Coprocessor-specific operation code.
src The value to be written to the coprocessor.
CRn The coprocessor register to write to.
CRm Additional coprocessor register—set to zero if not used.
AFE1_AFE2-1:1
Intrinsic functions
Description Inserts a coprocessor write instruction (MCR or MCR2). The parameters coproc,
opcode_1, CRn, CRm, and opcode_2 will be encoded in the instruction and must
therefore be constants.
The intrinsic function __MCR requires either Arm mode, or an Armv6T2 or higher for
Thumb mode.
The intrinsic function __MCR2 requires an Armv5T architecture or higher for Arm
mode, or Armv6T2 or higher for Thumb mode.
__MCRR
__MCRR2
Syntax void __MCRR(__cpid coproc, __cpopc opc1, unsigned long long src,
__cpreg CRm);
void __MCRR2(__cpid coproc, __cpopc opc1, unsigned long long
src, __cpreg CRm);
Parameters
coproc The coprocessor number 0..15.
opc1 Coprocessor-specific operation code.
src The value to be written to the coprocessor.
CRm The coprocessor register to read from.
Description Inserts a coprocessor write instruction, MCRR or MCRR2. The parameters coproc, opc1,
and CRm will be encoded in the instruction and must therefore be constants.
The intrinsic functions __MCRR and __MCRR2 require an Armv6 architecture or higher
for Arm mode, or Armv6T2 or higher for Thumb mode.
427
AFE1_AFE2-1:1
Descriptions of IAR Systems intrinsic functions
__MRC
__MRC2
Syntax unsigned int __MRC(__ul coproc, __ul opcode_1, __ul CRn, __ul
CRm, __ul opcode_2);
unsigned int __MRC2(__ul coproc, __ul opcode_1, __ul CRn, __ul
CRm, __ul opcode_2);
Parameters
coproc The coprocessor number 0..15.
opcode_1 Coprocessor-specific operation code.
CRn The coprocessor register to write to.
CRm Additional coprocessor register—set to zero if not used.
opcode_2 Additional coprocessor-specific operation code—set to zero if
not used.
Description Inserts a coprocessor read instruction (MRC or MRC2). Returns the value of the specified
coprocessor register. The parameters coproc, opcode_1, CRn, CRm, and opcode_2 will
be encoded in the instruction and must therefore be constants.
The intrinsic function __MRC requires either Arm mode, or an Armv6T2 or higher for
Thumb mode.
The intrinsic function __MRC2 requires an Armv5T architecture or higher for Arm
mode, or Armv6T2 or higher for Thumb mode.
__MRRC
__MRRC2
Syntax unsigned long long __MRRC(__cpid coproc, __cpopc opc1, __cpreg
CRm);
unsigned long long __MRRC2(__cpid coproc, __cpopc opc1, __cpreg
CRm);
Parameters
coproc The coprocessor number 0..15.
AFE1_AFE2-1:1
Intrinsic functions
Description Inserts a coprocessor read instruction, MRRC or MRRC2. Returns the value of the specified
coprocessor register. The parameters coproc, opc1, and CRm will be encoded in the
instruction and must therefore be constants.
The intrinsic functions __MRRC and __MRRC2 require an Armv6 architecture or higher
for Arm mode, or ArmV6T2 or higher for Thumb mode.
__no_operation
Syntax void __no_operation(void);
__PKHBT
Syntax unsigned int __PKHBT(unsigned int x, unsigned int y, unsigned
int count);
Parameters
x First operand.
y Second operand, optionally shifted left.
count Shift count 0–31, where 0 means no shift.
Description Inserts a PKHBT instruction, with an optionally shifted operand (LSL) for count in the
range 1–31.
This intrinsic function requires an Arm v6 architecture or higher for Arm mode, and
Armv7-A, Armv7-R, or Armv7E-M for Thumb mode.
429
AFE1_AFE2-1:1
Descriptions of IAR Systems intrinsic functions
__PKHTB
Syntax unsigned int __PKHTB(unsigned int x, unsigned int y, unsigned
int count);
Parameters
x First operand.
y Second operand, optionally shifted right (arithmetic shift).
count Shift count 0–32, where 0 means no shift.
Description Inserts a PKHTB instruction, with an optionally shifted operand (ASR) for count in the
range 1–32.
This intrinsic function requires an Arm v6 architecture or higher for Arm mode, and
Armv7-A, Armv7-R, or Arm v7E-M for Thumb mode.
__PLD
__PLDW
Syntax void __PLD(void const *);
void __PLDW(void const *);
See also The Arm C Language Extensions (ACLE) intrinsic functions __pld.
__PLI
Syntax void __PLI(void const *);
See also The Arm C Language Extensions (ACLE) intrinsic function __pli.
AFE1_AFE2-1:1
Intrinsic functions
__QADD
__QDADD
__QDSUB
__QSUB
Syntax signed int __Qxxx(signed int, signed int);
__QADD8
__QADD16
__QASX
__QSAX
__QSUB8
__QSUB16
Syntax unsigned int __Qxxx(unsigned int, unsigned int);
431
AFE1_AFE2-1:1
Descriptions of IAR Systems intrinsic functions
These intrinsic functions are equivalent to the Arm C Language Extensions (ACLE)
intrinsic functions __qadd8, __qadd16, __qasx, __qsax, __qsub8, and __qsub16.
__QCFlag
Syntax unsigned int __QCFlag(void);
Description Returns the value of the cumulative saturation flag QC of the FPSCR register
(Floating-point Status and Control Register). This intrinsic function is only available for
devices with Neon (Advanced SIMD).
__QDOUBLE
Syntax signed int __QDOUBLE(signed int);
Description Inserts an instruction QADD Rd,Rs,Rs for a source register Rs, and a destination register
Rd.
This intrinsic function requires architecture Armv5E or higher for Arm mode, and
Armv7-A, Armv7-R, or Armv7E-M for Thumb mode.
__QFlag
Syntax int __QFlag(void);
__RBIT
Syntax unsigned int __RBIT(unsigned int);
Description Inserts an RBIT instruction, which reverses the bit order in a 32-bit register. If the RBIT
instruction is not available, a separate sequence of instructions is inserted to achieve the
same result.
This intrinsic function is equivalent to the Arm C Language Extensions (ACLE) intrinsic
function __rbit.
AFE1_AFE2-1:1
Intrinsic functions
__reset_Q_flag
Syntax void __reset_Q_flag(void);
__reset_QC_flag
Syntax void __reset_QC_flag(void);
Description Clears the value of the cumulative saturation flag QC of the FPSCR register
(Floating-point Status and Control Register). This intrinsic function is only available for
devices with Neon (Advanced SIMD).
__REV
__REV16
__REVSH
Syntax unsigned int __REV(unsigned int);
unsigned int __REV16(unsigned int);
signed int __REVSH(short);
Description Inserts the specified instruction. If the instruction is not available, a separate sequence
of instructions is inserted to achieve the same result.
These intrinsic functions are equivalent to the Arm C Language Extensions (ACLE)
intrinsic functions __rev, __rev16, and __revsh.
__rintn
__rintnf
Syntax double __rintn(double x);
float __rintnf(float x);
433
AFE1_AFE2-1:1
Descriptions of IAR Systems intrinsic functions
Description Rounds a number x to the nearest integer number (with ties to even), which corresponds
either to the intrinsic call __VRINTN_F64(x) for double precision, or
__VRINTN_F32(x) for single precision.
These intrinsic functions are defined according to the Arm C Language Extensions
(ACLE).
__ROR
Syntax unsigned int __ROR(unsigned int);
__RRX
Syntax unsigned int __RRX(unsigned int);
__SADD8
__SADD16
__SASX
__SSAX
__SSUB8
__SSUB16
Syntax unsigned int __Sxxx(unsigned int, unsigned int);
AFE1_AFE2-1:1
Intrinsic functions
These intrinsic functions require architecture Armv6 or higher for Arm mode, and
Armv7-A, Armv7-R, or Armv7E-M for Thumb mode.
These intrinsic functions are equivalent to the Arm C Language Extensions (ACLE)
intrinsic functions __sadd8, __sadd16, __sasx, __ssax, __ssub8, and __ssub16.
__SEL
Syntax unsigned int __SEL(unsigned int, unsigned int);
__set_BASEPRI
Syntax void __set_BASEPRI(unsigned int);
Description Sets the value of the BASEPRI register. This intrinsic function can only be used in
privileged mode and it requires a Cortex-M3, Cortex-M4, or Cortex-M7 device.
__set_CONTROL
Syntax void __set_CONTROL(unsigned int);
Description Sets the value of the CONTROL register. This intrinsic function can only be used in
privileged mode and it requires a Cortex-M device.
__set_CPSR
Syntax void __set_CPSR(unsigned int);
Description Sets the value of the Arm CPSR (Current Program Status Register). Only the control field
is changed (bits 0-7). This intrinsic function can only be used in privileged mode, is not
available for Cortex-M devices, and it requires Arm mode.
435
AFE1_AFE2-1:1
Descriptions of IAR Systems intrinsic functions
__set_FAULTMASK
Syntax void __set_FAULTMASK(unsigned int);
Description Sets the value of the FAULTMASK register. This intrinsic function can only be used in
privileged mode and it requires a Cortex-M3, Cortex-M4, or Cortex-M7 device.
__set_FPSCR
Syntax void __set_FPSCR(unsigned int);
Description Sets the value of FPSCR (floating-point status and control register)
This intrinsic function is only available for devices with a VFP coprocessor.
__set_interrupt_state
Syntax void __set_interrupt_state(__istate_t);
For information about the __istate_t type, see __get_interrupt_state, page 422.
__set_LR
Syntax void __set_LR(unsigned int);
__set_MSP
Syntax void __set_MSP(unsigned int);
AFE1_AFE2-1:1
Intrinsic functions
Description Sets the value of the MSP register (Main Stack Pointer). This intrinsic function can only
be used in privileged mode, and is only available for Cortex-M devices.
__set_PRIMASK
Syntax void __set_PRIMASK(unsigned int);
Description Sets the value of the PRIMASK register. This intrinsic function can only be used in
privileged mode and it requires a Cortex-M device.
__set_PSP
Syntax void __set_PSP(unsigned int);
Description Sets the value of the PSP register (Process Stack Pointer). This intrinsic function can
only be used in privileged mode, and is only available for Cortex-M devices.
__set_SB
Syntax void __set_SB(unsigned int);
__set_SP
Syntax void __set_SP(unsigned int);
__SEV
Syntax void __SEV(void);
437
AFE1_AFE2-1:1
Descriptions of IAR Systems intrinsic functions
__SHADD8
__SHADD16
__SHASX
__SHSAX
__SHSUB8
__SHSUB16
Syntax unsigned int __SHxxx(unsigned int, unsigned int);
AFE1_AFE2-1:1
Intrinsic functions
__SMLABB
__SMLABT
__SMLATB
__SMLATT
__SMLAWB
__SMLAWT
Syntax unsigned int __SMLAxxx(unsigned int, unsigned int, unsigned
int);
__SMLAD
__SMLADX
__SMLSD
__SMLSDX
Syntax unsigned int __SMLxxx(unsigned int, unsigned int, unsigned int);
439
AFE1_AFE2-1:1
Descriptions of IAR Systems intrinsic functions
__SMLALBB
__SMLALBT
__SMLALTB
__SMLALTT
Syntax unsigned long long __SMLALxxx(unsigned int, unsigned int,
unsigned long long);
__SMLALD
__SMLALDX
__SMLSLD
__SMLSLDX
Syntax unsigned long long __SMLxxx(unsigned int, unsigned int, unsigned
long long);
AFE1_AFE2-1:1
Intrinsic functions
__SMMLA
__SMMLAR
__SMMLS
__SMMLSR
Syntax unsigned int __SMMLxxx(unsigned int, unsigned int, unsigned
int);
__SMMUL
__SMMULR
Syntax signed int __SMMULxxx(signed int, signed int);
__SMUAD
__SMUADX
__SMUSD
__SMUSDX
Syntax unsigned int __SMUxxx(unsigned int, unsigned int);
441
AFE1_AFE2-1:1
Descriptions of IAR Systems intrinsic functions
These intrinsic functions require architecture Armv6 or higher for Arm mode, and
Armv7-A, Armv7-R, or Armv7E-M for Thumb mode.
__SMUL
Syntax signed int __SMUL(signed short, signed short);
__SMULBB
__SMULBT
__SMULTB
__SMULTT
__SMULWB
__SMULWT
Syntax unsigned int __SMULxxx(unsigned int, unsigned int);
__sqrt
__sqrtf
Syntax double __sqrt(double x);
float __sqrtf(float x);
AFE1_AFE2-1:1
Intrinsic functions
Description Computes the square root of the operand x, which corresponds either to the intrinsic call
__VSQRT_F64(x) for double precision, or __VSQRT_F32(x) for single precision.
These intrinsic functions are defined according to the Arm C Language Extensions
(ACLE).
__SSAT
Syntax signed int __SSAT(signed int, unsigned int);
__SSAT16
Syntax unsigned int __SSAT16(unsigned int, unsigned int);
443
AFE1_AFE2-1:1
Descriptions of IAR Systems intrinsic functions
__STC
__STCL
__STC2
__STC2L
Syntax void __STCxxx(__ul coproc, __ul CRn, __ul const *dst);
Parameters
coproc The coprocessor number 0..15.
CRn The coprocessor register to load.
dst A pointer to the destination.
Description Inserts the coprocessor store instruction STC—or one of its variants—which means that
the value of the specified coprocessor register will be written to a memory location. The
parameters coproc and CRn will be encoded in the instruction and must therefore be
constants.
The intrinsic functions __STC and __STCL require architecture Armv4 or higher for
Arm mode, and Arm v6T2 or higher for Thumb mode.
The intrinsic functions __STC2 and __STC2L require architecture Armv5 or higher for
Arm mode, and Armv6-T2 or higher for Thumb mode.
See also __arm_stc, page 414, __arm_stcl, page 414, __arm_stc2, page 414, and __arm_stc2l,
page 414.
AFE1_AFE2-1:1
Intrinsic functions
__STC_noidx
__STCL_noidx
__STC2_noidx
__STC2L_noidx
Syntax void __STCxxx_noidx(__ul coproc, __ul CRn, __ul const *dst, __ul
option);
Parameters
coproc The coprocessor number 0..15.
CRn The coprocessor register to load.
dst A pointer to the destination.
option Additional coprocessor option 0..255.
Description Inserts the coprocessor store instruction STC—or one of its variants—which means that
the value of the specified coprocessor register will be written to a memory location. The
parameters coproc, CRn, and option will be encoded in the instruction and must
therefore be constants.
The intrinsic functions __STC_noidx and __STCL_noidx require architecture Armv4
or higher for Arm mode, and Armv6-T2 or higher for Thumb mode.
The intrinsic functions __STC2_noidx and __STC2L_noidx require architecture
Armv5 or higher for Arm mode, and Armv6-T2 or higher for Thumb mode.
445
AFE1_AFE2-1:1
Descriptions of IAR Systems intrinsic functions
__STREX
__STREXB
__STREXD
__STREXH
Syntax unsigned int __STREX(unsigned int, unsigned int *);
unsigned int __STREXB(unsigned char, unsigned char *);
unsigned int __STREXD(unsigned long long, unsigned long long*);
unsigned int __STREXH(unsigned short, unsigned short *);
__SWP
__SWPB
Syntax unsigned int __SWP(unsigned int, unsigned int *);
char __SWPB(unsigned char, unsigned char *);
AFE1_AFE2-1:1
Intrinsic functions
__SXTAB
__SXTAB16
__SXTAH
__SXTB16
Syntax unsigned int __SXTxxx(unsigned int, unsigned int);
__TT
__TTT
__TTA
__TTAT
Syntax unsigned int __TT(unsigned int);
unsigned int __TTT(unsugned int);
unsigned int __TTA(unsigned int);
unsigned int __TTAT(unsigned int);
Description Inserts the specified instruction. Avoid using these intrinsic functions directly. Instead
use the functions cmse_TT, cmse_TTT, cmse_TT_fptr, and cmse_TTT_fptr, which
are defined in the header file arm_cmse.h.
These intrinsic functions require architecture Armv8-M with security extensions.
447
AFE1_AFE2-1:1
Descriptions of IAR Systems intrinsic functions
__UADD8
__UADD16
__UASX
__USAX
__USUB8
__USUB16
Syntax unsigned int __Uxxx(unsigned int, unsigned int);
__UHADD8
__UHADD16
__UHASX
__UHSAX
__UHSUB8
__UHSUB16
Syntax unsigned int __UHxxx(unsigned int, unsigned int);
AFE1_AFE2-1:1
Intrinsic functions
__UMAAL
Syntax unsigned long long __UMAAL(unsigned int, unsigned int, unsigned
int, unsigned int);
__UQADD8
__UQADD16
__UQASX
__UQSAX
__UQSUB8
__UQSUB16
Syntax unsigned int __UQxxx(unsigned int, unsigned int);
449
AFE1_AFE2-1:1
Descriptions of IAR Systems intrinsic functions
These intrinsic functions are equivalent to the Arm C Language Extensions (ACLE)
intrinsic functions __uqadd8, __uqadd16, __uqasx, __uqsax, __uqsub8, and
__uqsub16.
__USAD8
__USADA8
Syntax unsigned int __USADxxx(unsigned int, unsigned int);
__USAT
Syntax unsigned int __USAT(signed int, unsigned int);
__USAT16
Syntax unsigned int __USAT16(unsigned int, unsigned int);
AFE1_AFE2-1:1
Intrinsic functions
__UXTAB
__UXTAB16
__UXTAH
__UXTB16
Syntax unsigned int __UXTxxx(unsigned int, unsigned int);
451
AFE1_AFE2-1:1
Descriptions of IAR Systems intrinsic functions
__VFMA_F64
__VFMS_F64
__VFNMA_F64
__VFNMS_F64
__VFMA_F32
__VFMS_F32
__VFNMA_F32
__VFNMS_F32
Syntax double __VFMA_F64(double a, double x, double y);
double __VFMS_F64(double a, double x, double y);
double __VFNMA_F64(double a, double x, double y);
double __VFNMS_F64(double a, double x, double y);
float __VFMA_f32(float a, float x, float y);
float __VFMS_f32(float a, float x, float y);
float __VFNMA_F32(float a, float x, float y);
float __VFNMS_F32(float a, float x, float y);
AFE1_AFE2-1:1
Intrinsic functions
__VMINNM_F64
__VMAXNM_F64
__VMINNM_F32
__VMAXNM_F32
Syntax double __VMINNM_F64(double x, double y);
double __VMAXNM_F64(double x, double y);
float __VMINNM_F32(float x, float y);
float __VMAXNM_F32(float x, float y);
453
AFE1_AFE2-1:1
Descriptions of IAR Systems intrinsic functions
__VRINTA_F64
__VRINTM_F64
__VRINTN_F64
__VRINTP_F64
__VRINTX_F64
__VRINTR_F64
__VRINTZ_F64
__VRINTA_F32
__VRINTM_F32
__VRINTN_F32
__VRINTP_F32
__VRINTX_F32
__VRINTR_F32
__VRINTZ_F32
Syntax double __VRINTA_F64(double x);
double __VRINTM_F64(double x);
double __VRINTN_F64(double x);
double __VRINTP_F64(double x);
double __VRINTX_F64(double x);
double __VRINTR_F64(double x);
AFE1_AFE2-1:1
Intrinsic functions
If the result of, for example __VRINTA_F64, is converted to int, the instruction
VCVTA.S32.F64 is used instead. For conversion to unsigned int, the instruction
VCVTA.U32.F64 is used instead. Similarly, VRINTM, VRINTN, VRINTP, and VRINTR use
corresponding instructions VCVTM, VCVTN, VCVTP, and VCVTR for integer conversion.
__VSQRT_F64
__VSQRT_F32
Syntax double __VSQRT_F64(double x);
float __VSQRT_F32(float x);
455
AFE1_AFE2-1:1
Descriptions of IAR Systems intrinsic functions
__WFE
__WFI
__YIELD
Syntax void int __xxx(void);
AFE1_AFE2-1:1
The preprocessor
● Overview of the preprocessor
Note: Backslashes can also be used—use one in include file paths and two in source
code strings.
457
AFE1_AFE2-1:1
Description of predefined preprocessor symbols
__AAPCS__
Description An integer that is set based on the compiler option --aapcs. The symbol is set to 1 if
the AAPCS base standard is the selected calling convention (--aapcs=std). The
symbol is undefined for other calling conventions.
This preprocessor symbol is equivalent to the ACLE (Arm C Language Extensions)
macro __ARM_PCS.
__AAPCS_VFP__
Description An integer that is set based on the compiler option --aapcs. The symbol is set to 1 if
the VFP variant of AAPCS is the selected calling convention (--aapcs=vfp). The
symbol is undefined for other calling conventions.
This preprocessor symbol is equivalent to the ACLE (Arm C Language Extensions)
macro __ARM_PCS_VFP.
__ARM_ADVANCED_SIMD__
Description An integer that is set based on the compiler option --cpu. The symbol is set to 1 if the
selected processor architecture has the Advanced SIMD architecture extension. The
symbol is undefined for other cores.
This preprocessor symbol is equivalent to the ACLE (Arm C Language Extensions)
macro __ARM_NEON.
AFE1_AFE2-1:1
The preprocessor
__ARM_ARCH
Description This symbol is defined according to ACLE (Arm C Language Extensions).
__ARM_ARCH_ISA_ARM
Description This symbol is defined according to ACLE (Arm C Language Extensions).
__ARM_ARCH_ISA_THUMB
Description This symbol is defined according to ACLE (Arm C Language Extensions).
__ARM_ARCH_PROFILE
Description This symbol is defined according to ACLE (Arm C Language Extensions).
__ARM_BIG_ENDIAN
Description This symbol is defined according to ACLE (Arm C Language Extensions).
__ARM_FEATURE_CMSE
Description An integer that is set based on the compiler options --cpu and --cmse. The symbol is
set to 3 if the selected processor architecture has CMSE (Cortex-M security extensions)
and the compiler option --cmse is specified.
The symbol is set to 1 if the selected processor architecture has CMSE and the compiler
option --cmse is not specified.
The symbol is undefined for cores without CMSE.
459
AFE1_AFE2-1:1
Description of predefined preprocessor symbols
__ARM_FEATURE_CRC32
Description This symbol is defined to 1 if the CRC32 instructions are supported (optional in
Armv8-A/R).
This symbol is defined according to ACLE (Arm C Language Extensions).
__ARM_FEATURE_CRYPTO
Description This symbol is defined to 1 if the crypto instructions are supported (implies Armv8-A/R
with Neon).
This symbol is defined according to ACLE (Arm C Language Extensions).
__ARM_FEATURE_DIRECTED_ROUNDING
Description This symbol is defined to 1 if the directed rounding and conversion instructions are
supported.
This symbol is defined according to ACLE (Arm C Language Extensions).
__ARM_FEATURE_DSP
Description This symbol is defined according to ACLE (Arm C Language Extensions).
__ARM_FEATURE_FMA
Description This symbol is defined to 1 if the FPU supports fused floating-point
multiply-accumulate.
This symbol is defined according to ACLE (Arm C Language Extensions).
__ARM_FEATURE_IDIV
Description This symbol is defined according to ACLE (Arm C Language Extensions).
AFE1_AFE2-1:1
The preprocessor
__ARM_FEATURE_NUMERIC_MAXMIN
Description This symbol is defined to 1 if the floating-point maximum and minimum instructions
are supported.
This symbol is defined according to ACLE (Arm C Language Extensions).
__ARM_FEATURE_UNALIGNED
Description This symbol is defined only if the target supports unaligned access, and unaligned
access is allowed. The compiler option --no_unaligned_access can be used to
disallow unaligned access.
This symbol is defined according to ACLE (Arm C Language Extensions).
__ARM_FP
Description This symbol is defined according to ACLE (Arm C Language Extensions).
__ARM_MEDIA__
Description An integer that is set based on the compiler option --cpu. The symbol is set to 1 if the
selected processor architecture has the Armv6 SIMD extensions for multimedia. The
symbol is undefined for other cores.
This preprocessor symbol is equivalent to the ACLE (Arm C Language Extensions)
macro __ARM_FEATURE_SIMD32.
__ARM_NEON
Description This symbol is defined according to ACLE (Arm C Language Extensions).
__ARM_NEON_FP
Description This symbol is defined according to ACLE (Arm C Language Extensions).
461
AFE1_AFE2-1:1
Description of predefined preprocessor symbols
__ARM_PROFILE_M__
Description An integer that is set based on the compiler option --cpu. The symbol is set to 1 if the
selected processor architecture is a profile M core. The symbol is undefined for other
cores.
This preprocessor symbol is related to the ACLE (Arm C Language Extensions) macro
__ARM_ARCH_PROFILE.
__ARMVFP__
Description An integer that reflects the --fpu option and is defined to __ARMVFPV2__,
__ARMVFPV3__, or __ARMVFPV4__. These symbolic names can be used when testing
the __ARMVFP__ symbol. If VFP code generation is disabled (default), the symbol will
be undefined.
__ARMVFP_D16__
Description An integer that is set based on the compiler option --fpu. The symbol is set to 1 if the
selected FPU is a VFPv3 or VFPv4 unit with only 16 D registers. Otherwise, the symbol
is undefined.
__ARMVFP_SP__
Description An integer that is set based on the compiler option --fpu. The symbol is set to 1 if the
selected FPU only supports 32-bit single-precision. Otherwise, the symbol is undefined.
This preprocessor symbol is related to the ACLE (Arm C Language Extensions) macro
__ARM_FP.
AFE1_AFE2-1:1
The preprocessor
__BASE_FILE__
Description A string that identifies the name of the base source file (that is, not the header file), being
compiled.
__BUILD_NUMBER__
Description A unique integer that identifies the build number of the compiler currently in use.
__CORE__
Description An integer that identifies the chip core in use. The value reflects the setting of the --cpu
option and is defined to __ARM4TM__, __ARM5__, __ARM5E__, __ARM6__,
__ARM6M__, __ARM6SM__, __ARM7M__, __ARM7EM__, __ARM7A__, __ARM7R__,
__ARM8A__, __ARM8M_BASELINE__, __ARM8M_MAINLINE__, __ARM8R__, or
__ARM8EM_MAINLINE__. These symbolic names can be used when testing the
__CORE__ symbol.
This preprocessor symbol is related to the ACLE (Arm C Language Extensions) macro
__ARM_ARCH.
__COUNTER__
Description A macro that expands to a new integer each time it is expanded, starting at zero (0) and
counting up.
__cplusplus
Description An integer which is defined when the compiler runs in any of the C++ modes, otherwise
it is undefined. When defined, its value is 201402L. This symbol can be used with
#ifdef to detect whether the compiler accepts C++ code. It is particularly useful when
creating header files that are to be shared by C and C++ code.
This symbol is required by Standard C.
463
AFE1_AFE2-1:1
Description of predefined preprocessor symbols
__CPU_MODE__
Description An integer that reflects the selected CPU mode and is defined to 1 for Thumb and 2 for
Arm.
__DATE__
Description A string that identifies the date of compilation, which is returned in the form "Mmm dd
yyyy", for example, "Oct 30 2018".
__EXCEPTIONS__
Description A symbol that is defined when exceptions are supported in C++.
__FILE__
Description A string that identifies the name of the file being compiled, which can be both the base
source file and any included header file.
This symbol is required by Standard C.
__func__
Description A predefined string identifier that is initialized with the name of the function in which
the symbol is used. This is useful for assertions and other trace utilities. The symbol
requires that language extensions are enabled.
This symbol is required by Standard C.
AFE1_AFE2-1:1
The preprocessor
__FUNCTION__
Description A predefined string identifier that is initialized with the name of the function in which
the symbol is used. This is useful for assertions and other trace utilities. The symbol
requires that language extensions are enabled.
__IAR_SYSTEMS_ICC__
Description An integer that identifies the IAR compiler platform. The current value is 9—the
number could be higher in a future version of the product. This symbol can be tested
with #ifdef to detect whether the code was compiled by a compiler from IAR Systems.
__ICCARM__
Description An integer that is set to 1 when the code is compiled with the IAR C/C++ Compiler for
Arm.
__LINE__
Description An integer that identifies the current source line number of the file being compiled,
which can be both the base source file and any included header file.
This symbol is required by Standard C.
__LITTLE_ENDIAN__
Description An integer that reflects the setting of the compiler option --endian and is defined to 1
when the byte order is little-endian. The symbol is defined to 0 when the byte order is
big-endian.
This preprocessor symbol is related to the ACLE (Arm C Language Extensions) macro
__ARM_BIG_ENDIAN.
__PRETTY_FUNCTION__
Description A predefined string identifier that is initialized with the function name, including
parameter types and return type, of the function in which the symbol is used, for
465
AFE1_AFE2-1:1
Description of predefined preprocessor symbols
example, "void func(char)". This symbol is useful for assertions and other trace
utilities. The symbol requires that language extensions are enabled.
__ROPI__
Description An integer that is defined when the compiler option --ropi is used.
This preprocessor symbol is equivalent to the ACLE (Arm C Language Extensions)
macro __ARM_ROPI.
__RTTI__
Description A symbol that is defined when runtime type information (RTTI) is supported in C++.
__RWPI__
Description An integer that is defined when the compiler option --rwpi is used.
This preprocessor symbol is equivalent to the ACLE (Arm C Language Extensions)
macro __ARM_RWPI.
__STDC__
Description An integer that is set to 1, which means the compiler adheres to Standard C. This symbol
can be tested with #ifdef to detect whether the compiler in use adheres to Standard C.*
This symbol is required by Standard C.
__STDC_LIB_EXT1__
Description An integer that is set to 201112L and that signals that Annex K, Bounds-checking
interfaces, of the C standard is supported.
AFE1_AFE2-1:1
The preprocessor
__STDC_NO_ATOMICS__
Description Set to 1 if the compiler does not support atomic types nor stdatomic.h.
__STDC_NO_THREADS__
Description Set to 1 to indicate that the implementation does not support threads.
__STDC_NO_VLA__
Description Set to 1 to indicate that C variable length arrays, VLAs, are not enabled.
__STDC_UTF16__
Description Set to 1 to indicate that the values of type char16_t are UTF-16 encoded.
__STDC_UTF32__
Description Set to 1 to indicate that the values of type char32_t are UTF-32 encoded.
__STDC_VERSION__
Description An integer that identifies the version of the C standard in use. The symbol expands to
201710L, unless the --c89 compiler option is used, in which case the symbol expands
to 199409L.
This symbol is required by Standard C.
__TIME__
Description A string that identifies the time of compilation in the form "hh:mm:ss".
This symbol is required by Standard C.
467
AFE1_AFE2-1:1
Descriptions of miscellaneous preprocessor extensions
__TIMESTAMP__
Description A string constant that identifies the date and time of the last modification of the current
source file. The format of the string is the same as that used by the asctime standard
function (in other words, "Tue Sep 16 13:03:52 2014").
__VER__
Description An integer that identifies the version number of the IAR compiler in use. For example,
version 5.11.3 is returned as 5011003.
NDEBUG
Description This preprocessor symbol determines whether any assert macros you have written in
your application shall be included or not in the built application.
If this symbol is not defined, all assert macros are evaluated. If the symbol is defined,
all assert macros are excluded from the compilation. In other words, if the symbol is:
● defined, the assert code will not be included
● not defined, the assert code will be included
This means that if you write any assert code and build your application, you should
define this symbol to exclude the assert code from the final application.
Note: The assert macro is defined in the assert.h standard include file.
In the IDE, the NDEBUG symbol is automatically defined if you build your application in
the Release build configuration.
__STDC_WANT_LIB_EXT1__
Description If this symbol is defined to 1 prior to any inclusions of system header files, it will enable
the use of functions from Annex K, Bounds-checking interfaces, of the C standard.
AFE1_AFE2-1:1
The preprocessor
#warning message
Syntax #warning message
Description Use this preprocessor directive to produce messages. Typically, this is useful for
assertions and other trace utilities, similar to the way the Standard C #error directive
is used. This directive is not recognized when the --strict compiler option is used.
469
AFE1_AFE2-1:1
Descriptions of miscellaneous preprocessor extensions
AFE1_AFE2-1:1
C/C++ standard library
functions
● C/C++ standard library overview
For detailed reference information about the library functions, see the online
help system.
HEADER FILES
Your application program gains access to library definitions through header files, which
it incorporates using the #include directive. The definitions are divided into several
different header files, each covering a particular functional area, letting you include just
those that are required.
It is essential to include the appropriate header file before making any reference to its
definitions. Failure to do so can cause the call to fail during execution, or generate error
or warning messages at compile time or link time.
471
AFE1_AFE2-1:1
C/C++ standard library overview
To use any of these more accurate versions, use the --redirect linker option.
REENTRANCY
A function that can be simultaneously invoked in the main application and in any
number of interrupts is reentrant. A library function that uses statically allocated data is
therefore not reentrant.
Most parts of the DLIB runtime environment are reentrant, but the following functions
and parts are not reentrant because they need static data:
● Heap functions—malloc, free, realloc, calloc, etc. and the C++ operators
new and delete
● Locale functions—localeconv, setlocale
● Multibyte functions—mblen, mbrlen, mbrtowc, mbsrtowc, mbtowc, wcrtomb,
wcsrtomb, wctomb
● Rand functions—rand, srand
● Time functions—asctime, localtime, gmtime, mktime
● The miscellaneous functions atexit, perror, strerror, strtok
● Functions that use files or the heap in some way. This includes scanf, sscanf,
getchar, getwchar, putchar, and putwchar. In addition, if you are using the
options --enable_multibyte and --dlib_config=Full, the printf and
sprintf functions (or any variants) can also use the heap.
AFE1_AFE2-1:1
C/C++ standard library functions
Functions that can set errno are not reentrant, because an errno value resulting from
one of these functions can be destroyed by a subsequent use of the function before it is
read. This applies to math and string conversion functions, among others.
Remedies for this are:
● Do not use non-reentrant functions in interrupt service routines
● Guard calls to a non-reentrant function by a mutex, or a secure region, etc.
473
AFE1_AFE2-1:1
DLIB runtime environment—implementation details
C HEADER FILES
This section lists the C header files specific to the DLIB runtime environment. Header
files may additionally contain target-specific definitions, which are documented in the
chapter Using C.
This table lists the C header files:
Header file Usage
assert.h Enforcing assertions when functions execute
complex.h Computing common complex mathematical functions
ctype.h Classifying characters
errno.h Testing error codes reported by library functions
fenv.h Floating-point exception flags
float.h Testing floating-point type properties
inttypes.h Defining formatters for all types defined in stdint.h
iso646.h Alternative spellings
limits.h Testing integer type properties
locale.h Adapting to different cultural conventions
math.h Computing common mathematical functions
setjmp.h Executing non-local goto statements
signal.h Controlling various exceptional conditions
stdalign.h Handling alignment on data objects
stdarg.h Accessing a varying number of arguments
stdatomic.h Adding support for atomic operations.
Atomic operations are available in cores where the instruction set
supports them.
stdbool.h Adds support for the bool data type in C.
stddef.h Defining several useful types and macros
stdint.h Providing integer characteristics
stdio.h Performing input and output
Table 31: Traditional Standard C header files—DLIB
AFE1_AFE2-1:1
C/C++ standard library functions
475
AFE1_AFE2-1:1
DLIB runtime environment—implementation details
AFE1_AFE2-1:1
C/C++ standard library functions
477
AFE1_AFE2-1:1
DLIB runtime environment—implementation details
symbols in the global and std namespace, whereas the latter puts them in the global
namespace only.
This table shows the new header files:
Header file Usage
cassert Enforcing assertions when functions execute
ccomplex Computing common complex mathematical functions
cctype Classifying characters
cerrno Testing error codes reported by library functions
cfenv Floating-point exception flags
cfloat Testing floating-point type properties
cinttypes Defining formatters for all types defined in stdint.h
ciso646 Alternative spellings
climits Testing integer type properties
clocale Adapting to different cultural conventions
cmath Computing common mathematical functions
csetjmp Executing non-local goto statements
csignal Controlling various exceptional conditions
cstdalign Handling alignment on data objects
cstdarg Accessing a varying number of arguments
cstdatomic Adding support for atomic operations
cstdbool Adds support for the bool data type in C.
cstddef Defining several useful types and macros
cstdint Providing integer characteristics
cstdio Performing input and output
cstdlib Performing a variety of operations
cstdnoreturn Adding support for non-returning functions
cstring Manipulating several kinds of strings
ctgmath Type-generic mathematical functions
cthreads Adding support for multiple threads of execution.
This functionality is not supported.
ctime Converting between various time and date formats
cuchar Unicode functionality
cwchar Support for wide characters
Table 33: New Standard C header files—DLIB
AFE1_AFE2-1:1
C/C++ standard library functions
Some library functions will have the same address. This occurs, most notably, when the
library function parameters differ in type but not in size, as for example, cos(double)
and cosl(long double).
The IAR C/C++ compiler does not support threads as described in the C11 and C++14
standards. However, using DLib_Threads.h and an RTOS, you can build an
application with thread support. For more information, see Managing a multithreaded
environment, page 160.
ATOMIC OPERATIONS
When you compile for cores with instruction set support for atomic accesses, the
standard C and C++ atomic operations are available. If atomic operations are not
available, the macro __STDC_NO_ATOMICS__ is defined to 1. This is true both in C and
C++.
Atomic operations that cannot be handled natively by the hardware are passed on to
library functions. The IAR C/C++ Compiler for Arm does not include implementations
for these functions. A template implementation can be found in the file
src\lib\atomic\libatomic.c.
ADDED C FUNCTIONALITY
The DLIB runtime environment includes some added C functionality:
● C bounds-checking interface
● DLib_Threads.h
● iar_dlmalloc.h
● LowLevelIOInterface.h
479
AFE1_AFE2-1:1
DLIB runtime environment—implementation details
● stdio.h
● stdlib.h
● string.h
● time.h
C bounds-checking interface
The C library supports Annex K (Bounds-checking interfaces) of the C standard. It adds
symbols, types, and functions in the header files errno.h, stddef.h, stdint.h,
stdlib.h, string.h, time.h, and wchar.h.
DLib_Threads.h
The DLib_Threads.h header file contains support for locks and thread-local storage
(TLS) variables. This is useful for implementing thread support. For more information,
see the header file.
iar_dlmalloc.h
The iar_dlmalloc.h header file contains support for the advanced (dlmalloc) heap
handler. For more information, see Heap considerations, page 207.
LowLevelIOInterface.h
The header file LowLevelInterface.h contains declarations for the low-level I/O
functions used by DLIB. See The DLIB low-level I/O interface, page 149.
stdio.h
These functions provide additional I/O functionality:
AFE1_AFE2-1:1
C/C++ standard library functions
string.h
These are the additional functions defined in string.h:
time.h
There are two interfaces for using time_t and the associated functions time, ctime,
difftime, gmtime, localtime, and mktime:
● The 32-bit interface supports years from 1900 up to 2035 and uses a 32-bit integer
for time_t. The type and function have names like __time32_t, __time32, etc.
This variant is mainly available for backwards compatibility.
● The 64-bit interface supports years from -9999 up to 9999 and uses a signed
long long for time_t. The type and function have names like __time64_t,
__time64, etc.
481
AFE1_AFE2-1:1
DLIB runtime environment—implementation details
An application can use either interface, and even mix them by explicitly using the 32 or
64-bit variants.
See also __time32, __time64, page 157.
clock_t is represented by a 32-bit integer type.
By default, the time library does not support the timezone and daylight saving time
functionality. To enable that functionality, use the linker option --timezone_lib. See
--timezone_lib, page 344.
There are two functions that can be used for loading or force-loading the timezone and
daylight saving time information from __getzone:
● int _ReloadDstRules (void)
● int _ForceReloadDstRules (void)
Both these functions return 0 for DST rules found and -1 for DST rules not found.
NON-STANDARD IMPLEMENTATIONS
These functions do not work as specified by the C standard:
● fopen_s and freopen
These functions will not propagate the u exclusivity attribute to the low-level
interface.
● towupper and towlower
These functions will only handle A, ..., Z and a, ..., z.
● iswalnum, ..., iswxdigit
These functions will only handle arguments in the range 0 to 127.
● The collate functions strcoll and strxfrm will not work as intended. The same
applies to the C++ equivalent functionality.
Use the compiler option --predef_macros to determine the value for any predefined
symbols.
The symbols used internally by the library are not listed in this guide.
AFE1_AFE2-1:1
The linker configuration
file
● Overview
● Regions
● Section handling
● Section selection
● Structural configuration
Before you read this chapter you must be familiar with the concept of sections,
see Modules and sections, page 90.
Overview
To link and locate an application in memory according to your requirements, ILINK
needs information about how to handle sections and how to place them into the available
memory regions. In other words, ILINK needs a configuration, passed to it by means of
the linker configuration file.
This file consists of a sequence of directives and typically, provides facilities for:
● Defining available addressable memories
giving the linker information about the maximum size of possible addresses and
defining the available physical memory, as well as dealing with memories that can be
addressed in different ways.
● Defining the regions of the available memories that are populated with ROM or
RAM
giving the start and end address for each region.
483
AFE1_AFE2-1:1
Defining memories and regions
● Section groups
dealing with how to group sections into blocks and overlays depending on the section
requirements.
● Defining how to handle initialization of the application
giving information about which sections that are to be initialized, and how that
initialization should be made.
● Memory allocation
defining where—in what memory region—each set of sections should be placed.
● Using symbols, expressions, and numbers
expressing addresses and sizes, etc, in the other configuration directives. The
symbols can also be used in the application itself.
● Structural configuration
meaning that you can include or exclude directives depending on a condition, and to
split the configuration file into several different files.
● Special characters in names
When specifying the name of a symbol or section that uses non-identifier characters,
you can enclose the name in back quotes. Example: ‘My Name‘.
Comments can be written either as C comments (/*...*/) or as C++ comments
(//...).
AFE1_AFE2-1:1
The linker configuration file
Parameters
size_expr Specifies how many units the memory space
contains—always counted from address zero.
bitsize_expr Specifies how many bits each unit contains.
bytesize_expr Specifies how many bytes each unit contains. Each
byte contains 8 bits.
Description The define memory directive defines a memory space with a given size, which is the
maximum possible amount of addressable memory, not necessarily physically available.
This sets the limits for the possible addresses to be used in the linker configuration file.
For many microcontrollers, one memory space is sufficient. However, some
microcontrollers require two or more. For example, a Harvard architecture usually
requires two different memory spaces, one for code and one for data. If only one
memory is defined, the memory name is optional. If no unit-size is given, the unit
contains 8 bits.
Parameters
name The name of the region.
Description The define region directive defines a region in which specific sections of code and
sections of data can be placed. A region consists of one or several memory ranges, where
each memory range consists of a continuous sequence of bytes in a specific memory.
485
AFE1_AFE2-1:1
Defining memories and regions
Several ranges can be combined by using region expressions—these ranges do not need
to be consecutive or even in the same memory.
logical directive
Syntax logical range-list = physical range-list
Parameters
region-expr A region expression, see also Regions, page 487.
address-expr An address expression
Description The logical directive maps logical addresses to physical addresses. The physical
address is typically used when loading or burning content into memory, while the logical
address is the one seen by your application. The physical address is the same as the
logical address, if no logical directives are used, or if the address is in a range
specified in a logical directive.
When generating ELF output, the mapping affects the physical address in program
headers. When generating output in the Intel hex or Motorola S-records formats, the
physical address is used.
Each address in the logical range list, in the order specified, is mapped to the
corresponding address in the physical range list, in the order specified.
Unless one or both of the range lists end with the from form, the total size of the logical
ranges and the physical ranges must be the same. If one side ends with the from form
and not the other, the side that ends with the from form will include a final range of a
size that makes the total sizes match, if possible. If both sides end with a from form, the
ranges will extend to the highest possible address that makes the total sizes match.
Setting up a mapping from logical to physical addresses can affect how sections and
other content are placed. No content will be placed to overlap more than one individual
logical or physical range. Also, if there is a mapping from a different logical range to the
corresponding physical range, any logical range for which no mapping to physical
ranges has been specified—by not being mentioned in a logical directive—is
excluded from placement.
AFE1_AFE2-1:1
The linker configuration file
All logical directives are applied together. Using one or using several directives to
specify the same mapping makes no difference to the result.
Regions
A region is s a set of non-overlapping memory ranges. A region expression is built up
out of region literals and set operations (union, intersection, and difference) on regions.
487
AFE1_AFE2-1:1
Regions
Region literal
Syntax [ memory-name: ][from expr { to expr | size expr }
Parameters
memory-name The name of the memory space in which the region literal
will be located. If there is only one memory, the name is
optional.
from expr expr is the start address of the memory range (inclusive).
repeat expr expr defines several ranges in the same memory for the
region literal.
displacement expr expr is the displacement from the previous range start in the
repeat sequence. Default displacement is the same value as
the range size.
Description A region literal consists of one memory range. When you define a range, the memory it
resides in, a start address, and a size must be specified. The range size can be stated
explicitly by specifying a size, or implicitly by specifying the final address of the range.
The final address is included in the range and a zero-sized range will only contain an
address. A range can span over the address zero and such a range can even be expressed
by unsigned values, because it is known where the memory wraps.
The repeat parameter will create a region literal that contains several ranges, one for
each repeat. This is useful for banked or far regions.
AFE1_AFE2-1:1
The linker configuration file
Example /* The 5-byte size range spans over the address zero */
Mem:[from -2 to 2]
See also define region directive, page 485, and Region expression, page 489.
Region expression
Syntax region-operand
| region-expr | region-operand
| region-expr - region-operand
| region-expr & region-operand
Description Normally, a region consists of one memory range, which means a region literal is
sufficient to express it. When a region contains several ranges, possibly in different
memories, it is instead necessary to use a region expression to express it. Region
expressions are actually set expressions on sets of memory ranges.
489
AFE1_AFE2-1:1
Regions
To create region expressions, three operators are available: union (|), intersection (&),
and difference (-). These operators work as in set theory. For example, if you have the
sets A and B, then the result of the operators would be:
● A | B: all elements in either set A or set B
● A & B: all elements in both set A and B
● A - B: all elements in set A but not in B.
Empty region
Syntax [ ]
Description The empty region does not contain any memory ranges. If the empty region is used in a
placement directive that actually is used for placing one or more sections, ILINK will
issue an error.
AFE1_AFE2-1:1
The linker configuration file
Section handling
Section handling describes how ILINK should handle the sections of the execution
image, which means:
● Placing sections in regions
The place at and place in directives place sets of sections with similar attributes
into previously defined regions. See place at directive, page 502 and place in
directive, page 503.
● Making sets of sections with special requirements
The block directive makes it possible to create empty sections with specific or
expanding sizes, specific alignments, sequentially sorted sections of different types,
etc.
The overlay directive makes it possible to create an area of memory that can
contain several overlay images. See define block directive, page 492, and define
overlay directive, page 497.
● Initializing the application
The directives initialize and do not initialize control how the application
should be started. With these directives, the application can initialize global symbols
at startup, and copy pieces of code. The initializers can be stored in several ways, for
example, they can be compressed. See initialize directive, page 498 and do not
initialize directive, page 501.
● Keeping removed sections
The keep directive retains sections even though they are not referred to by the rest
of the application, which means it is equivalent to the root concept in the assembler
and compiler. See keep directive, page 501.
● Specifying the contents of linker-generated sections
The define section directive can be used for creating specific sections with
content and calculations that are only available at link time.
● Additional more specialized directives:
use init table directive
This section gives detailed information about each linker directive specific to section
handling.
491
AFE1_AFE2-1:1
Section handling
and where the rest of the directive selects sections to include in the block, see Section
selection, page 505.
Parameters
name The name of the block to be defined.
size Customizes the size of the block. By default, the size of a
block is the sum of its parts dependent of its contents.
minimum size Specifies a lower limit for the size of the block. The block is
at least this large, even if its contents would otherwise not
require it.
maximum size Specifies an upper limit for the size of the block. An error is
generated if the sections in the block do not fit.
expanding size The block will expand to use all available space in the
memory range where it is placed.
alignment Specifies a minimum alignment for the block. If any section
in the block has a higher alignment than the minimum
alignment, the block will have that alignment.
fixed order Places sections in the specified order. Each
extended-selector is added in a separate nested block,
and these blocks are kept in the specified order.
AFE1_AFE2-1:1
The linker configuration file
Description The block directive defines a contiguous area of memory that contains a possibly
empty set of sections or other blocks. Blocks with no content are useful for allocating
space for stacks or heaps. Blocks with content are usually used to group together
sections that must to be consecutive.
You can access the start, end, and size of a block from an application by using the
__section_begin, __section_end, or __section_size operators. If there is no
block with the specified name, but there are sections with that name, a block will be
created by the linker, containing all such sections.
movable blocks are for use with read-only and read-write position independence.
Making blocks movable enables the linker to validate the application’s use of addresses.
Movable blocks are located in exactly the same way as other blocks, but the linker will
check that the appropriate relocations are used when referring to symbols in movable
blocks.
Blocks with expanding size are most often used for heaps or stacks.
Note: You cannot place a block with expanding size inside another block with
expanding size, inside a block with a maximum size, or inside an overlay.
Example /* Create a block with a minimum size for the heap that will use
all remaining space in its memory range */
define block HEAP with minimum size = 4K, expanding size,
alignment = 8 { };
See also Interaction between the tools and your application, page 209. For an accessing example,
see define overlay directive, page 497.
493
AFE1_AFE2-1:1
Section handling
Parameters
name The name of the section.
sec-align The alignment of the section, an expression.
root Optional. If root is specified, the section is always
included, even if it is not referenced.
AFE1_AFE2-1:1
The linker configuration file
495
AFE1_AFE2-1:1
Section handling
[public] label: Defines a label at the current offset from the start of the
section. If public is specified, the label is visible to
other program modules. If not, it is only visible to other
data expressions in the linker configuration file.
if-item Configuration-time selection of items.
condition An expression.
data An expression that is only evaluated during relocation
and only if the value is needed.
Description Use the define section directive to create sections with content that is not available
from assembler language or C/C++. Examples of this are the results of stack usage
analysis, the size of blocks, and arithmetic operations that do not exist as relocations.
Unknown identifiers in data expressions are assumed to be labels.
Note: Only data expressions can use labels, stack usage analysis results, etc. All the
other expressions are evaluated immediately when the configuration file is read.
AFE1_AFE2-1:1
The linker configuration file
For information about extended selectors and except clauses, see Section selection, page
505.
Parameters
name The name of the overlay.
size Customizes the size of the overlay. By default, the size of a
overlay is the sum of its parts dependent of its contents.
maximum size Specifies an upper limit for the size of the overlay. An error
is generated if the sections in the overlay do not fit.
alignment Specifies a minimum alignment for the overlay. If any
section in the overlay has a higher alignment than the
minimum alignment, the overlay will have that alignment.
fixed order Places sections in fixed order—if not specified, the order of
the sections will be arbitrary.
Description The overlay directive defines a named set of sections. In contrast to the block
directive, the overlay directive can define the same name several times. Each definition
will then be grouped in memory at the same place as all other definitions of the same
name. This creates an overlaid memory area, which can be useful for an application that
has several independent sub-applications.
Place each sub-application image in ROM and reserve a RAM overlay area that can hold
all sub-applications. To execute a sub-application, first copy it from ROM to the RAM
overlay.
Note: ILINK does not help you with managing interdependent overlay definitions, apart
from generating a diagnostic message for any reference from one overlay to another
overlay.
The size of an overlay will be the same size as the largest definition of that overlay name
and the alignment requirements will be the same as for the definition with the highest
alignment requirements.
497
AFE1_AFE2-1:1
Section handling
Note: Sections that were overlaid must be split into a RAM and a ROM part and you
must take care of all the copying needed.
Code in overlaid memory areas cannot be debugged; the C-SPY Debugger cannot
determine which code is currently loaded.
initialize directive
Syntax initialize { by copy | manually }
[ with param, param... ]
{
section-selectors
}
[ except
{
section-selectors
} ];
For information about section selectors and except clauses, see Section selection, page
505.
Parameters
by copy Splits the section into sections for initializers and initialized
data, and handles the initialization at application startup
automatically.
manually Splits the section into sections for initializers and initialized
data. The initialization at application startup is not handled
automatically.
AFE1_AFE2-1:1
The linker configuration file
Description The initialize directive splits each selected section into one section that holds
initializer data and another section that holds the space for the initialized data. The
section that holds the space for the initialized data retains the original section name, and
the section that holds initializer data gets the name suffix _init. You can choose
whether the initialization at startup should be handled automatically (initialize by
copy) or whether you should handle it yourself (initialize manually).
When you use the packing method auto (default for initialize by copy), ILINK
will automatically choose an appropriate packing algorithm for the initializers. To
override this, specify a different packing method. The --log initialization
option shows how ILINK decided which packing algorithm to use.
When initializers are compressed, a decompressor is automatically added to the image.
Each decompressor has two variants: one that can only handle a single source and
destination range at a time, and one that can handle more complex cases. By default, the
linker chooses a decompressor variant based on whether the associated section
placement directives specify a single or multi-range memory region. In general, this is
the desired behavior, but you can use the with complex ranges or the with simple
ranges modifier on an initialize directive to specify which decompressor variant
to use. You can also use the command line option --default_to_complex_ranges
to make initialize directives by default use complex ranges. The simple ranges
decompressors are normally hundreds of bytes smaller than the complex ranges
variants.
499
AFE1_AFE2-1:1
Section handling
When initializers are compressed, the exact size of the compressed initializers is
unknown until the exact content of the uncompressed data is known. If this data contains
other addresses, and some of these addresses are dependent on the size of the
compressed initializers, the linker fails with error Lp017. To avoid this, place
compressed initializers last, or in a memory region together with sections whose
addresses do not need to be known.
Due to an internal dependence, generation of compressed initializers can also fail (with
error LP021) if the address of the initialized area depends on the size of its initializers.
To avoid this, place the initializers and the initialized area in different parts of the
memory (for example, the initializers are placed in ROM and the initialized area in
RAM).
If you specify the parameter no exclusions, an error is emitted if any sections are
excluded (because they are needed for the initialization). no exclusions can only be
used with initialize by copy (automatic initialization), not with initialize
manually.
Unless initialize manually is used, ILINK will arrange for initialization to occur
during system startup by including an initialization table. Startup code calls an
initialization routine that reads this table and performs the necessary initializations.
Zero-initialized sections are not affected by the initialize directive.
The initialize directive is normally used for initialized variables, but can be used for
copying any sections, for example, copying executable code from slow ROM to fast
RAM, or for overlays. For another example, see define overlay directive, page 497.
Sections that are needed for initialization are not affected by the initialize by copy
directive. This includes the __low_level_init function and anything it references.
Anything reachable from the program entry label is considered needed for initialization
unless reached via a section fragment with a label starting with __iar_init$$done.
The --log sections option, in addition to logging the marking of section fragments
to be included in the application, also logs the process of determining which sections are
needed for initialization.
See also Initialization at system startup, page 96, and do not initialize directive, page 501.
AFE1_AFE2-1:1
The linker configuration file
For information about section selectors and except clauses, see Section selection, page
505.
Description Use the do not initialize directive to specify the sections that you do not want to be
automatically zero-initialized by the system startup code. The directive can only be used
on zeroinit sections.
Typically, this is useful if you want to handle zero-initialization in some other way for
all or some zeroinit sections.
This can also be useful if you want to suppress zero-initialization of variables entirely.
Normally, this is handled automatically for variables specified as __no_init in the
source, but if you link with object files produced by older tools from IAR Systems or
other tool vendors, you might need to suppress zero-initialization specifically for some
sections.
See also Initialization at system startup, page 96, and initialize directive, page 498.
keep directive
Syntax keep
{
[ { section-selectors | block name }
[ , {section-selectors | block name }... ] ]
}
[ except
{
section-selectors
} ];
501
AFE1_AFE2-1:1
Section handling
For information about selectors and except clauses, see Section selection, page 505.
Description The keep directive can be used for including blocks, overlays, or sections in the
executable image that would otherwise be discarded because no references to them exist
in the included parts of the application. Note that only sections from included modules
are considered for inclusion.
The keep directive does not cause any additional modules to be included in the
application. To cause modules that define the specified symbols to be included, use the
Keep symbols linker option (or the --keep command line option).
place at directive
Syntax [ "name": ]
place [ noload ] at { address [ memory: ] address |
start of region_expr [ with mirroring to mirror_address ] |
end of region_expr [ with mirroring to mirror_address ] }
{
extended-selectors
}
[ except
{
section-selectors
} ];
For information about extended selectors and except clauses, see Section selection, page
505.
Parameters
name Optional. If it is specified, it is used in the map file, in
some log messages, and is part of the name of any ELF
output sections resulting from the directive.
noload Optional. If it is specified, it prevents the sections in the
directive from being loaded to the target system. To use
the sections, you must put them into the target system in
some other way. noload can only be used when a name
is specified.
AFE1_AFE2-1:1
The linker configuration file
Description The place at directive places sections and blocks either at a specific address or, at the
beginning or the end of a region. The same address cannot be used for two different
place at directives. It is also not possible to use an empty region in a place at
directive. If placed in a region, the sections and blocks will be placed before any other
sections or blocks placed in the same region with a place in directive.
Note: with mirroring to can be used only together with start of and end of.
place in directive
Syntax [ "name": ]
place [ noload ] in region-expr
[ with mirroring to mirror_address ]
{
extended-selectors
}
[ except{
section-selectors
} ];
503
AFE1_AFE2-1:1
Section handling
Parameters
name Optional. If it is specified, it is used in the map file, in
some log messages, and is part of the name of any ELF
output sections resulting from the directive.
noload Optional. If it is specified, it prevents the sections in the
directive from being loaded to the target system. To use
the sections, you must put them into the target system in
some other way. noload can only be used when a name
is specified.
mirror_address If with mirroring to is specified, the contents of any
sections are assumed to be mirrored to this address,
therefore debug information and symbols will appear in
the mirrored range, but the actual content bytes are placed
as if with mirroring to was not specified.
Note: This functionality is intended to support external
(target-specific) mirroring.
Description The place in directive places sections and blocks in a specific region. The sections and
blocks will be placed in the region in an arbitrary order.
To specify a specific order, use the block directive. The region can have several ranges.
Note: When with mirroring to is specified, the region-expr must result in a
single range.
AFE1_AFE2-1:1
The linker configuration file
For information about section selectors and except clauses, see Section selection, page
505.
Parameters
name The name of the init table.
Description Normally, all initialization entries are generated into a single initialization table (called
Table). Use this directive to cause some of the entries to be put into a separate table.
You can then use this initialization table at another time, or under different
circumstances, than the normal initialization table.
Initialization entries for all variables not mentioned in a use init table directive are
put into the normal initialization table. By having multiple use init table directives
you can have multiple initialization tables.
The start, end, and size of the init table can be accessed in the application program by
using __section_begin, __section_end, or __section_size of
"Region$$name", respectively, or via the symbols Region$$name$$Base,
Region$$name$$Limit, and Region$$name$$Length.
Section selection
The purpose of section selection is to specify—by means of section selectors and except
clauses—the sections that an ILINK directive should be applied to. All sections that
match one or more of the section selectors will be selected, and none of the sections
selectors in the except clause, if any. Each section selector can match sections on section
attributes, section name, and object or library name.
505
AFE1_AFE2-1:1
Section selection
Some directives provide functionality that requires more detailed selection capabilities,
for example, directives that can be applied on both sections and blocks. In this case, the
extended-selectors are used.
This section gives detailed information about each linker directive specific to section
selection.
section-selectors
Syntax [ section-selector [ , section-selector... ] ]
section-selector is:
[ section-attribute ][ section-type ]
[ symbol symbol-name ][ section section-name ]
[ object module-spec ]
section-attribute is:
section-type is:
[ preinit_array | init_array ]
Parameters
section-attribute Only sections with the specified attribute will be selected.
section-attribute can consist of:
AFE1_AFE2-1:1
The linker configuration file
section-type Only sections with that ELF section type will be selected.
section-type can be:
symbol symbol-name Only sections that define at least one public symbol that
matches the symbol name pattern will be selected.
symbol-name is the symbol name pattern. Two wildcards
are allowed:
? matches any single character.
* matches zero or more characters.
object module-spec Only sections that originate from library modules or object
files that matches module-spec will be selected.
module-spec can be in one of two forms:
Description A section selector selects all sections that match the section attribute, section type,
symbol name, section name, and the name of the module. Up to four of the five
conditions can be omitted.
507
AFE1_AFE2-1:1
Section selection
It is also possible to use only { } without any section selectors, which can be useful
when defining blocks.
Note: A section selector with narrower scope has higher priority than a more generic
section selector. If more than one section selector matches for the same purpose, one of
them must be more specific. A section selector is more specific than another one if in
priority order:
● It specifies a symbol name with no wildcards and the other one does not.
● It specifies a section name or object name with no wildcards and the other one does
not
● It specifies a section type and the other one does not
● There could be sections that match the other selector that also match this one,
however, the reverse is not true.
Assuming a section in an object named foo.o in a library named lib.a, any of these
selectors will select that section:
object foo.o(lib.a)
object f*(lib*)
object foo.o
object lib.a
See also initialize directive, page 498, do not initialize directive, page 501, and keep directive,
page 501.
AFE1_AFE2-1:1
The linker configuration file
extended-selectors
Syntax [ extended-selector [ , extended-selector...]]
Parameters
first Places the selected sections, block, or overlay first in the
containing placement directive, block, or overlay.
last Places the selected sections, block or overlay last in the
containing placement directive, block, or overlay.
midway Places the selected sections, block, or overlay so that they are
no further than half the maximum size of the containing
block away from either edge of the block. Note that this
parameter can only be used inside a block that has a
maximum size.
name The name of the block or overlay.
509
AFE1_AFE2-1:1
Using symbols, expressions, and numbers
You can also define the block First inline, instead of in a separate define block
directive:
define block Table { first block First { ro section .f* },
ro section .b* };
See also define block directive, page 492, define overlay directive, page 497, and place at
directive, page 502.
Parameters
expression A boolean expression.
AFE1_AFE2-1:1
The linker configuration file
Description You can use the check that directive to compare the results of stack usage analysis
against the sizes of blocks and regions. If the expression evaluates to zero, an error is
emitted.
Three extra operators are available for use only in check that expressions:
maxstack(category) The stack depth of the deepest call chain for any call
graph root function in the category.
totalstack(category) The sum of the stack depths of the deepest call chains
for each call graph root function in the category.
size(block) The size of the block.
Parameters
exported Exports the symbol to be usable by the executable
image.
name The name of the symbol.
expr The symbol value.
Description The define symbol directive defines a symbol with a specified value. The symbol can
then be used in expressions in the configuration file. The symbols defined in this way
work exactly like the symbols defined with the option --config_def outside of the
configuration file.
The define exported symbol variant of this directive is a shortcut for using the
directive define symbol in combination with the export symbol directive. On the
command line this would require both a --config_def option and a
--define_symbol option to achieve the same effect.
Note:
● A symbol cannot be redefined
511
AFE1_AFE2-1:1
Using symbols, expressions, and numbers
● Symbols that are either prefixed by _X, where X is a capital letter, or that contain __
(double underscore) are reserved for toolset vendors.
See also export directive, page 512 and Interaction between ILINK and the application, page
116.
export directive
Syntax export symbol name;
Parameters
name The name of the symbol.
Description The export directive defines a symbol to be exported, so that it can be used both from
the executable image and from a global label. The application, or the debugger, can then
refer to it for setup purposes etc.
expressions
Syntax An expression is built up of the following constituents:
expression binop expression
unop expression
expression ? expression : expression
(expression)
number
symbol
func-operator
AFE1_AFE2-1:1
The linker configuration file
where symbol is a defined symbol, see define symbol directive, page 511 and
--config_def, page 317
and where func-operator is one of these function-like operators:
where expr is an expression, and r is a region expression, see Region expression, page
489.
Description In the linker configuration file, an expression is a 65-bit value with the range -2^64 to
2^64. The expression syntax closely follows C syntax with some minor exceptions.
There are no assignments, casts, pre or post-operations, and no address operations (*, &,
[], ->, and .). Some operations that extract a value from a region expression, etc, use a
syntax resembling that of a function call. A boolean expression returns 0 (False) or 1
(True).
numbers
Syntax nr [nr-suffix]
Description A number can be expressed either by normal C means or by suffixing it with a set of
useful suffixes, which provides a compact way of specifying numbers.
513
AFE1_AFE2-1:1
Structural configuration
Structural configuration
The structural directives provide means for creating structure within the configuration,
such as:
● Conditional inclusion
An if directive includes or excludes other directives depending on a condition,
which makes it possible to have directives for several different memory
configurations in the same file. See if directive, page 514.
● Dividing the linker configuration file into several different files
The include directive makes it possible to divide the configuration file into several
logically distinct files. See include directive, page 515.
● Signaling an error for unsupported cases
This section gives detailed information about each linker directive specific to structural
configuration.
error directive
Syntax error string
Parameters
string The error message.
Description An error directive can be used for signaling an error if the directive occurs in the active
part of a conditional directive.
if directive
Syntax if (expr) {
directives
[ } else if (expr) {
directives ]
[ } else {
directives ]
}
AFE1_AFE2-1:1
The linker configuration file
Parameters
directives Any ILINK directive.
include directive
Syntax include "filename";
Parameters
filename A path where both / and \ can be used as the directory
delimiter.
Description The include directive makes it possible to divide the configuration file into several
logically distinct parts, each in a separate file. For instance, there might be parts that you
need to change often and parts that you seldom edit.
Normally, the linker searches for configuration include files in the system configuration
directory. You can use the --config_search linker option to add more directories to
search.
515
AFE1_AFE2-1:1
Structural configuration
AFE1_AFE2-1:1
Section reference
● Summary of sections and blocks
For more information, see the chapter Modules and sections, page 90.
517
AFE1_AFE2-1:1
Descriptions of sections and blocks
In addition to the ELF sections used for your application, the tools use a number of other
ELF sections for a variety of purposes:
● Sections starting with .debug generally contain debug information in the DWARF
format
● Sections starting with .iar.debug contain supplemental debug information in an
IAR format
● The section .comment contains the tools and command lines used for building the
file
● Sections starting with .rel or .rela contain ELF relocation information
● The section .symtab contains the symbol table for a file
● The section .strtab contains the names of the symbol in the symbol table
● The section .shstrtab contains the names of the sections.
.bss
Description Holds zero-initialized static and global variables.
CSTACK
Description Block that holds the internal data stack.
AFE1_AFE2-1:1
Section reference
.data
Description Holds static and global initialized variables. In object files, this includes the initial
values. When the linker directive initialize is used, a corresponding .data_init
section is created for each .data section, holding the possibly compressed initial
values.
.data_init
Description Holds the possibly compressed initial values for .data sections. This section is created
by the linker if the initialize linker directive is used.
.exc.text
Description Holds code that is only executed when your application handles an exception.
HEAP
Description Holds the heap used for dynamically allocated data in memory, in other words data
allocated by malloc and free, and in C++, new and delete.
__iar_tls.$$DATA
Description Holds initial values for TLS variables. This section is created by the linker if the linker
option --threaded_lib is used.
519
AFE1_AFE2-1:1
Descriptions of sections and blocks
.iar.dynexit
Description Holds the table of calls to be made at exit.
.init_array
Description Holds pointers to routines to call for initializing one or more C++ objects with static
storage duration.
.intvec
Description Holds the reset vector table and exception vectors which contain branch instructions to
cstartup, interrupt service routines etc.
Memory placement The placement of this section is device-dependent. See the manufacturer’s hardware
manual.
IRQ_STACK
Description Holds the stack which is used when servicing IRQ exceptions. Other stacks may be
added as needed for servicing other exception types: FIQ, SVC, ABT, and UND. The
cstartup.s file must be modified to initialize the exception stack pointers used.
.noinit
Description Holds static and global __no_init variables.
AFE1_AFE2-1:1
Section reference
.preinit_array
Description Like .init_array, but is used by the library to make some C++ initializations happen
before the others.
.prepreinit_array
Description Like .init_array, but is used when C static initialization is rewritten as dynamic
initialization. Performed before all C++ dynamic initialization.
.rodata
Description Holds constant data. This can include constant variables, string and aggregate literals,
etc.
.text
Description Holds program code, including the code for system initialization.
.textrw
Description Holds __ramfunc declared program code.
521
AFE1_AFE2-1:1
Descriptions of sections and blocks
.textrw_init
Description Holds initializers for the .textrw declared sections.
Veneer$$CMSE
Description This section contains secure gateway veneers created automatically by the linker for
each entry function, as determined by the extended keyword
__cmse_nonsecure_entry.
Memory placement This section should be placed in an NSC (non-secure callable) memory region. NSC
regions can be programmed using an SAU (security attribution unit) or an IDAU
(implementation-defined attribute unit). For information about how to program the SAU
or IDAU, see the documentation for your Armv8-M core.
See also Arm TrustZone®, page 222, --cmse, page 269, __cmse_nonsecure_entry, page 371, and
--import_cmse_lib_out, page 329
AFE1_AFE2-1:1
The stack usage control file
● Overview
● Syntactic components
Before you read this chapter, see Stack usage analysis, page 98.
Overview
A stack usage control file consists of a sequence of directives that control stack usage
analysis. You can use C ("/*...*/") and C++ ("//...") comments in these files.
The default filename extension for stack usage control files is suc.
C++ NAMES
When you specify the name of a C++ function in a stack usage control file, you must
use the name exactly as used by the linker. Both the number and names of parameters,
as well as the names of types must match. However, most non-significant white-space
differences are accepted. In particular, you must enclose the name in quote marks
because all C++ function names include non-identifier characters.
You can also use wildcards in function names. "#*" matches any sequence of characters,
and "#?" matches a single character. This makes it possible to write function names that
will match any instantiation of a template function.
Examples:
"operator new(unsigned int)"
"std::ostream::flush()"
"operator <<(std::ostream &, char const *)"
"void _Sort<#*>(#*, #*, #*)"
523
AFE1_AFE2-1:1
Stack usage control directives
Parameters
category See category, page 527
func-spec See func-spec, page 527
Description Specifies that the listed functions are call graph roots. You can optionally specify a call
graph root category. Call graph roots are listed under their category in the Stack Usage
chapter in the linker map file.
The linker will normally issue a warning for functions needed in the application that are
not call graph roots and which do not appear to be called.
exclude directive
Syntax exclude func-spec [, func-spec... ];
Parameters
func-spec See func-spec, page 527
Description Excludes the specified functions, and call trees originating with them, from stack usage
calculations.
function directive
Syntax [ override ] function [ category ] func-spec : stack-size
[ , call-info... ];
Parameters
category See category, page 527
func-spec See func-spec, page 527
call-info See call-info, page 528
AFE1_AFE2-1:1
The stack usage control file
Description Specifies what the maximum stack usage is in a function and which other functions that
are called from that function.
Normally, an error is issued if there already is stack usage information for the function,
but if you start with override, the error will be suppressed and the information
supplied in the directive will be used instead of the previous information.
Parameters
func-spec See func-spec, page 527
size See size, page 529
Description Specifies the maximum number of iterations through any of the cycles in the recursion
nest of which the function is a member.
A recursion nest is a set of cycles in the call graph where each cycle shares at least one
node with another cycle in the nest.
Stack usage analysis will base its result on the max recursion depth multiplied by the
stack usage of the deepest cycle in the nest. If the nest is not entered on a point along
one of the deepest cycles, no stack usage result will be calculated for such calls.
Parameters
func-spec See func-spec, page 527
525
AFE1_AFE2-1:1
Syntactic components
Description When you provide stack usage information for some functions in a module without
stack usage information, the linker warns about functions that are referenced from the
module but not listed as called. This is primarily to help avoid problems with C runtime
routines, calls to which are generated by the compiler, beyond user control.
If there actually is no call to some of these functions, use the no calls from directive
to selectively suppress the warning for the specified functions. You can also disable the
warning entirely (--diag_suppress or
Project>Options>Linker>Diagnostics>Suppress these diagnostics).
Parameters
calling-func See func-spec, page 527
called-func See func-spec, page 527
Description Specifies an exhaustive list of possible destinations for all indirect calls in one function.
Use this for functions which are known to perform indirect calls and where you know
exactly which functions that might be called in this particular application. Consider
using the #pragma calls directive if the information about which functions that might
be called is available when compiling.
When the function does not perform any calls, the list is empty:
possible calls MyFunc8: ;
Syntactic components
This section describes the syntactical components that can be used by the stack usage
control directives.
AFE1_AFE2-1:1
The stack usage control file
category
Syntax [ name ]
Description A call graph root category. You can use any name you like. Categories are not
case-sensitive.
func-spec
Syntax [ ? ] name [ module-spec ]
Description Specifies the name of a symbol, and for module-local symbols, the name of the module
it is defined in. Normally, if func-spec does not match a symbol in the program, a
warning is emitted. Prefixing with ? suppresses this warning.
module-spec
Syntax [name [ (name) ]]
Description Specifies the name of a module, and optionally, in parentheses, the name of the library
it belongs to. To distinguish between modules with the same name, you can specify:
● The complete path of the file ("D:\C1\test\file.o")
● As many path elements as are needed at the end of the path ("test\file.o")
● Some path elements at the start of the path, followed by "...", followed by some
path elements at the end ("D:\...\file.o").
Note: When using multi-file compilation (--mfc), multiple files are compiled into a
single module, named after the first file.
527
AFE1_AFE2-1:1
Syntactic components
[file.o]
[file.o(lib.a)]
["D:\C1\test\file.o"]
name
Description A name can be either an identifier or a quoted string.
The first character of an identifier must be either a letter or one of the characters "_",
"$", or ".". The rest of the characters can also be digits.
A quoted string starts and ends with " and can contain any character. Two consecutive
" characters can be used inside a quoted string to represent a single ".
call-info
Syntax calls func-spec [ , func-spec... ][ : stack-size ]
Description Specifies one or more called functions, and optionally, the stack size at the calls.
stack-size
Syntax [ stack ] size
([ stack ] size)
Description Specifies the size of a stack frame. A stack may not be specified more than once.
24
stack 28
AFE1_AFE2-1:1
The stack usage control file
size
Description A decimal integer, or 0x followed by a hexadecimal integer. Either alternative can
optionally be followed by a suffix indicating a power of two (K=210, M=220, G=230,
T=240, P=250).
529
AFE1_AFE2-1:1
Syntactic components
AFE1_AFE2-1:1
IAR utilities
● The IAR Archive Tool—iarchive—creates and manipulates a library (an
archive) of several ELF object files
531
AFE1_AFE2-1:1
The IAR Archive Tool—iarchive
INVOCATION SYNTAX
The invocation syntax for the archive builder is:
iarchive parameters
Parameters
The parameters are:
Parameter Description
command Command line options that define an operation to be performed.
Such an option must be specified before the name of the library file.
libraryfile The library file to be operated on.
objectfile1 ... The object file(s) that the specified command operates on.
objectfileN
options Command line options that define actions to be performed. These
options can be placed anywhere on the command line.
Table 36: iarchive parameters
Examples
This example creates a library file called mylibrary.a from the source object files
module1.o, module.2.o, and module3.o:
This example replaces module3.o in the library with the content in the module3.o file
and appends module4.o to mylibrary.a:
iarchive --replace mylibrary.a module3.o module4.o
AFE1_AFE2-1:1
IAR utilities
DIAGNOSTIC MESSAGES
This section lists the messages produced by iarchive:
533
AFE1_AFE2-1:1
The IAR Archive Tool—iarchive
AFE1_AFE2-1:1
IAR utilities
INVOCATION SYNTAX
The invocation syntax for the IAR ELF Tool is:
ielftool [options] inputfile outputfile [options]
The ielftool tool will first process all the fill options, then it will process all the
checksum options (from left to right).
Parameters
The parameters are:
Parameter Description
inputfile An absolute ELF executable image produced by the ILINK linker.
options Any of the available command line options, see Summary of ielftool
options, page 536.
outputfile An absolute ELF executable image, or if one of the relevant command
line options is specified, an image file in another format.
Table 39: ielftool parameters
See also Rules for specifying a filename or directory as parameters, page 260.
Example
This example fills a memory range with 0xFF and then calculates a checksum on the
same range:
ielftool my_input.out my_output.out --fill 0xFF;0–0xFF
--checksum __checksum:4,crc32;0–0xFF
535
AFE1_AFE2-1:1
The IAR ELF Dumper—ielfdump
● To produce a listing of the general properties of the input file and the ELF segments
and ELF sections it contains. This is the default behavior when no command line
options are used.
AFE1_AFE2-1:1
IAR utilities
● To also include a textual representation of the contents of each ELF section in the
input file. To specify this behavior, use the command line option --all.
● To produce a textual representation of selected ELF sections from the input file. To
specify this behavior, use the command line option --section.
INVOCATION SYNTAX
The invocation syntax for ielfdumparm is:
ielfdumparm input_file [output_file]
Note: ielfdumparm is a command line tool which is not primarily intended to be used
in the IDE.
Parameters
The parameters are:
Parameter Description
input_file An ELF relocatable or executable file to use as input.
output_file A file or directory where the output is emitted. If absent and no
--output option is specified, output is directed to the console.
Table 41: ielfdumparm parameters
See also Rules for specifying a filename or directory as parameters, page 260.
537
AFE1_AFE2-1:1
The IAR ELF Object Tool—iobjmanip
INVOCATION SYNTAX
The invocation syntax for the IAR ELF Object Tool is:
iobjmanip options inputfile outputfile
Parameters
The parameters are:
Parameter Description
options Command line options that define actions to be performed. These
options can be placed anywhere on the command line. At least one of
the options must be specified.
inputfile A relocatable ELF object file.
outputfile A relocatable ELF object file with all the requested operations applied.
Table 43: iobjmanip parameters
AFE1_AFE2-1:1
IAR utilities
See also Rules for specifying a filename or directory as parameters, page 260.
Examples
This example renames the section .example in input.o to .example2 and stores the
result in output.o:
iobjmanip --rename_section .example=.example2 input.o output.o
DIAGNOSTIC MESSAGES
This section lists the messages produced by iobjmanip:
539
AFE1_AFE2-1:1
The IAR ELF Object Tool—iobjmanip
AFE1_AFE2-1:1
IAR utilities
INVOCATION SYNTAX
The invocation syntax for the IAR Absolute Symbol Exporter is:
isymexport [options] inputfile outputfile [options]
541
AFE1_AFE2-1:1
The IAR Absolute Symbol Exporter—isymexport
Parameters
The parameters are:
Parameter Description
inputfile A ROM image in the form of an executable ELF file (output from
linking).
options Any of the available command line options, see Summary of isymexport
options, page 543.
outputfile A relocatable ELF file that can be used as input to linking, and which
contains all or a selection of the absolute symbols in the input file.
The output file contains only the symbols, not the actual code or data
sections. A steering file can be used for controlling which symbols are
included, and if desired, for also renaming some of the symbols.
Table 45: isymexport parameters
See also Rules for specifying a filename or directory as parameters, page 260.
In the IDE, to add the export of library symbols, choose Project>Options>Build
Actions and specify your command line in the Post-build command line text field, for
example:
$TOOLKIT_DIR$\bin\isymexport.exe "$TARGET_PATH$"
"$PROJ_DIR$\const_lib.symbols"
AFE1_AFE2-1:1
IAR utilities
STEERING FILES
A steering file can be used for controlling which symbols are included, and if desired,
for also renaming some of the symbols. In the file, you can use show and hide directives
to select which public symbols from the input file that are to be included in the output
file. rename directives can be used for changing the names of symbols in the input file.
When you use a steering file, only actively exported symbols will be available in the
output file. Therefore, a steering file without show directives will generate an output file
without symbols.
Syntax
The following syntax rules apply:
● Each directive is specified on a separate line.
● C comments (/*...*/) and C++ comments (//...) can be used.
● Patterns can contain wildcard characters that match more than one possible
character in a symbol name.
● The * character matches any sequence of zero or more characters in a symbol name.
543
AFE1_AFE2-1:1
The IAR Absolute Symbol Exporter—isymexport
Example
rename xxx_* as YYY_* /*Change symbol prefix from xxx_ to YYY_ */
show YYY_* /* Export all symbols from YYY package */
hide *_internal /* But do not export internal symbols */
show zzz? /* Export zzza, but not zzzaaa */
hide zzzx /* But do not export zzzx */
Show directive
Syntax show pattern
Parameters
pattern A pattern to match against a symbol name.
Description A symbol with a name that matches the pattern will be included in the output file unless
this is overridden by a later hide directive.
Show-weak directive
Syntax show-weak pattern
Parameters
pattern A pattern to match against a symbol name.
Description A symbol with a name that matches the pattern will be included in the output file as a
weak symbol unless this is overridden by a later hide directive.
When linking, no error will be reported if the new code contains a definition for a
symbol with the same name as the exported symbol.
Note: Any internal references in the isymexport input file are already resolved and
cannot be affected by the presence of definitions in the new code.
AFE1_AFE2-1:1
IAR utilities
Hide directive
Syntax hide pattern
Parameters
pattern A pattern to match against a symbol name.
Description A symbol with a name that matches the pattern will not be included in the output file
unless this is overridden by a later show directive.
Rename directive
Syntax rename pattern1 as pattern2
Parameters
pattern1 A pattern used for finding symbols to be renamed. The pattern
can contain no more than one * or ? wildcard character.
pattern2 A pattern used for the new name for a symbol. If the pattern
contains a wildcard character, it must be of the same kind as in
pattern1.
Description Use this directive to rename symbols from the output file to the input file. No exported
symbol is allowed to match more than one rename pattern.
rename directives can be placed anywhere in the steering file, but they are executed
before any show and hide directives. Therefore, if a symbol will be renamed, all show
and hide directives in the steering file must refer to the new name.
If the name of a symbol matches a pattern1 pattern that contains no wildcard
characters, the symbol will be renamed pattern2 in the output file.
If the name of a symbol matches a pattern1 pattern that contains a wildcard character,
the symbol will be renamed pattern2 in the output file, with part of the name matching
the wildcard character preserved.
545
AFE1_AFE2-1:1
The IAR Absolute Symbol Exporter—isymexport
DIAGNOSTIC MESSAGES
This section lists the messages produced by isymexport:
AFE1_AFE2-1:1
IAR utilities
INVOCATION SYNTAX
The invocation syntax for iexe2obj is:
iexe2obj options inputfile outputfile
547
AFE1_AFE2-1:1
The IAR ELF Relocatable Object Creator—iexe2obj
Parameters
The parameters are:
Parameter Description
options Command line options that define actions to be performed. These
options can be placed anywhere on the command line. At least one
option must be specified. See Summary of iexe2obj options, page 549
inputfile An executable ELF object file.
outputfile The name of the resulting relocatable ELF object file with all the
requested operations applied.
Table 47: iexe2obj parameters
See also Rules for specifying a filename or directory as parameters, page 260.
Writable data
The input file can contain at most one writable, non-executable section that will be
placed in the output file. The start address of the section will be used as a static base
address, SB.
The writable data section might need dynamic initialization, in which case iexe2obj
will create a function ( __sti_routine) that is called during dynamic initialization of
the client application. For this to work, a label __init is needed (as defined in the
library rt7MQx_tl), and the linker configuration file used for creating your input file
must contain:
AFE1_AFE2-1:1
IAR utilities
The linker might issue a warning (Lp005) for mixing sections with content and sections
without content. If that warning concerns sections .data and .bss, it can be ignored.
Descriptions of options
This section gives detailed reference information about each command line option
available for the different utilities.
--a
Syntax --a
549
AFE1_AFE2-1:1
Descriptions of options
--all
Syntax --all
Description Use this option to include the contents of all ELF sections in the output, in addition to
the general properties of the input file. Sections are output in index order, except that
each relocation section is output immediately after the section it holds relocations for.
By default, no section contents are included in the output.
This option is not available in the IDE.
--bin
Syntax --bin[=range]
Parameters
range The address range content to include in the output file. The
address range can be specified using literals, or by using
symbols present in the ELF file. Examples:
"0x8000-0x8FFF", "START-END"
Description Sets the format of the output file to raw binary, a binary format that includes only the
raw bytes, with no address information. If no range is specified, the output file will
include all the bytes from the lowest address for which there is content in the ELF file
to the highest address for which there is content. If a range is specified, only bytes from
that range are included. Note that in both cases, any gaps for which there is no content
will be generated as zeros.
To set related options, choose:
Project>Options>Output converter
--bin-multi
Syntax --bin-multi[=range[;range...]]
AFE1_AFE2-1:1
IAR utilities
Parameters
range An address range to produce an output file for. An address
range can be specified using literals, or by using symbols
present in the ELF file. Examples: "0x8000-0x8FFF",
"START-END"
Description Use this option to produce one or more raw binary output files. If no ranges are
specified, a raw binary output file is generated for each range for which there is content
in the ELF file. If ranges are specified, a raw binary output file is generated for each
range specified. In each case, the name of each output file will include the start address
of its range. For example, if the output file is specified as out.bin and the ranges
0x0-0x1F and 0x8000-0x8147 are output, there will be two files, named
out-0x0.bin and out-0x8000.bin.
--checksum
Syntax --checksum {symbol[+offset]|address}:size,
algorithm[:[1|2][a|m|z][L|W][x][r][R][o][i|p]]
[,start];range[;range...]
Parameters
symbol The name of the symbol where the checksum value should be
stored. Note that it must exist in the symbol table in the input
ELF file.
offset An offset to the symbol.
address The absolute address where the checksum value should be
stored.
size The number of bytes in the checksum—1, 2, or 4. The number
cannot be larger than the size of the checksum symbol.
551
AFE1_AFE2-1:1
Descriptions of options
a|m|z Reverses the order of the bits for the checksum. Choose between:
a, reverses the input bytes (but nothing else).
AFE1_AFE2-1:1
IAR utilities
L|W Specifies the size of the unit for which a checksum should be
calculated. Choose between:
L, calculates a checksum on 32 bits in every iteration
553
AFE1_AFE2-1:1
Descriptions of options
p, prefixes the input data with a word of size size that contains
the start value.
start By default, the initial value of the checksum is 0. If necessary,
use start to supply a different initial value. If not 0, then either
i or p must be specified.
range range is one or more memory ranges for which the checksum
will be calculated. Hexadecimal and decimal notation is allowed,
for example, 0x8002–0x8FFF. The memory range(s) can also
be expressed as:
● Symbols that are present in ELF file can be used in the range
description, for example, __checksum_begin–
__checksum_end.
● One or more block names where each block is placed inside
a pair of curly braces,{}, like {MY_BLOCK}. A block that is
used in this manner must be specified in the linker
configuration file and must contain only read-only content.
See define block directive, page 492.
It is typically advisable to use symbols or blocks if the memory
range can change. If you use explicit addresses, for example,
0x8000-0x8347, and the code then changes, you need to update
the end address to the new value. If you instead use {CODE} or a
symbol located at the end of the code, you do not need to update
the --checksum command.
AFE1_AFE2-1:1
IAR utilities
Description Use this option to calculate a checksum with the specified algorithm for the specified
ranges. If you have an external definition for the checksum—for example, a hardware
CRC implementation—use the appropriate parameters to the --checksum option to
match the external design. In this case, learn more about that design in the hardware
documentation. The checksum will then replace the original value in symbol. A new
absolute symbol will be generated, with the symbol name suffixed with _value
containing the calculated checksum. This symbol can be used for accessing the
checksum value later when needed, for example, during debugging.
If the --checksum option is used more than once on the command line, the options are
evaluated from left to right. If a checksum is calculated for a symbol that is specified in
a later evaluated --checksum option, an error is issued.
Example This example shows how to use the crc16 algorithm with the start value 0 over the
address range 0x8000–0x8FFF:
ielftool --checksum=__checksum:2,crc16;0x8000-0x8FFF
sourceFile.out destinationFile.out
The input data i read from sourceFile.out, and the resulting checksum value of size
2 bytes will be stored at the symbol __checksum. The modified ELF file is saved as
destinationFile.out leaving sourceFile.out untouched.
In the next example, a symbol is used for specifying the start of the range:
ielftool --checksum=__checksum:2,crc16;__checksum_begin-0x8FFF
sourceFile.out destinationFile.out
See also Checksum calculation for verifying image integrity, page 210
To set related options, choose:
Project>Options>Linker>Checksum
555
AFE1_AFE2-1:1
Descriptions of options
--code
Syntax --code
Description Use this option to dump all sections that contain executable code—sections with the
ELF section attribute SHF_EXECINSTR.
This option is not available in the IDE.
--create
Syntax --create libraryfile objectfile1 ... objectfileN
Parameters
libraryfile The library file that the command operates on. See Rules for
specifying a filename or directory as parameters, page 260.
objectfile1 ... The object file(s) to build the library from.
objectfileN
Description Use this command to build a new library from a set of object files (modules). The object
files are added to the library in the exact order that they are specified on the command
line.
If no command is specified on the command line, --create is used by default.
This option is not available in the IDE.
--delete, -d
Syntax --delete libraryfile objectfile1 ... objectfileN
-d libraryfile objectfile1 ... objectfileN
Parameters
libraryfile The library file that the command operates on. See Rules for
specifying a filename or directory as parameters, page 260.
AFE1_AFE2-1:1
IAR utilities
objectfile1 ... The object file(s) that the command operates on.
objectfileN
Description Use this command to remove object files (modules) from an existing library. All object
files that are specified on the command line will be removed from the library.
This option is not available in the IDE.
--disasm_data
Syntax --disasm_data
Description Use this command to instruct the dumper to dump data sections as if they were code
sections.
This option is not available in the IDE.
--edit
Syntax --edit steering_file
Description Use this option to specify a steering file for controlling which symbols are included in
the isymexport output file, and if desired, also for renaming some of the symbols.
--extract, -x
Syntax --extract libraryfile [objectfile1 ... objectfileN]
-x libraryfile [objectfile1 ... objectfileN]
557
AFE1_AFE2-1:1
Descriptions of options
Parameters
libraryfile The library file that the command operates on. See Rules for
specifying a filename or directory as parameters, page 260.
objectfile1 ... The object file(s) that the command operates on.
objectfileN
Description Use this command to extract object files (modules) from an existing library. If a list of
object files is specified, only these files are extracted. If a list of object files is not
specified, all object files in the library are extracted.
This option is not available in the IDE.
-f
Syntax -f filename
Parameters See Rules for specifying a filename or directory as parameters, page 260.
Description Use this option to make the tool read command line options from the named file, with
the default filename extension xcl.
In the command file, you format the items exactly as if they were on the command line
itself, except that you can use multiple lines, because the newline character acts just as
a space or tab character.
Both C and C++ style comments are allowed in the file. Double quotes behave in the
same way as in the Microsoft Windows command line environment.
This option is not available in the IDE.
AFE1_AFE2-1:1
IAR utilities
--fill
Syntax --fill [v;]pattern;range[;range...]
Parameters
v Generates virtual fill for the fill command. Virtual fill is filler
bytes that are included in checksumming, but that are not
included in the output file. The primary use for this is certain
types of hardware where bytes that are not specified by the image
have a known value—typically, 0xFF or 0x0.
pattern A hexadecimal string with the 0x prefix, for example, 0xEF,
interpreted as a sequence of bytes, where each pair of digits
corresponds to one byte, for example 0x123456, for the
sequence of bytes 0x12, 0x34, and 0x56. This sequence is
repeated over the fill area. If the length of the fill pattern is
greater than 1 byte, it is repeated as if it started at address 0.
range Specifies the address range for the fill. Hexadecimal and decimal
notation is allowed, for example, 0x8002–0x8FFF. Note that
each address must be 4-byte aligned.
Symbols that are present in the ELF file can be used in the range
description, for example, __checksum_begin–
__checksum_end.
Description Use this option to fill all gaps in one or more ranges with a pattern, which can be either
an expression or a hexadecimal string. The contents will be calculated as if the fill
pattern was repeatedly filled from the start address until the end address is passed, and
then the real contents will overwrite that pattern.
If the --fill option is used more than once on the command line, the fill ranges cannot
overlap each other.
To set related options, choose:
Project>Options>Linker>Checksum
--front_headers
Syntax --front_headers
559
AFE1_AFE2-1:1
Descriptions of options
Description Use this option to output ELF program and section headers in the beginning of the file,
instead of at the end.
This option is not available in the IDE.
--generate_vfe_header
Syntax --generate_vfe_header
Description Use this option to declare that the image does not contain any virtual function calls to
potentially discarded functions.
When the linker performs virtual function elimination, it discards virtual functions that
appear not to be needed. For the optimization to be applied correctly, there must be no
virtual function calls in the image that affect the functions that are discarded.
--hide_symbols
Syntax --hide_symbols
Description Use this option to hide all symbols from the input file.
This option is not available in the IDE.
--ihex
Syntax --ihex
AFE1_AFE2-1:1
IAR utilities
Description Sets the format of the output file to 32-bit linear Intel Extended hex, a hexadecimal text
format defined by Intel.
To set related options, choose:
Project>Options>Linker>Output converter
--keep_mode_symbols
Syntax --keep_mode_symbols
Description Use this option to copy mode symbols from the input file to the output file. This is used,
for example, by the disassembler.
This option is not available in the IDE.
--no_bom
Syntax --no_bom
Description Use this option to omit the Byte Order Mark (BOM) when generating a UTF-8 output
file.
See also --text_out, page 575 and Text encodings, page 254
This option is not available in the IDE.
--no_header
Syntax --no_header
Description By default, a standard list header is added before the actual file content. Use this option
to suppress output of the list header.
561
AFE1_AFE2-1:1
Descriptions of options
--no_rel_section
Syntax --no_rel_section
Description By default, whenever the content of a section of a relocatable file is generated as output,
the associated section, if any, is also included in the output. Use this option to suppress
output of the relocation section.
This option is not available in the IDE.
--no_strtab
Syntax --no_strtab
Description Use this option to suppress dumping of string table sections (sections of type
SHT_STRTAB).
--no_utf8_in
Syntax --no_utf8_in
Description The dumper can normally determine whether ELF files produced by IAR tools use the
UTF-8 text encoding or not, and produce the correct output. For ELF files produced by
non-IAR tools, the dumper will assume UTF-8 encoding unless this option is used, in
which case the encoding is assumed to be according to the current system default locale.
Note: This only makes a difference if any characters beyond 7-bit ASCII are used in
paths, symbols, etc.
AFE1_AFE2-1:1
IAR utilities
--offset
Syntax --offset [-]offset
Parameters
offset The offset will be added (or subtracted if - is specified) to
all addresses in the generated output file.
Description Use this option to add or subtract an offset to the address of each output record in the
generated output file. The option only works on Motorola S-records, Intel Hex, TI-Txt,
and Simple-Code. The option has no effect when generating an ELF file or when binary
files (--bin contain no address information) are generated. No content, including the
entry point, will be changed by using this option, only the addresses in the output format.
This will add an offset of 0x30000 to all addresses. As a result, content that was linked
at address 0x4000 will be placed at 0x34000.
This option is not available in the IDE.
--output, -o
Syntax -o {filename|directory}
--output {filename|directory}
Parameters See Rules for specifying a filename or directory as parameters, page 260.
Description iarchive
By default, iarchive assumes that the first argument after the iarchive command is
the name of the destination library. Use this option to explicitly specify a different
filename for the library.
563
AFE1_AFE2-1:1
Descriptions of options
ielfdumparm
By default, output from the dumper is directed to the console. Use this option to direct
the output to a file instead. The default name of the output file is the name of the input
file with an added id filename extension
You can also specify the output file by specifying a file or directory following the name
of the input file.
This option is not available in the IDE.
--parity
Syntax --parity{symbol[+offset]|address}:size,algo:flashbase[:flags];ran
ge[;range...]
Parameters
symbol The name of the symbol where the parity bytes should be
stored. Note that it must exist in the symbol table in the
input ELF file.
offset An offset to the symbol. By default, 0.
address The absolute address where the parity bytes should be
stored.
size The maximum number of bytes that the parity generation
can use. An error will be issued if this value is exceeded.
Note that the size must fit in the specified symbol in the ELF
file.
algo Choose between:
odd, uses odd parity.
even, uses even parity.
flashbase The start address of the flash memory. Parity bits will not be
generated for the addresses between flashbase and the
start address of the range. If flashbase and the start
address of the range coincide, parity bits will be generated
for all addresses
AFE1_AFE2-1:1
IAR utilities
range The address range over which the parity bytes should be
generated. Hexadecimal and decimal notation are allowed,
for example, 0x8002–0x8FFF.
Description Use this option to generate parity bytes over specified ranges. The range is traversed left
to the right and the parity bits are generated using the odd or even algorithm. The parity
bits are finally stored in the specified symbol where they can be accessed by your
application.
This option is not available in the IDE.
--prefix
Syntax --prefix prefix
Parameters
prefix A prefix for symbol and section names
Description By default, the base name of the output file is used as a prefix for symbol and section
names that are defined in wrappers. Use this option to set a custom prefix for these
symbols and section names.
565
AFE1_AFE2-1:1
Descriptions of options
--ram_reserve_ranges
Syntax --ram_reserve_ranges[=symbol_prefix]
Parameters
symbol_prefix The prefix of symbols created by this option.
Description Use this option to generate symbols for the areas in RAM that the image uses. One
symbol will be generated for each such area. The name of each symbol is based on the
name of the area and is prefixed by the optional parameter symbol_prefix.
Generating symbols that cover an area in this way prevents the linker from placing other
content at the affected addresses. This can be useful when linking against an existing
image.
If --ram_reserve_ranges is used together with --reserve_ranges, the RAM
areas will get their prefix from the --ram_reserve_ranges option and the non-RAM
areas will get their prefix from the --reserve_ranges option.
--range
Syntax --range start-end
Parameters
start-end Disassemble code where the start address is greater than or
equal to start, and where the end address is less than end.
Description Use this option to specify a range for which code from an executable will be dumped.
This option is not available in the IDE.
AFE1_AFE2-1:1
IAR utilities
--raw
Syntax --raw
Description By default, many ELF sections will be dumped using a text format specific to a
particular kind of section. Use this option to dump each selected ELF section using the
generic text format.
The generic text format dumps each byte in the section in hexadecimal format, and
where appropriate, as ASCII text.
This option is not available in the IDE.
--remove_file_path
Syntax --remove_file_path
Description Use this option to make iobjmanip remove information about the directory structure
of the project source tree from the generated object file, which means that the file
symbol in the ELF object file is modified.
This option must be used in combination with --remove_section ".comment".
This option is not available in the IDE.
--remove_section
Syntax --remove_section {section|number}
Parameters
section The section—or sections, if there are more than one section with
the same name—to be removed.
number The number of the section to be removed. Section numbers can
be obtained from an object dump created using ielfdumparm.
567
AFE1_AFE2-1:1
Descriptions of options
Description Use this option to make iobjmanip omit the specified section when generating the
output file.
This option is not available in the IDE.
--rename_section
Syntax --rename_section {oldname|oldnumber}=newname
Parameters
oldname The section—or sections, if there are more than one section with
the same name—to be renamed.
oldnumber The number of the section to be renamed. Section numbers can
be obtained from an object dump created using ielfdumparm.
newname The new name of the section.
Description Use this option to make iobjmanip rename the specified section when generating the
output file.
This option is not available in the IDE.
--rename_symbol
Syntax --rename_symbol oldname =newname
Parameters
oldname The symbol to be renamed.
newname The new name of the symbol.
Description Use this option to make iobjmanip rename the specified symbol when generating the
output file.
This option is not available in the IDE.
AFE1_AFE2-1:1
IAR utilities
--replace, -r
Syntax --replace libraryfile objectfile1 ... objectfileN
-r libraryfile objectfile1 ... objectfileN
Parameters
libraryfile The library file that the command operates on. See Rules for
specifying a filename or directory as parameters, page 260.
objectfile1 ... The object file(s) that the command operates on.
objectfileN
Description Use this command to replace or add object files (modules) to an existing library. The
object files specified on the command line either replace existing object files in the
library—if they have the same name—or are appended to the library.
This option is not available in the IDE.
--reserve_ranges
Syntax --reserve_ranges[=symbol_prefix]
Parameters
symbol_prefix The prefix of symbols created by this option.
Description Use this option to generate symbols for the areas in ROM and RAM that the image uses.
One symbol will be generated for each such area. The name of each symbol is based on
the name of the area and is prefixed by the optional parameter symbol_prefix.
Generating symbols that cover an area in this way prevents the linker from placing other
content at the affected addresses. This can be useful when linking against an existing
image.
If --reserve_ranges is used together with --ram_reserve_ranges, the RAM
areas will get their prefix from the --ram_reserve_ranges option and the non-RAM
areas will get their prefix from the --reserve_ranges option.
569
AFE1_AFE2-1:1
Descriptions of options
--section, -s
Syntax --section section_number|section_name[,...]
--s section_number|section_name[,...]
Parameters
section_number The number of the section to be dumped.
section_name The name of the section to be dumped.
Description Use this option to dump the contents of a section with the specified number, or any
section with the specified name. If a relocation section is associated with a selected
section, its contents are output as well.
If you use this option, the general properties of the input file will not be included in the
output.
You can specify multiple section numbers or names by separating them with commas,
or by using this option more than once.
By default, no section contents are included in the output.
--segment, -g
Syntax --segment segment_number[,...]
-g segment_number[,...]
Parameters
segmnt_number The number of a segment whose contents will be included
in the output.
AFE1_AFE2-1:1
IAR utilities
Description Use this option to select specific segments—parts of an executable image indicated by
program headers—for inclusion in the output.
This option is not available in the IDE.
--self_reloc
Syntax --self_reloc
Description This option is intentionally not documented as it is not intended for general use.
This option is not available in the IDE.
--show_entry_as
Syntax --show_entry_as name
Parameters
name The name to give to the program entry point in the output file.
Description Use this option to export the entry point of the application given as input under the name
name.
--silent
Syntax --silent
Description Causes the tool to operate without sending any messages to the standard output stream.
571
AFE1_AFE2-1:1
Descriptions of options
By default, the tool sends various messages via the standard output stream. You can use
this option to prevent this. The tool sends error and warning messages to the error output
stream, so they are displayed regardless of this setting.
This option is not available in the IDE.
--simple
Syntax --simple
Description Sets the format of the output file to Simple-code, a binary format that includes address
information.
To set related options, choose:
Project>Options>Output converter
--simple-ne
Syntax --simple-ne
Description Sets the format of the output file to Simple code, but no entry record is generated.
To set related options, choose:
Project>Options>Output converter
--source
Syntax --source
Description Use this option to make ielftool include source for each statement before the code
for that statement, when dumping code from an executable file. To make this work, the
executable image must be built with debug information, and the source code must still
be accessible in its original location.
AFE1_AFE2-1:1
IAR utilities
--srec
Syntax --srec
Description Sets the format of the output file to Motorola S-records, a hexadecimal text format
defined by Motorola.
Note: You can use the ielftool options --srec-len and --srec-s3only to modify
the exact format used.
To set related options, choose:
Project>Options>Output converter
--srec-len
Syntax --srec-len=length
Parameters
length The number of data bytes in each S-record.
Description Restricts the number of data bytes in each S-record. This option can be used in
combination with the --srec option.
This option is not available in the IDE.
--srec-s3only
Syntax --srec-s3only
Description Restricts the S-record output to contain only a subset of records, that is S0, S3 and S7
records. This option can be used in combination with the --srec option.
573
AFE1_AFE2-1:1
Descriptions of options
--strip
Syntax --strip
Description Use this option to remove all sections containing debug information before the output
file is written.
Note: ielftool needs an unstripped input ELF image. If you use the --strip option
in the linker, remove it and use the --strip option in ielftool instead.
To set related options, choose:
Project>Options>Linker>Output>Include debug information in output
--symbols
Syntax --symbols libraryfile
Parameters
libraryfile The library file that the command operates on. See Rules for
specifying a filename or directory as parameters, page 260.
Description Use this command to list all external symbols that are defined by any object file
(module) in the specified library, together with the name of the object file (module) that
defines it.
In silent mode (--silent), this command performs symbol table-related syntax checks
on the library file and displays only errors and warnings.
This option is not available in the IDE.
AFE1_AFE2-1:1
IAR utilities
--text_out
Syntax --text_out{utf8|utf16le|utf16be|locale}
Parameters
utf8 Uses the UTF-8 encoding
utf16le Uses the UTF-16 little-endian encoding
utf16be Uses the UTF-16 big-endian encoding
locale Uses the system locale encoding
Description Use this option to specify the encoding to be used when generating a text output file.
The default for the list files is to use the same encoding as the main source file. The
default for all other text files is UTF-8 with a Byte Order Mark (BOM).
If you want text output in UTF-8 encoding without BOM, you can use the option
--no_bom as well.
See also --no_bom, page 561 and Text encodings, page 254
This option is not available in the IDE.
--titxt
Syntax --titxt
Description Sets the format of the output file to Texas Instruments TI–TXT, a hexadecimal text
format defined by Texas Instruments.
To set related options, choose:
Project>Options>Output converter
--toc, -t
Syntax --toc libraryfile
-t libraryfile
575
AFE1_AFE2-1:1
Descriptions of options
Parameters
libraryfile The library file that the command operates on. See Rules for
specifying a filename or directory as parameters, page 260.
Description Use this command to list the names of all object files (modules) in a specified library.
In silent mode (--silent), this command performs basic syntax checks on the library
file, and displays only errors and warnings.
This option is not available in the IDE.
--use_full_std_template_names
Syntax --use_full_std_template_names
Description Normally, the names of some standard C++ templates are used in the output in an
abbreviated form in the unmangled names of symbols, for example, "std::string"
instead of "std::basic_string<char, std::char_traits<char>,
std_::allocator<char>>". Use this option to make ielfdump use the
unabbreviated form.
This option is not available in the IDE.
--utf8_text_in
Syntax --utf8_text_in
Description Use this option to specify that the tool shall use the UTF-8 encoding when reading a text
input file with no Byte Order Mark (BOM).
Note: This option does not apply to source files.
AFE1_AFE2-1:1
IAR utilities
--verbose, -V
Syntax --verbose
-V (iarchive only)
Description Use this option to make the tool report which operations it performs, in addition to
giving diagnostic messages.
This option is not available in the IDE because this setting is always enabled.
--version
Syntax --version
Description Use this option to make the tool send version information to the console and then exit.
This option is not available in the IDE.
--vtoc
Syntax --vtoc libraryfile
Parameters
libraryfile The library file that the command operates on. See Rules for
specifying a filename or directory as parameters, page 260.
Description Use this command to list the names, sizes, and modification times of all object files
(modules) in a specified library.
In silent mode (--silent), this command performs basic syntax checks on the library
file, and displays only errors and warnings.
577
AFE1_AFE2-1:1
Descriptions of options
--wrap
Syntax --wrap symbol
Parameters
symbol A function symbol that should be callable by clients of the
output file of iexe2obj.
Description Use this option to generate a wrapper function for function symbols.
This option is not available in the IDE.
AFE1_AFE2-1:1
Implementation-defined
behavior for Standard C++
● Descriptions of implementation-defined behavior for C++
● Implementation quantities
1 GENERAL
Diagnostics (1.3.6)
Diagnostics are produced in the form:
filename,linenumber level[tag]: message
where filename is the name of the source file in which the error was encountered,
linenumber is the line number at which the compiler detected the error, level is the
level of seriousness of the message (remark, warning, error, or fatal error), tag is a
unique tag that identifies the message, and message is an explanatory message, possibly
several lines.
579
AFE1_AFE2-1:1
Descriptions of implementation-defined behavior for C++
2 LEXICAL CONVENTIONS
AFE1_AFE2-1:1
Implementation-defined behavior for Standard C++
The value of wide-character literals with single c-char that are not
in the execution wide-character set (2.14.3)
All possible c-chars have a representation in the execution wide-character set.
581
AFE1_AFE2-1:1
Descriptions of implementation-defined behavior for C++
3 BASIC CONCEPTS
AFE1_AFE2-1:1
Implementation-defined behavior for Standard C++
int main()
int main(int, char **)
583
AFE1_AFE2-1:1
Descriptions of implementation-defined behavior for C++
Alignment (3.11)
See Alignment, page 349.
4 STANDARD CONVERSIONS
AFE1_AFE2-1:1
Implementation-defined behavior for Standard C++
5 EXPRESSIONS
585
AFE1_AFE2-1:1
Descriptions of implementation-defined behavior for C++
7 DECLARATIONS
8 DECLARATORS
AFE1_AFE2-1:1
Implementation-defined behavior for Standard C++
9 CLASSES
14 TEMPLATES
15 EXCEPTION HANDLING
16 PREPROCESSING DIRECTIVES
587
AFE1_AFE2-1:1
Descriptions of implementation-defined behavior for C++
#pragma (16.6)
See Recognized pragma directives (6.10.6), page 607.
17 LIBRARY INTRODUCTION
AFE1_AFE2-1:1
Implementation-defined behavior for Standard C++
589
AFE1_AFE2-1:1
Descriptions of implementation-defined behavior for C++
AFE1_AFE2-1:1
Implementation-defined behavior for Standard C++
21 STRINGS LIBRARY
591
AFE1_AFE2-1:1
Descriptions of implementation-defined behavior for C++
22 LOCALIZATION LIBRARY
AFE1_AFE2-1:1
Implementation-defined behavior for Standard C++
23 CONTAINERS LIBRARY
25 ALGORITHMS LIBRARY
27 INPUT/OUTPUT LIBRARY
593
AFE1_AFE2-1:1
Descriptions of implementation-defined behavior for C++
AFE1_AFE2-1:1
Implementation-defined behavior for Standard C++
Implementation quantities
The IAR Systems implementation of C++ is, like all implementations, limited in the size
of the applications it can successfully process.
These limitations apply:
C++ feature Limitation
Nesting levels of compound statements, iteration control Limited only by memory.
structures, and selection control structures.
Nesting levels of conditional inclusion. Limited only by memory.
Pointer, array, and function declarators (in any Limited only by memory.
combination) modifying a class, arithmetic, or incomplete
type in a declaration.
Nesting levels of parenthesized expressions within a Limited only by memory.
full-expression.
Number of characters in an internal identifier or macro Limited only by memory.
name.
Table 50: C++ implementation quantities
595
AFE1_AFE2-1:1
Implementation quantities
AFE1_AFE2-1:1
Implementation-defined behavior for Standard C++
597
AFE1_AFE2-1:1
Implementation quantities
AFE1_AFE2-1:1
Implementation-defined
behavior for Standard C
● Descriptions of implementation-defined behavior
J.3.1 TRANSLATION
where filename is the name of the source file in which the error was encountered,
linenumber is the line number at which the compiler detected the error, level is the
level of seriousness of the message (remark, warning, error, or fatal error), tag is a
unique tag that identifies the message, and message is an explanatory message, possibly
several lines.
599
AFE1_AFE2-1:1
Descriptions of implementation-defined behavior
J.3.2 ENVIRONMENT
Main (5.1.2.1)
The function called at program startup is called main. No prototype is declared for
main, and the only definition supported for main is:
int main(void)
AFE1_AFE2-1:1
Implementation-defined behavior for Standard C
J.3.3 IDENTIFIERS
J.3.4 CHARACTERS
601
AFE1_AFE2-1:1
Descriptions of implementation-defined behavior
AFE1_AFE2-1:1
Implementation-defined behavior for Standard C
J.3.5 INTEGERS
603
AFE1_AFE2-1:1
Descriptions of implementation-defined behavior
AFE1_AFE2-1:1
Implementation-defined behavior for Standard C
ptrdiff_t (6.5.6)
For information about ptrdiff_t, see ptrdiff_t, page 359.
J.3.8 HINTS
605
AFE1_AFE2-1:1
Descriptions of implementation-defined behavior
J.3.10 QUALIFIERS
AFE1_AFE2-1:1
Implementation-defined behavior for Standard C
alignment
alternate_target_def
baseaddr
basic_template_matching
building_runtime
can_instantiate
607
AFE1_AFE2-1:1
Descriptions of implementation-defined behavior
codeseg
constseg
cplusplus_neutral
cspy_support
cstat_dump
dataseg
define_type_info
do_not_instantiate
early_dynamic_initialization
exception_neutral
function
function_category
function_effects
hdrstop
important_typedef
ident
implements_aspect
init_routines_only_for_needed_variables
initialization_routine
inline_template
instantiate
keep_definition
library_default_requirements
library_provides
library_requirement_override
memory
module_name
no_pch
no_vtable_use
AFE1_AFE2-1:1
Implementation-defined behavior for Standard C
once
pop_macro
preferred_typedef
push_macro
separate_init_routine
set_generate_entries_without_bounds
system_include
uses_aspect
vector
warnings
609
AFE1_AFE2-1:1
Descriptions of implementation-defined behavior
signal() (7.14.1.1)
The signal part of the library is not supported.
Note: The default implementation of signal does not perform anything. Use the
template source code to implement application-specific signal handling. See signal,
page 156 and raise, page 154, respectively.
AFE1_AFE2-1:1
Implementation-defined behavior for Standard C
611
AFE1_AFE2-1:1
Descriptions of implementation-defined behavior
remove() (7.21.4.1)
The effect of a remove operation on an open file depends on the application-specific
implementation of the low-level file routines. See Briefly about input and output (I/O),
page 124.
rename() (7.21.4.2)
The effect of renaming a file to an already existing filename depends on the
application-specific implementation of the low-level file routines. See Briefly about
input and output (I/O), page 124.
AFE1_AFE2-1:1
Implementation-defined behavior for Standard C
613
AFE1_AFE2-1:1
Descriptions of implementation-defined behavior
J.3.13 ARCHITECTURE
For information about sizes, ranges, etc for all basic types, see Data representation, page
349.
The limit macros for the exact-width, minimum-width, and fastest minimum-width
integer types defined in stdint.h have the same ranges as char, short, int, long,
and long long.
The floating-point constant FLT_ROUNDS has the value 1 (to nearest) and the
floating-point constant FLT_EVAL_METHOD has the value 0 (treat as is).
AFE1_AFE2-1:1
Implementation-defined behavior for Standard C
J.4 LOCALE
It is up to your application with the support of the library configuration to handle the
characters correctly.
615
AFE1_AFE2-1:1
Descriptions of implementation-defined behavior
AFE1_AFE2-1:1
Implementation-defined behavior for Standard C
617
AFE1_AFE2-1:1
Descriptions of implementation-defined behavior
AFE1_AFE2-1:1
Implementation-defined
behavior for C89
● Descriptions of implementation-defined behavior
TRANSLATION
Diagnostics (5.1.1.3)
Diagnostics are produced in the form:
filename,linenumber level[tag]: message
where filename is the name of the source file in which the error was encountered,
linenumber is the line number at which the compiler detected the error, level is the
level of seriousness of the message (remark, warning, error, or fatal error), tag is a
unique tag that identifies the message, and message is an explanatory message, possibly
several lines.
ENVIRONMENT
int main(void)
To change this behavior for the DLIB runtime environment, see System initialization,
page 148.
619
AFE1_AFE2-1:1
Descriptions of implementation-defined behavior
IDENTIFIERS
CHARACTERS
AFE1_AFE2-1:1
Implementation-defined behavior for C89
INTEGERS
621
AFE1_AFE2-1:1
Descriptions of implementation-defined behavior
FLOATING POINT
AFE1_AFE2-1:1
Implementation-defined behavior for C89
REGISTERS
623
AFE1_AFE2-1:1
Descriptions of implementation-defined behavior
QUALIFIERS
DECLARATORS
STATEMENTS
PREPROCESSING DIRECTIVES
AFE1_AFE2-1:1
Implementation-defined behavior for C89
file currently being processed. If there is no grandparent file and the file is not found,
the search continues as if the filename was enclosed in angle brackets.
baseaddr
basic_template_matching
building_runtime
can_instantiate
codeseg
constseg
cspy_support
dataseg
define_type_info
do_not_instantiate
early_dynamic_initialization
function
function_effects
hdrstop
important_typedef
instantiate
625
AFE1_AFE2-1:1
Descriptions of implementation-defined behavior
keep_definition
library_default_requirements
library_provides
library_requirement_override
memory
module_name
no_pch
once
system_include
vector
warnings
AFE1_AFE2-1:1
Implementation-defined behavior for C89
signal() (7.7.1.1)
The signal part of the library is not supported.
Note: The default implementation of signal does not perform anything. Use the
template source code to implement application-specific signal handling. See signal,
page 156 and raise, page 154, respectively.
Files (7.9.3)
Whether the file position indicator of an append-mode stream is initially positioned at
the beginning or the end of the file, depends on the application-specific implementation
of the low-level file routines.
Whether a write operation on a text stream causes the associated file to be truncated
beyond that point, depends on the application-specific implementation of the low-level
file routines. See Briefly about input and output (I/O), page 124.
The characteristics of the file buffering is that the implementation supports files that are
unbuffered, line buffered, or fully buffered.
Whether a zero-length file actually exists depends on the application-specific
implementation of the low-level file routines.
627
AFE1_AFE2-1:1
Descriptions of implementation-defined behavior
remove() (7.9.4.1)
The effect of a remove operation on an open file depends on the application-specific
implementation of the low-level file routines. See Briefly about input and output (I/O),
page 124.
rename() (7.9.4.2)
The effect of renaming a file to an already existing filename depends on the
application-specific implementation of the low-level file routines. See Briefly about
input and output (I/O), page 124.
%p in printf() (7.9.6.1)
The argument to a %p conversion specifier, print pointer, to printf() is treated as
having the type void *. The value will be printed as a hexadecimal number, similar to
using the %x conversion specifier.
%p in scanf() (7.9.6.2)
The %p conversion specifier, scan pointer, to scanf() reads a hexadecimal number and
converts it into a value with the type void *.
AFE1_AFE2-1:1
Implementation-defined behavior for C89
Environment (7.10.4.4)
The set of available environment names and the method for altering the environment list
is described in getenv, page 152.
system() (7.10.4.5)
How the command processor works depends on how you have implemented the system
function. See system, page 157.
clock() (7.12.2.1)
From where the system clock starts counting depends on how you have implemented the
clock function. See clock, page 151.
629
AFE1_AFE2-1:1
Descriptions of implementation-defined behavior
AFE1_AFE2-1:1
Index
Index
alternate_target_def (pragma directive) . . . . . . . . . . . . . . 607
A anonymous structures . . . . . . . . . . . . . . . . . . . . . . . . . . . . 229
--a (ielfdump option) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 549 ANSI C. See C89
__AAPCS__ (predefined symbol) . . . . . . . . . . . . . . . . . . 458 application
--aapcs (compiler option) . . . . . . . . . . . . . . . . . . . . . . . . . 267 building, overview of . . . . . . . . . . . . . . . . . . . . . . . . . . . 69
__AAPCS_VFP__ (predefined symbol) . . . . . . . . . . . . . . 458 execution, overview of . . . . . . . . . . . . . . . . . . . . . . . . . . 64
ABI, AEABI and IA64 . . . . . . . . . . . . . . . . . . . . . . . . . . . 218 startup and termination (DLIB) . . . . . . . . . . . . . . . . . . 145
abort argv (argument), implementation-defined behavior in C. . 600
implementation-defined behavior in C . . . . . . . . . . . . . 613 Arm
implementation-defined behavior in C89 (DLIB) . . . . 629 and Thumb code, overview . . . . . . . . . . . . . . . . . . . . . . 78
system termination (DLIB) . . . . . . . . . . . . . . . . . . . . . 147 supported devices. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 55
__absolute (extended keyword) . . . . . . . . . . . . . . . . . . . . 369 __arm (extended keyword) . . . . . . . . . . . . . . . . . . . . . . . . 369
absolute location --arm (compiler option). . . . . . . . . . . . . . . . . . . . . . . . . . . 268
data, placing at (@) . . . . . . . . . . . . . . . . . . . . . . . . . . . 231 Arm TrustZone . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 222
language support for . . . . . . . . . . . . . . . . . . . . . . . . . . 189 __ARMVFP__ (predefined symbol) . . . . . . . . . . . . . . . . . 462
placing data in registers (@) . . . . . . . . . . . . . . . . . . . . 233 __ARMVFPV2__ (predefined symbol) . . . . . . . . . . . . . . 462
#pragma location . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 396 __ARMVFPV3__ (predefined symbol) . . . . . . . . . . . . . . 462
--advanced_heap (linker option) . . . . . . . . . . . . . . . . . . . . 315 __ARMVFPV4__ (predefined symbol) . . . . . . . . . . . . . . 462
--aeabi (compiler option) . . . . . . . . . . . . . . . . . . . . . . . . . 267 __ARMVFP_D16__ (predefined symbol) . . . . . . . . . . . . 462
_AEABI_PORTABILITY_LEVEL (preprocessor __ARMVFP_SP__ (predefined symbol) . . . . . . . . . . . . . . 462
symbol) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 221 __ARM_ADVANCED_SIMD__ (predefined symbol) . . 458
_AEABI_PORTABLE (preprocessor symbol) . . . . . . . . . 221 __ARM_ARCH (predefined symbol) . . . . . . . . . . . . . . . . 459
algorithm (library header file) . . . . . . . . . . . . . . . . . . . . . . 475 __ARM_ARCH_ISA_ARM (predefined symbol) . . . . . . 459
alias_def (pragma directive) . . . . . . . . . . . . . . . . . . . . . . . 607 __ARM_ARCH_ISA_THUMB (predefined symbol) . . . . 459
alignment . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 349 __ARM_ARCH_PROFILE (predefined symbol) . . . . . . . 459
extended (implementation-defined behavior for C++) . 591 __ARM_BIG_ENDIAN (predefined symbol) . . . . . . . . . 459
forcing stricter (#pragma data_alignment) . . . . . . . . . . 388 __arm_cdp (intrinsic function) . . . . . . . . . . . . . . . . . . . . . 410
implementation-defined behavior for C++ . . . . . . . . . . 584 __arm_cdp2 (intrinsic function) . . . . . . . . . . . . . . . . . . . . 410
in structures (#pragma pack) . . . . . . . . . . . . . . . . . . . . 400 __ARM_FEATURE_CMSE (predefined symbol) . . . . . . 459
in structures, causing problems . . . . . . . . . . . . . . . . . . 228 __ARM_FEATURE_CRC32 (predefined symbol) . . . . . . 460
of an object (__ALIGNOF__) . . . . . . . . . . . . . . . . . . . 190 __ARM_FEATURE_CRYPTO (predefined symbol) . . . . 460
of data types . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 350 __ARM_FEATURE_DIRECTED_ROUNDING (predefined
restrictions for inline assembler . . . . . . . . . . . . . . . . . . 165 symbol) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 460
alignment (pragma directive) . . . . . . . . . . . . . . . . . . 607, 625 __ARM_FEATURE_DSP (predefined symbol) . . . . . . . . 460
__ALIGNOF__ (operator) . . . . . . . . . . . . . . . . . . . . . . . . 190 __ARM_FEATURE_FMA (predefined symbol) . . . . . . . 460
alignof expression, __ARM_FEATURE_IDIV (predefined symbol) . . . . . . . 460
implementation-defined behavior for C++ . . . . . . . . . . . . 584 __ARM_FEATURE_NUMERIC_MAXMIN (predefined
--align_sp_on_irq (compiler option) . . . . . . . . . . . . . . . . . 268 symbol) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 461
--all (ielfdump option) . . . . . . . . . . . . . . . . . . . . . . . . . . . 550 __ARM_FEATURE_UNALIGNED (predefined symbol) 461
__ARM_FP (predefined symbol) . . . . . . . . . . . . . . . . . . . 461
631
AFE1_AFE2-1:1
__arm_ldc (intrinsic function). . . . . . . . . . . . . . . . . . . . . . 411 array (library header file) . . . . . . . . . . . . . . . . . . . . . . . . . 475
__arm_ldcl (intrinsic function) . . . . . . . . . . . . . . . . . . . . . 411 arrays
__arm_ldcl2 (intrinsic function) . . . . . . . . . . . . . . . . . . . . 411 implementation-defined behavior . . . . . . . . . . . . . . . . 605
__arm_ldc2 (intrinsic function). . . . . . . . . . . . . . . . . . . . . 411 implementation-defined behavior in C89 . . . . . . . . . . . 623
__arm_mcr (intrinsic function) . . . . . . . . . . . . . . . . . . . . . 412 non-lvalue . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 192
__arm_mcrr (intrinsic function) . . . . . . . . . . . . . . . . . . . . 412 of incomplete types . . . . . . . . . . . . . . . . . . . . . . . . . . . 191
__arm_mcrr2 (intrinsic function) . . . . . . . . . . . . . . . . . . . 412 single-value initialization . . . . . . . . . . . . . . . . . . . . . . . 193
__arm_mcr2 (intrinsic function) . . . . . . . . . . . . . . . . . . . . 412 arrays of incomplete types . . . . . . . . . . . . . . . . . . . . . . . . 202
__ARM_MEDIA__ (predefined symbol) . . . . . . . . . . . . . 461 array::const_iterator, implementation-defined behavior for
__arm_mrc (intrinsic function) . . . . . . . . . . . . . . . . . . . . . 413 C++ . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 593
__arm_mrc2 (intrinsic function) . . . . . . . . . . . . . . . . . . . . 413 array::iterator, implementation-defined behavior for C++ 593
__arm_mrrc (intrinsic function) . . . . . . . . . . . . . . . . . . . . 413 asm, __asm (language extension) . . . . . . . . . . . . . . . . . . . 166
__arm_mrrc2 (intrinsic function) . . . . . . . . . . . . . . . . . . . 413 implementation-defined behavior for C++ . . . . . . . . . . 586
__ARM_NEON (predefined symbol) . . . . . . . . . . . . . . . . 461 assembler code
__ARM_NEON_FP (predefined symbol) . . . . . . . . . . . . . 461 calling from C . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 172
__ARM_PROFILE_M__ (predefined symbol) . . . . . . . . . 462 calling from C++ . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 175
__arm_rsr (intrinsic function) . . . . . . . . . . . . . . . . . . . . . . 413 inserting inline . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 164
__arm_rsrp (intrinsic function) . . . . . . . . . . . . . . . . . . . . . 414 assembler directives
__arm_rsr64 (intrinsic function) . . . . . . . . . . . . . . . . . . . . 413 for call frame information . . . . . . . . . . . . . . . . . . . . . . 182
__arm_stc (intrinsic function) . . . . . . . . . . . . . . . . . . . . . . 414 using in inline assembler code . . . . . . . . . . . . . . . . . . . 165
__arm_stcl (intrinsic function) . . . . . . . . . . . . . . . . . 414–415 assembler instructions
__arm_stc2 (intrinsic function) . . . . . . . . . . . . . . . . . . . . . 414 for software interrupts . . . . . . . . . . . . . . . . . . . . . . . . . . 84
__arm_stc2l (intrinsic function) . . . . . . . . . . . . . . . . 414–415 assembler instructions, inserting inline . . . . . . . . . . . . . . . 164
__arm_wsr (intrinsic function) . . . . . . . . . . . . . . . . . . . . . 415 assembler labels
__ARM4TM__ (predefined symbol) . . . . . . . . . . . . . . . . 463 default for application startup . . . . . . . . . . . . . . . . 69, 111
__ARM5__ (predefined symbol) . . . . . . . . . . . . . . . . . . . 463 making public (--public_equ) . . . . . . . . . . . . . . . . . . . . 299
__ARM5E__ (predefined symbol) . . . . . . . . . . . . . . . . . . 463 assembler language interface . . . . . . . . . . . . . . . . . . . . . . 163
__ARM6__ (predefined symbol) . . . . . . . . . . . . . . . . . . . 463 calling convention. See assembler code
__ARM6M__ (predefined symbol) . . . . . . . . . . . . . . . . . . 463 assembler list file, generating . . . . . . . . . . . . . . . . . . . . . . 283
__ARM6SM__ (predefined symbol). . . . . . . . . . . . . . . . . 463 assembler output file . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 174
__ARM7A__ (predefined symbol) . . . . . . . . . . . . . . . . . . 463 assembler statements. . . . . . . . . . . . . . . . . . . . . . . . . . . . . 194
__ARM7EM__ (predefined symbol) . . . . . . . . . . . . . . . . 463 asserts
__ARM7M__ (predefined symbol) . . . . . . . . . . . . . . . . . . 463 implementation-defined behavior of in C. . . . . . . . . . . 609
__ARM7R__ (predefined symbol) . . . . . . . . . . . . . . . . . . 463 implementation-defined behavior of in C89, (DLIB) . . 626
__ARM8A__ (predefined symbol) . . . . . . . . . . . . . . . . . . 463 including in application . . . . . . . . . . . . . . . . . . . . . . . . 468
__ARM8EM_MAINLINE__ (predefined symbol) . . . . . . 463 assert.h (DLIB header file) . . . . . . . . . . . . . . . . . . . . . . . . 474
__ARM8M_BASELINE__ (predefined symbol) . . . . . . . 463 assignment of pointer types. . . . . . . . . . . . . . . . . . . . . . . . 193
__ARM8M_MAINLINE__ (predefined symbol) . . . . . . . 463 @ (operator)
__ARM8R__ (predefined symbol) . . . . . . . . . . . . . . . . . . 463 placing at absolute address . . . . . . . . . . . . . . . . . . . . . . 231
placing in sections . . . . . . . . . . . . . . . . . . . . . . . . . . . . 232
AFE1_AFE2-1:1
Index
633
AFE1_AFE2-1:1
.bss (ELF section) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 518 cctype (DLIB header file) . . . . . . . . . . . . . . . . . . . . . . . . . 478
building_runtime (pragma directive). . . . . . . . . . . . . 607, 625 __CDP (intrinsic function) . . . . . . . . . . . . . . . . . . . . . . . . 416
__BUILD_NUMBER__ (predefined symbol) . . . . . . . . . 463 __CDP2 (intrinsic function) . . . . . . . . . . . . . . . . . . . . . . . 416
byte order . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 70 cerrno (DLIB header file) . . . . . . . . . . . . . . . . . . . . . . . . . 478
identifying . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 465 cexit (system termination code)
bytes, number customizing system termination . . . . . . . . . . . . . . . . . . 148
of bits in (implementation-defined behavior for C++) . . . 580 in DLIB . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 145
cfenv (library header file) . . . . . . . . . . . . . . . . . . . . . . . . . 478
AFE1_AFE2-1:1
Index
check that (linker directive) . . . . . . . . . . . . . . . . . . . . . . . 510 part of linker invocation syntax . . . . . . . . . . . . . . . . . . 250
checksum passing . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 250
calculation of . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 210 typographic convention . . . . . . . . . . . . . . . . . . . . . . . . . 48
display format in C-SPY for symbol . . . . . . . . . . . . . . 218 command prompt icon, in this guide . . . . . . . . . . . . . . . . . . 49
--checksum (ielftool option) . . . . . . . . . . . . . . . . . . . . . . . 551 .comment (ELF section) . . . . . . . . . . . . . . . . . . . . . . . . . . 518
chrono (library header file) . . . . . . . . . . . . . . . . . . . . . . . . 475 comments
cinttypes (DLIB header file) . . . . . . . . . . . . . . . . . . . . . . . 478 after preprocessor directives . . . . . . . . . . . . . . . . . . . . 192
ciso646 (library header file) . . . . . . . . . . . . . . . . . . . . . . . 478 common block (call frame information) . . . . . . . . . . . . . . 183
class type, passing common subexpr elimination (compiler transformation) . 238
argument of (implementation-defined behavior for C++) . 585 disabling (--no_cse) . . . . . . . . . . . . . . . . . . . . . . . . . . . 288
climits (DLIB header file) . . . . . . . . . . . . . . . . . . . . . . . . . 478 Common.i (CFI header example file) . . . . . . . . . . . . . . . . 185
clobber . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 165 compilation date
clocale (DLIB header file) . . . . . . . . . . . . . . . . . . . . . . . . 478 exact time of (__TIME__) . . . . . . . . . . . . . . . . . . . . . . 467
clock (DLIB library function), identifying (__DATE__) . . . . . . . . . . . . . . . . . . . . . . . 464
implementation-defined behavior in C89 . . . . . . . . . . . . . 629 compiler
__CLREX (intrinsic function). . . . . . . . . . . . . . . . . . . . . . 416 environment variables . . . . . . . . . . . . . . . . . . . . . . . . . 251
clustering (compiler transformation) . . . . . . . . . . . . . . . . . 239 invocation syntax . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 249
disabling (--no_clustering) . . . . . . . . . . . . . . . . . . . . . . 287 output from . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 252
__CLZ (intrinsic function) . . . . . . . . . . . . . . . . . . . . . . . . 417 compiler listing, generating (-l). . . . . . . . . . . . . . . . . . . . . 283
cmain (system initialization code) compiler object file . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 62
in DLIB . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 145 including debug information in (--debug, -r) . . . . . . . . 272
cmath (DLIB header file) . . . . . . . . . . . . . . . . . . . . . . . . . 478 output from compiler . . . . . . . . . . . . . . . . . . . . . . . . . . 252
CMSE . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 222 compiler optimization levels . . . . . . . . . . . . . . . . . . . . . . . 236
--cmse (compiler option). . . . . . . . . . . . . . . . . . . . . . . . . . 269 compiler options . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 259
__cmse_nonsecure_call (extended keyword) . . . . . . . . . . 370 passing to compiler . . . . . . . . . . . . . . . . . . . . . . . . . . . 250
__cmse_nonsecure_entry (extended keyword) . . . . . . . . . 371 reading from file (-f) . . . . . . . . . . . . . . . . . . . . . . . . . . 280
CMSIS integration . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 221 reading from file (--f) . . . . . . . . . . . . . . . . . . . . . . . . . . 281
code specifying parameters . . . . . . . . . . . . . . . . . . . . . . . . . 261
Arm and Thumb, overview . . . . . . . . . . . . . . . . . . . . . . 78 summary . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 261
facilitating for good generation of . . . . . . . . . . . . . . . . 240 syntax. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 259
interruption of execution . . . . . . . . . . . . . . . . . . . . . . . . 80 for creating skeleton code . . . . . . . . . . . . . . . . . . . . . . 174
--code (ielfdump option) . . . . . . . . . . . . . . . . . . . . . . . . . . 556 instruction scheduling . . . . . . . . . . . . . . . . . . . . . . . . . 240
code motion (compiler transformation) . . . . . . . . . . . . . . . 238 --warnings_affect_exit_code . . . . . . . . . . . . . . . . . . . . 253
disabling (--no_code_motion) . . . . . . . . . . . . . . . . . . . 287 compiler platform, identifying . . . . . . . . . . . . . . . . . . . . . 465
codecvt (library header file) . . . . . . . . . . . . . . . . . . . . . . . 475 compiler transformations . . . . . . . . . . . . . . . . . . . . . . . . . 234
codeseg (pragma directive) . . . . . . . . . . . . . . . . . . . . 608, 625 compiler version number . . . . . . . . . . . . . . . . . . . . . . . . . 468
command line options compiling
See also compiler options from the command line . . . . . . . . . . . . . . . . . . . . . . . . . 69
See also linker options syntax. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 249
part of compiler invocation syntax . . . . . . . . . . . . . . . . 249
635
AFE1_AFE2-1:1
complex (library header file). . . . . . . . . . . . . . . . . . . . . . . 475 __cplusplus (predefined symbol) . . . . . . . . . . . . . . . . . . . 463
complex.h (library header file) . . . . . . . . . . . . . . . . . . . . . 474 cplusplus_neutral (pragma directive) . . . . . . . . . . . . . . . . 608
computer style, typographic convention . . . . . . . . . . . . . . . 48 --cpp_init_routine (linker option) . . . . . . . . . . . . . . . . . . . 318
concatenating strings. . . . . . . . . . . . . . . . . . . . . . . . . 194, 202 --cpu (compiler option) . . . . . . . . . . . . . . . . . . . . . . . . . . . 270
concatenating wide string literals with different encoding --cpu (linker option) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 319
types __CPU_MODE__ (predefined symbol) . . . . . . . . . . . . . . 464
implementation-defined behavior in C . . . . . . . . . . . . . 603 --cpu_mode (compiler option) . . . . . . . . . . . . . . . . . . . . . 271
condition_variable (library header file) . . . . . . . . . . . . . . . 476 CPU, specifying on command line for compiler . . . . . . . . 270
--config (linker option) . . . . . . . . . . . . . . . . . . . . . . . . . . . 317 __crc32b (intrinsic function) . . . . . . . . . . . . . . . . . . . . . . . 417
configuration __crc32cb (intrinsic function) . . . . . . . . . . . . . . . . . . . . . . 418
basic project settings . . . . . . . . . . . . . . . . . . . . . . . . . . . 69 __crc32cd (intrinsic function) . . . . . . . . . . . . . . . . . . . . . . 418
__low_level_init . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 148 __crc32ch (intrinsic function) . . . . . . . . . . . . . . . . . . . . . . 418
configuration file for linker.See linker configuration file __crc32cw (intrinsic function) . . . . . . . . . . . . . . . . . . . . . 418
configuration symbols __crc32d (intrinsic function) . . . . . . . . . . . . . . . . . . . . . . . 417
for file input and output . . . . . . . . . . . . . . . . . . . . . . . . 159 __crc32h (intrinsic function) . . . . . . . . . . . . . . . . . . . . . . . 417
in library configuration files. . . . . . . . . . . . . . . . . . . . . 132 __crc32w (intrinsic function) . . . . . . . . . . . . . . . . . . . . . . 417
in linker configuration files . . . . . . . . . . . . . . . . . . . . . 511 --create (iarchive option). . . . . . . . . . . . . . . . . . . . . . . . . . 556
specifying for linker . . . . . . . . . . . . . . . . . . . . . . . . . . . 317 csetjmp (DLIB header file) . . . . . . . . . . . . . . . . . . . . . . . . 478
--config_def (linker option) . . . . . . . . . . . . . . . . . . . . . . . 317 csignal (DLIB header file) . . . . . . . . . . . . . . . . . . . . . . . . 478
--config_search (linker option) . . . . . . . . . . . . . . . . . . . . . 318 cspy_support (pragma directive) . . . . . . . . . . . . . . . . 608, 625
consistency, module . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 119 CSTACK (ELF block) . . . . . . . . . . . . . . . . . . . . . . . . . . . 518
const See also stack
declaring objects . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 363 setting up size for . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 111
constseg (pragma directive) . . . . . . . . . . . . . . . . . . . 608, 625 cstartup (system startup code)
contents, of this guide . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 44 customizing system initialization . . . . . . . . . . . . . . . . . 148
control characters source files for (DLIB). . . . . . . . . . . . . . . . . . . . . . . . . 145
implementation-defined behavior in C . . . . . . . . . . . . . 616 cstat_disable (pragma directive) . . . . . . . . . . . . . . . . . . . . 383
conventions, used in this guide . . . . . . . . . . . . . . . . . . . . . . 48 cstat_dump (pragma directive) . . . . . . . . . . . . . . . . . . . . . 608
copyright notice . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2 cstat_enable (pragma directive) . . . . . . . . . . . . . . . . . . . . 383
__CORE__ (predefined symbol). . . . . . . . . . . . . . . . . . . . 463 cstat_restore (pragma directive) . . . . . . . . . . . . . . . . . . . . 383
core cstat_suppress (pragma directive) . . . . . . . . . . . . . . . . . . . 383
identifying . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 463 cstdalign (DLIB header file) . . . . . . . . . . . . . . . . . . . . . . . 478
selecting . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 70 cstdarg (DLIB header file) . . . . . . . . . . . . . . . . . . . . . . . . 478
Cortex-M7 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 221 cstdbool (DLIB header file) . . . . . . . . . . . . . . . . . . . . . . . 478
Cortex, special considerations for interrupt functions . . . . . 79 cstddef (DLIB header file) . . . . . . . . . . . . . . . . . . . . . . . . 478
cos (library function) . . . . . . . . . . . . . . . . . . . . . . . . . . . . 472 cstdio (DLIB header file) . . . . . . . . . . . . . . . . . . . . . . . . . 478
cos (library routine) . . . . . . . . . . . . . . . . . . . . . . . . . 143–144 cstdlib (DLIB header file) . . . . . . . . . . . . . . . . . . . . . . . . . 478
cosf (library routine) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 144 cstdnoreturn (DLIB header file) . . . . . . . . . . . . . . . . . . . . 478
cosl (library routine) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 144 cstring (DLIB header file) . . . . . . . . . . . . . . . . . . . . . . . . . 478
__COUNTER__ (predefined symbol). . . . . . . . . . . . . . . . 463
AFE1_AFE2-1:1
Index
637
AFE1_AFE2-1:1
define section (linker directive) . . . . . . . . . . . . . . . . . . . . 494 isymexport . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 546
define symbol (linker directive) . . . . . . . . . . . . . . . . . . . . 511 --diagnostics_tables (compiler option) . . . . . . . . . . . . . . . 276
--define_symbol (linker option) . . . . . . . . . . . . . . . . . . . . 320 --diagnostics_tables (linker option) . . . . . . . . . . . . . . . . . . 322
define_type_info (pragma directive) . . . . . . . . . . . . . 608, 625 diagnostics, implementation-defined behavior . . . . . . . . . 599
define_without_bounds (pragma directive) . . . . . . . . . . . . 384 diagnostics, implementation-defined behavior for C++ . . 579
define_with_bounds (pragma directive) . . . . . . . . . . . . . . 384 diag_default (pragma directive) . . . . . . . . . . . . . . . . . . . . 391
--delete (iarchive option). . . . . . . . . . . . . . . . . . . . . . . . . . 556 --diag_error (compiler option) . . . . . . . . . . . . . . . . . . . . . 274
delete (keyword) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 75 --diag_error (linker option) . . . . . . . . . . . . . . . . . . . . . . . . 321
denormalized numbers. See subnormal numbers --no_fragments (compiler option) . . . . . . . . . . . . . . . . . . . 288
--dependencies (compiler option) . . . . . . . . . . . . . . . . . . . 273 --no_fragments (linker option) . . . . . . . . . . . . . . . . . . . . . 335
--dependencies (linker option) . . . . . . . . . . . . . . . . . . . . . 320 diag_error (pragma directive) . . . . . . . . . . . . . . . . . . . . . . 392
deprecated (pragma directive) . . . . . . . . . . . . . . . . . . . . . . 391 --diag_remark (compiler option) . . . . . . . . . . . . . . . . . . . . 275
--deprecated_feature_warnings (compiler option). . . . . . . 274 --diag_remark (linker option) . . . . . . . . . . . . . . . . . . . . . . 321
deque (library header file) . . . . . . . . . . . . . . . . . . . . . . . . . 476 diag_remark (pragma directive) . . . . . . . . . . . . . . . . . . . . 392
destructors and interrupts, using . . . . . . . . . . . . . . . . . . . . 199 --diag_suppress (compiler option) . . . . . . . . . . . . . . . . . . 275
device description files, preconfigured for C-SPY . . . . . . . 56 --diag_suppress (linker option) . . . . . . . . . . . . . . . . . . . . . 322
devices, interactive diag_suppress (pragma directive) . . . . . . . . . . . . . . . . . . . 393
implementation-defined behavior for C++ . . . . . . . . . . 580 --diag_warning (compiler option) . . . . . . . . . . . . . . . . . . . 276
diagnostic messages . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 256 --diag_warning (linker option) . . . . . . . . . . . . . . . . . . . . . 322
classifying as compilation errors . . . . . . . . . . . . . . . . . 274 diag_warning (pragma directive) . . . . . . . . . . . . . . . . . . . 393
classifying as compilation remarks . . . . . . . . . . . . . . . 275 directives
classifying as compiler warnings . . . . . . . . . . . . . . . . . 276 pragma . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 57, 383
classifying as errors . . . . . . . . . . . . . . . . . . . . . . . 288, 335 to the linker . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 483
classifying as linker warnings . . . . . . . . . . . . . . . . . . . 322 directory, specifying as parameter . . . . . . . . . . . . . . . . . . 260
classifying as linking errors . . . . . . . . . . . . . . . . . . . . . 321 disable_check (pragma directive) . . . . . . . . . . . . . . . . . . . 384
classifying as linking remarks . . . . . . . . . . . . . . . . . . . 321 __disable_fiq (intrinsic function) . . . . . . . . . . . . . . . . . . . 418
disabling compiler warnings . . . . . . . . . . . . . . . . . . . . 295 __disable_interrupt (intrinsic function) . . . . . . . . . . . . . . . 418
disabling linker warnings . . . . . . . . . . . . . . . . . . . . . . . 338 __disable_irq (intrinsic function) . . . . . . . . . . . . . . . . . . . 419
disabling wrapping of in compiler . . . . . . . . . . . . . . . . 295 --disasm_data (ielfdump option) . . . . . . . . . . . . . . . . . . . . 557
disabling wrapping of in linker . . . . . . . . . . . . . . . . . . 338 --discard_unused_publics (compiler option) . . . . . . . . . . . 276
enabling compiler remarks . . . . . . . . . . . . . . . . . . . . . . 300 disclaimer . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2
enabling linker remarks . . . . . . . . . . . . . . . . . . . . . . . . 341 DLIB. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 473
listing all used by compiler . . . . . . . . . . . . . . . . . . . . . 276 configurations . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 134
listing all used by linker . . . . . . . . . . . . . . . . . . . . . . . . 322 configuring . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 131, 277
suppressing in compiler . . . . . . . . . . . . . . . . . . . . . . . . 275 naming convention . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 49
suppressing in linker . . . . . . . . . . . . . . . . . . . . . . . . . . 322 reference information. See the online help system . . . . 471
diagnostics runtime environment . . . . . . . . . . . . . . . . . . . . . . . . . . 123
iarchive . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 533 --dlib_config (compiler option). . . . . . . . . . . . . . . . . . . . . 277
iobjmanip . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 539 DLib_Defaults.h (library configuration file) . . . . . . . . . . . 132
AFE1_AFE2-1:1
Index
639
AFE1_AFE2-1:1
errno.h (library header file) . . . . . . . . . . . . . . . . . . . . . . . . 474 __exit (library function) . . . . . . . . . . . . . . . . . . . . . . . . . . 147
error checking (C-RUN), documentation for . . . . . . . . . . . 46 exp (library routine) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 143
error messages . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 257 expf (library routine) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 144
classifying . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 288, 335 expl (library routine) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 144
classifying for compiler . . . . . . . . . . . . . . . . . . . . . . . . 274 export (linker directive) . . . . . . . . . . . . . . . . . . . . . . . . . . 512
classifying for linker . . . . . . . . . . . . . . . . . . . . . . . . . . 321 --export_builtin_config (linker option) . . . . . . . . . . . . . . . 326
range . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 117 expressions (in linker configuration file) . . . . . . . . . . . . . 512
error return codes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 253 extended alignment,
error (linker directive) . . . . . . . . . . . . . . . . . . . . . . . . . . . . 514 implementation-defined behavior for C++ . . . . . . . . . . . . 591
error (pragma directive) . . . . . . . . . . . . . . . . . . . . . . . . . . 393 extended command line file
errors and warnings, for compiler . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 280–281
listing all used by the compiler (--diagnostics_tables) . . . 276 for linker . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 326–327
error_category, implementation-defined behavior for C++589 passing options . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 250
--error_limit (compiler option) . . . . . . . . . . . . . . . . . . . . . 280 extended keywords . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 365
--error_limit (linker option) . . . . . . . . . . . . . . . . . . . . . . . 325 enabling (-e) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 278
escape sequences overview . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 57
implementation-defined behavior for C++ . . . . . . . . . . 582 summary . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 368
implementation-defined behavior in C . . . . . . . . . . . . . 602 syntax
exception flags, for floating-point values . . . . . . . . . . . . . 357 object attributes . . . . . . . . . . . . . . . . . . . . . . . . . . . . 368
exception (library header file) . . . . . . . . . . . . . . . . . . . . . . 476 type attributes on data objects . . . . . . . . . . . . . . . . . 366
__EXCEPTIONS__ (predefined symbol) . . . . . . . . . . . . . 464 type attributes on functions . . . . . . . . . . . . . . . . . . . 367
exceptions, code for in section . . . . . . . . . . . . . . . . . . . . . 519 extended-selectors (in linker configuration file) . . . . . . . . 509
exception_neutral (pragma directive) . . . . . . . . . . . . . . . . 608 extern "C" linkage. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 198
--exception_tables (linker option) . . . . . . . . . . . . . . . . . . . 325 --extract (iarchive option) . . . . . . . . . . . . . . . . . . . . . . . . . 557
exception::what, --extra_init (linker option) . . . . . . . . . . . . . . . . . . . . . . . . 326
implementation-defined behavior for C++ . . . . . . . . . . . . 590
exclude (stack usage control directive) . . . . . . . . . . . . . . . 524
.exc.text (ELF section) . . . . . . . . . . . . . . . . . . . . . . . . . . . 519 F
execution character set, -f (compiler option). . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 280
implementation-defined behavior in C . . . . . . . . . . . . . . . 601 -f (IAR utility option) . . . . . . . . . . . . . . . . . . . . . . . . . . . . 558
execution character -f (linker option) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 326
set, implementation-defined behavior for C++ . . . . . . . . . 581
--f (compiler option) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 281
execution wide-
--f (linker option) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 327
character set, implementation-defined behavior for C++ . 581
fast interrupts . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 82
_Exit (library function) . . . . . . . . . . . . . . . . . . . . . . . . . . . 147
fatal error messages . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 258
exit (library function) . . . . . . . . . . . . . . . . . . . . . . . . . . . . 147
fdopen, in stdio.h . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 480
implementation-defined behavior for C++ . . . . . . . . . . 589
FENV_ACCESS, implementation-defined behavior in C . 604
implementation-defined behavior in C . . . . . . . . . . . . . 613
fenv.h (library header file) . . . . . . . . . . . . . . . . . . . . 474, 478
implementation-defined behavior in C89 . . . . . . . . . . . 629
_exit (library function) . . . . . . . . . . . . . . . . . . . . . . . . . . . 147
AFE1_AFE2-1:1
Index
641
AFE1_AFE2-1:1
__func__ (predefined symbol) . . . . . . . . . . . . . . . . . . . . . 464
implementation-defined behavior for C++ . . . . . . . . . . 586 G
__FUNCTION__ (predefined symbol) . . . . . . . . . . . . . . . 465 -g (ielfdump option) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 570
function calls GCC attributes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 380
calling convention . . . . . . . . . . . . . . . . . . . . . . . . . . . . 175 generate_entry_without_bounds (pragma directive) . . . . . 384
eliminating overhead of by inlining . . . . . . . . . . . . . . . . 86 --generate_vfe_header (isymexport option) . . . . . . . . . . . 560
preserved registers across. . . . . . . . . . . . . . . . . . . . . . . 177 getw, in stdio.h . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 480
function declarations, Kernighan & Ritchie . . . . . . . . . . . 242 getzone (library function), configuring support for . . . . . . 130
function execution, in RAM . . . . . . . . . . . . . . . . . . . . . . . . 78 __get_BASEPRI (intrinsic function) . . . . . . . . . . . . . . . . 420
function inlining . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 121 __get_CONTROL (intrinsic function) . . . . . . . . . . . . . . . 421
function inlining (compiler transformation) . . . . . . . . . . . 238 __get_CPSR (intrinsic function) . . . . . . . . . . . . . . . . . . . . 421
disabling (--no_inline) . . . . . . . . . . . . . . . . . . . . . . . . . 289 __get_FAULTMASK (intrinsic function) . . . . . . . . . . . . . 421
function pointer to object pointer conversion, __get_FPSCR (intrinsic function) . . . . . . . . . . . . . . . . . . . 421
implementation-defined behavior for C++ . . . . . . . . . . . . 585 __get_interrupt_state (intrinsic function) . . . . . . . . . . . . . 422
function pointers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 358 __get_IPSR (intrinsic function) . . . . . . . . . . . . . . . . . . . . 422
function prototypes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 241 __get_LR (intrinsic function) . . . . . . . . . . . . . . . . . . . . . . 422
enforcing . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 300 __get_MSP (intrinsic function) . . . . . . . . . . . . . . . . . . . . . 423
function (pragma directive) . . . . . . . . . . . . . . . . . . . . 608, 625 get_pointer_safety,
function (stack usage control directive) . . . . . . . . . . . . . . 524 implementation-defined behavior for C++ . . . . . . . . . . . . 590
functional (library header file) . . . . . . . . . . . . . . . . . . . . . 476 __get_PRIMASK (intrinsic function) . . . . . . . . . . . . . . . . 423
functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 77 __get_PSP (intrinsic function) . . . . . . . . . . . . . . . . . . . . . 423
declaring . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 176, 241 __get_PSR (intrinsic function) . . . . . . . . . . . . . . . . . . . . . 423
inlining. . . . . . . . . . . . . . . . . . . . . . . . . . . . . 238, 241, 395 __get_SB (intrinsic function) . . . . . . . . . . . . . . . . . . . . . . 423
interrupt . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 80 __get_SP (intrinsic function) . . . . . . . . . . . . . . . . . . . . . . 424
intrinsic . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 163, 241 global variables
parameters . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 178 affected by static clustering . . . . . . . . . . . . . . . . . . . . . 239
placing in memory . . . . . . . . . . . . . . . . . . . . 230, 232, 303 handled during system termination . . . . . . . . . . . . . . . 147
recursive hints for not using . . . . . . . . . . . . . . . . . . . . . . . . . . . . 240
avoiding . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 241 initialized during system startup . . . . . . . . . . . . . . . . . 146
storing data on stack . . . . . . . . . . . . . . . . . . . . . . . . . 74 GRP_COMDAT, group type . . . . . . . . . . . . . . . . . . . . . . 540
reentrancy (DLIB) . . . . . . . . . . . . . . . . . . . . . . . . . . . . 472 --guard_calls (compiler option). . . . . . . . . . . . . . . . . . . . . 282
related extensions. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 77 guidelines, reading . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 43
return values from . . . . . . . . . . . . . . . . . . . . . . . . . . . . 179
function_category (pragma directive) . . . . . . . . . . . . 394, 608
function_effects (pragma directive) . . . . . . . . . . . . . 608, 625
function-spec (in stack usage control file). . . . . . . . . . . . . 527
H
Harbison, Samuel P. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 47
future (library header file) . . . . . . . . . . . . . . . . . . . . . . . . . 476
hardware support in compiler . . . . . . . . . . . . . . . . . . . . . . 123
hash_map (library header file) . . . . . . . . . . . . . . . . . . . . . 476
hash_set (library header file). . . . . . . . . . . . . . . . . . . . . . . 476
AFE1_AFE2-1:1
Index
643
AFE1_AFE2-1:1
__iar_sin_smalll (library routine) . . . . . . . . . . . . . . . . . . . 144 important_typedef (pragma directive) . . . . . . . . . . . . 608, 625
__IAR_SYSTEMS_ICC__ (predefined symbol) . . . . . . . 465 --import_cmse_lib_in (linker option) . . . . . . . . . . . . . . . . 329
__iar_tan_accurate (library routine) . . . . . . . . . . . . . . . . . 144 --import_cmse_lib_out (linker option) . . . . . . . . . . . . . . . 329
__iar_tan_accuratef (library routine). . . . . . . . . . . . . . . . . 144 #include directive,
__iar_tan_accuratef (library function). . . . . . . . . . . . . . . . 472 implementation-defined behavior for C++ . . . . . . . . . . . . 588
__iar_tan_accuratel (library routine) . . . . . . . . . . . . . . . . . 144 include files
__iar_tan_accuratel (library function) . . . . . . . . . . . . . . . . 472 including before source files . . . . . . . . . . . . . . . . . . . . 298
__iar_tan_small (library routine) . . . . . . . . . . . . . . . . . . . 143 search procedure implementation for C++ . . . . . . . . . . 588
__iar_tan_smallf (library routine) . . . . . . . . . . . . . . . . . . . 144 specifying . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 251
__iar_tan_smalll (library routine) . . . . . . . . . . . . . . . . . . . 144 include (linker directive) . . . . . . . . . . . . . . . . . . . . . . . . . . 515
__iar_tls.$$DATA (ELF section) . . . . . . . . . . . . . . . . . . . 519 include_alias (pragma directive) . . . . . . . . . . . . . . . . . . . . 394
.iar.debug (ELF section) . . . . . . . . . . . . . . . . . . . . . . . . . . 518 infinity . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 358
.iar.dynexit (ELF section) . . . . . . . . . . . . . . . . . . . . . . . . . 520 infinity (style for printing), implementation-defined
IA64 ABI . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 218 behavior in C . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 612
__ICCARM__ (predefined symbol) . . . . . . . . . . . . . . . . . 465 initialization
icons changing default. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 112
in this guide . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 49 C++ dynamic . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 98
IDE dynamic . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 145
building a library from . . . . . . . . . . . . . . . . . . . . . . . . . 132 manual . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 113
overview of build tools . . . . . . . . . . . . . . . . . . . . . . . . . 53 packing algorithm for. . . . . . . . . . . . . . . . . . . . . . . . . . 113
ident (pragma directive) . . . . . . . . . . . . . . . . . . . . . . . . . . 608 single-value . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 193
identifiers suppressing . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 112
implementation-defined behavior in C . . . . . . . . . . . . . 601 initialization_routine (pragma directive) . . . . . . . . . . . . . . 608
implementation-defined behavior in C89 . . . . . . . . . . . 620 initialize (linker directive). . . . . . . . . . . . . . . . . . . . . . . . . 498
reserved . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 256 initializers, static . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 192
IEEE format, floating-point values . . . . . . . . . . . . . . . . . . 356 initializer_list (library header file) . . . . . . . . . . . . . . . . . . 476
ielfdump . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 536 .init_array (section) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 520
options summary . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 537 init_routines_only_for_needed_variables
ielftool . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 535 (pragma directive) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 608
options summary . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 536 --inline (linker option) . . . . . . . . . . . . . . . . . . . . . . . . . . . 330
iexe2obj . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 547 inline assembler . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 164
if (linker directive) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 514 avoiding . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 241
--ignore_uninstrumented_pointers (linker option). . . . . . . 312 for passing values between C and assembler . . . . . . . . 244
--ihex (ielftool option) . . . . . . . . . . . . . . . . . . . . . . . . . . . 560 See also assembler language interface
ILINK options. See linker options inline functions
ILINKARM_CMD_LINE (environment variable) . . . . . . 251 in compiler . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 238
ILINK. See linker inline (pragma directive) . . . . . . . . . . . . . . . . . . . . . . . . . . 395
--image_input (linker option) . . . . . . . . . . . . . . . . . . . . . . 328 inline_template (pragma directive) . . . . . . . . . . . . . . . . . . 608
implements_aspect (pragma directive) . . . . . . . . . . . . . . . 608 inlining . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 121
inlining functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 86
AFE1_AFE2-1:1
Index
645
AFE1_AFE2-1:1
keep_definition (pragma directive) . . . . . . . . . . . . . . 608, 626 libraries, required
--keep_mode_symbols (iexe2obj option) . . . . . . . . . . . . . 561 (implementation-defined behavior for C++) . . . . . . . . . . . 579
Kernighan & Ritchie function declarations . . . . . . . . . . . . 242 library configuration files
disallowing . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 300 DLIB . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 134
keywords . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 365 DLib_Defaults.h . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 132
extended, overview of . . . . . . . . . . . . . . . . . . . . . . . . . . 57 modifying . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 132
specifying . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 277
library documentation . . . . . . . . . . . . . . . . . . . . . . . . . . . . 471
L library files, linker search path to (--search) . . . . . . . . . . . 342
-L (linker option) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 341 library functions
-l (compiler option) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 283 summary, DLIB . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 474
for creating skeleton code . . . . . . . . . . . . . . . . . . . . . . 174 online help for . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 46
labels. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 192 library header files . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 471
assembler, making public . . . . . . . . . . . . . . . . . . . . . . . 299 library modules
__iar_program_start . . . . . . . . . . . . . . . . . . . . . . . . . . . 145 introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 90
__program_start . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 145 overriding . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 131
Labrosse, Jean J. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 47 library object files . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 472
language extensions library project, building using a template . . . . . . . . . . . . . 132
enabling using pragma . . . . . . . . . . . . . . . . . . . . . . . . . 395 library_default_requirements (pragma directive) . . . 608, 626
enabling (-e) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 278 library_provides (pragma directive) . . . . . . . . . . . . . 608, 626
language overview . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 55 library_requirement_override (pragma directive) . . . 608, 626
language (pragma directive) . . . . . . . . . . . . . . . . . . . . . . . 395 lightbulb icon, in this guide. . . . . . . . . . . . . . . . . . . . . . . . . 49
__LDC (intrinsic function) . . . . . . . . . . . . . . . . . . . . . . . . 424 limits (library header file) . . . . . . . . . . . . . . . . . . . . . . . . . 476
__LDCL (intrinsic function) . . . . . . . . . . . . . . . . . . . . . . . 424 limits.h (library header file) . . . . . . . . . . . . . . . . . . . . . . . 474
__LDCL_noidx (intrinsic function) . . . . . . . . . . . . . . . . . 425 __LINE__ (predefined symbol) . . . . . . . . . . . . . . . . . . . . 465
__LDC_noidx (intrinsic function) . . . . . . . . . . . . . . . . . . . 425 linkage, C and C++ . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 176
__LDC2 (intrinsic function) . . . . . . . . . . . . . . . . . . . . . . . 424 implementation-defined behavior for C++ . . 586–587, 589
__LDC2L (intrinsic function) . . . . . . . . . . . . . . . . . . . . . . 424 linker. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 89
__LDC2L_noidx (intrinsic function) . . . . . . . . . . . . . . . . 425 output from . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 254
__LDC2_noidx (intrinsic function) . . . . . . . . . . . . . . . . . . 425 linker configuration file
__LDREX (intrinsic function) . . . . . . . . . . . . . . . . . . . . . 426 for placing code and data . . . . . . . . . . . . . . . . . . . . . . . . 93
__LDREXB (intrinsic function) . . . . . . . . . . . . . . . . . . . . 426 in depth . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 483, 523
__LDREXD (intrinsic function) . . . . . . . . . . . . . . . . . . . . 426 overview of . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 483, 523
__LDREXH (intrinsic function) . . . . . . . . . . . . . . . . . . . . 426 selecting . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 107
--legacy (compiler option) . . . . . . . . . . . . . . . . . . . . . . . . 284 linker object executable image
libraries . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 221 specifying filename of (-o) . . . . . . . . . . . . . . . . . . . . . . . . 339
reason for using . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 62 linker optimizations . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 121
using a prebuilt . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 135 duplicate section merging . . . . . . . . . . . . . . . . . . . . . . 121
small function inlining . . . . . . . . . . . . . . . . . . . . . . . . . 121
virtual function elimination . . . . . . . . . . . . . . . . . . . . . 121
AFE1_AFE2-1:1
Index
linker options . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 311 long long (data type) signed and unsigned . . . . . . . . . . . . 351
reading from file (-f) . . . . . . . . . . . . . . . . . . . . . . . . . . 326 long (data type) signed and unsigned . . . . . . . . . . . . . . . . 351
reading from file (--f) . . . . . . . . . . . . . . . . . . . . . . . . . . 327 longjmp, restrictions for using . . . . . . . . . . . . . . . . . . . . . 473
summary . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 311 loop unrolling (compiler transformation) . . . . . . . . . . . . . 238
typographic convention . . . . . . . . . . . . . . . . . . . . . . . . . 48 disabling . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 294
linking #pragma unroll . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 406
from the command line . . . . . . . . . . . . . . . . . . . . . . . . . 69 loop-invariant expressions . . . . . . . . . . . . . . . . . . . . . . . . 238
in the build process . . . . . . . . . . . . . . . . . . . . . . . . . . . . 62 __low_level_init . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 145
introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 89 customizing . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 148
process for . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 91 initialization phase . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 65
list (library header file) . . . . . . . . . . . . . . . . . . . . . . . . . . . 476 low_level_init.c . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 145
listing, generating . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 283 low-level processor operations . . . . . . . . . . . . . . . . . . . . . 188
literature, recommended . . . . . . . . . . . . . . . . . . . . . . . . . . . 47 accessing . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 163
__LITTLE_ENDIAN__ (predefined symbol) . . . . . . . . . . 465 lvalue-to-rvalue
__little_endian (extended keyword) . . . . . . . . . . . . . . . . . 372 conversion, implementation-defined behavior for C++ . . . 584
little-endian (byte order) . . . . . . . . . . . . . . . . . . . . . . . . . . . 70 lz77, packing algorithm for initializers . . . . . . . . . . . . . . . 499
local symbols, removing from ELF image . . . . . . . . . . . . 337
local variables, See auto variables
locale M
changing at runtime . . . . . . . . . . . . . . . . . . . . . . . . . . . 160 macros
implementation-defined behavior for C++ . . . . . . . . . . 592 embedded in #pragma optimize . . . . . . . . . . . . . . . . . . 399
implementation-defined behavior in C . . . . . . . . . 603, 615 ERANGE (in errno.h) . . . . . . . . . . . . . . . . . . . . . 610, 627
library header file . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 476 inclusion of assert . . . . . . . . . . . . . . . . . . . . . . . . . . . . 468
support for . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 159 NULL, implementation-defined behavior
locale object, implementation-defined behavior for C++ . 592 in C89 for DLIB . . . . . . . . . . . . . . . . . . . . . . . . . . . 626
locale.h (library header file) . . . . . . . . . . . . . . . . . . . . . . . 474 NULL, implementation-defined behavior in C . . . . . . 611
located data, declaring extern . . . . . . . . . . . . . . . . . . . . . . 232 substituted in #pragma directives . . . . . . . . . . . . . . . . . 188
location (pragma directive) . . . . . . . . . . . . . . . . . . . . 231, 396 --macro_positions_in_diagnostics (compiler option) . . . . 284
--log (linker option) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 331 main (function)
log (library routine). . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 143 definition (C89) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 619
logf (library routine) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 144 implementation-defined behavior for C++ . . . . . . 582–583
logical (linker directive) . . . . . . . . . . . . . . . . . . . . . . . . . . 486 implementation-defined behavior in C . . . . . . . . . . . . . 600
logl (library routine) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 144 --make_all_definitions_weak (compiler option) . . . . . . . . 285
--log_file (linker option) . . . . . . . . . . . . . . . . . . . . . . . . . . 331 malloc (library function)
log10 (library routine) . . . . . . . . . . . . . . . . . . . . . . . . . . . . 143 See also heap . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 75
log10f (library routine) . . . . . . . . . . . . . . . . . . . . . . . . . . . 144 implementation-defined behavior in C89 . . . . . . . . . . . 628
log10l (library routine) . . . . . . . . . . . . . . . . . . . . . . . . . . . 144 --mangled_names_in_messages (linker option) . . . . . . . . 332
long double (data type) . . . . . . . . . . . . . . . . . . . . . . . . . . . 356 Mann, Bernhard . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 47
long float (data type), synonym for double . . . . . . . . . . . . 192 --manual_dynamic_initialization (linker option) . . . . . . . . 332
647
AFE1_AFE2-1:1
-map (linker option) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 332 messages::do_close,
map file, producing . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 332 implementation-defined behavior for C++ . . . . . . . . . . . . 592
map (library header file) . . . . . . . . . . . . . . . . . . . . . . . . . . 476 messages::do_get,
math functions rounding mode, implementation-defined behavior for C++ . . . . . . . . . . . . 592
implementation-defined behavior in C . . . . . . . . . . . . . . . 614 messages::do_open,
math functions (library functions) . . . . . . . . . . . . . . . . . . . 143 implementation-defined behavior for C++ . . . . . . . . . . . . 592
math.h (library header file) . . . . . . . . . . . . . . . . . . . . . . . . 474 Meyers, Scott . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 47
max recursion depth (stack usage control directive) . . . . . 525 --mfc (compiler option). . . . . . . . . . . . . . . . . . . . . . . . . . . 286
--max_cost_constexpr_call (compiler option) . . . . . . . . . . 285 migration, from earlier IAR compilers . . . . . . . . . . . . . . . . 46
--max_depth_constexpr_call (compiler option) . . . . . . . . 285 MISRA C
MB_LEN_MAX, implementation-defined behavior in C . 614 documentation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 46
__MCR (intrinsic function) . . . . . . . . . . . . . . . . . . . . . . . . 426 --misrac (compiler option) . . . . . . . . . . . . . . . . . . . . . . . . 263
__MCRR (intrinsic function) . . . . . . . . . . . . . . . . . . . . . . 427 --misrac (linker option) . . . . . . . . . . . . . . . . . . . . . . . . . . . 313
__MCRR2 (intrinsic function) . . . . . . . . . . . . . . . . . . . . . 427 --misrac_verbose (compiler option) . . . . . . . . . . . . . . . . . 264
__MCR2 (intrinsic function) . . . . . . . . . . . . . . . . . . . . . . . 426 --misrac_verbose (linker option) . . . . . . . . . . . . . . . . . . . . 313
memory --misrac1998 (compiler option) . . . . . . . . . . . . . . . . . . . . 263
allocating in C++ . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 75 --misrac1998 (linker option) . . . . . . . . . . . . . . . . . . . . . . . 313
dynamic . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 75 --misrac2004 (compiler option) . . . . . . . . . . . . . . . . . . . . 263
heap . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 75 --misrac2004 (linker option) . . . . . . . . . . . . . . . . . . . . . . . 313
non-initialized . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 244 mode changing, implementation-defined behavior in C . . 612
RAM, saving . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 241 module consistency . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 119
releasing in C++. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 75 rtmodel. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 402
stack . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 74 modules, introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 90
saving . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 241 module_name (pragma directive) . . . . . . . . . . . . . . . 608, 626
used by global or static variables . . . . . . . . . . . . . . . . . . 73 module-spec (in stack usage control file) . . . . . . . . . . . . . 527
memory clobber . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 165 Motorola S-records . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 205
memory map __MRC (intrinsic function). . . . . . . . . . . . . . . . . . . . . . . . 428
initializing SFRs . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 148 __MRC2 (intrinsic function) . . . . . . . . . . . . . . . . . . . . . . . 428
linker configuration for . . . . . . . . . . . . . . . . . . . . . . . . 108 __MRRC (intrinsic function) . . . . . . . . . . . . . . . . . . . . . . 428
output from linker . . . . . . . . . . . . . . . . . . . . . . . . . . . . 254 __MRRC2 (intrinsic function) . . . . . . . . . . . . . . . . . . . . . 428
producing (--map) . . . . . . . . . . . . . . . . . . . . . . . . . . . . 332 multibyte characters
memory (library header file) . . . . . . . . . . . . . . . . . . . . . . . 476 implementation-defined behavior for C++ . . . . . . . . . . 591
memory (pragma directive) . . . . . . . . . . . . . . . . . . . . 608, 626 implementation-defined behavior in C . . . . . . . . . 601, 615
merge duplicate sections . . . . . . . . . . . . . . . . . . . . . . . . . . 121 multithreaded environment . . . . . . . . . . . . . . . . . . . . . . . . 160
-merge_duplicate_sections (linker option) . . . . . . . . . . . . 333 multi-character literals,
message (pragma directive) . . . . . . . . . . . . . . . . . . . . . . . 397 value of (implementation-defined behavior for C++) . . . . 581
messages multi-file compilation . . . . . . . . . . . . . . . . . . . . . . . . . . . . 235
disabling . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 303, 342 multi-threaded environment
forcing . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 397 implementation-defined behavior in C . . . . . . . . . . . . . 600
mutex (library header file) . . . . . . . . . . . . . . . . . . . . . . . . 476
AFE1_AFE2-1:1
Index
649
AFE1_AFE2-1:1
--no_tbaa (compiler option) . . . . . . . . . . . . . . . . . . . . . . . 293 --only_stdout (linker option) . . . . . . . . . . . . . . . . . . . . . . . 338
--no_typedefs_in_diagnostics (compiler option) . . . . . . . . 293 open_s (function) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 482
--no_unaligned_access (compiler option) . . . . . . . . . . . . . 293 operators
--no_uniform_attribute_syntax (compiler option) . . . . . . . 294 See also @ (operator)
--no_unroll (compiler option) . . . . . . . . . . . . . . . . . . . . . . 294 for region expressions . . . . . . . . . . . . . . . . . . . . . . . . . 490
--no_utf8_in (ielfdump option) . . . . . . . . . . . . . . . . . . . . . 562 for section control . . . . . . . . . . . . . . . . . . . . . . . . . . . . 190
--no_var_align (compiler option) . . . . . . . . . . . . . . . . . . . 295 precision for 32-bit float . . . . . . . . . . . . . . . . . . . . . . . 357
--no_vfe (linker option). . . . . . . . . . . . . . . . . . . . . . . . . . . 338 precision for 64-bit float . . . . . . . . . . . . . . . . . . . . . . . 357
no_vtable_use (pragma directive) . . . . . . . . . . . . . . . . . . . 608 sizeof, implementation-defined behavior in C . . . . . . . 615
--no_warnings (compiler option) . . . . . . . . . . . . . . . . . . . 295 __ALIGNOF__, for alignment control. . . . . . . . . . . . . 190
--no_warnings (linker option) . . . . . . . . . . . . . . . . . . . . . . 338 ?, language extensions for . . . . . . . . . . . . . . . . . . . . . . 201
--no_wrap_diagnostics (compiler option) . . . . . . . . . . . . . 295 optimization
--no_wrap_diagnostics (linker option) . . . . . . . . . . . . . . . 338 clustering, disabling . . . . . . . . . . . . . . . . . . . . . . . . . . . 287
NULL code motion, disabling . . . . . . . . . . . . . . . . . . . . . . . . . 287
implementation-defined behavior for C++ . . . . . . . . . . 589 common sub-expression elimination, disabling . . . . . . 288
implementation-defined behavior in C . . . . . . . . . . . . . 611 configuration . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 71
implementation-defined behavior in C89 (DLIB) . . . . 626 disabling . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 237
pointer constant, relaxation to Standard C . . . . . . . . . . 192 function inlining, disabling (--no_inline) . . . . . . . . . . . 289
numbers (in linker configuration file) . . . . . . . . . . . . . . . . 513 hints . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 240
numeric conversion functions loop unrolling, disabling . . . . . . . . . . . . . . . . . . . . . . . 294
implementation-defined behavior in C . . . . . . . . . . . . . 616 scheduling, disabling . . . . . . . . . . . . . . . . . . . . . . . . . . 291
numeric (library header file) . . . . . . . . . . . . . . . . . . . . . . . 476 specifying (-O) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 296
techniques . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 237
AFE1_AFE2-1:1
Index
651
AFE1_AFE2-1:1
summary . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 383 printing characters
for absolute located data . . . . . . . . . . . . . . . . . . . . . . . 231 implementation-defined behavior in C . . . . . . . . . . . . . 616
implementation-defined behavior for C++ . . . . . . . . . . 588 processor configuration . . . . . . . . . . . . . . . . . . . . . . . . . . . . 70
list of all recognized . . . . . . . . . . . . . . . . . . . . . . . . . . . 607 processor operations
list of all recognized (C89). . . . . . . . . . . . . . . . . . . . . . 625 accessing . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 163
pack . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 400 low-level . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 188
--preconfig (linker option) . . . . . . . . . . . . . . . . . . . . . . . . 340 program entry label . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 145
predefined symbols program termination,
overview . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 57 implementation-defined behavior in C . . . . . . . . . . . . . . . 600
summary . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 458 programming hints . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 240
--predef_macro (compiler option) . . . . . . . . . . . . . . . . . . . 298 __program_start (label) . . . . . . . . . . . . . . . . . . . . . . . . . . . 145
preferred_typedef (pragma directive) . . . . . . . . . . . . . . . . 609 projects
Prefetch_Handler (exception function) . . . . . . . . . . . . . . . . 82 basic settings for . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 69
--prefix (iexe2obj option) . . . . . . . . . . . . . . . . . . . . . . . . . 565 setting up for a library . . . . . . . . . . . . . . . . . . . . . . . . . 132
--preinclude (compiler option) . . . . . . . . . . . . . . . . . . . . . 298 prototypes, enforcing . . . . . . . . . . . . . . . . . . . . . . . . . . . . 300
.preinit_array (section) . . . . . . . . . . . . . . . . . . . . . . . . . . . 521 ptrdiff_t (integer type) . . . . . . . . . . . . . . . . . . . . . . . . . . . 359
.prepreinit_array (section) . . . . . . . . . . . . . . . . . . . . . . . . . 521 implementation-defined behavior for C++ . . . . . . 585, 589
--preprocess (compiler option) . . . . . . . . . . . . . . . . . . . . . 299 PUBLIC (assembler directive) . . . . . . . . . . . . . . . . . . . . . 299
preprocessor publication date, of this guide . . . . . . . . . . . . . . . . . . . . . . . . 2
output . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 299 --public_equ (compiler option) . . . . . . . . . . . . . . . . . . . . . 299
preprocessor directives public_equ (pragma directive) . . . . . . . . . . . . . . . . . . . . . 401
comments at the end of . . . . . . . . . . . . . . . . . . . . . . . . 192 push_macro (pragma directive). . . . . . . . . . . . . . . . . . . . . 609
implementation-defined behavior in C . . . . . . . . . . . . . 606 putenv (library function), absent from DLIB . . . . . . . . . . 153
implementation-defined behavior in C89 . . . . . . . . . . . 624 putw, in stdio.h . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 481
#pragma . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 383
#pragma (implementation-defined behavior for C++) . 588
preprocessor extensions Q
#warning message . . . . . . . . . . . . . . . . . . . . . . . . . . . . 469 __QADD (intrinsic function) . . . . . . . . . . . . . . . . . . . . . . 431
preprocessor symbols . . . . . . . . . . . . . . . . . . . . . . . . . . . . 458 __QADD8 (intrinsic function) . . . . . . . . . . . . . . . . . . . . . 431
defining . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 272, 320 __QADD16 (intrinsic function) . . . . . . . . . . . . . . . . . . . . 431
preserved registers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 177 __QASX (intrinsic function) . . . . . . . . . . . . . . . . . . . . . . . 431
__PRETTY_FUNCTION__ (predefined symbol). . . . . . . 465 QCCARM (environment variable) . . . . . . . . . . . . . . . . . . 251
print formatter, selecting . . . . . . . . . . . . . . . . . . . . . . . . . . 140 __QCFlag (intrinsic function) . . . . . . . . . . . . . . . . . . . . . . 432
printf (library function) . . . . . . . . . . . . . . . . . . . . . . . . . . . 139 __QDADD (intrinsic function) . . . . . . . . . . . . . . . . . . . . . 431
choosing formatter . . . . . . . . . . . . . . . . . . . . . . . . . . . . 139 __QDOUBLE (intrinsic function) . . . . . . . . . . . . . . . . . . . 432
implementation-defined behavior in C . . . . . . . . . . . . . 612 __QDSUB (intrinsic function) . . . . . . . . . . . . . . . . . . . . . 431
implementation-defined behavior in C89 . . . . . . . . . . . 628 __QFlag (intrinsic function) . . . . . . . . . . . . . . . . . . . . . . . 432
__printf_args (pragma directive). . . . . . . . . . . . . . . . . . . . 401 __QSAX (intrinsic function) . . . . . . . . . . . . . . . . . . . . . . . 431
--printf_multibytes (linker option) . . . . . . . . . . . . . . . . . . 340 __QSUB (intrinsic function) . . . . . . . . . . . . . . . . . . . . . . . 431
AFE1_AFE2-1:1
Index
653
AFE1_AFE2-1:1
rename (library function) runtime libraries (DLIB)
implementation-defined behavior in C . . . . . . . . . . . . . 612 introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 471
implementation-defined behavior in C89 (DLIB) . . . . 628 customizing system startup code . . . . . . . . . . . . . . . . . 148
--rename_section (iobjmanip option) . . . . . . . . . . . . . . . . 568 filename syntax . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 136
--rename_symbol (iobjmanip option) . . . . . . . . . . . . . . . . 568 overriding modules in . . . . . . . . . . . . . . . . . . . . . . . . . 131
--replace (iarchive option). . . . . . . . . . . . . . . . . . . . . . . . . 569 using prebuilt . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 135
required (pragma directive) . . . . . . . . . . . . . . . . . . . . . . . . 401 runtime model attributes . . . . . . . . . . . . . . . . . . . . . . . . . . 119
--require_prototypes (compiler option) . . . . . . . . . . . . . . . 300 runtime model definitions . . . . . . . . . . . . . . . . . . . . . . . . . 402
reserved identifiers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 256 __RWPI__ (predefined symbol) . . . . . . . . . . . . . . . . . . . . 466
--reserve_ranges (isymexport option) . . . . . . . . . . . . . . . . 569 --rwpi (compiler option) . . . . . . . . . . . . . . . . . . . . . . . . . . 302
reset vector table . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 520 --rwpi_near (compiler option) . . . . . . . . . . . . . . . . . . . . . . 302
__reset_QC_flag (intrinsic function). . . . . . . . . . . . . . . . . 433
__reset_Q_flag (intrinsic function) . . . . . . . . . . . . . . . . . . 433
restrict keyword, enabling . . . . . . . . . . . . . . . . . . . . . . . . . 279 S
return values, from functions . . . . . . . . . . . . . . . . . . . . . . 179 -s (ielfdump option) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 570
__REV (intrinsic function) . . . . . . . . . . . . . . . . . . . . . . . . 433 __SADD8 (intrinsic function) . . . . . . . . . . . . . . . . . . . . . . 434
__REVSH (intrinsic function). . . . . . . . . . . . . . . . . . . . . . 433 __SADD16 (intrinsic function) . . . . . . . . . . . . . . . . . . . . . 434
__REV16 (intrinsic function) . . . . . . . . . . . . . . . . . . . . . . 433 __SASX (intrinsic function) . . . . . . . . . . . . . . . . . . . . . . . 434
__rintn (intrinsic function) . . . . . . . . . . . . . . . . . . . . . . . . 433 __sbrel (extended keyword) . . . . . . . . . . . . . . . . . . . . . . . 369
__rintnf (intrinsic function) . . . . . . . . . . . . . . . . . . . . . . . . 433 scanf (library function)
.rodata (ELF section) . . . . . . . . . . . . . . . . . . . . . . . . . . . . 521 choosing formatter (DLIB) . . . . . . . . . . . . . . . . . . . . . 141
ROM to RAM, copying . . . . . . . . . . . . . . . . . . . . . . . . . . 115 implementation-defined behavior in C . . . . . . . . . . . . . 612
__root (extended keyword) . . . . . . . . . . . . . . . . . . . . . . . . 377 implementation-defined behavior in C89 (DLIB) . . . . 628
__ROPI__ (predefined symbol) . . . . . . . . . . . . . . . . . . . . 466 __scanf_args (pragma directive) . . . . . . . . . . . . . . . . . . . . 403
--ropi (compiler option) . . . . . . . . . . . . . . . . . . . . . . . . . . 301 --scanf_multibytes (linker option) . . . . . . . . . . . . . . . . . . . 341
--ropi_cb (compiler option) . . . . . . . . . . . . . . . . . . . . . . . . 301 scheduling (compiler transformation) . . . . . . . . . . . . . . . . 240
__ROR (intrinsic function) . . . . . . . . . . . . . . . . . . . . . . . . 434 disabling . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 291
routines, time-critical . . . . . . . . . . . . . . . . . . . . . . . . 163, 188 scoped_allocator (library header file) . . . . . . . . . . . . . . . . 477
__ro_placement (extended keyword) . . . . . . . . . . . . . . . . 377 scratch registers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 177
__RRX (intrinsic function) . . . . . . . . . . . . . . . . . . . . . . . . 434 --search (linker option) . . . . . . . . . . . . . . . . . . . . . . . . . . . 341
rtmodel (assembler directive) . . . . . . . . . . . . . . . . . . . . . . 120 search directory, for linker configuration files
rtmodel (pragma directive) . . . . . . . . . . . . . . . . . . . . . . . . 402 (--config_search). . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 318
__RTTI__ (predefined symbol) . . . . . . . . . . . . . . . . . . . . 466 search path to library files (--search) . . . . . . . . . . . . . . . . . 342
RTTI data (dynamic), including in the image . . . . . . . . . . 334 search path to object files (--search) . . . . . . . . . . . . . . . . . 342
runtime environment --section (ielfdump option) . . . . . . . . . . . . . . . . . . . . . . . . 570
DLIB . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 123 --section (compiler option) . . . . . . . . . . . . . . . . . . . . . . . . 303
setting up (DLIB) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 129 sections
runtime error checking, documentation for . . . . . . . . . . . . . 46 summary . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 517
allocation of . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 93
AFE1_AFE2-1:1
Index
655
AFE1_AFE2-1:1
size (in stack usage control file) . . . . . . . . . . . . . . . . . . . . 529 __SMULWT (intrinsic function) . . . . . . . . . . . . . . . . . . . 442
sizeof, implementation-defined behavior for C++. . . . . . . 585 __SMUSD (intrinsic function) . . . . . . . . . . . . . . . . . . . . . 441
size_t (integer type) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 359 __SMUSDX (intrinsic function) . . . . . . . . . . . . . . . . . . . . 441
implementation-defined behavior for C++ . . . . . . . . . . 589 software interrupts . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 84
skeleton code, creating for assembler language interface . 173 --source (ielfdump option) . . . . . . . . . . . . . . . . . . . . . . . . 572
slist (library header file) . . . . . . . . . . . . . . . . . . . . . . . . . . 477 source files, list all referred . . . . . . . . . . . . . . . . . . . . . . . . 282
small function inlining (linker optimization). . . . . . . . . . . 121 --source_encoding (compiler option) . . . . . . . . . . . . . . . . 304
smallest, packing algorithm for initializers . . . . . . . . . . . . 499 space characters, implementation-defined behavior in C . 611
__SMLABB (intrinsic function) . . . . . . . . . . . . . . . . . . . . 439 special function registers (SFR) . . . . . . . . . . . . . . . . . . . . 243
__SMLABT (intrinsic function) . . . . . . . . . . . . . . . . . . . . 439 sprintf (library function) . . . . . . . . . . . . . . . . . . . . . . . . . . 139
__SMLAD (intrinsic function) . . . . . . . . . . . . . . . . . . . . . 439 choosing formatter . . . . . . . . . . . . . . . . . . . . . . . . . . . . 139
__SMLADX (intrinsic function) . . . . . . . . . . . . . . . . . . . . 439 __sqrt (intrinsic function) . . . . . . . . . . . . . . . . . . . . . . . . . 442
__SMLALBB (intrinsic function) . . . . . . . . . . . . . . . . . . . 440 __sqrtf (intrinsic function) . . . . . . . . . . . . . . . . . . . . . . . . 442
__SMLALBT (intrinsic function) . . . . . . . . . . . . . . . . . . . 440 --srec (ielftool option) . . . . . . . . . . . . . . . . . . . . . . . . . . . . 573
__SMLALD (intrinsic function) . . . . . . . . . . . . . . . . . . . . 440 --srec-len (ielftool option) . . . . . . . . . . . . . . . . . . . . . . . . . 573
__SMLALDX (intrinsic function) . . . . . . . . . . . . . . . . . . 440 --srec-s3only (ielftool option) . . . . . . . . . . . . . . . . . . . . . . 573
__SMLALTB (intrinsic function) . . . . . . . . . . . . . . . . . . . 440 __SSAT (intrinsic function) . . . . . . . . . . . . . . . . . . . . . . . 443
__SMLALTT (intrinsic function) . . . . . . . . . . . . . . . . . . . 440 __SSAT16 (intrinsic function) . . . . . . . . . . . . . . . . . . . . . 443
__SMLATB (intrinsic function) . . . . . . . . . . . . . . . . . . . . 439 __SSAX (intrinsic function) . . . . . . . . . . . . . . . . . . . . . . . 434
__SMLATT (intrinsic function) . . . . . . . . . . . . . . . . . . . . 439 sscanf (library function)
__SMLAWB (intrinsic function) . . . . . . . . . . . . . . . . . . . 439 choosing formatter (DLIB) . . . . . . . . . . . . . . . . . . . . . 141
__SMLAWT (intrinsic function) . . . . . . . . . . . . . . . . . . . 439 sstream (library header file) . . . . . . . . . . . . . . . . . . . . . . . 477
__SMLSD (intrinsic function) . . . . . . . . . . . . . . . . . . . . . 439 __SSUB16 (intrinsic function) . . . . . . . . . . . . . . . . . . . . . 434
__SMLSDX (intrinsic function) . . . . . . . . . . . . . . . . . . . . 439 __SSUB8 (intrinsic function) . . . . . . . . . . . . . . . . . . . . . . 434
__SMLSLD (intrinsic function) . . . . . . . . . . . . . . . . . . . . 440 stack . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 74
__SMLSLDX (intrinsic function) . . . . . . . . . . . . . . . . . . . 440 advantages and problems using . . . . . . . . . . . . . . . . . . . 74
__SMMLA (intrinsic function) . . . . . . . . . . . . . . . . . . . . . 441 block for holding . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 518
__SMMLAR (intrinsic function) . . . . . . . . . . . . . . . . . . . 441 cleaning after function return . . . . . . . . . . . . . . . . . . . . 180
__SMMLS (intrinsic function) . . . . . . . . . . . . . . . . . . . . . 441 contents of . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 74
__SMMLSR (intrinsic function) . . . . . . . . . . . . . . . . . . . . 441 layout . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 179
__SMMUL (intrinsic function) . . . . . . . . . . . . . . . . . . . . . 441 saving space . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 241
__SMMULR (intrinsic function) . . . . . . . . . . . . . . . . . . . 441 setting up size for . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 111
__SMUAD (intrinsic function) . . . . . . . . . . . . . . . . . . . . . 441 size . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 206
__SMUL (intrinsic function) . . . . . . . . . . . . . . . . . . . . . . 442 stack buffer overflow . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 87
__SMULBB (intrinsic function) . . . . . . . . . . . . . . . . . . . . 442 stack buffer overrun . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 87
__SMULBT (intrinsic function) . . . . . . . . . . . . . . . . . . . . 442 stack canaries . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 87
__SMULTB (intrinsic function) . . . . . . . . . . . . . . . . . . . . 442 stack parameters . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 179
__SMULTT (intrinsic function) . . . . . . . . . . . . . . . . . . . . 442 stack pointer . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 74
__SMULWB (intrinsic function) . . . . . . . . . . . . . . . . . . . 442 stack protection . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 87
AFE1_AFE2-1:1
Index
657
AFE1_AFE2-1:1
streamoff, implementation-defined behavior for C++ . . . . 591 SVC #immed, for software interrupts . . . . . . . . . . . . . . . . . 84
streampos, implementation-defined behavior for C++ . . . 591 __swi (extended keyword) . . . . . . . . . . . . . . . . . . . . . . . . 378
streams SWI_Handler (exception function) . . . . . . . . . . . . . . . . . . . 82
implementation-defined behavior in C . . . . . . . . . . . . . 600 swi_number (pragma directive) . . . . . . . . . . . . . . . . . . . . 405
strerror (library function) SWO, directing stdout/stderr via . . . . . . . . . . . . . . . . . . . . 128
implementation-defined behavior in C . . . . . . . . . . . . . 617 __SWP (intrinsic function) . . . . . . . . . . . . . . . . . . . . . . . . 446
strerror (library function), __SWPB (intrinsic function) . . . . . . . . . . . . . . . . . . . . . . . 446
implementation-defined behavior in C89 (DLIB) . . . . . . . 629 __SXTAB (intrinsic function). . . . . . . . . . . . . . . . . . . . . . 447
__STREX (intrinsic function) . . . . . . . . . . . . . . . . . . . . . . 446 __SXTAB16 (intrinsic function). . . . . . . . . . . . . . . . . . . . 447
__STREXB (intrinsic function) . . . . . . . . . . . . . . . . . . . . 446 __SXTAH (intrinsic function) . . . . . . . . . . . . . . . . . . . . . 447
__STREXD (intrinsic function) . . . . . . . . . . . . . . . . . . . . 446 __SXTB16 (intrinsic function) . . . . . . . . . . . . . . . . . . . . . 447
__STREXH (intrinsic function) . . . . . . . . . . . . . . . . . . . . 446 symbols
--strict (compiler option) . . . . . . . . . . . . . . . . . . . . . . . . . . 304 directing from one to another . . . . . . . . . . . . . . . . . . . . 340
string literals, implementation-defined behavior for C++ . 582 including in output . . . . . . . . . . . . . . . . . . . . . . . . . . . . 402
string (library header file) . . . . . . . . . . . . . . . . . . . . . . . . . 477 local, removing from ELF image . . . . . . . . . . . . . . . . . 337
string.h (library header file) . . . . . . . . . . . . . . . . . . . . . . . 475 overview of predefined . . . . . . . . . . . . . . . . . . . . . . . . . 57
string.h, additional C functionality . . . . . . . . . . . . . . . . . . 481 patching using $Super$$ and $Sub$$ . . . . . . . . . . . . . 225
--strip (ielftool option) . . . . . . . . . . . . . . . . . . . . . . . . . . . 574 preprocessor, defining . . . . . . . . . . . . . . . . . . . . . 272, 320
--strip (iobjmanip option) . . . . . . . . . . . . . . . . . . . . . . . . . 574 --symbols (iarchive option) . . . . . . . . . . . . . . . . . . . . . . . . 574
--strip (linker option) . . . . . . . . . . . . . . . . . . . . . . . . . . . . 343 .symtab (ELF section) . . . . . . . . . . . . . . . . . . . . . . . . . . . . 518
strncasecmp, in string.h. . . . . . . . . . . . . . . . . . . . . . . . . . . 481 syntax
strnlen, in string.h . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 481 command line options . . . . . . . . . . . . . . . . . . . . . . . . . 259
strstream (library header file) . . . . . . . . . . . . . . . . . . . . . . 477 extended keywords . . . . . . . . . . . . . . . . . . . . . . . 366–368
.strtab (ELF section) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 518 invoking compiler and linker . . . . . . . . . . . . . . . . . . . . 249
structure types system function, implementation-defined behavior in C . . 613
alignment . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 359–360 system function,
layout of . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 360 implementation-defined behavior in C . . . . . . . . . . . . . . . 601
packed . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 360 system startup
structures customizing . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 148
aligning . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 400 DLIB . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 145
anonymous . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 229 implementation-defined behavior for C++ . . . . . . . . . . 582
implementation-defined behavior in C . . . . . . . . . . . . . 605 initialization phase . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 65
implementation-defined behavior in C89 . . . . . . . . . . . 623 system termination
packing and unpacking . . . . . . . . . . . . . . . . . . . . . . . . 229 C-SPY interface to . . . . . . . . . . . . . . . . . . . . . . . . . . . . 148
strxfrm (function) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 482 DLIB . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 147
subnormal numbers . . . . . . . . . . . . . . . . . . . . . . . . . . 356, 358 implementation-defined behavior for C++ . . . . . . . . . . 582
$Sub$$ pattern . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 225 system (library function)
$Super$$ pattern . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 225 implementation-defined behavior in C89 (DLIB) . . . . 629
support, technical . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 258 system_error (library header file) . . . . . . . . . . . . . . . . . . . 477
Sutter, Herb. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 47 system_include (pragma directive) . . . . . . . . . . . . . . 609, 626
AFE1_AFE2-1:1
Index
659
AFE1_AFE2-1:1
tuple (library header file) . . . . . . . . . . . . . . . . . . . . . . . . . 477 underflow range errors,
type attributes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 365 implementation-defined behavior in C89 . . . . . . . . . . . . . 627
specifying . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 406 underscore
type qualifiers double in reserved identifiers . . . . . . . . . . . . . . . . . . . . 256
const and volatile . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 361 followed by uppercase letter (reserved identifier) . . . . 256
implementation-defined behavior . . . . . . . . . . . . . . . . 606 __ungetchar, in stdio.h . . . . . . . . . . . . . . . . . . . . . . . . . . . 481
implementation-defined behavior in C89 . . . . . . . . . . . 624 Unicode . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 255
typedefs uniform attribute syntax . . . . . . . . . . . . . . . . . . . . . . . . . . 366
excluding from diagnostics . . . . . . . . . . . . . . . . . . . . . 293 --uniform_attribute_syntax (compiler option) . . . . . . . . . . 306
repeated . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 192 unions
typeid, derived anonymous . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 229
type for (implementation-defined behavior for C++) . . . . 585 implementation-defined behavior in C . . . . . . . . . . . . . 605
typeindex (library header file) . . . . . . . . . . . . . . . . . . . . . . 477 implementation-defined behavior in C89 . . . . . . . . . . . 623
typeinfo (library header file) . . . . . . . . . . . . . . . . . . . . . . . 477 universal character names, implementation-defined
types, trivially behavior in C . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 607
copyable (implementation-defined behavior for C++) . . . 583 universal character
typetraits (library header file) . . . . . . . . . . . . . . . . . . . . . . 477 names, implementation-defined behavior for C++ . . . . . . 582
type_attribute (pragma directive) . . . . . . . . . . . . . . . . . . . 406 unordered_map (library header file) . . . . . . . . . . . . . . . . . 477
type_info::name, implementation-defined behavior for C++ . . . . . . . . . . 593
implementation-defined behavior for C++ . . . . . . . . . . . . 590 unordered_multimap,
type-based alias analysis (compiler transformation) . . . . . 239 implementation-defined behavior for C++ . . . . . . . . . . . . 593
disabling . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 293 unordered_multiset,
typographic conventions . . . . . . . . . . . . . . . . . . . . . . . . . . . 48 implementation-defined behavior for C++ . . . . . . . . . . . . 593
unordered_set (library header file) . . . . . . . . . . . . . . . . . . 477
implementation-defined behavior for C++ . . . . . . . . . . 593
U unroll (pragma directive) . . . . . . . . . . . . . . . . . . . . . . . . . 406
unsigned char (data type) . . . . . . . . . . . . . . . . . . . . . 351–352
__UADD8 (intrinsic function) . . . . . . . . . . . . . . . . . . . . . 448
__UADD16 (intrinsic function) . . . . . . . . . . . . . . . . . . . . 448 changing to signed char . . . . . . . . . . . . . . . . . . . . . . . . 269
__UASX (intrinsic function) . . . . . . . . . . . . . . . . . . . . . . . 448 unsigned int (data type) . . . . . . . . . . . . . . . . . . . . . . . . . . . 351
uchar.h (library header file) . . . . . . . . . . . . . . . . . . . . . . . 475 unsigned long long (data type) . . . . . . . . . . . . . . . . . . . . . 351
__UHADD8 (intrinsic function) . . . . . . . . . . . . . . . . . . . . 448 unsigned long (data type) . . . . . . . . . . . . . . . . . . . . . . . . . 351
__UHADD16 (intrinsic function) . . . . . . . . . . . . . . . . . . . 448 unsigned short (data type) . . . . . . . . . . . . . . . . . . . . . . . . . 351
__UHASX (intrinsic function) . . . . . . . . . . . . . . . . . . . . . 448 unsigned to signed
conversion, implementation-defined behavior for C++ . . . 584
__UHSAX (intrinsic function) . . . . . . . . . . . . . . . . . . . . . 448
__UQADD8 (intrinsic function) . . . . . . . . . . . . . . . . . . . . 449
__UHSUB16 (intrinsic function) . . . . . . . . . . . . . . . . . . . 448
__UQADD16 (intrinsic function) . . . . . . . . . . . . . . . . . . . 449
__UHSUB8 (intrinsic function) . . . . . . . . . . . . . . . . . . . . 448
__UQASX (intrinsic function) . . . . . . . . . . . . . . . . . . . . . 449
uintptr_t (integer type) . . . . . . . . . . . . . . . . . . . . . . . . . . . 359
__UQSAX (intrinsic function) . . . . . . . . . . . . . . . . . . . . . 449
__UMAAL (intrinsic function) . . . . . . . . . . . . . . . . . . . . . 449
__UQSUB16 (intrinsic function) . . . . . . . . . . . . . . . . . . . 449
underflow errors, implementation-defined behavior in C . 610
__UQSUB8 (intrinsic function) . . . . . . . . . . . . . . . . . . . . 449
AFE1_AFE2-1:1
Index
661
AFE1_AFE2-1:1
__VMAXNM_F32 (intrinsic function) . . . . . . . . . . . . . . . 453 exit code in linker . . . . . . . . . . . . . . . . . . . . . . . . . . . . 347
__VMAXNM_F64 (intrinsic function) . . . . . . . . . . . . . . . 453 warnings icon, in this guide . . . . . . . . . . . . . . . . . . . . . . . . 49
__VMINNM_F32 (intrinsic function). . . . . . . . . . . . . . . . 453 warnings (pragma directive) . . . . . . . . . . . . . . . . . . . 609, 626
__VMINNM_F64 (intrinsic function). . . . . . . . . . . . . . . . 453 --warnings_affect_exit_code (compiler option) . . . . 253, 309
void, pointers to . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 192 --warnings_affect_exit_code (linker option) . . . . . . . . . . . 347
volatile --warnings_are_errors (compiler option) . . . . . . . . . . . . . 309
and const, declaring objects . . . . . . . . . . . . . . . . . . . . . 362 --warnings_are_errors (linker option) . . . . . . . . . . . . . . . . 347
declaring objects . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 361 --warn_about_c_style_casts (compiler option) . . . . . . . . . 309
protecting simultaneously accesses variables . . . . . . . . 243 wchar_t (data type) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 352
rules for access. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 362 implementation-defined behavior in C . . . . . . . . . . . . . 603
volatile-qualified wchar.h (library header file) . . . . . . . . . . . . . . . . . . . 475, 478
type, implementation-defined behavior for C++ . . . . . . . . 586 wctype.h (library header file) . . . . . . . . . . . . . . . . . . . . . . 475
__VRINTA_F32 (intrinsic function). . . . . . . . . . . . . . . . . 455 __weak (extended keyword) . . . . . . . . . . . . . . . . . . . . . . . 380
__VRINTA_F64 (intrinsic function). . . . . . . . . . . . . . . . . 454 weak (pragma directive) . . . . . . . . . . . . . . . . . . . . . . . . . . 407
__VRINTM_F32 (intrinsic function) . . . . . . . . . . . . . . . . 455 web sites, recommended . . . . . . . . . . . . . . . . . . . . . . . . . . . 47
__VRINTM_F64 (intrinsic function) . . . . . . . . . . . . . . . . 454 __WFE (intrinsic function) . . . . . . . . . . . . . . . . . . . . . . . . 456
__VRINTN_F32 (intrinsic function). . . . . . . . . . . . . . . . . 455 __WFI (intrinsic function) . . . . . . . . . . . . . . . . . . . . . . . . 456
__VRINTN_F64 (intrinsic function). . . . . . . . . . . . . . . . . 454 white-space characters, implementation-defined behavior 599
__VRINTP_F32 (intrinsic function) . . . . . . . . . . . . . . . . . 455 --whole_archive (linker option) . . . . . . . . . . . . . . . . . . . . 347
__VRINTP_F64 (intrinsic function) . . . . . . . . . . . . . . . . . 454 wide-character
__VRINTR_F32 (intrinsic function) . . . . . . . . . . . . . . . . . 455 literals, implementation-defined behavior for C++ . . . . . . 581
__VRINTR_F64 (intrinsic function) . . . . . . . . . . . . . . . . . 454 --wrap (iexe2obj option) . . . . . . . . . . . . . . . . . . . . . . . . . . 578
__VRINTX_F32 (intrinsic function). . . . . . . . . . . . . . . . . 455 __write_array, in stdio.h . . . . . . . . . . . . . . . . . . . . . . . . . . 481
__VRINTX_F64 (intrinsic function). . . . . . . . . . . . . . . . . 454 __write_buffered (DLIB library function) . . . . . . . . . . . . 128
__VRINTZ_F32 (intrinsic function) . . . . . . . . . . . . . . . . . 455 wstreampos, implementation-defined behavior for C++ . . 591
__VRINTZ_F64 (intrinsic function) . . . . . . . . . . . . . . . . . 455
__VSQRT_F32 (intrinsic function) . . . . . . . . . . . . . . . . . 455
__VSQRT_F64 (intrinsic function) . . . . . . . . . . . . . . . . . 455 X
--vtoc (iarchive option) . . . . . . . . . . . . . . . . . . . . . . . . . . . 577 -x (iarchive option) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 557
W Y
#warning message (preprocessor extension) . . . . . . . . . . . 469 __YIELD (intrinsic function) . . . . . . . . . . . . . . . . . . . . . . 456
warnings . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 257
classifying in compiler . . . . . . . . . . . . . . . . . . . . . . . . . 276
classifying in linker . . . . . . . . . . . . . . . . . . . . . . . . . . . 322
disabling in compiler . . . . . . . . . . . . . . . . . . . . . . . . . . 295
Z
zeros, packing algorithm for initializers . . . . . . . . . . . . . . 499
disabling in linker . . . . . . . . . . . . . . . . . . . . . . . . . . . . 338
exit code in compiler . . . . . . . . . . . . . . . . . . . . . . . . . . 309
AFE1_AFE2-1:1
Index
663
AFE1_AFE2-1:1
__asm (language extension) . . . . . . . . . . . . . . . . . . . . . . . 166 __fp16 (data type) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 356
__BASE_FILE__ (predefined symbol) . . . . . . . . . . . . . . . 463 __FUNCTION__ (predefined symbol) . . . . . . . . . . . . . . . 465
__big_endian (extended keyword) . . . . . . . . . . . . . . . . . . 370 __func__ (predefined symbol) . . . . . . . . . . . . . . . . . . . . . 464
__BUILD_NUMBER__ (predefined symbol) . . . . . . . . . 463 implementation-defined behavior for C++ . . . . . . . . . . 586
__CDP (intrinsic function) . . . . . . . . . . . . . . . . . . . . . . . . 416 __gets, in stdio.h . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 480
__CDP2 (intrinsic function) . . . . . . . . . . . . . . . . . . . . . . . 416 __get_BASEPRI (intrinsic function) . . . . . . . . . . . . . . . . 420
__CLREX (intrinsic function). . . . . . . . . . . . . . . . . . . . . . 416 __get_CONTROL (intrinsic function) . . . . . . . . . . . . . . . 421
__CLZ (intrinsic function) . . . . . . . . . . . . . . . . . . . . . . . . 417 __get_CPSR (intrinsic function) . . . . . . . . . . . . . . . . . . . . 421
__cmse_nonsecure_call (extended keyword) . . . . . . . . . . 370 __get_FAULTMASK (intrinsic function) . . . . . . . . . . . . . 421
__cmse_nonsecure_entry (extended keyword) . . . . . . . . . 371 __get_FPSCR (intrinsic function) . . . . . . . . . . . . . . . . . . . 421
__CORE__ (predefined symbol). . . . . . . . . . . . . . . . . . . . 463 __get_interrupt_state (intrinsic function) . . . . . . . . . . . . . 422
__COUNTER__ (predefined symbol). . . . . . . . . . . . . . . . 463 __get_IPSR (intrinsic function) . . . . . . . . . . . . . . . . . . . . 422
__cplusplus (predefined symbol) . . . . . . . . . . . . . . . . . . . 463 __get_LR (intrinsic function) . . . . . . . . . . . . . . . . . . . . . . 422
__CPU_MODE__ (predefined symbol) . . . . . . . . . . . . . . 464 __get_MSP (intrinsic function) . . . . . . . . . . . . . . . . . . . . . 423
__crc32b (intrinsic function) . . . . . . . . . . . . . . . . . . . . . . . 417 __get_PRIMASK (intrinsic function) . . . . . . . . . . . . . . . . 423
__crc32cb (intrinsic function) . . . . . . . . . . . . . . . . . . . . . . 418 __get_PSP (intrinsic function) . . . . . . . . . . . . . . . . . . . . . 423
__crc32cd (intrinsic function) . . . . . . . . . . . . . . . . . . . . . . 418 __get_PSR (intrinsic function) . . . . . . . . . . . . . . . . . . . . . 423
__crc32ch (intrinsic function) . . . . . . . . . . . . . . . . . . . . . . 418 __get_SB (intrinsic function) . . . . . . . . . . . . . . . . . . . . . . 423
__crc32cw (intrinsic function) . . . . . . . . . . . . . . . . . . . . . 418 __get_SP (intrinsic function) . . . . . . . . . . . . . . . . . . . . . . 424
__crc32d (intrinsic function) . . . . . . . . . . . . . . . . . . . . . . . 417 __iar_cos_accurate (library routine) . . . . . . . . . . . . . . . . . 144
__crc32h (intrinsic function) . . . . . . . . . . . . . . . . . . . . . . . 417 __iar_cos_accuratef (library routine) . . . . . . . . . . . . . . . . 144
__crc32w (intrinsic function) . . . . . . . . . . . . . . . . . . . . . . 417 __iar_cos_accuratel (library routine) . . . . . . . . . . . . . . . . 144
__DATE__ (predefined symbol). . . . . . . . . . . . . . . . . . . . 464 __iar_cos_small (library routine) . . . . . . . . . . . . . . . . . . . 143
implementation-defined behavior for C++ . . . . . . . . . . 588 __iar_cos_smallf (library routine) . . . . . . . . . . . . . . . . . . . 144
__disable_fiq (intrinsic function) . . . . . . . . . . . . . . . . . . . 418 __iar_cos_smalll (library routine) . . . . . . . . . . . . . . . . . . . 144
__disable_interrupt (intrinsic function) . . . . . . . . . . . . . . . 418 __iar_exp_small (library routine) . . . . . . . . . . . . . . . . . . . 143
__disable_irq (intrinsic function) . . . . . . . . . . . . . . . . . . . 419 __iar_exp_smallf (library routine) . . . . . . . . . . . . . . . . . . 144
__DLIB_FILE_DESCRIPTOR (configuration symbol) . . 159 __iar_exp_smalll (library routine) . . . . . . . . . . . . . . . . . . 144
__DMB (intrinsic function) . . . . . . . . . . . . . . . . . . . . . . . 419 __iar_log_small (library routine) . . . . . . . . . . . . . . . . . . . 143
__DSB (intrinsic function) . . . . . . . . . . . . . . . . . . . . . . . . 419 __iar_log_smallf (library routine) . . . . . . . . . . . . . . . . . . . 144
__enable_fiq (intrinsic function) . . . . . . . . . . . . . . . . . . . . 419 __iar_log_smalll (library routine) . . . . . . . . . . . . . . . . . . . 144
__enable_interrupt (intrinsic function) . . . . . . . . . . . . . . . 420 __iar_log10_small (library routine) . . . . . . . . . . . . . . . . . 143
__enable_irq (intrinsic function) . . . . . . . . . . . . . . . . . . . . 420 __iar_log10_smallf (library routine) . . . . . . . . . . . . . . . . . 144
__EXCEPTIONS__ (predefined symbol) . . . . . . . . . . . . . 464 __iar_log10_smalll (library routine) . . . . . . . . . . . . . . . . . 144
__exit (library function) . . . . . . . . . . . . . . . . . . . . . . . . . . 147 __iar_maximum_atexit_calls . . . . . . . . . . . . . . . . . . . . . . 112
__FILE__ (predefined symbol) . . . . . . . . . . . . . . . . . . . . . 464 __iar_pow_accurate (library routine) . . . . . . . . . . . . . . . . 144
__fiq (extended keyword) . . . . . . . . . . . . . . . . . . . . . . . . . 371 __iar_pow_accuratef (library routine). . . . . . . . . . . . . . . . 144
__fma (intrinsic function) . . . . . . . . . . . . . . . . . . . . . . . . . 420 __iar_pow_accuratel (library routine) . . . . . . . . . . . . . . . . 144
__fmaf (intrinsic function) . . . . . . . . . . . . . . . . . . . . . . . . 420 __iar_pow_small (library routine) . . . . . . . . . . . . . . . . . . 143
AFE1_AFE2-1:1
Index
665
AFE1_AFE2-1:1
__QSUB16 (intrinsic function) . . . . . . . . . . . . . . . . . . . . . 431 __SEV (intrinsic function) . . . . . . . . . . . . . . . . . . . . . . . . 437
__QSUB8 (intrinsic function) . . . . . . . . . . . . . . . . . . . . . . 431 __SHADD8 (intrinsic function) . . . . . . . . . . . . . . . . . . . . 438
__ramfunc (extended keyword) . . . . . . . . . . . . . . . . . . . . 376 __SHADD16 (intrinsic function) . . . . . . . . . . . . . . . . . . . 438
__RBIT (intrinsic function) . . . . . . . . . . . . . . . . . . . . . . . 432 __SHASX (intrinsic function). . . . . . . . . . . . . . . . . . . . . . 438
__reset_QC_flag (intrinsic function). . . . . . . . . . . . . . . . . 433 __SHSAX (intrinsic function). . . . . . . . . . . . . . . . . . . . . . 438
__reset_Q_flag (intrinsic function) . . . . . . . . . . . . . . . . . . 433 __SHSUB16 (intrinsic function) . . . . . . . . . . . . . . . . . . . . 438
__REV (intrinsic function) . . . . . . . . . . . . . . . . . . . . . . . . 433 __SHSUB8 (intrinsic function) . . . . . . . . . . . . . . . . . . . . . 438
__REVSH (intrinsic function). . . . . . . . . . . . . . . . . . . . . . 433 __SMLABB (intrinsic function) . . . . . . . . . . . . . . . . . . . . 439
__REV16 (intrinsic function) . . . . . . . . . . . . . . . . . . . . . . 433 __SMLABT (intrinsic function) . . . . . . . . . . . . . . . . . . . . 439
__rintn (intrinsic function) . . . . . . . . . . . . . . . . . . . . . . . . 433 __SMLAD (intrinsic function) . . . . . . . . . . . . . . . . . . . . . 439
__rintnf (intrinsic function) . . . . . . . . . . . . . . . . . . . . . . . . 433 __SMLADX (intrinsic function) . . . . . . . . . . . . . . . . . . . . 439
__root (extended keyword) . . . . . . . . . . . . . . . . . . . . . . . . 377 __SMLALBB (intrinsic function) . . . . . . . . . . . . . . . . . . . 440
__ROPI__ (predefined symbol) . . . . . . . . . . . . . . . . . . . . 466 __SMLALBT (intrinsic function) . . . . . . . . . . . . . . . . . . . 440
__ROR (intrinsic function) . . . . . . . . . . . . . . . . . . . . . . . . 434 __SMLALD (intrinsic function) . . . . . . . . . . . . . . . . . . . . 440
__ro_placement (extended keyword) . . . . . . . . . . . . . . . . 377 __SMLALDX (intrinsic function) . . . . . . . . . . . . . . . . . . 440
__RRX (intrinsic function) . . . . . . . . . . . . . . . . . . . . . . . . 434 __SMLALTB (intrinsic function) . . . . . . . . . . . . . . . . . . . 440
__RTTI__ (predefined symbol) . . . . . . . . . . . . . . . . . . . . 466 __SMLALTT (intrinsic function) . . . . . . . . . . . . . . . . . . . 440
__RWPI__ (predefined symbol) . . . . . . . . . . . . . . . . . . . . 466 __SMLATB (intrinsic function) . . . . . . . . . . . . . . . . . . . . 439
__SADD8 (intrinsic function) . . . . . . . . . . . . . . . . . . . . . . 434 __SMLATT (intrinsic function) . . . . . . . . . . . . . . . . . . . . 439
__SADD16 (intrinsic function) . . . . . . . . . . . . . . . . . . . . . 434 __SMLAWB (intrinsic function) . . . . . . . . . . . . . . . . . . . 439
__SASX (intrinsic function) . . . . . . . . . . . . . . . . . . . . . . . 434 __SMLAWT (intrinsic function) . . . . . . . . . . . . . . . . . . . 439
__sbrel (extended keyword) . . . . . . . . . . . . . . . . . . . . . . . 369 __SMLSD (intrinsic function) . . . . . . . . . . . . . . . . . . . . . 439
__scanf_args (pragma directive) . . . . . . . . . . . . . . . . . . . . 403 __SMLSDX (intrinsic function) . . . . . . . . . . . . . . . . . . . . 439
__section_begin (extended operator) . . . . . . . . . . . . . . . . 190 __SMLSLD (intrinsic function) . . . . . . . . . . . . . . . . . . . . 440
__section_end (extended operator) . . . . . . . . . . . . . . . . . . 190 __SMLSLDX (intrinsic function) . . . . . . . . . . . . . . . . . . . 440
__section_size (extended operator) . . . . . . . . . . . . . . . . . . 190 __SMMLA (intrinsic function) . . . . . . . . . . . . . . . . . . . . . 441
__SEL (intrinsic function) . . . . . . . . . . . . . . . . . . . . . . . . 435 __SMMLAR (intrinsic function) . . . . . . . . . . . . . . . . . . . 441
__set_BASEPRI (intrinsic function) . . . . . . . . . . . . . . . . . 435 __SMMLS (intrinsic function) . . . . . . . . . . . . . . . . . . . . . 441
__set_CONTROL (intrinsic function). . . . . . . . . . . . . . . . 435 __SMMLSR (intrinsic function) . . . . . . . . . . . . . . . . . . . . 441
__set_CPSR (intrinsic function) . . . . . . . . . . . . . . . . . . . . 435 __SMMUL (intrinsic function) . . . . . . . . . . . . . . . . . . . . . 441
__set_FAULTMASK (intrinsic function) . . . . . . . . . . . . . 436 __SMMULR (intrinsic function) . . . . . . . . . . . . . . . . . . . 441
__set_FPSCR (intrinsic function) . . . . . . . . . . . . . . . . . . . 436 __SMUAD (intrinsic function) . . . . . . . . . . . . . . . . . . . . . 441
__set_interrupt_state (intrinsic function) . . . . . . . . . . . . . 436 __SMUL (intrinsic function) . . . . . . . . . . . . . . . . . . . . . . 442
__set_LR (intrinsic function) . . . . . . . . . . . . . . . . . . . . . . 436 __SMULBB (intrinsic function) . . . . . . . . . . . . . . . . . . . . 442
__set_MSP (intrinsic function) . . . . . . . . . . . . . . . . . . . . . 436 __SMULBT (intrinsic function) . . . . . . . . . . . . . . . . . . . . 442
__set_PRIMASK (intrinsic function) . . . . . . . . . . . . . . . . 437 __SMULTB (intrinsic function) . . . . . . . . . . . . . . . . . . . . 442
__set_PSP (intrinsic function). . . . . . . . . . . . . . . . . . . . . . 437 __SMULTT (intrinsic function) . . . . . . . . . . . . . . . . . . . . 442
__set_SB (intrinsic function) . . . . . . . . . . . . . . . . . . . . . . 437 __SMULWB (intrinsic function) . . . . . . . . . . . . . . . . . . . 442
__set_SP (intrinsic function) . . . . . . . . . . . . . . . . . . . . . . . 437 __SMULWT (intrinsic function) . . . . . . . . . . . . . . . . . . . 442
AFE1_AFE2-1:1
Index
667
AFE1_AFE2-1:1
__VFMA_F64 (intrinsic function) . . . . . . . . . . . . . . . . . . 452 -g (ielfdump option) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 570
__VFMS_F32 (intrinsic function) . . . . . . . . . . . . . . . . . . . 452 -I (compiler option). . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 283
__VFMS_F64 (intrinsic function) . . . . . . . . . . . . . . . . . . . 452 -l (compiler option) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 283
__VFNMA_F32 (intrinsic function) . . . . . . . . . . . . . . . . . 452 for creating skeleton code . . . . . . . . . . . . . . . . . . . . . . 174
__VFNMA_F64 (intrinsic function) . . . . . . . . . . . . . . . . . 452 -L (linker option) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 341
__VFNMS_F32 (intrinsic function) . . . . . . . . . . . . . . . . . 452 -O (compiler option) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 296
__VFNMS_F64 (intrinsic function) . . . . . . . . . . . . . . . . . 452 -o (compiler option) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 297
__VMAXNM_F32 (intrinsic function) . . . . . . . . . . . . . . . 453 -o (iarchive option) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 563
__VMAXNM_F64 (intrinsic function) . . . . . . . . . . . . . . . 453 -o (ielfdump option) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 563
__VMINNM_F32 (intrinsic function). . . . . . . . . . . . . . . . 453 -o (linker option) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 339
__VMINNM_F64 (intrinsic function). . . . . . . . . . . . . . . . 453 -r (compiler option). . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 272
__VRINTA_F32 (intrinsic function). . . . . . . . . . . . . . . . . 455 -r (iarchive option) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 569
__VRINTA_F64 (intrinsic function). . . . . . . . . . . . . . . . . 454 -s (ielfdump option) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 570
__VRINTM_F32 (intrinsic function) . . . . . . . . . . . . . . . . 455 -t (iarchive option) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 575
__VRINTM_F64 (intrinsic function) . . . . . . . . . . . . . . . . 454 -V (iarchive option) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 577
__VRINTN_F32 (intrinsic function). . . . . . . . . . . . . . . . . 455 -x (iarchive option) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 557
__VRINTN_F64 (intrinsic function). . . . . . . . . . . . . . . . . 454 --a (ielfdump option) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 549
__VRINTP_F32 (intrinsic function) . . . . . . . . . . . . . . . . . 455 --aapcs (compiler option) . . . . . . . . . . . . . . . . . . . . . . . . . 267
__VRINTP_F64 (intrinsic function) . . . . . . . . . . . . . . . . . 454 --advanced_heap (linker option) . . . . . . . . . . . . . . . . . . . . 315
__VRINTR_F32 (intrinsic function) . . . . . . . . . . . . . . . . . 455 --aeabi (compiler option) . . . . . . . . . . . . . . . . . . . . . . . . . 267
__VRINTR_F64 (intrinsic function) . . . . . . . . . . . . . . . . . 454 --align_sp_on_irq (compiler option) . . . . . . . . . . . . . . . . . 268
__VRINTX_F32 (intrinsic function). . . . . . . . . . . . . . . . . 455 --all (ielfdump option) . . . . . . . . . . . . . . . . . . . . . . . . . . . 550
__VRINTX_F64 (intrinsic function). . . . . . . . . . . . . . . . . 454 --arm (compiler option). . . . . . . . . . . . . . . . . . . . . . . . . . . 268
__VRINTZ_F32 (intrinsic function) . . . . . . . . . . . . . . . . . 455 --basic_heap (linker option) . . . . . . . . . . . . . . . . . . . . . . . 316
__VRINTZ_F64 (intrinsic function) . . . . . . . . . . . . . . . . . 455 --BE32 (linker option) . . . . . . . . . . . . . . . . . . . . . . . . . . . 316
__VSQRT_F32 (intrinsic function) . . . . . . . . . . . . . . . . . 455 --BE8 (linker option) . . . . . . . . . . . . . . . . . . . . . . . . . . . . 316
__VSQRT_F64 (intrinsic function) . . . . . . . . . . . . . . . . . 455 --bin (ielftool option) . . . . . . . . . . . . . . . . . . . . . . . . . . . . 550
__weak (extended keyword) . . . . . . . . . . . . . . . . . . . . . . . 380 --bin-multi (ielftool option). . . . . . . . . . . . . . . . . . . . . . . . 550
__WFE (intrinsic function) . . . . . . . . . . . . . . . . . . . . . . . . 456 --bounds_table_size (linker option) . . . . . . . . . . . . . . . . . 311
__WFI (intrinsic function) . . . . . . . . . . . . . . . . . . . . . . . . 456 --call_graph (linker option) . . . . . . . . . . . . . . . . . . . . . . . . 317
__write_array, in stdio.h . . . . . . . . . . . . . . . . . . . . . . . . . . 481 --char_is_signed (compiler option) . . . . . . . . . . . . . . . . . . 269
__write_buffered (DLIB library function) . . . . . . . . . . . . 128 --char_is_unsigned (compiler option) . . . . . . . . . . . . . . . . 269
__YIELD (intrinsic function) . . . . . . . . . . . . . . . . . . . . . . 456 --checksum (ielftool option) . . . . . . . . . . . . . . . . . . . . . . . 551
-D (compiler option) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 272 --cmse (compiler option). . . . . . . . . . . . . . . . . . . . . . . . . . 269
-d (iarchive option) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 556 --code (ielfdump option) . . . . . . . . . . . . . . . . . . . . . . . . . . 556
-e (compiler option) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 278 --config (linker option) . . . . . . . . . . . . . . . . . . . . . . . . . . . 317
-f (compiler option). . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 280 --config_def (linker option) . . . . . . . . . . . . . . . . . . . . . . . 317
-f (IAR utility option) . . . . . . . . . . . . . . . . . . . . . . . . . . . . 558 --config_search (linker option) . . . . . . . . . . . . . . . . . . . . . 318
-f (linker option) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 326 --cpp_init_routine (linker option) . . . . . . . . . . . . . . . . . . . 318
AFE1_AFE2-1:1
Index
669
AFE1_AFE2-1:1
--misrac2004 (compiler option) . . . . . . . . . . . . . . . . . . . . 263 --no_typedefs_in_diagnostics (compiler option) . . . . . . . . 293
--misrac2004 (linker option) . . . . . . . . . . . . . . . . . . . . . . . 313 --no_unaligned_access (compiler option) . . . . . . . . . . . . . 293
--nonportable_path_warnings (compiler option) . . . . . . . . 296 --no_unroll (compiler option) . . . . . . . . . . . . . . . . . . . . . . 294
--no_alignment_reduction (compiler option) . . . . . . . . . . 286 --no_utf8_in (ielfdump option) . . . . . . . . . . . . . . . . . . . . . 562
--no_bom (compiler option) . . . . . . . . . . . . . . . . . . . . . . . 286 --no_var_align (compiler option) . . . . . . . . . . . . . . . . . . . 295
--no_bom (ielfdump option) . . . . . . . . . . . . . . . . . . . . . . . 561 --no_vfe (linker option). . . . . . . . . . . . . . . . . . . . . . . . . . . 338
--no_bom (iobjmanip option) . . . . . . . . . . . . . . . . . . . . . . 561 --no_warnings (compiler option) . . . . . . . . . . . . . . . . . . . 295
--no_bom (isymexport option) . . . . . . . . . . . . . . . . . . . . . 561 --no_warnings (linker option) . . . . . . . . . . . . . . . . . . . . . . 338
--no_clustering (compiler option) . . . . . . . . . . . . . . . . . . . 287 --no_wrap_diagnostics (compiler option) . . . . . . . . . . . . . 295
--no_code_motion (compiler option) . . . . . . . . . . . . . . . . 287 --no_wrap_diagnostics (linker option) . . . . . . . . . . . . . . . 338
--no_const_align (compiler option) . . . . . . . . . . . . . . . . . . 287 --offset (ielftool option) . . . . . . . . . . . . . . . . . . . . . . . . . . 563
--no_cse (compiler option) . . . . . . . . . . . . . . . . . . . . . . . . 288 --only_stdout (compiler option) . . . . . . . . . . . . . . . . . . . . 297
--no_dynamic_rtti_elimination (linker option) . . . . . . . . . 334 --only_stdout (linker option) . . . . . . . . . . . . . . . . . . . . . . . 338
--no_entry (linker option) . . . . . . . . . . . . . . . . . . . . . . . . . 334 --option_name (compiler option) . . . . . . . . . . . . . . . . . . . 323
--no_exceptions (compiler option) . . . . . . . . . . . . . . . . . . 288 --output (compiler option). . . . . . . . . . . . . . . . . . . . . . . . . 297
--no_exceptions (linker option) . . . . . . . . . . . . . . . . . . . . . 335 --output (iarchive option) . . . . . . . . . . . . . . . . . . . . . . . . . 563
--no_fragments (compiler option) . . . . . . . . . . . . . . . . . . . 288 --output (ielfdump option) . . . . . . . . . . . . . . . . . . . . . . . . 563
--no_fragments (linker option) . . . . . . . . . . . . . . . . . . . . . 335 --output (linker option) . . . . . . . . . . . . . . . . . . . . . . . . . . . 339
--no_free_heap (linker option) . . . . . . . . . . . . . . . . . . . . . 335 --parity (ielftool option) . . . . . . . . . . . . . . . . . . . . . . . . . . 564
--no_header (ielfdump option) . . . . . . . . . . . . . . . . . . . . . 561 --pending_instantiations (compiler option) . . . . . . . . . . . . 297
--no_inline (compiler option) . . . . . . . . . . . . . . . . . . . . . . 289 --pi_veneers (linker option) . . . . . . . . . . . . . . . . . . . . . . . 339
--no_inline (linker option). . . . . . . . . . . . . . . . . . . . . . . . . 336 --place_holder (linker option) . . . . . . . . . . . . . . . . . . . . . . 339
--no_library_search (linker option) . . . . . . . . . . . . . . . . . . 336 --preconfig (linker option) . . . . . . . . . . . . . . . . . . . . . . . . 340
--no_literal_pool (compiler option) . . . . . . . . . . . . . . . . . . 289 --predef_macro (compiler option) . . . . . . . . . . . . . . . . . . . 298
--no_literal_pool (linker option) . . . . . . . . . . . . . . . . . . . . 336 --prefix (iexe2obj option) . . . . . . . . . . . . . . . . . . . . . . . . . 565
--no_locals (linker option) . . . . . . . . . . . . . . . . . . . . . . . . 337 --preinclude (compiler option) . . . . . . . . . . . . . . . . . . . . . 298
--no_loop_align (compiler option) . . . . . . . . . . . . . . . . . . 290 --preprocess (compiler option) . . . . . . . . . . . . . . . . . . . . . 299
--no_mem_idioms (compiler option) . . . . . . . . . . . . . . . . 290 --printf_multibytes (linker option) . . . . . . . . . . . . . . . . . . 340
--no_path_in_file_macros (compiler option). . . . . . . . . . . 290 --ram_reserve_ranges (isymexport option) . . . . . . . . . . . . 566
--no_range_reservations (linker option) . . . . . . . . . . . . . . 337 --range (ielfdump option) . . . . . . . . . . . . . . . . . . . . . . . . . 566
--no_rel_section (ielfdump option) . . . . . . . . . . . . . . . . . . 562 --raw (ielfdump] option) . . . . . . . . . . . . . . . . . . . . . . . . . . 567
--no_remove (linker option) . . . . . . . . . . . . . . . . . . . . . . . 337 --redirect (linker option) . . . . . . . . . . . . . . . . . . . . . . . . . . 340
--no_rtti (compiler option) . . . . . . . . . . . . . . . . . . . . . . . . 291 --relaxed_fp (compiler option) . . . . . . . . . . . . . . . . . . . . . 299
--no_rw_dynamic_init (compiler option) . . . . . . . . . . . . . 291 --remarks (compiler option) . . . . . . . . . . . . . . . . . . . . . . . 300
--no_scheduling (compiler option) . . . . . . . . . . . . . . . . . . 291 --remarks (linker option) . . . . . . . . . . . . . . . . . . . . . . . . . . 341
--no_size_constraints (compiler option) . . . . . . . . . . . . . . 292 --remove_file_path (iobjmanip option) . . . . . . . . . . . . . . . 567
--no_static_destruction (compiler option) . . . . . . . . . . . . . 292 --remove_section (iobjmanip option) . . . . . . . . . . . . . . . . 567
--no_strtab (ielfdump option) . . . . . . . . . . . . . . . . . . . . . . 562 --rename_section (iobjmanip option) . . . . . . . . . . . . . . . . 568
--no_system_include (compiler option) . . . . . . . . . . . . . . 292 --rename_symbol (iobjmanip option) . . . . . . . . . . . . . . . . 568
AFE1_AFE2-1:1
Index
671
AFE1_AFE2-1:1
.prepreinit_array (section) . . . . . . . . . . . . . . . . . . . . . . . . . 521
.rel (ELF section) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 518
.rela (ELF section) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 518
.rodata (ELF section) . . . . . . . . . . . . . . . . . . . . . . . . . . . . 521
.shstrtab (ELF section) . . . . . . . . . . . . . . . . . . . . . . . . . . . 518
.strtab (ELF section) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 518
.symtab (ELF section) . . . . . . . . . . . . . . . . . . . . . . . . . . . . 518
.text (ELF section) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 521
.textrw (ELF section) . . . . . . . . . . . . . . . . . . . . . . . . . . . . 521
.textrw_init (ELF section) . . . . . . . . . . . . . . . . . . . . . . . . . 522
@ (operator)
placing at absolute address . . . . . . . . . . . . . . . . . . . . . . 231
placing in sections . . . . . . . . . . . . . . . . . . . . . . . . . . . . 232
#include directive,
implementation-defined behavior for C++ . . . . . . . . . . . . 588
#include files, specifying . . . . . . . . . . . . . . . . . . . . . 251, 283
#include_next . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 194
#pragma directive . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 383
implementation-defined behavior for C++ . . . . . . . . . . 588
#warning . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 194
#warning message (preprocessor extension) . . . . . . . . . . . 469
%Z replacement string,
implementation-defined behavior in C . . . . . . . . . . . . . . . 614
$Sub$$ pattern . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 225
$Super$$ pattern . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 225
$$ (in reserved identifiers) . . . . . . . . . . . . . . . . . . . . . . . . 256
Numerics
32-bits (floating-point format) . . . . . . . . . . . . . . . . . . . . . 357
64-bits (floating-point format) . . . . . . . . . . . . . . . . . . . . . 357
AFE1_AFE2-1:1