In RTOS Nuttx,how do we get the size of the uesd and remaining stack.
We init an app, we usually will set the stack size that will allow to be uesd.
But we may also need the info that we used and remaining stack info in this app.
In app Kconfig
config EXAMPLES_HELLO
bool "hello example"
default n
if EXAMPLES_HELLO
config EXAMPLES_HELLO_PRIORITY
int "hello task priority"
default 254
config EXAMPLES_HELLO_STACKSIZE
int "hello stack size"
default 8192
endif
The interface get the size of used and remaining stack.
/*This will get the size of used stack*/
size_t up_check_stack(void)
{
return up_check_tcbstack(this_task());
}
/*This will get the size of remaining stack*/
ssize_t up_check_stack_remain(void)
{
return up_check_tcbstack_remain(this_task());
}