rt/include/rt/stack.h

31 lines
968 B
C

#pragma once
#include <rt/arch/stack.h>
#ifdef __cplusplus
extern "C" {
#endif
#ifndef RT_STACK_SIZE
#define RT_STACK_SIZE(n) \
(((n) + (RT_STACK_ALIGN(n) - 1)) & ~(RT_STACK_ALIGN(n) - 1))
#endif
#ifndef RT_STACK_SECTION
#define RT_STACK_SECTION(name) ".stack." #name
#endif
#define RT_STACK(name, size) \
char name[RT_STACK_SIZE(size)] \
__attribute__((aligned(RT_STACK_ALIGN(size)), \
section(RT_STACK_SECTION(name))))
#define RT_STACKS(name, size, num) \
char name[(num)][RT_STACK_SIZE(size)] \
__attribute__((aligned(RT_STACK_ALIGN(size)), \
section(RT_STACK_SECTION(name))))
#ifdef __cplusplus
}
#endif