Live data from Hacker News

Rust on RTL8710 running FreeRTOS

polyfractal.com

31–40 of 47 posts

Re: Rust on RTL8710 running FreeRTOS

#31
post #17

Earlier quoted context omitted.

Unfortunately, there's little chance for Rust to make inroads into the embedded market, tho I wish it were otherwise. C++ has had many benefits over C for embedded s/w for many years and has similarly failed. Note that contrary to popular belief, C++ does not result in larger, more inefficient s/w than C (for the correct C++ subset). The momentum behind the C ecosystem is so overwhelming that Rust simply will not get…

My company uses a C++ subset (no STL, no malloc) on all of our embedded projects, which are mostly on ARM Cortex-M4. I'd love to learn and start using Rust in our work, but we are client-project-driven, so it will be hard to justify the investment and productivity drop. I think it would make it easier to attract top talent, though things are weird in the embedded world.

I had a co-worker a long time ago described this problem as being a bunch of lumberjacks chopping down trees, but who were never allowed to stop and sharpen their axe's (let alone procure the chainsaws and learn how to use those...).

Re: Rust on RTL8710 running FreeRTOS

#32
post #30
post #17

Earlier quoted context omitted.

My company uses a C++ subset (no STL, no malloc) on all of our embedded projects, which are mostly on ARM Cortex-M4. I'd love to learn and start using Rust in our work, but we are client-project-driven, so it will be hard to justify the investment and productivity drop. I think it would make it easier to attract top talent, though things are weird in the embedded world.

I'm a C++ enthusiast interested in embedded programming but I have very little experience. What is the rationale for your company's avoidance of the STL, is it primarily binary size?

Likely because it allocates and uses exceptions pervasively.

Re: Rust on RTL8710 running FreeRTOS

#33
Delighted to see this tidy summary! I've been wading through four or five documentation sources over the past few days getting everything hooked up. I'm working on a project that uses SPI and would love to use Rust... I may pick your brains further.

Strongly recommend you post a link to this at the PADI Stamp forums, I'm sure others will appreciate it. http://forum.pine64.org/forumdisplay.php?fid=57

Re: Rust on RTL8710 running FreeRTOS

#34

Soldering tip: tack a pin down on opposing corners of the chip before attacking the rest.

Ah, yeah, I can see how that would have helped tremendously. Thanks for the tip! :) I cringed when I saw this at the top of HN because I knew the shame that is my soldering skill would be seen by a few hundred people :)

If you have analytics on your blog you'll probably find a bit more than a few hundred. Front page #1 stories often accumulate thousands of views an hour.

Re: Rust on RTL8710 running FreeRTOS

#35

This is cool, though not having the standard library would be painful. Hopefully, there is some middle ground than jettisoning the entire std crate.

That's what libcore is; you still get a lot of the useful bits.

Most of the rest of libstd requires a known OS abstraction to exist.

Most of the algorithmy stuff (e.g. regex) has been moved out of the stdlib so you can pull it in separately if the crate supports no_std.

Not perfect, and a lot more crates could support no_std, but it's sometimes good enough.

Re: Rust on RTL8710 running FreeRTOS

#36

Tl;dr: this works because the RTL8710 is an ARM core, which is supported by LLVM and thus Rust anyway. Its a nice how-to for working with the chip though.

Just because something uses ARM doesn't mean it'll be easy to target, there's a hell of a lot more to getting something running on an embedded system than just what basic architecture it supports.

Re: Rust on RTL8710 running FreeRTOS

#37

It's going to be really great as Rust spreads further and further into the embedded world. I know enough C to get by, but I'm always second guessing myself when things start to get complicated, and Rust has really made lowish-level programming a lot easier for me. The safety features in addition to exposing a C ABI make it a great language for build once, run everywhere (everywhere that LLVM supports, anyway). Exciti…

Unfortunately, there's little chance for Rust to make inroads into the embedded market, tho I wish it were otherwise. C++ has had many benefits over C for embedded s/w for many years and has similarly failed. Note that contrary to popular belief, C++ does not result in larger, more inefficient s/w than C (for the correct C++ subset). The momentum behind the C ecosystem is so overwhelming that Rust simply will not get…

We use embedded C++ though it is mostly C with classes and sugar after throwing out STL and exceptions. I'm eagerly awaiting more embedded friendly Nim improvements since it can be plumbed into existing embedded C tool chains.

Re: Rust on RTL8710 running FreeRTOS

#38

Earlier quoted context omitted.

Unfortunately, there's little chance for Rust to make inroads into the embedded market, tho I wish it were otherwise. C++ has had many benefits over C for embedded s/w for many years and has similarly failed. Note that contrary to popular belief, C++ does not result in larger, more inefficient s/w than C (for the correct C++ subset). The momentum behind the C ecosystem is so overwhelming that Rust simply will not get…

That's why I quite like the approach of using existing C tooling and SDK, then linking in "user-land" Rust. I wanted to run stuff on the RTL8710, and it seemed crazy to start rewriting all the HAL from scratch. But it only took an afternoon to bolt Rust into the C build because Rust's FFI story is really nice (imo). So I get the best of both worlds: existing C HAL and SDK with the pleasantness and safety of Rust.* *…

Brilliant! Thanks for the proof of concept. I've been debating this method, but it looks like you got it setup relatively quickly. Almost as easy as transitioning to another C compiler/tool chain.

Re: Rust on RTL8710 running FreeRTOS

#39

Earlier quoted context omitted.

Unfortunately, there's little chance for Rust to make inroads into the embedded market, tho I wish it were otherwise. C++ has had many benefits over C for embedded s/w for many years and has similarly failed. Note that contrary to popular belief, C++ does not result in larger, more inefficient s/w than C (for the correct C++ subset). The momentum behind the C ecosystem is so overwhelming that Rust simply will not get…

> The momentum behind the C ecosystem is so overwhelming that Rust simply will not get a foothold anytime soon. You could also say this for C on Unix in 1990. Or x86 assembly for PCs in 1985. In 1990, the idea that, 25 years later, we would be deploying network services written in JavaScript was unthinkable. Change takes time, and C won't die, ever—but history shows that change eventually does happen.

> You could also say this for C on Unix in 1990.

You can still say this on 2017.

No UNIX kernel will ever be written in anything other than C, the way they are married to each other and the way UNIX culture works.

To get rid of C we need to get rid of UNIX, even a POSIX like OS coded in say Ada, needs to expose C like semantics for POSIX compatibility.

Which means we still have a long way ahead in what concerns improving security.

Re: Rust on RTL8710 running FreeRTOS

#40
post #11

Earlier quoted context omitted.

Unfortunately, there's little chance for Rust to make inroads into the embedded market, tho I wish it were otherwise. C++ has had many benefits over C for embedded s/w for many years and has similarly failed. Note that contrary to popular belief, C++ does not result in larger, more inefficient s/w than C (for the correct C++ subset). The momentum behind the C ecosystem is so overwhelming that Rust simply will not get…

What makes the ecosystem so unfriendly to languages that link to C easily, either way?

The culture, the outdated compilers (expect C89 and C++98) and software designed by hardware engineers.
Post reply on HN