Live data from Hacker News

Raspberry Pi Bare Metal Programming with Rust

blog.thiago.me

21–30 of 96 posts

Re: Raspberry Pi Bare Metal Programming with Rust

#21
post #16
post #9

Is Rust the future? As a C++ (hobby), Java (full time) developer, should I invest my time in Rust?

I started playing around with Rust a few weeks ago and fell in love; it has some quirks for sure (the whole borrowing system is a bit tough to grok at first) but it didn't take long for me to start seeing things the "Rust way." My only hang-up with it right now is that so many of the most useful packages in Cargo depend on the nightly build of Rust.

Could you list which packages you tried to use which were blocked on a nightly? In many cases a package can be moved off nightly with trivial changes, I can try to do it.

Re: Raspberry Pi Bare Metal Programming with Rust

#23
post #9

Is Rust the future? As a C++ (hobby), Java (full time) developer, should I invest my time in Rust?

Rust, Go, Java, Scala, Clojure, Javascript... (leaving out quite a few other choices for brevity). They say choice is a good thing but too much choice is actually really annoying and fragments the community across a very large number of ecosystems.

[deleted]

Re: Raspberry Pi Bare Metal Programming with Rust

#24
post #9

Is Rust the future? As a C++ (hobby), Java (full time) developer, should I invest my time in Rust?

Out of all the new languages of the last 5 years or so (D, Rust, Crystal, Go?, etc.) I think Rust shows the most promise. It is attracting both c/c++ people and people coming from dynamic languages (Python, ruby, js). So I'd recommend trying Rust out for sure, not much to lose, maybe spending a day...

The first release of D was in 2001. That's 15, not 5, years ago.

Re: Raspberry Pi Bare Metal Programming with Rust

#25
post #9

Is Rust the future? As a C++ (hobby), Java (full time) developer, should I invest my time in Rust?

I think you should lean Rust just for some new insights and patterns (error handling, optionals, pattern matching come to mind). It might make you a better programmer over all.

Re: Raspberry Pi Bare Metal Programming with Rust

#26
post #8

I have the perfect project for this! Generate a signal using the GPIO ports to drive a mirror and camera in a synchronized fashion. Does anyone know if the RPi GPIOs can be driven at around 80KHz? I've seen reports that this is possible, but that the USB or video driver tends to lock the CPU for long times, messing with timings - but hopefully running on bare metal would take care of that.

You could do this with much less than an RPi. I would recommend using an AVR or better yet a 555 timer if all you need is an 80KHz signal. Let me know if you want help with this I'm looking for projects like this or something much more complicated.

Re: Raspberry Pi Bare Metal Programming with Rust

#27
post #8

I have the perfect project for this! Generate a signal using the GPIO ports to drive a mirror and camera in a synchronized fashion. Does anyone know if the RPi GPIOs can be driven at around 80KHz? I've seen reports that this is possible, but that the USB or video driver tends to lock the CPU for long times, messing with timings - but hopefully running on bare metal would take care of that.

Yeah 80khz should be no problem. Even in Linux if you access the Pi's GPIO registers directly you can toggle pins in a tight loop at around 1-2mhz. As others mentioned though you might look at a small microcontroller though since the Pi is kind of overkill for generating a simple signal.

Re: Raspberry Pi Bare Metal Programming with Rust

#28
As a long time C programmer this is not very convincing. A C program to do the same requires far less voodoo. All you need to do is take the address of the GPIO register then toggle the bit. No name mangling. No error handlers to override. Don't get me wrong I know rust does have some compelling features. It does seem odd to me that so many of what would be compiler options in C are hard coded.

Re: Raspberry Pi Bare Metal Programming with Rust

#29

As a long time C programmer this is not very convincing. A C program to do the same requires far less voodoo. All you need to do is take the address of the GPIO register then toggle the bit. No name mangling. No error handlers to override. Don't get me wrong I know rust does have some compelling features. It does seem odd to me that so many of what would be compiler options in C are hard coded.

We generally try to put options in source code or configuration files, rather than in command-line flags, because that's more repeatable. It makes the CLI much simpler.

Re: Raspberry Pi Bare Metal Programming with Rust

#30
post #19

Earlier quoted context omitted.

The new raspberry pi zero can be run as a device, so you could use that.

O.o this $5 puppy could essentially replace the 1.5K National Instruments DAQ I'm using right now. Even better, I won't have to deal with their horrendous API documentation anymore. Of course that would require a Linux kernel, so not bare metal anymore, but there might be a way to make this work! Now I just need to get my hands on one, it's out of stock everywhere within a radius of 300km...

They haven't committed to making more, or if they do, to the $5 price point.
Post reply on HN