04.01.2015 Views

RealView Compilation Tools - ARM Information Center

RealView Compilation Tools - ARM Information Center

RealView Compilation Tools - ARM Information Center

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.

Compiler-specific Features<br />

The function exits by setting the program counter to lr-4 and the CPSR to the value in<br />

SPSR. No arguments or return values can be used with __irq functions.<br />

Note<br />

When compiling for a Thumb-only processor, the code is compiled to Thumb code<br />

because interrupt handlers are entered in Thumb state. Otherwise, even when compiling<br />

for Thumb using the --thumb option or #pragma thumb, any functions specified as __irq<br />

are compiled for <strong>ARM</strong>.<br />

See also<br />

• --thumb on page 2-122<br />

• #pragma thumb on page 4-73<br />

• Chapter 6 Handling Processor Exceptions in the Developer Guide.<br />

4.1.11 __packed<br />

The __packed qualifier sets the alignment of any valid type to 1. This means that:<br />

• there is no padding inserted to align the packed object<br />

• objects of packed type are read or written using unaligned accesses.<br />

The __packed qualifier applies to all members of a structure or union when it is declared<br />

using __packed. There is no padding between members, or at the end of the structure.<br />

All substructures of a packed structure must be declared using __packed. Integral<br />

subfields of an unpacked structure can be packed individually.<br />

Usage<br />

The __packed qualifier is useful to map a structure to an external data structure, or for<br />

accessing unaligned data, but it is generally not useful to save data size because of the<br />

relatively high cost of access. Only packing fields in a structure that requires packing<br />

can reduce the number of unaligned accesses.<br />

Note<br />

On <strong>ARM</strong> processors that do not support unaligned access in hardware, for example,<br />

pre-<strong>ARM</strong>v6, access to unaligned data can be costly in terms of code size and execution<br />

speed. Data accesses through packed structures must be minimized to avoid increase in<br />

code size and performance loss.<br />

<strong>ARM</strong> DUI 0348C Copyright © 2007-2010 <strong>ARM</strong>. All rights reserved. 4-11<br />

ID101213<br />

Non-Confidential,

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

Saved successfully!

Ooh no, something went wrong!