29.10.2014 Views

ARM Compiler toolchain v4.1 for µVision Using the Compiler

ARM Compiler toolchain v4.1 for µVision Using the Compiler

ARM Compiler toolchain v4.1 for µVision Using the Compiler

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

<strong>Compiler</strong> Coding Practices<br />

5.30 Advantages of natural data alignment<br />

The various C data types are aligned on specific byte boundaries to maximize storage potential<br />

and to provide <strong>for</strong> fast, efficient memory access with <strong>the</strong> <strong>ARM</strong> instruction set. For example, <strong>the</strong><br />

<strong>ARM</strong> architecture can access a four-byte variable using only one instruction when <strong>the</strong> object is<br />

stored at an address divisible by four, so four-byte objects are located on four-byte boundaries.<br />

<strong>ARM</strong> and Thumb processors are designed to efficiently access naturally aligned data, that is,<br />

doublewords that lie on addresses that are multiples of eight, words that lie on addresses that are<br />

multiples of four, halfwords that lie on addresses that are multiples of two, and single bytes that<br />

lie at any byte address. Such data is located on its natural size boundary.<br />

5.30.1 See also<br />

Concepts<br />

• <strong>Compiler</strong> storage of data objects by natural byte alignment on page 5-43<br />

• Relevance of natural data alignment at compile time on page 5-44.<br />

<strong>ARM</strong> DUI 0375C Copyright © 2007-2008, 2011 <strong>ARM</strong>. All rights reserved. 5-42<br />

ID061811<br />

Non-Confidential

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!