6.31 Access to C and C++ compile-time constant expressions from embedded assembler

You can use the __cpp keyword to access C and C++ compile-time constant expressions, including the addresses of data or functions with external linkage, from the assembly code.

The expression inside the __cpp must be a constant expression suitable for use as a C++ static initialization. See 3.6.2 Initialization of non-local objects and 5.19 Constant expressions in ISO/IEC 14882:2003.
The following example shows a constant replacing the use of __cpp(expr):
LDR r0, =__cpp(&some_variable)
LDR r1, =__cpp(some_function)
BL  __cpp(some_function)
MOV r0, #__cpp(some_constant_expr)
Names in the __cpp expression are looked up in the C++ context of the __asm function. Any names in the result of a __cpp expression are mangled as required and automatically have IMPORT statements generated for them.
Related concepts
6.26 Embedded assembler support in the compiler
6.29 Restrictions on embedded assembly language functions in C and C++ code
6.33 Manual overload resolution in embedded assembler
6.32 Differences between expressions in embedded assembler and C or C++
Non-ConfidentialPDF file icon PDF versionARM DUI0375E
Copyright © 2007, 2008, 2011, 2012, 2014 ARM. All rights reserved.