@James Munns I agree crates, etc. make the library management and board management easy to implemented...maybe some extensions to vscode or similar to add a nice gui to everything + a basic event loop already setup with a setup/loop...
@dkhayes117 that would be cool! We put a lot of work to make sure tools like probe-run work with editors like VSCode
Funny, I was just going to ask about Rust in VSCode...
It's _excellent_
> I agree crates, etc. make the library management and board management easy to implemented...maybe some extensions to vscode or similar to add a nice gui to everything + a basic event loop already setup with a setup/loop...
Check out https://github.com/knurling-rs/app-template !
We even include vscode configuration and unit tests (on/off hardware) already set up!
@James Munns , what about the other side of the wire? any production ready MQTT brokers? I've found some obscure bugs in mosquitto
so in short....<generic question about embedded rust> Answer: Knurling
What IDE do you use in linux out of interest (or does vscode work in linux now, i'm not sure?)
I mean, Knurling is specifically my company's open source project to round off the rough edges of embedded development :)
Yes, VSCode works in Linux.
aha, ta
since years? or forever?
> What IDE do you use in linux out of interest (or does vscode work in linux now, i'm not sure?)
I use SublimeText most of the time, other folks I know use VSCode mostly or some flavor of Vim!
Are there any signs of MCU manufacturers putting any effort into official Rust support? As far as I understand all the current support comes from the community only?
I suppose those who use emacs program in lisp ;-)
not rust,,,but I've had a lot of luck with vernemq as an MQTT broker
yeah, the old erlang
> I've been looking at using higher level but not interpreted languages on microcontrollers, and another contender seems to be Nim. Do you have any insight in why Rust or Nim would be the way to go?
I haven't had much experience with Nim! I really enjoyed circuitpython when I've used it for prototyping, but I've mostly been doing Rust only for the last 3-4 years.
> Are there any signs of MCU manufacturers putting any effort into official Rust support? As far as I understand all the current support comes from the community only?
That is pretty accurate. We've talked with some folks, but big momentum to get them interested. We've already started to train larger tech + manufacturing companies. so the open source ecosystem doesn't seem to be a blocker for them! I hope the silicon companies will change their planning soon as well too :)
Nordic Semiconductor has also sponsored a number of our events, like the Oxidize Conference, or our Knurling Sessions
@James Munns Do you get the impression that any vendors are catching on to the momentum that Rust is generating and are considering developing Rust SDKs?
> Do you get the impression that any vendors are catching on to the momentum that Rust is generating and are considering developing Rust SDKs?
We've certainly talked to a lot, but I'm not aware of any official roadmaps yet. That being said, the OSS support is already huge, and filling the gaps is a bit tedious but pretty quick once you get started!
Exciting to hear Nordic showing some support. I know nothing about the realities of this market, but a wild guess would be that if a manufacturer would make an early investment into great Rust support, they could gain a lot of market share (if embedded Rust catches on)
We've build a couple drivers/added support for platform for a couple end-user customers, it's not an unreasonable amount of work.
> xciting to hear Nordic showing some support. I know nothing about the realities of this market, but a wild guess would be that if a manufacturer would make an early investment into great Rust support, they could gain a lot of market share (if embedded Rust catches on)
That's what I try to tell them!
@James Munns , a lot of my colleagues swear by haskell and brag about how easy it is to make code without bugs ... is rust good enough to save me from learning haskell? ;) ;)
@James Munns SVD files tend to be a bit of a trainwreck from a lot of vendors, to the point where entire projects are spawned to correct them prior to code generation (`svdtools` + `stm32-rs`). Any idea why they're so neglected by manufacturers?
> .. is rust good enough to save me from learning haskell? ;) ;)
I think they both share a lot of common benefits, as they come with more expressive type system! Depends on the kind of stuff you do :)
and haskell is functional so very different paradign
It's a funny idea having Haskell on microcontrollers, in a way, because the entire point is side effects
what rust needs is something like the infamous arduino vibrator workshop
> SVD files tend to be a bit of a trainwreck from a lot of vendors, to the point where entire projects are spawned to correct them prior to code generation (`svdtools` + `stm32-rs`). Any idea why they're so neglected by manufacturers?
I dunno, up to now, I think most use of svds were for debuggers, so little inaccuracies weren't so big of a deal. I'm really surprised they don't have a single source of truth between code, datasheets, and svds.
I'm just a tinkerer, and I found Rust much more approachable than C when working on embedded stuff. Not sure why, maybe because I never drank the cool aid?
where there was a maker faire in the same hotel at the same time as the annual porn film awards...they setup a workshop to show the actresses how to modify and program their vibrators with arduino
> and haskell is functional so very different paradign
You can do a lot of functional stuff on embedded
"I'm really surprised they don't have a single source of truth between code, datasheets, and svds." That makes two-... err, well, I guess a lot of us :)
I do a fair amount of Forth on micros...not functional but similar ideas
Like this iterator-driven, DMA SPI driver:
https://github.com/nrf-rs/nrf-hal/blob/master/nrf-hal-common/src/spim.rs#L296-L344
(it ended up compiling smaller/faster than my old for-loop approach)
> "I'm really surprised they don't have a single source of truth between code, datasheets, and svds." That makes two-... err, well, I guess a lot of us :)
If any silicon vendor teams are out there, I'd love to talk to you about code and document generation :)
is there any site that offers a way to learn rust by solving challenges?
Theres Rustlings!
https://github.com/rust-lang/rustlings
rust-lang/rustlings
Greetings and welcome to rustlings. This project contains small exercises to get you used to reading and writing Rust code. This includes reading and responding to compiler messages! ...looking for the old, web-based version of Rustlings? Try here Alternatively, for a first-time Rust learner, there are several other resources: The Book - The most comprehensive resource for learning Rust, but a bit theoretical sometimes.
There are a lot of good/free/maintained resources linked here too: https://www.rust-lang.org/learn
@john https://doc.rust-lang.org/stable/rust-by-example/
and https://rustbeginners.github.io/awesome-rust-mentors/ if you are looking for mentors!
@James Munns Out of curiosity, have you seen m4vga-rs from Cliff Biffle? 800x600@60fps VGA on an stm32f4... in Rust. And amazingly well commented/documented too
@James Munns the mentorship thing looks very cool. I gotta check that out.
Nice! I think I have! There's also the Neotron which is a similar project!
https://neotron-compute.github.io/Neotron-Book/
Neotron - The Embedded Rust Home Computer Platform
Neotron is an attempt to make computers simple again, whilst also taking advantage of the very latest in programming language development. We are saddened by chat clients that require multi-Gigabyte installs, and systems with hundreds of millions of lines of source code that no one person could ever hope to understand.
So we're up against the end of our hour today, and I just want to say thanks to James for his time today. I'm always keen to learn something new, and learning Rust might be a great self-improvement project for me to tackle.
I've stripped a hello world for x64, and is still in the hundreds of KB, what's the catch to make it fit in 1KB?
besides the I/O library
Are you using the embedded crates? or standard rust?
And I want to say thanks to everyone for turning out with so many great questions, I really appreciate it. Feel free to keep the conversation going -- the Hack Chat is always open!
Tanks @James Munns for this lively chat
> I've stripped a hello world for x64, and is still in the hundreds of KB, what's the catch to make it fit in 1KB?
Probably writing it in assembly! Though there are also lots of demo groups like logicoma that do 64K demos in Rust as well
Thanks all! It was a ton of questions, but I'll stick around for a bit longer!
You can always find me on twitter: twitter.com/bitshiftmask, or on matrix as `jamesmunns`!
> Are you using the embedded crates? or standard rust?
On embedded, there are a ton of embedded crates! It's totally the same language/tooling as regular rust, just with a slightly smaller standard library!
FYI, I'll be posting a transcript in a few minutes, in case anyone missed anything and wants to refer back.
(my 1KiB example was for a bare metal MCU, not a desktop program!)
I have to check the links again, but the names of the typical embedded crates, are available somewhere?
> On embedded, there are a ton of embedded crates! It's totally the same language/tooling as regular rust, just with a slightly smaller standard library!
that's what I Was getting at...if he's compiling standard rust there's a lot more stuff in there so 1kb isn't going to happen
https://github.com/rust-embedded/awesome-embedded-rust is a good list to browse!
@James Munns , thank you very much for your time, and all the answers!
Are there any good libraries or approaches for parsing protocols or files with data not falling on byte boundaries?
Things like bit packing?
yes
docs.rs/nom/ for parsing, and docs.rs/bitvec for working in-mem are probably my best suggestions!
But for most serialzation/deserialization, the Serde ecosystem is really good! serde.rs/
(it typically more works on the byte level tho, but it's not a hard requirement)
Thanks for all the advice, hopefully I will get a chance to take the Knurling stuff for a spin soon!
Discussions
Become a Hackaday.io Member
Create an account to leave a comment. Already have an account? Log In.