2 ms·
Have you looked at Rust? The Rust embedded ecosystem is still a bit immature, but there is whole ecosystem of std-lib free libraries - some specific to hardwar
by nicoburns 5y ago
Have you looked at Rust? The Rust embedded ecosystem is still a bit immature, but there is whole ecosystem of std-lib free libraries - some specific to hardware, others generic implementations of useful functionality.
- jcranberry 5y agoIs Rust good for embedded? I thought the binaries they produced were too fat?
- TingPing 5y agoEmbedded is a wide field. It's young but has promise.
- SAI_Peregrinus 5y agoIt statically links. But bare-metal embedded generally doesn't support dynamic linking at all, so that's not a real problem there. A lot of the rest of the fat is from things like debugging symbols bounds checks that aren't included when building in release mode.
- nicoburns 5y agoThe extra fat in Rust binaries compiled with default settings is things like: - the standard library - jemalloc (this is no longer the default, but is still a factor in people's perception about binary size because it used to be) - debug symbols - unwinding support for panics All of these can be turned off for use cases like embedded where binary size is important and you'll then get binaries of comparable size to those produced by C compilers.
- steveklabnik 5y agoYou just have to pay attention. I work in Rust on embedded, it’s not a problem. The smallest x86_64 binary rustc has ever produced is like, 145 bytes. I’m on Arm, we have space for a lot more, but still actively try to keep sizes down. Some tasks in our system are ~500 bytes, the larger ones are on the order of 10k. You can’t just use the broader ecosystem willy nilly, and if you want truly small stuff, you have to know how to coax the compiler from time to time. But that’s just always going to be the case.
- wongarsu 5y agoAnd while the headline features of Rust are memory safety and fearless concurrency, the whole language and ecosystem is designed around making it hard to do the wrong thing on accident. Which in this instance also means that floats stay floats, doubles stay doubles and u8 stays u8 unless you explicitly convert. If you're now asking what happens when you add a float to a double: that's a compiler error, you have to explicitly cast.