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

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>-specific Features<br />

Where:<br />

ptr<br />

Points to the address of the data to be loaded from memory. To specify<br />

the size of the data to be loaded, cast the parameter to an appropriate<br />

integral type.<br />

Table 4-9 Access widths supported by the __ldrt intrinsic<br />

Instruction a<br />

Size of data loaded<br />

C cast<br />

LDRSBT signed byte (signed char *)<br />

LDRBT unsigned byte (char *)<br />

LDRSHT signed half word (signed short int *)<br />

LDRHT unsigned halfword (short int *)<br />

LDRT word (int *)<br />

a. Or equivalent.<br />

Return value<br />

The __ldrt intrinsic returns the data loaded from the memory address pointed to by ptr.<br />

Errors<br />

The compiler does not recognize the __ldrt intrinsic when compiling for a target that<br />

does not support the LDRT instruction. The compiler generates either a warning or an<br />

error in this case.<br />

The __ldrt intrinsic does not support access to doubleword data. The compiler<br />

generates an error if you specify an access width that is not supported.<br />

Example<br />

int foo(void)<br />

{<br />

int loc = 0xff;<br />

return __ldrt((const volatile int *)loc);<br />

}<br />

Compiling this code with the default options produces:<br />

||foo|| PROC<br />

MOV<br />

LDRBT<br />

r0,#0xff<br />

r1,[r0],#0<br />

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

Non-Confidential

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

Saved successfully!

Ooh no, something went wrong!