Zephyr Project API 3.7.0
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)   __asm__ (".set " # sym "_Requires, " # sym "\n\t");
 
#define ALWAYS_INLINE   inline __attribute__((always_inline))
 
#define STRINGIFY(s)   Z_STRINGIFY(s)
 
#define IS_PTR_ALIGNED_BYTES(ptr, bytes)   ((((uintptr_t)ptr) % bytes) == 0)
 
#define IS_PTR_ALIGNED(ptr, type)   IS_PTR_ALIGNED_BYTES(ptr, __alignof(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 
)    IS_PTR_ALIGNED_BYTES(ptr, __alignof(type))

◆ IS_PTR_ALIGNED_BYTES

#define IS_PTR_ALIGNED_BYTES (   ptr,
  bytes 
)    ((((uintptr_t)ptr) % bytes) == 0)

◆ 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)    __asm__ (".set " # sym "_Requires, " # sym "\n\t");

◆ STRINGIFY

#define STRINGIFY (   s)    Z_STRINGIFY(s)

◆ ZRESTRICT

#define ZRESTRICT   restrict