29.12.2014 Views

RealView Compilation Tools Compiler Reference Guide - ARM ...

RealView Compilation Tools Compiler Reference Guide - ARM ...

RealView Compilation Tools Compiler Reference Guide - ARM ...

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

<strong>Compiler</strong>-specific Features<br />

4.5.5 __attribute__((packed))<br />

The packed variable attribute specifies that a variable or structure field has the smallest<br />

possible alignment. That is, one byte for a variable, and one bit for a field, unless you<br />

specify a larger value with the aligned attribute.<br />

Note<br />

This variable attribute is a GNU compiler extension that is supported by the <strong>ARM</strong><br />

compiler.<br />

Example<br />

struct<br />

{<br />

char a;<br />

int b __attribute__ ((packed));<br />

} Variable_Attributes_packed_0;<br />

See also<br />

• Packed structures on page 5-10<br />

• The __packed qualifier and unaligned accesses to data on page 4-24 in the<br />

<strong>Compiler</strong> User <strong>Guide</strong><br />

• __packed structures versus individually __packed fields on page 4-26 in the<br />

<strong>Compiler</strong> User <strong>Guide</strong>.<br />

4.5.6 __attribute__((section))<br />

Normally, the <strong>ARM</strong> compiler places the objects it generates in sections like data and<br />

bss. However, you might require additional data sections or you might want a variable<br />

to appear in a special section, for example, to map to special hardware. The section<br />

attribute specifies that a variable must be placed in a particular data section. If you use<br />

the section attribute, read-only variables are placed in RO data sections, read-write<br />

variables are placed in RW data sections unless you use the zero_init attribute. In this<br />

case, the variable is placed in a ZI section.<br />

Note<br />

This variable attribute is a GNU compiler extension that is supported by the <strong>ARM</strong><br />

compiler.<br />

4-44 Copyright © 2007, 2010 <strong>ARM</strong> Limited. All rights reserved. <strong>ARM</strong> DUI 0348A<br />

Non-Confidential

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

Saved successfully!

Ooh no, something went wrong!