5.30 Types of data alignment

All access to data in memory can be classified into a number of different categories.

These categories are as follows:

  • Natural alignment, for example, on a word boundary at 0x1004. The ARM compiler normally aligns variables and pads structures so that these items are accessed efficiently using LDR and STR instructions.

  • Known but non-natural alignment, for example, a word at address 0x1001. This type of alignment commonly occurs when structures are packed to remove unnecessary padding. In C and C++, the __packed qualifier or the #pragma pack(n) pragma let you signify that a structure is packed.

  • Unknown alignment, for example, a word at an arbitrary address. This type of alignment commonly occurs when defining a pointer that can point to a word at any address. In C and C++, the __packed qualifier or the #pragma pack(n) pragma let you signify that a pointer can access a word on a non-natural alignment boundary.

Non-ConfidentialPDF file icon PDF versionARM DUI0472M
Copyright © 2010-2016 ARM Limited or its affiliates. All rights reserved.