TE
科技回声
首页24小时热榜最新最佳问答展示工作
GitHubTwitter
首页

科技回声

基于 Next.js 构建的科技新闻平台,提供全球科技新闻和讨论内容。

GitHubTwitter

首页

首页最新最佳问答展示工作

资源链接

HackerNews API原版 HackerNewsNext.js

© 2025 科技回声. 版权所有。

Embedded Rust in Production?

205 点作者 michidk7 个月前

24 条评论

dazzawazza7 个月前
Access to competant Rust developers can be a challenge even for large companies.<p>I recently finished a contract at a (very large game dev) company where some tools were written in Rust. The tools were a re-write of python scripts and added no new functionality but were slightly faster in Rust.<p>The reality was that these tools were unmaintainable by the rest of the company. Only the author &quot;knew&quot; Rust and it was hard to justify a new hire Rust developer to maintain this small set of tools.<p>The only reason these tools were written in Rust was because the dev wanted to learn Rust (a big but common mistake). I pointed out to the Technical Director that this was a big mistake and the teams had taken on a large amount of technical debt for no reason other than the ego of the wanna-be-rust-developer. Since I &quot;knew&quot; Rust he wanted me to maintain it. My advice was to go back to the Python scripts and I left.
评论 #41835305 未加载
评论 #41835570 未加载
评论 #41835522 未加载
评论 #41836742 未加载
评论 #41836384 未加载
评论 #41835268 未加载
评论 #41835745 未加载
评论 #41837344 未加载
评论 #41835386 未加载
评论 #41835460 未加载
评论 #41836673 未加载
评论 #41835266 未加载
评论 #41846616 未加载
评论 #41835427 未加载
评论 #41840322 未加载
评论 #41840444 未加载
评论 #41836318 未加载
评论 #41848063 未加载
评论 #41839371 未加载
评论 #41835838 未加载
评论 #41835607 未加载
culebron217 个月前
The author complains there are few developers available to maintain Rust code.<p>I see very few job postings, and almost all of them are either cryptocurrencies (I don&#x27;t want to waste my life on this), or &quot;3 years professional Rust development in production&quot; (disqualifies self-learners).<p>Given that nowadays most applications are not replied, it makes little sense to spend time even browsing the postings.
评论 #41835434 未加载
评论 #41835586 未加载
评论 #41835927 未加载
评论 #41841056 未加载
myrmidon7 个月前
A very important point that the article neglects is that for a lot of embedded platforms, you have to heavily rely on the hardware manufacturers libraries and tooling. All of that stuff is typically gonna be targeted at C.<p>Without this, using even very simple hardware interfaces (like an SPI&#x2F;I2C bus) is gonna be a huge pain, because you&#x27;ll have to comb through reference manuals and register descriptions for your processor and piece everything together yourself instead of just calling a few API functions (this is also very error-prone and using Rust is not really gonna help one bit).<p>The only chance to get even halfway decent rust integration is to pick one of the like 3 most popular hardware platforms among hobby enthusiasts (think ESP32, raspberry pico), which is simply not viable for a LOT of embedded applications.<p>So I still think its probably a really bad idea for a typical embedded-shop to fully go for rust right now-- the downsides from lacking tooling&#x2F;libraries, reduced developer pool and the need to train extant devs appear very hard to overcome to me.
评论 #41836762 未加载
评论 #41835713 未加载
评论 #41835630 未加载
评论 #41839785 未加载
评论 #41838862 未加载
评论 #41836918 未加载
评论 #41841075 未加载
RandomThoughts37 个月前
The article is really light on actual details.<p>Basically, this is a company who uses ESP32 to read serial data from batteries using UART and retransmits it in json over MQTT. They apparently had buggy C code to do that (for unspecified reasons) and successfully rewrote that in Rust.<p>Conclusion, you can write ESP32 code in Rust. No information on what that actually entails sadly.
评论 #41835850 未加载
评论 #41835541 未加载
评论 #41835476 未加载
评论 #41836023 未加载
skwee3577 个月前
As someone who is using Rust in production for a year now [0], albeit in a different industry -- webdev, I really like the language. Sure, the first steps were rough, but eventually DX became decent, and the safety guarantees of Rust allow me to have a safe mind when developing and deploying (something I can&#x27;t say about other popular dynamic languages).<p>Having said that, I agree with one of the commenters in this thread: Rust is essentially a solution looking for a problem. It is a great language, but it fails to find its niche. Rust developers are nowhere to be found, companies are not hiring Rust developers (except if you want to work in crypto).<p>[0]<a href="https:&#x2F;&#x2F;yieldcode.blog&#x2F;post&#x2F;one-year-of-rust-in-production&#x2F;" rel="nofollow">https:&#x2F;&#x2F;yieldcode.blog&#x2F;post&#x2F;one-year-of-rust-in-production&#x2F;</a>
评论 #41835802 未加载
评论 #41835676 未加载
评论 #41836127 未加载
评论 #41839825 未加载
pixelfarmer7 个月前
I remember looking into Rust for a personal project, on embedded, in 2016. After poking through all of it I decided against doing that because it was clear I&#x27;d be spending a lot of time getting Rust working at all instead of doing anything for the project itself. So C it was.<p>The thing I have to say in the context of the article is this: There is no way to know whether a complete rewrite in C would have yielded similar results to Rust. The phrase &quot;C prototype&quot; made me squirm, even more so when reading that in the context of critical infrastructure. It is known by now (or should be) that such prototypes live on like zombies, so unless it is really some throwaway (from the point of architecture!), these things tend to live on for longer than most feel comfortable with. And, being so critical in function, maintainability is one of the primary concerns.<p>Yes, Rust will, eventually, at some point, maybe? the go-to language we use in the embedded field, but we are talking not just about a language replacement, we are talking ecosystem replacement. That is not going to happen overnight.<p>That said, as some mentioned Java, Perl, and such things: I revived a personal Perl 5 project not too long ago that was more than 20 years old by that point. Needed a small change because the latest installment of Perl 5 is a bit more restrictive with some borderline syntax things (good), but other than that it just worked. In the larger context of the project there is also some C code for binary file processing, also &gt;20 years old. Needed a renaming of a POSIX function (arguments and functionality all the same, though), and then it worked, even compiled as native 64 bit code. Granted, there are not that many dependencies beside POSIX, and the code was even back then written to a level of quality that allowed it to run on all sorts of (POSIX) platforms already.<p>Which is why &quot;C prototype&quot; sounds to me like &quot;we cobbled something together&quot;, and all sorts of bugs are no surprise then. You can cut only so many corners before it becomes an issue, especially in software that is used all the time and in a critical place of a system. This needs to be done right, else you will waste a lot of time (and money!) afterwards.
评论 #41836662 未加载
dextrous7 个月前
I am a C&#x2F;C++ dev learning Rust on my own, and enjoying it. I am finally starting to enjoy the jiu jitsu match with the compiler&#x2F;borrow-checker and the warm “my code is safe” afterglow … but I have a question for the more experienced Rust devs out there, particularly in light of the OP’s observation about “lots of unsafe” in the Rust embedded realm (which makes sense).<p>If your Rust project leans heavily on unsafe code and&#x2F;or many libraries that use lots of unsafe, then aren’t you fooling yourself to some degree; i.e. trusting that the unsafe code you write or that written by the 10 other people who wrote the unsafe libs you’re using is ok? Seems like that tosses some cold water on the warm afterglow.
评论 #41836872 未加载
评论 #41836851 未加载
评论 #41846831 未加载
blae7 个月前
I hate how prevalent AI &quot;art&quot; has become on articles like these.
评论 #41835792 未加载
评论 #41835689 未加载
baq7 个月前
As expected, the people problem is the biggest factor. Turns out getting C folks to learn Rust is a difficult proposition (hello, lkml) but the other way around it isn&#x27;t too much of a problem.<p>I wonder how much of it is low-level experienced developers only ever using C fail to see that C is not the universally best tool (or, &#x27;if all you have is a hammer, everything looks like a nail&#x27; question).
评论 #41835262 未加载
评论 #41836108 未加载
评论 #41835870 未加载
评论 #41836074 未加载
评论 #41835561 未加载
cesaref7 个月前
The problem I have with articles like this is that if we were to substitute anything in for &#x27;Rust&#x27;, it would read the same. I imagine if they had re-written it in C it would also be better than before. If it was an advert for anything, it might be chucking away a dodgy prototype and starting again (which is surprisingly rare).<p>Anyhow, on the other side of the coin, it&#x27;s good to see newer languages getting a proper outing in real world situations. Proving stuff is &#x27;up to it&#x27; can be a bit of a long haul, so every data point is useful.
评论 #41835559 未加载
sshine7 个月前
Reposted:<p>2024-02-20 (3 comments): <a href="https:&#x2F;&#x2F;news.ycombinator.com&#x2F;item?id=39446699">https:&#x2F;&#x2F;news.ycombinator.com&#x2F;item?id=39446699</a><p>2024-02-04 (0 comments): <a href="https:&#x2F;&#x2F;news.ycombinator.com&#x2F;item?id=39251131">https:&#x2F;&#x2F;news.ycombinator.com&#x2F;item?id=39251131</a>
goodpoint7 个月前
&gt; Since Rust, and especially embedded Rust (lots of FFI &amp; unsafe), is quite hard to learn, it is not viable (for us) to retrain a C developer to Rust.<p>Rust does not need a phd in quantum physics. Anybody can learn it with a bit of patience.
评论 #41843211 未加载
Do1237 个月前
Didn&#x27;t they just have a shitty implementation written in C (could have been any other language...it&#x27;s not the language!) and than learned from the past mistakes and written a new implementation in Rust(could have been any other language)? And now the author tries to attribute it&#x27;s success to Rust?
评论 #41836185 未加载
评论 #41835651 未加载
Dowwie7 个月前
If you&#x27;re going to try using rust for esp32 development, you&#x27;ll use the wrapper libraries that Espressif maintains. When things don&#x27;t work correctly, you&#x27;ll be dealing with a larger problem space as you try to figure out whether the problem is your implementation &#x2F; logic, the lower-level libraries, or the wrapper libraries. I don&#x27;t know what benefits you&#x27;re gaining using rust if you&#x27;re not using a native rust (to the metal) stack of libraries.<p>If only Oxide found a need for esp32 modules, perhaps they would be up for the task?
cozzyd7 个月前
Debugging on embedded is not THAT hard, if it&#x27;s just program logic (as opposed to things like interrupts or DMA). Just use gdb on the programmer like you normally would...
marmaduke7 个月前
I’m doing some C on esp32 currently, and wondered about switching to rust, and I understand that simple cases with Rust are solid. I’m definitely interested in trying it out.<p>However we need to work with a lot of the hardware apis like twai, ble, lte, ota, etc. It seems like support is spotty or it’s DIY.<p>It’s also worth keeping mind the remark about developer availability. I can generally answer questions about the C to someone who’s not experienced in C, while Rust might be another story.
评论 #41835548 未加载
jnordwick7 个月前
TL;DR we had some buggy C code and fixed the bugs then rewrote it in Rust and wow we didn&#x27;t have as many bugs... that we already fixed.<p>Rewriting something is not the same as the first effort. Try green fielding see how long it can she develop it once you already had the first basic C code it&#x27;s pretty trivial to convert it to rust most of the time especially just using other libraries.<p>And imagine that. You fixed all the bugs in the prototype and the second rewrite didn&#x27;t have as many bugs. That&#x27;s his nothing about the second versions language it just says you fixed all the bugs in the prototype.
nsoonhui7 个月前
I&#x27;m ignorant about Rust, but to me it&#x27;s just static type language akin to C#. And C# has IOT library which seems to target Rust most usual use case, namely on embedded platform. C# also has memory safety just like Rust.<p>So why do we need Rust at all? What&#x27;s the use case for it?<p>Anything that I&#x27;m missing?
评论 #41835762 未加载
评论 #41835666 未加载
评论 #41836656 未加载
评论 #41839000 未加载
评论 #41843390 未加载
bpbp-mango7 个月前
nice pop-up that scrolls you to the top of the article
评论 #41835136 未加载
ngcc_hk7 个月前
If you “embed” ulisp on that Platform, the serial interface seems have issues. Wonder whether this is the case of embedded rust?
deterministic7 个月前
Maybe just maybe hire better C developers? Just an idea.
priio7 个月前
Has anyone tried Nim in embedded systems? I wonder how it went.
评论 #41843897 未加载
n8henrie7 个月前
ESP32. ESP-IDF, not no_std.
goodpoint7 个月前
Really? <a href="https:&#x2F;&#x2F;join.com&#x2F;companies&#x2F;stabl&#x2F;12642327-initiative-application-full-time?widgetv2=true&amp;pid=d73d1a20e99ab4ced633" rel="nofollow">https:&#x2F;&#x2F;join.com&#x2F;companies&#x2F;stabl&#x2F;12642327-initiative-applica...</a>