Live data from Hacker News

Rust on Espressif chips

mabez.dev

31–40 of 71 posts

Re: Rust on Espressif chips

#31
post #23

Earlier quoted context omitted.

I think the key is that it's mainstream at the system/platform layer, not so much the application layer (though maybe one day!). Its benefits to the former are clear and undeniable; a paradigm-shift. Its benefits to the latter are pretty mixed by comparison. Anyone who mostly hangs out at the application-layer and doesn't follow this stuff closely could miss the adoption it's getting elsewhere.

I don’t see Rust becoming mainstream in the enterprise layer anytime soon. 90% or enterprise software consists of a REST API getting JSON payloads and saving them in a DB. The most complex part is often managing the “bus factor”, rather than some technical challenge. You often need just a bit more than VB6. Rust requires a higher cognitive cost than C# or Python, but doesn’t provide massive improvements in the areas…

I consider most web-services - certainly glue code - to be at the "application layer". Of course these definitions are always fuzzy.

Which isn't to say Rust is never the right choice for those, it's just a more complicated question that's highly project-specific. Which is why it isn't mainstream there like it is in other places.

Re: Rust on Espressif chips

#32
post #30
post #27

Earlier quoted context omitted.

I had an easy time getting setup with the esp32c3 with this repository (linked to in author's first post): https://github.com/ivmarkov/rust-esp32-std-demo Also got it working on WSL2. I could install flashing and monitoring tools as Windows binaries, which have access to Windows ports. https://pfesenmeier.github.io/wsl2-and-embedded-development/

That's because the c3 is a RISC-V chip and so doesn't require all of the annoying tooling that parent comment is referring to. The rest of Espressif's product line, including the extremely popular original ESP32 and the older 8266, use different chip architecture (xtensa) that requires a more annoying setup.

It was easy because of ivmarkov's tooling (see linked repo in previous comment). The "flasher coded in python, IDF coded in C" is installable through cargo. I did not have to install "MinWin". Docker does not having access to ports, but WSL2 does have access to the computers ports (through cross-compiling build tools).

Not having to install custom Rust toolchain for Xtensa chips was nice, too.

Re: Rust on Espressif chips

#33

Earlier quoted context omitted.

Yes, esp32-c3 [0] can be bought already, e.g., from mouser [1] or sparkfun [2] either as dev kit or as native module for a self-designed PCB. [0]: https://www.espressif.com/en/products/socs/esp32-c3 [1]: https://www.mouser.de/new/espressif/espressif-esp32c3wroom02... [2]: https://www.sparkfun.com/products/18034

They asked for dual core. The C3 is single core. > ESP32-C3 is a single-core, 32-bit, RISC-V-based MCU with 400KB of SRAM, which is capable of running at 160MHz https://www.espressif.com/en/news/ESP32_C3

And ESP's rust support provides threads and async supprot nonetheless.

With a zero-cost async implementation you may not require multiple cores, for some hard realtime stuff maybe, but even that can be handled by the work scheduler.

Re: Rust on Espressif chips

#34
post #32
post #30

Earlier quoted context omitted.

That's because the c3 is a RISC-V chip and so doesn't require all of the annoying tooling that parent comment is referring to. The rest of Espressif's product line, including the extremely popular original ESP32 and the older 8266, use different chip architecture (xtensa) that requires a more annoying setup.

It was easy because of ivmarkov's tooling (see linked repo in previous comment). The "flasher coded in python, IDF coded in C" is installable through cargo. I did not have to install "MinWin". Docker does not having access to ports, but WSL2 does have access to the computers ports (through cross-compiling build tools). Not having to install custom Rust toolchain for Xtensa chips was nice, too.

I stand corrected, that's a useful template project. Thanks for linking!

Re: Rust on Espressif chips

#35
post #2

I'm curious about this as someone who is interested in making DIY smart home products as well as their recently announced Zigbee radio module. But genuine question, is Rust ever going to catch on in the mainstream? It seems to have a bunch of nice to have features and great optimization. But the pick up, from what I've seen, has been less than stellar.

In what space? If you're talking about embedded, it's going to be pretty slow for industry to start using rust en masse. There's a huge amount of inertia in embedded, and the developers are somewhat beholden to manufacturers to release tooling around rust. In the software space, rust is being used by quite a few companies [0]. 0: https://www.rust-lang.org/production/users

FWIW, the Rust embedded size also lists a few production embedded users: https://www.rust-lang.org/what/embedded

Re: Rust on Espressif chips

#36

Oh, this is exciting. I've been trying to get PlatformIO to play nicely with my ESP32C3's but it's been a pain. Only the standard Espressif RTOS tooling seems to do anything but hang the chip for some reason, and I don't know enough about PlatformIO to modify my config to make it work or to open an issue on Github. Replacing one complex, half broken tool chain with another isn't such a bad deal, and I'm very much in…

I may not had to much nerves to just wrestle the initial learning curve, but my experience for PlatformIO was so bad that I do not plan to touch it ever again...

All you need is a compiler, a flash tool and maybe (nice to have but for a lot of stuff not a requirement) a JTAG debugger, so why the heck does I need that half baked, overly complex monster of pseudo IDE?

The tooling shown by ESP-rs seems nice and simple, I like that way more.

Re: Rust on Espressif chips

#37
post #4

I was looking forward to trying Rust on my ESP32 projects but always had a hard time. All the tooling is too complicated. There is flasher coded in python, IDF coded in C, you need to run MinWin on Windows which makes it even harder. You can't run all of this in docker because docker for windows doesn't allow mapping COM ports into container and stuff. Everything about just compiling a code seems so tiresome and unst…

It takes at most an hour to setup the tooling on windows. My first intro into embedded development was setting up the esp32 IDF. While there may be simpler platforms out there, it’s not overly complex for anyone doing embedded development.

Re: Rust on Espressif chips

#38

Earlier quoted context omitted.

> But genuine question, is Rust ever going to catch on in the mainstream? It seems to have a bunch of nice to have features and great optimization. But the pick up, from what I've seen, has been less than stellar. I'm not sure where you've gotten that impression. Rust is mainstream at this point. All the big companies (e.g. FAAMG) are using Rust. Lots of large products are: Firefox of course, but also, parts of AWS,…

>Rust is mainstream For sure it depends what you mean by mainstream. If a FAANG uses language X, it's language X mainstream? I'd venture to say that to be considered mainstream a language has to at least pass 1% threshold in Tiobe index (or the equivalent in Redmonk or others). If Rust is mainstream, then Fortran is über mainstream

I would argue that Fortran _is_ "über mainstream" - if you look at computing as a whole. It may not be used extensively for CRUD applications, but it is part of the bedrock of basically all computing. And there are some niches where it is the main/only language.

Rust will likely end up in a similar place - enormously useful in its niche, foundational for infrastructure outside, and with enough uptake and stability to make a career out of. I don't think anyone expects it to eclipse popular dynamic languages for web development, but it might make inroads on C and C++ in areas where active development is still needed.

Re: Rust on Espressif chips

#39

Earlier quoted context omitted.

They asked for dual core. The C3 is single core. > ESP32-C3 is a single-core, 32-bit, RISC-V-based MCU with 400KB of SRAM, which is capable of running at 160MHz https://www.espressif.com/en/news/ESP32_C3

And ESP's rust support provides threads and async supprot nonetheless. With a zero-cost async implementation you may not require multiple cores, for some hard realtime stuff maybe, but even that can be handled by the work scheduler.

The challenge in single-core timing-important ESP development is using the wireless peripherals effectively while maintaining I/O scheduling. Even with "zero-cost async" at the application layer, the WiFi and Bluetooth implementations are mostly software and will be getting scheduled on that same single CPU. You don't really get to control their scheduling in a granular manner, so meeting timing is pretty hard in many situations.

This is probably the most annoying thing about ESP development, but mostly goes away when you can just dedicate a core to the "ESP stuff" and then run your application on the other core.

Re: Rust on Espressif chips

#40

Oh, this is exciting. I've been trying to get PlatformIO to play nicely with my ESP32C3's but it's been a pain. Only the standard Espressif RTOS tooling seems to do anything but hang the chip for some reason, and I don't know enough about PlatformIO to modify my config to make it work or to open an issue on Github. Replacing one complex, half broken tool chain with another isn't such a bad deal, and I'm very much in…

I may not had to much nerves to just wrestle the initial learning curve, but my experience for PlatformIO was so bad that I do not plan to touch it ever again... All you need is a compiler, a flash tool and maybe (nice to have but for a lot of stuff not a requirement) a JTAG debugger, so why the heck does I need that half baked, overly complex monster of pseudo IDE? The tooling shown by ESP-rs seems nice and simple,…

To be fair to PIO, when I used another chip (an ESP8266) the entire process was plug and play. Just install the VS Code extension, follow the wizard, and you can start with an Arduino-compatible system loop that just works. Adding libraries is easy and intuitive, as is keeping them up to date.

If you need to manually configure the tool for your devices, well... I haven't figured out how to configure it for my ESP32C3 yet, so that's not as easy as I'd hoped.

Post reply on HN