News for hackers. Stuff that matters.
Re:AVR-GCC Compiler Makes Questionable Code by steveklabnik on Saturday December 17, 2022 @05:13PM (#34032824)
You can fit embedded rust programs in 2kb of RAM.

The smallest binary rustc has ever produced on x86_64 is 137 bytes: https://github.com/dgotrik/tiny-rust-executable

The projects I work on are in the 32 bit ARM space, so we have more space than the projects you're talking about, but we use a microkernel, compile all programs separately, and then put them all together at the end. Some example programs and sizes:

* kernel: 32k flash, 8k RAM

* supervisor task: 8k flash, 2k RAM

* SPI tasks: 16k flash, 2k RAM

* I2C task: 16k flash, 2k RAM

* sensors task: 8k flash, 8k RAM

* an "idle" do-nothing task: 128 bytes flash, 256 bytes RAM

(Note that some of these are larger than is actually required, I got these numbers by checking in on the amount of memory space they request from the OS, which has to be a power of 2 in the current implementation, so something that's 4097 bytes ends up being 8k in these numbers.)

There are no comments on this comment yet.