Super glad that this is finally open source, so I can sing my co-workers' praises in public and not private 😀
In short, Hubris and Humility are a brand new OS and debugger for embedded systems. 100% Rust.
There's a lot of things that are really, really cool here, far too many for Twitter. I've done a lot of work on our build system, which is one of those cool things: it is layered on top of Cargo to build the entire image.
hubris was one of the things that really drew me to oxide. really lucky to have such great co-workers.
One fun thing folks always ask about OSes written in Rust: what's the deal with unsafe?
well, the kernel itself is just under 2300 lines of Rust code. `rg "unsafe"` spits out one screen of results for me; we have 7 invocations of 'unsafe' *except* for arch\arm_m.rs which has 22
there's also a few unsafe extern "C" fns, for things like SysTick handler, the syscall entrypoint, stuff like that.
individual tasks use unsafe to access hardware as well, of course. being a microkernel a lot of stuff that would be in the kernel in a monolithic kernel is in userspace here.
we do use nightly. but *only*:
* inline asm
* naked functions
inline assembly is on its way to being stabilized: github.com/rust-lang/rust… but we need one or two bits that won't be stable just yet, iirc
i wanted try blocks once but resisted the temptation; we're very close to being on stable, and if we let nightly flags proliferate, we'll never get there
another cool thing: system calls are defined in terms of Rust semantics. so we can have safe system calls! here's the definition of "reply":
(well this is actually part of the definition, note it's not a 'pub fn')
this is the bit you'd actually want to call, exposed in our "userlib" library for writing tasks.
this leads me to another interesting thing: because system calls can take borrows, this means we can do stuff that's hard to do in non-rust systems, for example, "please loan some memory of mine to this task over here" which is very cool imho
okay so i should also say some cool stuff about humility
building a debugger also sounds wild at first... but it's brought a lot of cool advantages
so like, for example: the build process outputs an archive with all debugging info. no need to store any of that on the device itself; give humility an archive and point it at the device and it'll give you all that nice stuff, remotely
you want top on your embedded device? this is how you get top on your embedded device
(humility can query for the system state every $INTERVAL and print that out for you!)
lots of good stuff in here
another favorite of mine is "humility diagnose", which basically tries to figure out what is going wrong for you.
it can check if any task is faulting, it'll try to see if time is going backwards or not advancing for some reason, stuff like that
• • •
Missing some Tweet in this thread? You can try to
force a refresh
This essay is basically like "wow we have all of these production techniques to make copies of works of art. historically that was never practical. now it is easy. what does that mean for art"
it is a pretty short essay. i've always said programmers in general should read it.
but in some sense, nfts represent an attempt to be anti-this. it is trivial to be a "rightclicker" (lol). but they're trying to go back to this pre-industrial mode of art production
Some people have this experience and do exactly as I and @Wraithan do; “dang I wish I had the compiler to help me here, now I gotta do all this work”
Some people experience what Rust does and go “wow this compiler is constantly holding me back”
I suspect a lot of discussions around things like “productivity” are conflated with things like “have existing experience with tests/types” and “prefers runtime/compile time errors” and various other things
you know how i've had like, seriously declining mental health lately?
it is incredibly difficult, personally, to put a lot of volunteer work, heart, and soul, into doing something for a project, and then to have others malign it
i can handle heat from random people. that's fine. people can disagree with things. that's also fine!
but some of the stuff being said and done has just... it's tremendously painful. i've cried a lot. some actual friendships destroyed at this point
all i can say about 1password is that it gets my highest possible praise for a product, which is that i use it every day, it works perfectly, and i never need to think about it except when nerds get really upset about it online for whatever reason it is this time
the enlightened orange website user, on a tab about facebook: "if you're not paying, YOU'RE the product"
on a tab about 1password: $3/month is too much, use this free oss program with terrible ux instead
"ugh, an online vault that Just Works across every device you own no matter the OS? don't use that! just put this file in your dropbox and make sure to configure all the various apps to use that and if it gets out of date just manually re-sync it"
PSA: I plan on blogging about this, but haven’t yet, but semver is now a dtolnay crate. There’s basically nobody else I’d have given this too. Very glad to see what he’s doing with it