|
|||||||||||
|
Technical Support On-Line Manuals Assembler Reference |
ALIGN
The
where:
The current location is aligned to the next lowest address of the form:
If
Use
Alignment is relative to the start of the ELF section where
the routine is located. The section must be aligned to the same,
or coarser, boundaries. The
AREA cacheable, CODE, ALIGN=3
rout1 ; code ; aligned on 8-byte boundary
; code
MOV pc,lr ; aligned only on 4-byte boundary
ALIGN 8 ; now aligned on 8-byte boundary
rout2 ; code
In the following example, the
AREA OffsetExample, CODE
DCB 1 ; This example places the two bytes in the first
ALIGN 4,3 ; and fourth bytes of the same word.
DCB 1 ; The second DCB is offset by 3 bytes from the first DCB
In the following example, the AREA OffsetExample1, CODE DCB 1 ; In this example, n cannot be 0 because it clashes with DCB 1 ; the 3rd DCB. The assembler sets n to 1. DCB 1 ALIGN 4,2 ; The next instruction is word aligned and offset by 2. DCB 2 In the following example, the
AREA Example, CODE, READONLY
start LDR r6,=label1
; code
MOV pc,lr
label1 DCB 1 ; PC now misaligned
ALIGN ; ensures that subroutine1 addresses
subroutine1 ; the following instruction.
MOV r5,#0x5
| ||||||||||
|
|||||||||||