The __ldrt intrinsic lets you load data from memory in your C or C++ code using an LDR{size}T instruction.
Syntax
unsigned int __ldrt(const volatile void *ptr)
Where:
ptr
Points to the address of the data to be loaded from memory. To specify the size of
the data to be loaded, cast the parameter to an appropriate integral type.
Table 9-10 Access widths that the __ldrt intrinsic supports
The __ldrt intrinsic returns the data loaded from the memory address
pointed to by ptr.
Errors
The compiler does not recognize the __ldrt intrinsic when compiling for a
target that does not support the LDRT instruction. The compiler generates
either a warning or an error in this case, depending on the source language:
In C code: Warning: #223-D: function "__ldrt" declared implicitly.
In C++ code: Error: #20: identifier "__ldrt" is undefined.
The __ldrt intrinsic does not support access to doubleword data. The
compiler generates an error if you specify an access width that is not supported.
Example
int foo(void)
{
int loc = 0xff;
return __ldrt((const volatile int *)loc);
}
Compiling this code with the default options produces:
||foo|| PROC
MOV r1,#0xff
LDRT r0,[r1],#0
BX lr
ENDP
a If the target instruction set does not have
the listed instruction, the compiler generates a sequence of
instructions with equivalent behavior instead.
Arm’s Privacy Policy has been updated. By continuing to use our site, you consent to Arm’s Privacy Policy. Please review our Privacy Policy to learn more about our collection, use and transfers of your data.