11 ms·
The last low-level device I shipped code on, we had 2K of program space and about 1K of RAM. Started writing in vanilla C, crunching pieces into hand-written as
by kabdib 8y ago
The last low-level device I shipped code on, we had 2K of program space and about 1K of RAM. Started writing in vanilla C, crunching pieces into hand-written assembly and rewriting fat code when space got tight. 6 bytes free in the final code. I might be going out on a limb when I claim that Rust won't touch this kind of system . . . but probably not.
The system before that was largely just a USB driver, an event loop and some interrupt handlers, supporting a large amount of ported-over and mostly already existing stuff in C that did the interesting and product-defining algorithmic heavy lifting. I guess that we could have written the infrastructure in Rust, but it's hard to see the win in using two languages (the algorithmic stuff was not going to get a rewrite).
Rust isn't great for other reasons, too. Finding good embedded systems programmers is hard enough; require something bleeding edge like Rust and the population of candidates plummets to "well, we might be able to find and hire one person this year" territory.
- steveklabnik 8y agoRust can meet those requirements, though there may be other ones that you didn’t mention it that would disqualify them. With similar techniques as the C, the smallest Rust executable ever produced was 151 bytes. The CPU architecture is more likely a problem. And, as you say, the stuff that’s not purely a technical requirement. We’ll get there!
- keithnz 8y agosmallest device I program in C has 20 bytes of RAM
- steveklabnik 8y agoWhat device is that, and what do you do with it? Just curious.
- keithnz 8y agosorry, the device itself has 25 bytes :) But I was left with 20 for program logic. http://ww1.microchip.com/downloads/en/DeviceDoc/41236D.pdf http://ww1.microchip.com/downloads/en/DeviceDoc/41236D.pdf PIC12F508. It did a number of things. It had logic for controlling power on a low power device, coordinating between a number of other micros. It also acted as a last ditch watchdog system that triggered a recovery of the device
- steveklabnik 8y agoThanks, neat!
- pjmlp 8y agoThose PICs can also be targeted with Basic and Pascal, so that you get an idea of the competition. :) https://www.mikroe.com/mikropascal-pic https://www.mikroe.com/mikropascal-pic https://www.mikroe.com/mikrobasic-pic https://www.mikroe.com/mikrobasic-pic