Arduino IDE Creates Bootable X86 Floppy Disks

Arguably the biggest advantage of the Arduino ecosystem is how easy it is to get your code running. Type a few lines into the IDE, hit the button, and in a few seconds you’re seeing an LED blink or some text get echoed back over the serial port. But what if that same ease of use didn’t have to be limited to microcontrollers? What if you could use the Arduino IDE to create computer software?

That’s exactly what boot2duino, a project developed by [Jean THOMAS] hopes to accomplish. As you might have guessed from the name, the code you write in the Arduino is turned into a bootable floppy disk image that you can stick into an old PC. After a few seconds of beeping and grinding your “Hello World” should pop up on the monitor, and you’ve got yourself the world’s biggest Arduino.

A minimal x86 Arduino sketch.

Now to be clear, this isn’t some kind of minimal Linux environment that boots up and runs a compiled C program. [Jean] has created an Arduino core that provides basic functionality on x86 hardware. Your code has full control over the computer, and there’s no operating system overhead to contend with. As demonstrated in a series of videos, programs written with boot2duino can display text, read from the keyboard, and play tones over the PC’s speaker.

The documentation for boot2duino says the project serves no practical purpose, but we’re not so sure. While the feature set is minimal, the low overhead means you could theoretically press truly ancient PCs into service. There’s certainly an appeal to being able to write your code on a modern OS and effortlessly deploy it on a retrocomputer, from somewhat modernized versions of early computer games to more practical applications. If any readers end up exploring this concept a bit further, be sure to let us know how it goes.

