![]() |
CMSIS-Core (Cortex-A)
Version 1.1.4
CMSIS-Core support for Cortex-A processor-based devices
|
Compiler agnostic #define symbols for generic C/C++ source code. More...
Macros | |
#define | __ARM_ARCH_7A__ 1 |
Set to 1 when generating code for Armv7-A (Cortex-A7) More... | |
#define | __ASM __asm |
Pass information from the compiler to the assembler. More... | |
#define | __INLINE __inline |
Recommend that function should be inlined by the compiler. More... | |
#define | __STATIC_INLINE static __inline |
Define a static function should be inlined by the compiler. More... | |
#define | __STATIC_FORCEINLINE |
Define a static function that should be always inlined by the compiler. More... | |
#define | __NO_RETURN __declspec(noreturn) |
Inform the compiler that a function does not return. More... | |
#define | __USED __attribute__((used)) |
Inform that a variable shall be retained in executable image. More... | |
#define | __WEAK __attribute__((weak)) |
Export a function or variable weakly to allow overwrites. More... | |
#define | __ALIGNED(x) __attribute__((aligned(x))) |
Minimum alignment for a variable. More... | |
#define | __PACKED __attribute__((packed)) |
Request smallest possible alignment. More... | |
#define | __PACKED_STRUCT |
Request smallest possible alignment for a structure. More... | |
#define | __UNALIGNED_UINT32 |
Pointer for unaligned access of a uint32_t variable. More... | |
#define | __UNALIGNED_UINT16_READ |
Pointer for unaligned read of a uint16_t variable. More... | |
#define | __UNALIGNED_UINT16_WRITE |
Pointer for unaligned write of a uint16_t variable. More... | |
#define | __UNALIGNED_UINT32_READ |
Pointer for unaligned read of a uint32_t variable. More... | |
#define | __UNALIGNED_UINT32_WRITE |
Pointer for unaligned write of a uint32_t variable. More... | |
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.
#define __ALIGNED | ( | x | ) | __attribute__((aligned(x))) |
Specifies a minimum alignment for a variable or structure field, measured in bytes.
Code Example:
#define __ARM_ARCH_7A__ 1 |
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.
#define __ASM __asm |
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 __INLINE __inline |
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_RETURN __declspec(noreturn) |
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 __attribute__((packed)) |
Specifies that a type must have the smallest possible alignment.
Code Example:
#define __PACKED_STRUCT |
Specifies that a structure must have the smallest possible alignment.
Code Example:
#define __STATIC_FORCEINLINE |
Defines a static function that should be always inlined by the compiler.
Code Example:
#define __STATIC_INLINE static __inline |
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 |
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 |
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 |
Defines a pointer to a uint32_t from an address that does not need to be aligned. This can then be used in read/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 |
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 |
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 __attribute__((used)) |
Definitions tagged with __USED in the source code should be not removed by the linker when detected as unused.
Code Example:
#define __WEAK __attribute__((weak)) |
Functions defined with __WEAK export their symbols weakly. A function defined weak behaves like a normal defined function unless a non-weak function with the same name is linked into the same image. If both a non-weak function and a weak defined function exist in the same image, then all calls to the function resolve to the non-weak function.
Functions declared with __WEAK and then defined without __WEAK behave as non-weak functions.
Code Example: