I've ben working on rust for embedded work, in particular on the TI CC3200, which has 256K of RAM for code, stack, and heap.
We've got the basics running (if you're interested, see: https://github.com/fabricedesre/cc3200-rs).
Anyways, we quickly ran into some stack overflows when trying to use println! or logging and I decided to investigate a bit. It looks like calling println! to print a simple string takes a whopping 650 bytes of stack. Adding a {} to format a single integer seems to add another 176 bytes, and each additional {} adds about 40 bytes.
Formatting the first float adds an additional 1500 bytes of stack (oover and above the initial 650) and then roughly 50 bytes per additional {} added.
I found the big culprit for formatting floats, which seems to be this:
https://github.com/rust-lang/rust/blob/master/src/libcore/fmt/mod.rs#L1498
Is this something that could be made configurable through a feature? I don't mind allocating 32 or 64 bytes for a temp buffer, but 1K is totally prohibitive for embedded applications.
I need to dig around some more and find out why println! takes up so much. I figured I'd post what I have so far and see if anyone has some feedback.
And we're not using libstd, so we actually created our own println! macro which can be seen here:
https://github.com/fabricedesre/cc3200-rs/blob/master/src/cc3200.rs#L13-L31