Submitted via IRC for TheMightyBuzzard
Programming languages tend to polarize, and Rust is by far no exception. Whether it will stick around and grow as an alternative for the lower levels or not — time will tell. In the meantime, if you're curious about the language and its low-level abilities yourself, [phil-opp] has written a series of blog posts on building your own little bare metal kernel in Rust.
Starting from the basics, [phil-opp] describes in detail the set-up and build process to create a standalone executable that won't be linked against the Rust standard library. From here he proceeds to build a simple operating system kernel that prints a good old Hello World via VGA output — QEMU emulation included. And of course, there is a GitHub repository with all of the source code.
Source: https://hackaday.com/2018/09/08/pun-intended-bare-metal-attracts-rust/
(Score: 3, Interesting) by MichaelDavidCrawford on Saturday September 15 2018, @11:27PM (5 children)
Like the ARM7TDMI. I used to do Thumb firmware for the Oxford Semiconductor line of Firewire/USB to IDE bridge chips.
The first instruction always selected the endianness. There were a few other setup instructions that I don't recall, then it entered an infinite loop written in C at first then later C++.
All I/O was done by polling. There was no heap allocation - just stack and globals.
Those particular target boards are no longer made, but Atmel sells a wide variety of target boards.
My Oxford boards could receive firmware through a proprietary mechanism that could not be erased. The only "debugger" was a bank of eight LEDs that I could turn on and off individually.
I eventually clued in to the use of "while ( true ) ;" as the losing part of assertions. The watchdog reset quickly caught this, then my eight LEDs boogied for a little bit, eventually to trip the assert, the LEDs would stop boogieing then the watchdog would reset again.
Yes I Have No Bananas. [gofundme.com]
(Score: 1, Interesting) by Anonymous Coward on Saturday September 15 2018, @11:47PM (2 children)
I prefer to write "for (;;)" which I read as "forever".
(Score: 1, Informative) by Anonymous Coward on Saturday September 15 2018, @11:57PM
#define forever for (;;)
forever {
}
(Score: 1) by istartedi on Sunday September 16 2018, @08:45AM
I was taught that
is the preferred idiom because the parser recognizes it as a unique situation. The while-loop looks like any other while-loop in the parse tree. Of course any compiler that didn't ultimately optimize them to the same code is an awful compiler.
Appended to the end of comments you post. Max: 120 chars.
(Score: 2) by The Mighty Buzzard on Sunday September 16 2018, @12:52AM (1 child)
They're nothing special, really. The documentation is just shittier.
My rights don't end where your fear begins.
(Score: 2) by MichaelDavidCrawford on Sunday September 16 2018, @03:18AM
Compare optimizing by tallying up instruction timings in a spreadsheet to using Intel VTune on a server box.
Yes I Have No Bananas. [gofundme.com]