CMSIS-Core (Cortex-A)  
CMSIS-Core support for Cortex-A processor-based devices
 
Loading...
Searching...
No Matches
Compiler Control

Compiler agnostic #define symbols for generic C/C++ source code. More...

Macros

#define __ARM_ARCH_7A__
 Set to 1 when generating code for Armv7-A (Cortex-A7)
 
#define __STATIC_FORCEINLINE
 Define a static function that should be always inlined by the compiler.
 
#define __PACKED_STRUCT
 Request smallest possible alignment for a structure.
 
#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.
 

Description

Compiler agnostic #define symbols for generic C/C++ source code.

The CMSIS-Core provides the header file cmsis_compiler.h with consistent #define symbols to generate C or C++ source files that should be compiler agnostic. Each CMSIS compliant compiler should support the functionality described in this section.

Macro Definition Documentation

◆ __ARM_ARCH_7A__

#define __ARM_ARCH_7A__

Set to 1 when generating code for Armv7-A (Cortex-A7)

The #define ARM_ARCH_7A is set to 1 when generating code for the Armv7-A architecture. This architecture is for example used by the Cortex-A7 processor.

◆ __PACKED_STRUCT

#define __PACKED_STRUCT

Request smallest possible alignment for a structure.

Specifies that a structure must have the smallest possible alignment.

Code Example:

uint8_t u8;
uint32_t u32;
uint16_t u16;
};
#define __PACKED_STRUCT
Request smallest possible alignment for a structure.
Definition: ref_compiler_ctrl.txt:200

◆ __STATIC_FORCEINLINE

#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.

Note
For compilers that do not allow to force function inlining, the macro maps to __STATIC_INLINE.

Code Example:

\\ Get Interrupt Vector
__STATIC_FORCEINLINE uint32_t NVIC_GetVector(IRQn_Type IRQn)
{
uint32_t *vectors = (uint32_t *) ((uintptr_t) SCB->VTOR);
return vectors[(int32_t)IRQn + NVIC_USER_IRQ_OFFSET];
}
#define __STATIC_FORCEINLINE
Define a static function that should be always inlined by the compiler.
Definition: ref_compiler_ctrl.txt:103
IRQn_Type
Definition of IRQn numbers.
Definition: ref_irq_ctrl.txt:79

◆ __UNALIGNED_UINT16_READ

#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:

uint16_t val16;
void test (uint8_t *ptr) {
}
#define __UNALIGNED_UINT16_READ
Pointer for unaligned read of a uint16_t variable.
Definition: ref_compiler_ctrl.txt:221

◆ __UNALIGNED_UINT16_WRITE

#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:

uint16_t val16 = 0U;
void test (uint8_t *ptr) {
}
#define __UNALIGNED_UINT16_WRITE
Pointer for unaligned write of a uint16_t variable.
Definition: ref_compiler_ctrl.txt:242

◆ __UNALIGNED_UINT32_READ

#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:

uint32_t val32;
void test (uint8_t *ptr) {
}
#define __UNALIGNED_UINT32_READ
Pointer for unaligned read of a uint32_t variable.
Definition: ref_compiler_ctrl.txt:263

◆ __UNALIGNED_UINT32_WRITE

#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:

uint32_t val32 = 0U;
void test (uint8_t *ptr) {
}
#define __UNALIGNED_UINT32_WRITE
Pointer for unaligned write of a uint32_t variable.
Definition: ref_compiler_ctrl.txt:284