Zephyr API Documentation 4.0.0-rc3
A Scalable Open Source RTOS
Loading...
Searching...
No Matches
common.h File Reference

Common toolchain abstraction. More...

Go to the source code of this file.

Macros

#define EXTERN_C   extern
 
#define ZRESTRICT   restrict
 
#define REQUIRES(sym)
 
#define ALWAYS_INLINE   inline __attribute__((always_inline))
 
#define STRINGIFY(s)
 
#define IS_PTR_ALIGNED_BYTES(ptr, bytes)
 
#define IS_PTR_ALIGNED(ptr, type)
 
#define LINKER_KEEP(symbol)
 Tag a symbol (e.g.
 

Detailed Description

Common toolchain abstraction.

Macros to abstract compiler capabilities (common to all toolchains).

Macro Definition Documentation

◆ ALWAYS_INLINE

#define ALWAYS_INLINE   inline __attribute__((always_inline))

◆ EXTERN_C

#define EXTERN_C   extern

◆ IS_PTR_ALIGNED

#define IS_PTR_ALIGNED ( ptr,
type )
Value:
IS_PTR_ALIGNED_BYTES(ptr, __alignof(type))
#define IS_PTR_ALIGNED_BYTES(ptr, bytes)
Definition common.h:198

◆ IS_PTR_ALIGNED_BYTES

#define IS_PTR_ALIGNED_BYTES ( ptr,
bytes )
Value:
((((uintptr_t)ptr) % bytes) == 0)
__UINTPTR_TYPE__ uintptr_t
Definition stdint.h:105

◆ LINKER_KEEP

#define LINKER_KEEP ( symbol)
Value:
static const void * const symbol##_ptr __used \
__attribute__((__section__(".symbol_to_keep"))) = (void *)&symbol

Tag a symbol (e.g.

function) to be kept in the binary even though it is not used.

It prevents symbol from being removed by the linker garbage collector. It is achieved by adding a pointer to that symbol to the kept memory section.

Parameters
symbolSymbol to keep.

◆ REQUIRES

#define REQUIRES ( sym)
Value:
__asm__ (".set " # sym "_Requires, " # sym "\n\t");

◆ STRINGIFY

#define STRINGIFY ( s)
Value:
Z_STRINGIFY(s)
irp nz macro MOVR cc s mov cc s endm endr irp aw macro LDR aa s
Definition asm-macro-32-bit-gnu.h:17

◆ ZRESTRICT

#define ZRESTRICT   restrict