3 ms·
To be clear, since I have seen this pop up lately, Rust doesn't have a GC and absolutely gives you access to hardware. The challenges for it on embedded are mos
by steveklabnik 9y ago
To be clear, since I have seen this pop up lately, Rust doesn't have a GC and absolutely gives you access to hardware. The challenges for it on embedded are mostly toolchain issues.
- scruple 9y agoSo, are vendors working on rust toolchains for their hardware? I'm asking from a place of genuine curiosity, I left embedded a number of years ago. I've always viewed the 'rust breaking into embedded' problem as a toolchain issue, as well. But, my intuition is that vendors will be slow to release rust support in toolchains because the industry is still firmly in the "we write in C" camp.
- steveklabnik 9y agoThat's what I meant by challenges; it's pretty much "can LLVM support the chip and then did someone put in the compiler work in rustc", rather than "vendors are directly providing Rust support." Your intuition is mine as well.
- analog31 9y agoThis is an interesting thread... https://news.ycombinator.com/item?id=14071282 https://news.ycombinator.com/item?id=14071282 In my view the industry inertia is a chicken and egg thing. You want a chip that runs your existing code. Then you want to write new code on your existing chip. And you have ongoing projects at different stages, sharing chips and code.
- jdblair 9y agoThis is good to hear. I may give rust a shot. I have a lot of inertia, though, because I already know how to set up and maintain my cross-compile toolchain. I've also heard that Go may a viable option, at least on ARM, and I'm considering giving it a try for my next embedded side project.
- steveklabnik 9y agoSo, some quick things: every Rust compiler is a cross-compiler, so that's not the tough part. You need to compile 'libcore' for the target, but https://github.com/japaric/xargo https://github.com/japaric/xargo makes that pretty straightforward if your chip isn't one of the ones provided by the Rust project, if it is, then you just need to run a command to download it and you're good to go. https://forge.rust-lang.org/platform-support.html https://forge.rust-lang.org/platform-support.html is said target list today. AVR is coming soon, it works but has bugs and is hacky. Japaric is quite prolific, he writes over at http://blog.japaric.io/ http://blog.japaric.io/ and his latest posts are about his RTOS-like framework. Finally if you're into ARM, https://www.tockos.org/ https://www.tockos.org/ might be up your alley.
- jdblair 9y agoNoting all this for future research. Thanks!
- steveklabnik 9y agoAny time! :) I really need to write better docs on all of this...
- ksrm 9y agoIs there anything anywhere comparing ROM and RAM usage of Rust vs. C for embedded devices? Can you write anything meaningful in Rust with say 8KB of RAM?
- steveklabnik 9y agoI don't have great numbers, https://news.ycombinator.com/item?id=15367507 https://news.ycombinator.com/item?id=15367507 talks about 256k flash and 32k RAM. That said, the new AVR support includes 8 and 16 bit chips, I don't know the lowest amount of RAM that has had actual code running on it yet.