Skip to content

Instantly share code, notes, and snippets.

@jmpinit
Created February 16, 2023 15:51
Show Gist options
  • Save jmpinit/90879e04d94d803f791580310191674b to your computer and use it in GitHub Desktop.
Save jmpinit/90879e04d94d803f791580310191674b to your computer and use it in GitHub Desktop.
Print the stack usage of the current Zephyr thread.
void print_thread_stack_usage() {
struct k_thread* thread = k_current_get();
size_t stack_space;
k_thread_stack_space_get(thread, &stack_space);
printk("Thread has %u bytes of stack space left.\n", stack_space);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment