How to get the stack usage in embedded project?

I am working on an embedded project in Rust.
The OS is based on FreeRTOS.

The size of stack is small, which is around 100KB.

Any way I can get the stack usage in compile time?

GCC has -Wstack-usage and -fstack-usage options to provide this information.

Any similar options in Rust?

You could dive in cargo-call-stack.

1 Like

See also the rustc emit_stack_sizes unstable feature