Please explain your answer Thank you What does ALIGN 8 5 mea

Please explain your answer. Thank you.
What does \"ALIGN 8, 5\" mean? Draw the data memory layout assuming that the data memory starts at 0x20000000. AREA my Data, Data ALIGN 4 DCB 1 DCB 2 DCB 3 ALIGN 8, 5 DCB 5

Solution

Align instruction in arm assembly is used to align the address to a particular word/byte or double word size.

The format of the instruction is:

ALIGN {expr{,offset{,pad{,padsize}}}}
where:
expr
is a numeric expression evaluating to any power of 2 from 20 to 231
offset
can be any numeric expression
pad
can be any numeric expression
padsize
can be 1, 2 or 4.

ALIGN 4 will align the addresses to word size (4 byte). Like 0x2000_0004 or 0x2000_0008 etc

Similary ALIGN 8 will align the address to double word size (8 byte). like 0x2000_0008 and 0x2000_0010 etc.

The ALIGN 8,5

Here 5 represents the padding so the next instruction will be 8 byte aligned with offset of 5 and the addresses will go accordingly.

The address will be 0x2000_0008 + 0x5 as the offset.

Assuming the dcb is placed at address 0x2000_0008

Please explain your answer. Thank you. What does \

Get Help Now

Submit a Take Down Notice

Tutor
Tutor: Dr Jack
Most rated tutor on our site