7 #ifndef ZPP_INCLUDE_ZPP_THREAD_STACK_HPP
8 #define ZPP_INCLUDE_ZPP_THREAD_STACK_HPP
10 #include <zephyr/kernel.h>
11 #include <zephyr/sys/arch_interface.h>
12 #include <zephyr/sys/__assert.h>
30 __ASSERT_NO_MSG(m_data !=
nullptr);
33 constexpr
auto size() const noexcept
38 constexpr
auto data() const noexcept
43 k_thread_stack_t* m_data;
49 #define ZPP_THREAD_STACK_DEFINE(sym, size) \
50 K_THREAD_STACK_DEFINE(sym##_native,(size)); \
51 consteval auto sym() noexcept { \
52 return zpp::thread_stack(sym##_native, size); \
55 #define ZPP_THREAD_PINNED_STACK_DEFINE(sym, size) \
56 K_THREAD_PINNED_STACK_DEFINE(sym##_native,(size)); \
57 consteval auto sym() noexcept { \
58 return zpp::thread_stack(sym##_native, size); \
61 #define ZPP_THREAD_STACK_ARRAY_DEFINE(sym, nmemb, size) \
62 K_THREAD_STACK_ARRAY_DEFINE(sym##_native, nmemb, size); \
63 constexpr auto sym(size_t n) noexcept { \
64 return zpp::thread_stack(sym##_native[n], size); \
67 #define ZPP_THREAD_PINNED_STACK_ARRAY_DEFINE(sym, nmemb, size) \
68 K_THREAD_PINNED_STACK_ARRAY_DEFINE(sym##_native, nmemb, size); \
69 constexpr auto sym(size_t n) noexcept { \
70 return zpp::thread_stack(sym##_native[n], size); \
74 #define ZPP_KERNEL_STACK_DEFINE(sym, size) \
75 K_KERNEL_STACK_DEFINE(sym##_native,(size)); \
76 consteval auto sym() noexcept { \
77 return zpp::thread_stack(sym##_native, size); \
80 #define ZPP_KERNEL_PINNED_STACK_DEFINE(sym, size) \
81 K_KERNEL_PINNED_STACK_DEFINE(sym##_native,(size)); \
82 consteval auto sym() noexcept { \
83 return zpp::thread_stack(sym##_native, size); \
86 #define ZPP_KERNEL_STACK_ARRAY_DEFINE(sym, nmemb, size) \
87 K_KERNEL_STACK_ARRAY_DEFINE(sym##_native, nmemb, size); \
88 constexpr auto sym(size_t n) noexcept { \
89 return zpp::thread_stack(sym##_native[n], size); \
92 #define ZPP_KERNEL_PINNED_STACK_ARRAY_DEFINE(sym, nmemb, size) \
93 K_KERNEL_PINNED_STACK_ARRAY_DEFINE(sym##_native, nmemb, size); \
94 constexpr auto sym(size_t n) noexcept { \
95 return zpp::thread_stack(sym##_native[n], size); \
thread_stack holds the stack and thread control block memory
constexpr thread_stack & operator=(const thread_stack &) noexcept=default
constexpr thread_stack(const thread_stack &) noexcept=default
constexpr auto data() const noexcept
constexpr auto size() const noexcept
constexpr thread_stack(k_thread_stack_t *data, size_t size) noexcept