Thread stack. More...
#include <cmsis-plus/rtos/os.h>
Public Types | |
| using | allocation_element_t = os::rtos::port::stack::allocation_element_t |
| Type of a stack allocation element. | |
| using | element_t = os::rtos::port::stack::element_t |
| Type of a stack element. | |
Public Member Functions | |
Constructors & Destructor | |
| stack () | |
| Construct a thread stack object instance. | |
| ~stack ()=default | |
| Destruct the stack object instance. | |
Public Member Functions | |
| void | clear (void) |
| Clear the stack pointer and size. | |
| void | set (stack::element_t *address, std::size_t size_bytes) |
| Set the stack address and size. | |
| void | initialize (void) |
| Align the pointers and initialise to a known pattern. | |
| stack::element_t * | bottom (void) |
| Get the stack lowest reserved address. | |
| stack::element_t * | top (void) |
| Get the top stack address. | |
| std::size_t | size (void) |
| Get the stack size. | |
| bool | check_bottom_magic (void) |
| Check if bottom magic word is still there. | |
| bool | check_top_magic (void) |
| Check if top magic word is still there. | |
| std::size_t | available (void) |
| Compute how much available stack remains. | |
Static Public Member Functions | |
Public Static Member Functions | |
| static std::size_t | min_size (void) |
| Get the min stack size. | |
| static std::size_t | min_size (std::size_t size_bytes) |
| Set the min stack size. | |
| static std::size_t | default_size (void) |
| Get the default stack size. | |
| static std::size_t | default_size (std::size_t size_bytes) |
| Set the default stack size. | |
Static Public Attributes | |
| static const element_t | magic = os::rtos::port::stack::magic |
This class does not contain the stack space itself, it is allocated outside, but stores the address and the size of the stack.
It also manages the global variables storing the min and default stack sizes.
Definition at line 432 of file os-thread.h.
| using os::rtos::thread::stack::allocation_element_t = os::rtos::port::stack::allocation_element_t |
For alignment reasons, the stack is allocated in larger chunks, usually 8-bytes long on Cortex-M cores.
Definition at line 451 of file os-thread.h.
| using os::rtos::thread::stack::element_t = os::rtos::port::stack::element_t |
The stack is organised as an array of platform words (usually 4-bytes long on Cortex-M cores).
Definition at line 442 of file os-thread.h.
|
inline |
Definition at line 2122 of file os-thread.h.
|
default |
| std::size_t os::rtos::thread::stack::available | ( | void | ) |
Count the number of bytes where the magic is still there.
Definition at line 202 of file os-thread.cpp.
Referenced by os_terminate_goodbye().
|
inline |
Definition at line 2152 of file os-thread.h.
|
inline |
| true | The magic word is still there. |
| false | The magic word was overwritten. |
Definition at line 2184 of file os-thread.h.
References magic.
|
inline |
| true | The magic word is still there. |
| false | The magic word was overwritten. |
Definition at line 2193 of file os-thread.h.
References magic.
|
inline |
Definition at line 2131 of file os-thread.h.
|
inlinestatic |
| [in] | size_bytes | Default stack size in bytes. |
Definition at line 2231 of file os-thread.h.
|
inlinestatic |
Definition at line 2222 of file os-thread.h.
Referenced by os::rtos::thread::thread(), os_thread_stack_get_default_size(), and os_thread_stack_set_default_size().
| void os::rtos::thread::stack::initialize | ( | void | ) |
|
inlinestatic |
| [in] | size_bytes | Minimum stack size in bytes. |
Definition at line 2211 of file os-thread.h.
|
inlinestatic |
Definition at line 2202 of file os-thread.h.
Referenced by os::rtos::thread::thread(), os_thread_stack_get_min_size(), and os_thread_stack_set_min_size().
|
inline |
| [in] | address | Bottom stack address. |
| [in] | size_bytes | Reserved stack size, in bytes. |
Definition at line 2141 of file os-thread.h.
Referenced by _start().
|
inline |
Definition at line 2175 of file os-thread.h.
Referenced by os_terminate_goodbye().
|
inline |
Definition at line 2161 of file os-thread.h.
|
static |
Definition at line 454 of file os-thread.h.
Referenced by check_bottom_magic(), and check_top_magic().