70 thoughts on “Arduino IDE Creates Bootable X86 Floppy Disks

          1. And ISA or PCI card can enable you to boot via USB due to the fact that they can have little BIOSes of their own on the card. Hacking some PCI card’s firmware to add their own code was actually the what enabled the NSA to add a BIOS backdoor to some high-security systems and evade detection. :)

        1. It all hinges on your definition of “Operating System”. All you would need to add is a set of FAT16 routines and you’d have something roughly equivalent to MSDOS, TRSDOS, Apple ][ DOS 3.3, or MacOS prior to OSX (minus the GUI, and yes, that’s flamebait… go for it. I’ve owned all four).

          I would say all of those are “monitors” more than “operating system”, but to each their own I suppose.

          1. You forgot Apple II ProDOS and, of course, CP/M. Certainly CP/Ms before PC-DOS were “monitors”. I think you can blame the ambiguity to MS calling the Windows 3.11 Graphical shell, an “Operating System”. From then on marketers call anything they want an OS

        1. There are thin environments like Ultibo (a Pascal environment for Raspberry Pi that has its own boot, runtime and kernel). These are probably operating systems by some definition. At least embedded environments.

          1. Years ago, I was looking at a Ruby tutorial, and it occurred to me that not only was Ruby’s package manager similar to Python’s pip package manager, but both are similar to Debian’s apt and Fedora’s RPM, among other things.

            I concluded that every language, to some extent or another, “wants” to be an operating system — and a little more reflection caused me to conclude that every operating system is a language.

            Of course, if you have a good Forth implementation, you can have an interactive interpreter, compiler, editor, and so forth — in short, an operating system — that can easily fit in the RAM of a 2K Arduino.

            So I am more than willing to consider Ultibo to be an OS (even if I can’t help but say “Pascal? Why did it have to be Pascal?”).

    1. Wait you want to boot the IDE without an os? The point here is being able to use an old PC as a dev board, not to avoid operating systems entirely. You would basically have to build or reuse an operating system to run the Arduino ide: not just have but also native compilers and linkers, firmware tools, etc.

      The “no os” part just means you’re programming for the bare metal PC hardware, rather than being inside of and under an operating system. If you want code to run, you’ve got to either write it or link it in.

  1. Next up, configuring the parallel port to act as gpio.
    It can’t be hard to add an in/out 378/379/37a nn.
    If it already beeps the speaker, most of the code is already there, not quite a case of replacing the 7 and updating the total size but not far off.
    This would be pretty awesome. Although old PCs are becoming pretty hard to get your hands on these days. Saying that, depends on your definition of old.

          1. Just to clarify a common misunderstanding. LinuxCNC does not require a parallel port. It still supports the parallel port as an option, as there has been no good reason to un-support it, but it isn’t a preferred option. Better results can be had my PCI, PCIe, and Ethernet-connected interfaces. (And, also, if you must, ISA and EPP-data)

    1. I keep an old laptop with a parallel port for JTAG purposes, to access the 0x378 address.

      Jean Thomas is actually a friend from the DirtyJTAG project, an stm32 firmware to build a JTAG USB cable.

      Fun project, let’s see what people can do with it!

    2. Don’t forget I2C. If you still have a VGA port I think there’s an I2C bus on that. Lots of expansion cards also use I2C internally that I suppose you could bodge a wire onto.

  2. I really like this fun project, but:

    > and there’s no operating system overhead to contend with

    … aside from Arduino, which is way operating system overhead. Also, unlike, say, a FreeDOS program, you’re basically limited to writing code in the `loop` function; in a “proper” OS you don’t have to do that; servicing the hardware happens without you having to jump through these lhoops.

    That’s actually a significant overhead, when you think about it, both in the developer mindspace as well as in the ability to reliably predict timing of your system.

    That’s not to bash Arduino – it’s great for exactly the reasons stated in the article – but calling Arduino “low-overhead” is honestly not accurate.

    > Your code has full control over the computer

    aside from the parts that the `gcc -m16 -ffreestanding -fno-PIE -nostartfiles -nostdlib` compiled code has no access to (like, most of your RAM, PCIe devices, thus USB, basically everything the good ol’ BIOS emulation of your mainboard has no basic workflow for).

    1. > > Your code has full control over the computer
      > aside from the parts that the `gcc -m16 -ffreestanding -fno-PIE -nostartfiles -nostdlib`
      > compiled code has no access to (like, most of your RAM, PCIe devices, thus USB,
      > basically everything the good ol’ BIOS emulation of your mainboard has no basic
      > workflow for).

      If you use a USB keyboard, there’s a good chance your BIOS emulates plain old AT keyboard interface in SMM, running a USB stack in the background. And there’s a good chance ACPI/APM also steal CPU cycles from time to time.

      So yeah, fuil control…

  3. If your interest is in the “modern” toolchain, there are plenty of modern C implementations for DOS.

    If your interest is Arduino on x86, there are already x86 boards with fuller Arduino support for their hardware (GPIO etc).

    But I’m sure they solved some challenges, well done.

    1. Many PCs still have parallel ports. If not on the back panel then as a header on the motherboard.
      Of 34 motherboards listed at three have a back-panel parport and 3 have a motherboard header.
      (The board-finder allows you to filter for them, presumably as there is still some limited demand)

        1. I have (for my sins) experimented with a number of PCI add-on cards and motherboard parallel ports.
          So far every MB parallel port I have tried to access has responded to inb() and outb() on the advertised port. (I _think_ that they have all been at 0x378). PCI cards are more variable, some report an address to the system (visible in Linux with cat /proc/ioports or with lspci)
          The exceptions seem to be the cards with a small chip towards the rear bottom. These seem to have a general-purpose IO chip that only becomes a patallel (or serial) port when a driver is downloaded into it at (Windows) boot time. I have had no luck achieving port-level access with those.

  4. The first sentence of this article is só true.
    I am not a good programmer and always have proboems setting up hardware, yet I had my first arduino (a digispark) set up and blinking a LED (including installing the IDE) within six minutes (which I remember as I was reheating some food in the microwave) – mentally I had prepared an evening to get up to this level, so that was a great win.

  5. This is pretty cool. Whether or not you consider it easier or harder to develop x86 without DOS hardware servicing, it’s a great hack. I’d love to see someone do similar for 32bit protected mode using scanlime’s “metalkit” toolkit (which I think has a bootloader and basic setup routines).

  6. It seems a really nice way to hack on ancient systems which have no more hard disk or exploitable media except a floppy and access bios configuration or low level hardware

    I have an old 386 laptop which has a failed Conner CP2064 hard disk and will not accept something else, for which the bios setup was once done with system floppy that is now unobtainable… it would be pretty easy to peek at low level memory mapping and send a dump of the ROM to the serial port for being able to find the hard disk parameters and put a plan to boot DOS on another hard disk

    Would definitely try this out if I was able to find some time :p

    1. The generated code is 16-bits. The stack is hardcoded to 4096 bytes. You can tweak that in the linker script, but honestly if you need more RAM than that, it’s time to switch to something more serious ;-)

  7. has anybody installed this on windows? I installed arduino and the only /hardware folder is C:\Program Files (x86)\Arduino\hardware. I put the Bootduino folder in there but it doesn’t seem to be available e.g. the examples don’t show up in file/examples.

  8. This is brilliant. I’m gonna poke at it later and see if I can talk to the PATA port in PIO mode at 0x1f0. If I can bitbang those pins in addition to the parallel port at 0x3f8, that’s a ton of I/O bits already.

Leave a Reply

Please be kind and respectful to help make the comments section excellent. (Comment Policy)

This site uses Akismet to reduce spam. Learn how your comment data is processed.