Keil Logo Arm Logo

Technical Support

On-Line Manuals

Linker Reference Guide

Conventions and feedback Linker command-line options Linker steering file command reference Formal syntax of the scatter file BNF notation used in scatter-loading description s Syntax of a scatter file About load region descriptions Syntax of a load region description Load region attributes About execution region descriptions Syntax of an execution region description Execution region attributes Address attributes for load and execution regions Considerations when using a relative address +offs Considerations when using a relative address +offs Inheritance rules for load region address attribut Inheritance rules for execution region address att Inheritance rules for the RELOC address attribute About input section descriptions Syntax of an input section description How the linker resolves multiple matches when proc Behavior when .ANY sections overflow because of li How the linker resolves path names when processing About Expression evaluation in scatter files Expression usage in scatter files Expression rules in scatter files Execution address built-in functions for use in sc Scatter files containing relative base address loa ScatterAssert function and load address related fu Symbol related function in a scatter file Example of aligning a base address in execution sp AlignExpr(expr, align) function GetPageSize() function SizeOfHeaders() function

Linker Reference Guide

AlignExpr(expr, align) function

AlignExpr(expr, align) function

This function returns:

(expr + (align-1)) & ~(align-1))

where:

  • expr is a valid address expression

  • align is the alignment, and must be a positive power of 2.

It increases expr until it is:

0 mod align

Show/hideExample

This example aligns the address of ER2 on an 8-byte boundary:

ER +0
{
    ...
}

ER2 AlignExpr(+0x8000,8)
{
    ...
}

Show/hideRelationship with the ALIGN keyword

The following relationship exists between ALIGN and AlignExpr:

ALIGN keyword

Load and execution regions already have an ALIGN keyword:

  • for load regions the ALIGN keyword aligns the base of the load region in load space and in the file to the specified alignment

  • for execution regions the ALIGN keyword aligns the base of the execution region in execution and load space to the specified alignment.

AlignExpr

Aligns the expression it operates on, but has no effect on the properties of the load or execution region.

Show/hideSee also

Copyright © 2008, 2011-2012 ARM. All rights reserved.ARM DUI 0458C
Non-ConfidentialID062912

Keil logo

Arm logo
Important information

This site uses cookies to store information on your computer. By continuing to use our site, you consent to our cookies.