Embedded is not a clearly defined concept when it comes to size. When I worked with embedded Linux with a Gigabyte or two of RAM, we used to make the difference to the microcontroller world by calling them embedded embedded.
Embedded systems are a very large range, depending on what kind of performance needs to be embedded. From tiny microcontrollers on one end to what's equivalent to high-end workstations with custom hardware interfaces on the other (and probably talking to smaller controllers).
x86 hasn't been successful in the microcontroller half of things (even though fast microcontrollers beat some x86 options, so it's not a size thing, but there hasn't been a compelling offering), but on the microprocessor side of things it has its uses, primarily but not exclusively towards the high-end nowadays (due to competition by ARM). To add another line to differentiate, x86 without an OS is going to be quite rare nowadays.
Doesn't seem fair to hold a code size contest and not measure the code executed in BIOS calls. Anyone can get ever-smaller code sizes if you just move the code to somewhere outside the region gauged by the test.
So how does it work. Where do the standard library functions come from? Where do all the garbage collecting functionality gets loaded from?. Or is it more like pinvoking a reduced external library in C for all needed functionality.
1. Used CoreRT instead of the standard .NET libraries
2. He avoided using functionality that would use GC in the first place
3. Created his own alternative runtime library w/out GC and exception handling
4. Created a base type library for some of the System functions
5. Re-directed certain functions like Thread.Sleep to smaller implementations in specific libraries.
This is also a very good example that not all languages with GC are created equal, some do provide the mechanisms to do alternative ways of managing resources.
This implementation uses async/await, data structures from Rust's standard library (alloc crate), plus streams and channels (30 dependencies in total), so it's pretty fancy for a "no_std" project.
Bare-bones Rust executables can start at about 3.5KB, and code size increase on top of that is comparable to C or C++. Rust can be a "portable assembler" if you write code in such style. It can also generate lots of code if you lean into generics (same issue as with C++ templates).
Obligatory comment about how an operating system
is "system software that manages computer hardware, software resources, and provides common services for computer programs" and not just a program that executes at startup.
Obligatory comment about that this software abstracts away display, memory and interrupt management and provides services for the snake module. Also I like the name snakeos, since it doesn't promise more than it can deliver
I didn't take this comment as derogatory. Instead I see it as a good comment explaining that this example is much more than just "a program that executes at startup"... as it seems some people may have initially thought when glancing at only the start of the github readme page.
"An operating system is a collection of things that don't fit into a language. There shouldn't be one." – Dan Ingalls, in an article in Byte Magazine, 1981
Do they not still have both modes? I haven't bought a motherboard for a couple of years, but the last few that I have have been both. (And basically I've not known or cared which I used!) Seems an unfortunate backwards compatibility loss if so.
Class 3 is the progressively lower class which is designed to get users to accept lesser functionality as more "modern" so therefore it must be "better" or something.
36 comments
[ 3.9 ms ] story [ 83.1 ms ] threadRust'll be ready for embedded when it is 512 bytes: https://gitlab.com/pmikkelsen/asm_snake
x86 hasn't been successful in the microcontroller half of things (even though fast microcontrollers beat some x86 options, so it's not a size thing, but there hasn't been a compelling offering), but on the microprocessor side of things it has its uses, primarily but not exclusively towards the high-end nowadays (due to competition by ARM). To add another line to differentiate, x86 without an OS is going to be quite rare nowadays.
Here's a 11 kB bootable x86-64 version of the game written in C# https://github.com/kant2002/SeeSharpSnake/tree/kant/uefi#run....
There's an accompanying article with a video at the bottom https://codevision.medium.com/running-c-snake-inside-uefi-df....
Edit: Got my answer. /p:Mode=CoreRT-NoRuntime, /nostdlib, and a bunch of others.
1. Used CoreRT instead of the standard .NET libraries 2. He avoided using functionality that would use GC in the first place 3. Created his own alternative runtime library w/out GC and exception handling 4. Created a base type library for some of the System functions 5. Re-directed certain functions like Thread.Sleep to smaller implementations in specific libraries.
The blog posting is well worth reading:
https://medium.com/@MStrehovsky/building-a-self-contained-ga...
https://github.com/nongiach/snake_boot_sector
or:
https://github.com/w-shackleton/snake-in-my-boot
Bare-bones Rust executables can start at about 3.5KB, and code size increase on top of that is comparable to C or C++. Rust can be a "portable assembler" if you write code in such style. It can also generate lots of code if you lean into generics (same issue as with C++ templates).
(Just wondering. Of course nobody would seriosly want to use a modern PC to run that game.)
Couldn't quickly find a good reference, here is at least some: https://www.dell.com/support/kbdoc/fi-fi/000151899/no-boot-d...
Edit: UEFI class 3 is the keyword https://en.m.wikipedia.org/wiki/Unified_Extensible_Firmware_...
It's a technology demonstrator. And people run all sorts of tools from USB drives. For example, I recently ran a memory tester from USB.
https://www.memtest86.com/
v4: GPL, but legacy boot only
v5-v9: Closed source, no-cost variant available, UEFI
How much space can it take up?
Without that lots of visitors are not going to look much further at it.
If the IMG was there, I would have already tested it on bare metal, if it fit on a floppy that functionality would have been confirmed bare metal too.