- IAR Embedded Workbench for Arm 9.70.x
- IAR C/C++ Development
- The linker configuration file
- Overview of the linker configuration file
Overview of the linker configuration file
Before you read the following pages, you must be familiar with the concept of sections, see Modules and sections.
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:
Declaring the build type
informing the linker of whether the build is for a traditional ROM system or for a RAM system, helping the linker check that only suitable sections are placed in the different memory regions.
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.
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 (//...).
Using special characters in identifiers
To specify a user-defined identifier in a linker configuration file—for example, a symbol name, section name, region name, etc.—you have two options:
as a plain string, for example
define symbol fooas a string in backticks, for example
define symbol `foo symbol`
In section selectors you can also use double quotes, for example object "foo.o".
Strings within backticks can contain whitespace and other special characters. To use an actual backtick in a string, you can escape it with another backtick. For example, define symbol `it``s` will parse into a symbol named it`s. Backslash (\) is not an escape character in linker configuration files.
Escaping a double quote in a string within double quotes works in the same fashion. For example, include "foo"".icf" will escape the "" in the middle into a single ", making the linker look for a file named foo".icf.