> But my first attempt was a complete failure - I understood almost nothing.
This is how I feel every time I dig into something. Disappointingly, rarely do I have the time or focus to truly learn how something really works. Be it a library I am using, or a physics concept I want to learn more about.
Good for him for getting through it. I am adding this to my long ass list of things I would read if I could freeze time like that girl from the 90's TV show.
It turned out I had unknowingly bought a fake Prolific cable and the (non-fake) windows driver was crashing my whole system every five minutes or so when the cable was connected.
I worked around this by tracking down an older driver with no crash issues so I guess the latest one does this deliberately?
In any case, if you are planning on getting a USB serial cable make sure it's not a counterfeit, if you can.
How much do you recommend "The C Programming Language" for someone who just used Java / Python, and wanna start learning C and low level?
Do you recommend learning "current" Rust as a first low level Lang.
i think the best way to get started in low-level programming is to develop in linux on a raspberry pi and hack your own kernel. explore sysfs, ttys, and gpios. implement new syscalls and device drivers. then go bare-metal on the arduino or a PIC16 chip and build an interesting piece of hardware.
i've collected a lot of my favorite low-level programming tutorials and deep-dives on my HN profile page, but if i were to pick just a couple, they would be:
"Write a System Call": https://brennan.io/2016/11/14/kernel-dev-ep3/
"The TTY Demystified": http://www.linusakesson.net/programming/tty/
And a book, "Linux Device Drivers, 3rd Edition":https://lwn.net/Kernel/LDD3/ (free!)
protip: as you're getting started with kernel hacking, use kernel 2.6. LDD3 uses 2.6, as do a wealth of other books.
i'd also like to add that anybody who starts on a raspberry pi running linux will benefit from bootstrapped development. re-compiling the (linux!) kernel directly on the device is so much easier than setting up a cross-compile toolchain for C. eventually you'll want to have experience with cross compiling, but when you're first getting started it's a painful hurdle to overcome.
cross-compiling in rust is actually getting pretty easy, though, so that's cool.
You won't appreciate a lot of the protection that Rust gives you until you have spent some time with the freedom to make the mistakes yourself. Stuff like pointer arithmetic really helps you get into the mindset of how a program really executes. Rust tends to abstract this away and put in all these seemingly arbitrary (that's probably what it would feel like coming from a GC language) rules.
Plus C is well documented and supported everywhere. Tons of learning resources and you can guarantee that if you have a question someone else is bound to have had the same question and asked it. Rust, being newer, doesn't have quite as much.
As always, YMMV. I learned C 20 years before learning Rust myself.
They don't have any OS, rather, your program runs basically on the CPU directly. You can try to develop a OS from there, the CPU supports almost everything you need; interrupts and timers.
The only real limitation is that you have 2KiB of memory, on the other hand, it can be extended if you are willing to solder on a SRAM (2$ for 64KByte) or you can see it as a challenge to get an OS with a few processes working with such little memory.
The chip also has some advantages; since data and code live in seperate memory, you can't really crash or damage the chip by going out of bounds in an array. You can program something fairly robust in an arduino.
On the Java side where I live you can also compile native modules without much fuss.
I suggest this because it adds new to something familiar.
One thing I would not do is focus on making the first project maintainable etc or you’ll never get out the gate... stitch it together and redo it. Really 2 different programmers would be doing it, so no harm no foul.
Read documentation like it’s a good book... if it’s boring or not good then you’re not engaged enough so pick another project—supporting the disposable idea.
Good endeavors grow legs.
Learning it will definitely make you a better c/c++ developer. It'll beat memory safety into you with whatever you give it.
That said, although it does have great c abi interop, it doesn't build on as many platforms as c. And I think there might be some knob or levers that c provides for low level stuff that rust doesn't expose on stabe yet (SIMD, const stuff, and probably more)
That said, I think once you get past the borrow checker, programming in rust is considerably more enjoyable.
That said, if you're doing kernel-level stuff, you still need nightly, generally. We're getting there! Some major bits are stabilizing in the very near term (the panic-format stuff is a big one, for example)
You start out by composing simulated hardware gates to create higher-order gates, eventually creating a CPU and entire computer. Then you move into assembly, and eventually build an OS. All of the homework has automated grading, so it’s very possible to self-study.
That could help you in applying your new C skills in writing a simple device driver/kernel module you can play with. If are really into low level stuff I would propose an Arduino board whose OS is minimal, the Linux kernel is already very complex.
Get a role in an embedded software company and you may learn it all, but some experience is required.
I dont mean creating a whole functional module, but more like using an example, modifying some values, adding it to the kernel and compiling.
To build a module you don't need to build the kernel, but you do need the kernel headers, you will understand all this once you get to understand a bit of C language, and a bit of assembly won't hurt. Start with MIPS.
You do need a good grasp on the C language, and a lot of time.
If you can drive the command line and a makefile you should be able to tinker, and render it unable to boot. :)
It's a great course. Though I ended up writing the assembler in Python rather than C.
Also, what is the best beginner-friendly learning source? Rust Book 2nd edition? I like to learn from printed books, are there any good ones?
I also prefer printed books. The book second edition is personally my favorite, of course. :) it’s actually at the printers right now, so will be available in hard copy in just a few weeks. The O’Reilly book is also good but leans a bit more towards the experienced systems dev. It may work for you, it may not. I bought a copy of “Beginning Rust” by APress, I remember it being fairly solid.
There’s also a very neat book, “Step Ahead with Rust”, whose goal is to get you to learn the basics of the language well enough to be able to dive into other things. It skins over some stuff, but that also means it’s shorter, and therefore a bit simpler and faster than a more thorough book. It might appeal to you as well.
I kinda regret going into a corporate web dev field. The JS stack is terrible, work is mundane and monotonous. That's why I'm trying to learn myself something different.
Glad to hear that the official book will be available in print. The O'Reilly's book looks decent too, however it might be a little outdated already, considering how fast Rust is evolving.
On the server, there's a lot of churn right now, as async/await is being worked on in the compiler, futures are landing in the standard library, and the general ecosystem is undergoing a huge upgrade. So it also needs a lot of work, but may be harder without already knowing Rust.
One good thing to remember is that while it may be a little out of date, that just means it's missing some things. Nothing in it is wrong, it just is missing new APIs that may make some things a bit nicer.
Completely out of time to do anything for it but this company getting more traction would be really good given how completely open they are.
Concerning your linked example: if I look at the specs at
I see Mali 400 GPU. Is this GPU now fully open source?
If you are talking about drivers (rather than the GPU itself), there are reverse engineered drivers:
For the newer Mali GPUs there is the Panfrost driver:
Android is great example how you can do interesting OS development work by building upon stable foundations, focusing on userland, but also not fearing to poke kernel when needed.
I don't mean to disparage anyone, least of all the repo here that seems pretty nice resource for what it is. Just the title happened to tickle my imagination just right.