Seems like all the cool kids are rewriting legacy C programs in Rust these days, so we suppose it was only a matter of time before somebody decided to combine the memory-safe language with some of the most historically significant software ever written by way of a new Apollo Guidance Computer (AGC) emulator. Written by [Felipe], the Apache/MIT licensed emulator can run either ROM files made from the computer’s original rope core memory, or your own code written in AGC4 assembly language.
It’s worth noting that the emulator, called ragc
, needs a bit of help before it can deliver that authentic Moon landing experience. Specifically, the code only emulates the AGC itself and stops short of recreating the iconic display and keyboard (DSKY) module. To interact with the programs running on the virtual AGC you’ll need to also install yaDSKY2, an open source project that graphically recreates the panel Apollo astronauts actually used to enter commands and get data from the computer.
Of course, the next step would be to hack in support for talking to one of the physical recreations of the DSKY that have graced these pages over the years. Given the limitations of the AGC, we’d stop short of calling such an arrangement useful, but it would certainly make for a great conversation starter at the hackerspace.
Thanks for the tip, [CJ].
I’d be very curious to hear from people doing active development in bare metal rust.
I recently spent a week learning rust to potentially use it for quite a complex project.
Unfortunately, even though the community is really amazing and extremely willing to help, I wasn’t really able to create a firmware solution split in multiple files/modules in an elegant manner. As most modules need to share in some way or another the hardware resources (GPIOs, interrupts), rust ownership model gave me some serious headaches (before someone mentions it, I extensively used mutex, refcells and options).
I nearly had something perfect from my use until I hit the major roadblock that for speed reasons rust doesn’t allow borrowing of single functions inside a module (I needed that to call multiple functions from an interrupt).
Looking online, when hitting that roadblock it seems most persons using RTIC (previously RTFM), with all the extra overhead that comes with it.
RTIC afaik should not have any extra overhead and you should use refcells and mutexes only in special cases.
Also Rust has an official documentation for embedded systems: https://doc.rust-lang.org/stable/embedded-book/
refcell and mutexes are needed whenever something is access from threads… or in this case, from main and interrupts. the book you mention is indeed the one i followed.
Lots of people telling you to read the documentation you already read, and I know what RTFM stands for, so is RTIC, Read The Idiotic Comments? ;)
Rust ownership actually solves a gaping design problem C has with HW.
Compiler can track and prevent you from accidentaly using a nonatomic register or even just a nonatomic part of a partly atomic register from different interrupts or threads/tasks (without generating any code whatsoever until you want to really share the nonatomic part in runtime).
Just read the Rust’s official manual for embedded systems.
Here I thought it was about compiling Rust to run *on* the AGC…
I thought that too!
My first thought was “WTF why didn’t the NASA use stainless steel or aluminium or sth that does not rust for their stuff???”…