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

https://doc.rust-lang.org/unstable-book/compiler-flags/emit-stack-sizes.html

This topic was automatically closed 90 days after the last reply. We invite you to open a new topic if you have further questions or comments.