Compiler agnostic #define symbols for generic C/C++ source code. More...
Macros | |
#define | __ALIAS |
Creates a symbol as alias to another symbol. | |
#define | __ALIGNED |
Minimum alignment for a variable. | |
#define | __ARM_ARCH_6M__ |
Set to 1 when generating code for Armv6-M architecture. | |
#define | __ARM_ARCH_7EM__ |
Set to 1 when generating code for Armv7-M architecture with FPU. | |
#define | __ARM_ARCH_7M__ |
Set to 1 when generating code for Armv7-M architecture. | |
#define | __ARM_ARCH_8_1M_MAIN__ |
Set to 1 when generating code for Armv8.1-M architecture. | |
#define | __ARM_ARCH_8M_BASE__ |
Set to 1 when generating code for Armv8-M Baseline architecture. | |
#define | __ARM_ARCH_8M_MAIN__ |
Set to 1 when generating code for Armv8-M Mainline architecture. | |
#define | __ASM |
Pass information from the compiler to the assembler. | |
#define | __COMPILER_BARRIER |
Barrier to prevent compiler from reordering instructions. | |
#define | __INITIAL_SP |
Compiler/linker symbol specifying the location of the main stack (MSP). | |
#define | __INLINE |
Recommend that function should be inlined by the compiler. | |
#define | __NO_INIT |
Specifies a section name for a variable to simplify variable placement into a non-initialized memory. | |
#define | __NO_RETURN |
Inform the compiler that a function does not return. | |
#define | __PACKED |
Request smallest possible alignment. | |
#define | __PACKED_STRUCT |
Request smallest possible alignment for a structure. | |
#define | __PROGRAM_START |
Entry function into the user application or library startup. | |
#define | __RESTRICT |
restrict pointer qualifier to enable additional optimizations. | |
#define | __STACK_LIMIT |
Compiler/linker symbol specifying the limit of the main stack (MSP). | |
#define | __STATIC_FORCEINLINE |
Define a static function that should be always inlined by the compiler. | |
#define | __STATIC_INLINE |
Define a static function that may be inlined by the compiler. | |
#define | __UNALIGNED_UINT16_READ |
Pointer for unaligned read of a uint16_t variable. | |
#define | __UNALIGNED_UINT16_WRITE |
Pointer for unaligned write of a uint16_t variable. | |
#define | __UNALIGNED_UINT32_READ |
Pointer for unaligned read of a uint32_t variable. | |
#define | __UNALIGNED_UINT32_WRITE |
Pointer for unaligned write of a uint32_t variable. | |
#define | __USED |
Inform that a variable shall be retained in executable image. | |
#define | __VECTOR_TABLE |
Symbol name used for the (static) interrupt vector table. | |
#define | __VECTOR_TABLE_ATTRIBUTE |
Additional decl specs to be used when defining the (static) interrupt vector table. | |
#define | __WEAK |
Export a function or variable weakly to allow overwrites. | |
Compiler agnostic #define symbols for generic C/C++ source code.
The CMSIS-Core provides the header file cmsis_compiler.h with consistent #define symbols for generate C or C++ source files that should be compiler agnostic. Each CMSIS compliant compiler should support the functionality described in this section.
The header file cmsis_compiler.h is also included by each Device Header File <Device.h> so that these definitions are available.
#define __ALIAS |
Creates a symbol as alias to another symbol.
Code Example: The example declares the function Interrupt0_Handler. By default it is just an alias pointing to Default_Handler. In combination with __WEAK modifier this allows giving the function definition at a later point if required.
#define __ALIGNED |
#define __ARM_ARCH_6M__ |
Set to 1 when generating code for Armv6-M architecture.
The #define ARM_ARCH_6M is set to 1 when generating code for the Armv6-M architecture. This architecture is for example used by the Cortex-M0, Cortex-M0+, and Cortex-M1 processor.
#define __ARM_ARCH_7EM__ |
Set to 1 when generating code for Armv7-M architecture with FPU.
The #define ARM_ARCH_7EM is set to 1 when generating code for the Armv7-M architecture with floating point extension. This architecture is for example implemented by the Cortex-M4 processor with FPU.
#define __ARM_ARCH_7M__ |
Set to 1 when generating code for Armv7-M architecture.
The #define ARM_ARCH_7M is set to 1 when generating code for the Armv7-M architecture. This architecture is for example used by the Cortex-M3 processor.
#define __ARM_ARCH_8_1M_MAIN__ |
Set to 1 when generating code for Armv8.1-M architecture.
The #define ARM_ARCH_8_1M_MAIN is set to 1 when generating code for the Armv8.1-M architecture. This architecture is for example implemented by the Cortex-M55 processor.
#define __ARM_ARCH_8M_BASE__ |
Set to 1 when generating code for Armv8-M Baseline architecture.
The #define ARM_ARCH_8M_BASE is set to 1 when generating code for the Armv8-M architecture baseline variant. This architecture is for example implemented by the Cortex-M23 processor.
#define __ARM_ARCH_8M_MAIN__ |
Set to 1 when generating code for Armv8-M Mainline architecture.
The #define ARM_ARCH_8M_MAIN is set to 1 when generating code for the Armv8-M architecture mainline variant. This architecture is for example implemented by the Cortex-M33 processor.
#define __ASM |
Pass information from the compiler to the assembler.
The __ASM keyword can declare or define an embedded assembly function or incorporate inline assembly into a function (shown in the code example below).
Code Example:
#define __COMPILER_BARRIER |
Barrier to prevent compiler from reordering instructions.
This barrier limits the compilers reordering optimizations. It prevents the compiler from swapping instructions resulting from code before and after the barrier.
Code Example: The assignments in the example are independent. Hence the compiler could choose a different order of execution, e.g. for a better pipeline utilization. Using the barrier in between prevents this type of reordering.
#define __INITIAL_SP |
Compiler/linker symbol specifying the location of the main stack (MSP).
The address of the specified symbol is used to initialize the main stack pointer (MSP) during low level init. This is compiler/linker specific. CMSIS specifies common default for supported compilers.
#define __INLINE |
Recommend that function should be inlined by the compiler.
Inline functions offer a trade-off between code size and performance. By default, the compiler decides during optimization whether to inline code or not. The __INLINE attribute gives the compiler an hint to inline this function. Still, the compiler may decide not to inline the function. As the function is global an callable function is also generated.
Code Example:
#define __NO_INIT |
Specifies a section name for a variable to simplify variable placement into a non-initialized memory.
Specifies a section name (e.g, .bss.noinit or .noinit) for a variable that can be used by a linker-script to position that variable into a non-initialized memory.
Code Example: The EventBuffer in the example must not be copy- or zero-initialized. By adding __NO_INIT at variable declaration/definition, and with appropriate linker-script, this variable is positioned into a non-initialized memory.
#define __NO_RETURN |
Inform the compiler that a function does not return.
Informs the compiler that the function does not return. The compiler can then perform optimizations by removing code that is never reached.
Code Example:
#define __PACKED |
#define __PACKED_STRUCT |
Request smallest possible alignment for a structure.
Specifies that a structure must have the smallest possible alignment.
Code Example:
#define __PROGRAM_START |
Entry function into the user application or library startup.
Gives the function to be jumped into right after low level initialization, i.e. SystemInit. This is compiler and library specific. CMSIS specifies common default for supported compilers.
Code Example:
#define __RESTRICT |
restrict pointer qualifier to enable additional optimizations.
The __RESTRICT keyword corresponds to the restrict pointer qualifier that has been introduced in C99. __RESTRICT is a hint to the compiler that enables additional optimizations. It specifies that for the lifetime of the pointer, only the pointer itself or a value directly derived from it (such as pointer + 1) is used to access the object. The compiler may therefore ignore potential pointer aliasing effects and perform additional optimizations.
Code Example:
#define __STACK_LIMIT |
Compiler/linker symbol specifying the limit of the main stack (MSP).
The address of the specified symbol is used to initialize the main stack pointer limit (MSPLIM on Armv8-M) during low level init. This is compiler/linker specific. CMSIS specifies common default for supported compilers.
Code Example:
#define __STATIC_FORCEINLINE |
Define a static function that should be always inlined by the compiler.
Defines a static function that should be always inlined by the compiler.
Code Example:
#define __STATIC_INLINE |
Define a static function that may be inlined by the compiler.
Defines a static function that may be inlined by the compiler. If the compiler generates inline code for all calls to this functions, no additional function implementation is generated which may further optimize space.
Code Example:
#define __UNALIGNED_UINT16_READ |
Pointer for unaligned read of a uint16_t variable.
Defines a pointer to a uint16_t from an address that does not need to be aligned. This can then be used in read operations. The compiler will generate the appropriate access (aligned or non-aligned) depending on the underlying Arm processor core and compiler settings.
Code Example:
#define __UNALIGNED_UINT16_WRITE |
Pointer for unaligned write of a uint16_t variable.
Defines a pointer to a uint16_t from an address that does not need to be aligned. This can then be used in write operations. The compiler will generate the appropriate access (aligned or non-aligned) depending on the underlying Arm processor core and compiler settings.
Code Example:
#define __UNALIGNED_UINT32_READ |
Pointer for unaligned read of a uint32_t variable.
Defines a pointer to a uint32_t from an address that does not need to be aligned. This can then be used in read operations. The compiler will generate the appropriate access (aligned or non-aligned) depending on the underlying Arm processor core and compiler settings.
Code Example:
#define __UNALIGNED_UINT32_WRITE |
Pointer for unaligned write of a uint32_t variable.
Defines a pointer to a uint32_t from an address that does not need to be aligned. This can then be used in write operations. The compiler will generate the appropriate access (aligned or non-aligned) depending on the underlying Arm processor core and compiler settings.
Code Example:
#define __USED |
Inform that a variable shall be retained in executable image.
Definitions tagged with __USED in the source code should be not removed by the linker when detected as unused.
Code Example:
#define __VECTOR_TABLE |
Symbol name used for the (static) interrupt vector table.
The given name is used for defining the static (compiler time) interrupt vector table. The name must comply with any compiler/linker conventions, e.g. if used for vector table relocation or debugger awareness. CMSIS specifies common default for supported compilers.
#define __VECTOR_TABLE_ATTRIBUTE |
Additional decl specs to be used when defining the (static) interrupt vector table.
The given decl specs are used for defining the static (compiler time) interrupt vector table, e.g. to mark the table as used and force it into a specific linker section. CMSIS specifies common default for supported compilers.
#define __WEAK |
Export a function or variable weakly to allow overwrites.
Functions defined with __WEAK export their symbols weakly. A weakly defined function behaves like a normally defined function unless a non-weakly defined function of the same name is linked into the same image. If both a non-weakly defined function and a weakly defined function exist in the same image then all calls to the function resolve to call the non-weak function.
Functions declared with __WEAK and then defined without __WEAK behave as non-weak functions.
Code Example: