Rust for Raspberry Pi / IOT


#1

Rust is the best language for developer at Raspberry PI 3 or it’ Python/Nodejs ? Why Rust is used in IoT?


To the creators of Rust
#2

It depends what you want to do with it.

If your problem is limited by CPU or memory (which is relatively limited on RPI), then Rust is likely to serve you better than Python or JS.


#3

IoT is one of the strong points of Rust going forward. The default language for embedded is still C++. I’ve worked to convince a Electronic Masters friend to try Rust. I found the secret to convincing him when I mentioned Rust memory safety, in his own words “I run into a memory segmentation fault every single day!”.

Working on digital signal processing for university, the C++ compilers were horrible when using certain data types. Engineers just learn to work around these problems after lengthy trial-and-error. There’s no forum you can go to to complain about these things - unless your company has a million bucks retainer with the supplier.

In short, Rust shows promise as being much more user-friendly than the status quo, especially in IoT.


#4

You god damned right!


#5

Nodejs is monotread , good to scale and fast, easy to learn based on évent driven for I.o., but not for IoT ?


#6

You could probably run that on Raspberry Pi. Only thing is, I don’t really see the Pi as an embedded platform. It’s just a mini PC. Microcontrollers don’t have an OS. You program the main thread to do certain housekeeping functions and then rely on writing assembly language or C++ directly into the interrupt handlers to complete the functions. It’s much different to higher-level programming. Those are what IoT will rely on, because Raspberry Pi will just never be able to be low-power. The Pi is like a tractor with a massive fuel leak, it’s kinda powerful, but very inefficient.


#7

Rpi is not optimized un hardware with 1MO quad core… Which monocarte you recommanded tout develop un Rust? target on GCC ARL V7?V8?
Which the best IDE for Rust?Vscode?


#8

I think it’s better if you concretely explain what you want to do. For some embedded applications, RPi class hardware is the right choice, say, something that needs a user interface with a reasonably big screen/animations and such, or higher-performance networking.

For others it’s overkill and something like Arduino (STM32 etc) is better (cheaper, less power use). Both are supported for Rust you don’t have to be concerned about that.

The IDE question is completely unrelated and orthogonal, there have been quite a few threads about that, maybe search around a bit!


#9

Well that depends heavily on the definition of an embedded system you use. My definition is:

An embedded system is a system of hardware and software especially designed for each other with a resource restricted processor.


This is mostly true especially for low power controllers. But there are stronger uC that are able to run leightweight OSs like RTOS.


I think Raspberry Pi with Linux is a good starting point to learn embedded programming, i.e. programming when resource restictions matters.


#10

I’ve developed my IoT device (toy robot) in NodeJs because I thought prototyping would be faster.
I’m rewriting it into Rust because I’m tired of the workflow:

  1. Write something on my PC
  2. Deploy to RPi
  3. Run it
  4. Discover I have a trivial error which compiler would have easily caught

When I write the same thing in Rust it speeds me up, because compiler does a lot of checking before I have to push it to the device, plus I get additional performance benefits.