A 386 PC for Your RP2350

(github.com)

178 points | by SamuraiLion 9 hours ago

17 comments

  • ilaksh 54 minutes ago
    The problem is PC programs assume 640kb of RAM and the RP2350 has 512kb + 16kb cache SRAM so anything that goes past that has a sudden 40 cycle access delay.

    So even if you account for the RP2350 being 6 times faster than the RP2350, I think the emulation would randomly start to stutter a lot in certain circumstances waiting to access that part of the memory.

  • guenthert 5 hours ago
    Holy cow, a 386 with VGA and SoundBlaster on a $1 MCU?

    I recall VICE emulating the Brotkasten on 386 PCs some thirty years ago, later UAE doing it for Amiga. How long til my currently running system (anno 2016) is being emulated?

    • supergarfield 3 hours ago
      Maybe never with current technology? Looking just at the CPU and assuming you need comfortable IPC overhead for emulation, the 386 was from early in the Dennard scaling era and modern CPUs are 1000x or more faster single-thread. Since maybe 2012 that hasn't moved anywhere near that, certainly less than 10x.

      Figure 6 in "A New Golden Age for Computer Architecture" is a good representation of that effect: https://dl.acm.org/doi/epdf/10.1145/3282307.

      For the GPU things are potentially looking better! But since distributed shaders/kernels are higher-level compiled for your specific device, there's less of a need for emulation.

    • theamk 3 hours ago
      Either "already" or "not any time soon", depending on how you count.

      Already - because you have VMs and backwards compatibility. As long as you keep using Intel x86_64, your apps would run, no emulation needed. Or you can use the VM.

      Not any time soon - because the computers are not speeding up that fast. 10 year old computers are still being used today, and even the latest CPUs are not orders of magnitude faster. So for a full-system emulation, the most well-known ones is x86 VM's on Apple Silicon, and according to reports, full-system mode is still not close to regular PCs.

      • kevin_thibedeau 59 minutes ago
        16-bit x86 code dependent on interacting with real hardware under precise timing doesn't always work well in a VM.
  • dvdkon 7 hours ago
    It's really cool what can be done today with just an MCU that has sufficiently flexible IO. What's the performance like?
  • broswell 2 hours ago
    Which of the 4 boards on do you recommend as easiest? I would love to demo at the Computer Museum @ System Source https://museum.sysrc.com

    It looks like I would have to build my own frank board. Any off the shelf boards?

  • jasongill 1 hour ago
    In case anyone missed it earlier on HN, there is a similar project that runs on an ESP32: https://github.com/hchunhui/tiny386
    • LeFantome 35 minutes ago
      That one is offering Pentium Pro and SSE3 emulation. Not too shabby.
  • zabriel_goss 3 hours ago
    What a long way to have come from the beige towers!
  • cold_pizz4 7 hours ago
    I love it! The RP2350 is probably the most underrated microcontroller available today.
    • IshKebab 6 hours ago
      Overrated surely? It's a pretty bog standard MCU, no wireless support, mediocre deep sleep. I don't know why you'd pick it over an ESP32 or nRF5x.

      The only standout feature is PIO which is definitely interesting but very niche. It's also patented so say goodbye to any portability or FOSS vibes. (If you want a FOSS version btw, check out https://baochip.com/)

      If it didn't have the Raspberry name behind it nobody would even have heard of it.

      • Lerc 2 hours ago
        If you want something that can do some dumb buttons and lights handling on a mass consumer device, it's not ideal.

        I would say it is still underrated.

        PIO combined with DMA and the independent bus SRAM banks allow for immense combinations of capability.

        If you want to do something digital and specific beyond a few MHz the the RP2350 raised the ceiling of what you can do before requiring hardware or FPGA.

        It still has some areas where it could be improved, but most of thise would not have been apparent until you really stretched the design.

        Having extra PIO GPIO without physical pins but the ability to configure connecting pairs together in software would add a lot of capability.

        Perhaps an interesting test/benchmark would be to get a microcontroller to pretend to be an SRAM (or better yet two independently accessed SRAMs) while outputting the lyrics to still alive on a serial link.

        The virtual SRAM performance characteristics of timing tolerances and latency would be a respectable approximation for arbitrary digital signal handling that any particular MCU might be able to manage.

      • willis936 6 hours ago
        The PIO are pretty great and not niche. Almost any embedded application needs mixed signal interfaces. You could say embedded applications are niche, but not that embedded applications needing mixed signal interfaces.

        A serious warning: read the RP2350 errata carefully. You may be better off buying old 2040 inventory.

        • sh-run 3 hours ago
          RP2350 adds secure boot and encrypted boot. I am working on a little hardware device for a CTF and selected it as my MCU so participants can't just dump the flash to grab the flags.
        • vardump 3 hours ago
          > read the RP2350 errata carefully

          Even the latest rev? Can you elaborate a bit?

          • kjs3 1 hour ago
            The smart engineer always reads the errata carefully.
        • Neywiny 4 hours ago
          Mixed signal means analog and digital
      • riskable 4 hours ago
        Are you kidding me? It costs a fraction of the competition and you can use just about any pin for anything you want! It makes designing boards for the RP series so simple and easy!

        Contrast that with STM32 where you have to constantly reference the data sheet to make sure you're using the correct pins for say, I2C when you're running in a particular mode. And since you're running in that mode, you now can't use other pins for certain things. Ugh! I hate it!

        Then there's the issues with picking the right-size part number and making sure the pins you want are 5V tolerant, checking that you're using the correct ADC, and... Ugh! It's a pain in the ass!

        Other chips aren't much better as they all have those same problems.

        ESP32 is nice because of the zillions of built-in peripherals but configuring the damned thing can get really complicated really fast. It's so complicated, in fact, that they had to make a Makefile (as in `make menuconfig`) that rivals the Linux kernel in the sheer number of options/submenus.

  • gxd 5 hours ago
    I had Slackware CDs in the nineties! They had a minimalist label and came with no jewel case (rubber band if I recall correctly).

    I've been meaning to rediscover the CICA and Simtel collections. Maybe that's what I needed!

  • weinzierl 8 hours ago
    Looks like it can even run Windows 96. Incredibly cool. I'll have to try if it runs my old Slackware kernal 1.2.13 some time. I used it with a 4MiB, 25Mhz 386 DX back in the time, so it should.
    • ilaksh 51 minutes ago
      I don't know if they have some kind of magically genius caching system but the chip only has 512kb of SRAM and a little cache and the rest has to be managed by flash memory which is like 30+ times slower so I dunno about the performance of that.
      • Narishma 23 minutes ago
        The boards using this chip typically have 8 MB of PSRAM from what I've seen.
        • ilaksh 18 minutes ago
          yeah but the PSRAM is going to cause a delay
    • xhrpost 8 hours ago
      Did not realize that Win95 can technically run on a 20Mhz 386DX.
      • badsectoracula 7 hours ago
        It "technically" can - i used Win95 on an AMD 386DX with 4MB of RAM back in the 90s for a little. Most of the time was spent waiting for the computer to do something while the HDD was constantly working.

        The Pentium MMX with 32MB i replaced it with was MUCH faster, practically everything was instant.

        • nullsmack 2 hours ago
          I tried installing it on my 20mhz 486 IBM but the install never would finish even though the minimum specs listed 386. I always thought that was being too generous. I did use it on faster 486's at some point in school (I think 66mhz or faster?)
        • glitchc 3 hours ago
          Yup, the RAM was the main bottleneck. 8MB was the minimum for Win9x, 16MB and above led to a fast experience.
      • cgearhart 5 hours ago
        Back in the mid 90’s I got it to “run” on a 386, but it was miserable. It was basically wondering if it was hung or just really slow on every command or mouse click.
        • nottorp 5 hours ago
          Yes. I remember one of the MS guys saying the goal for win 95 was win32s equivalent performance on a 386 with 4 Mb ram. But win32s performance on that hardware was crap :)
      • st_goliath 7 hours ago
        > Win95 can technically run on a 20Mhz 386DX

        s/technically/allegedly/

        supposedly with a minimum of 4M RAM even! [1] I have a machine with twice that clock and twice that RAM that a friends parents wanted to toss out[2]. I spent the better part of a day getting Windows 3.11 and Office 4.3 to run. Playing around with it for a bit, I highly doubt that Windows 95 on minimum requirements would be anything but endlessly frustrating. I was not masochistic enough to try.

        [1] https://en.wikipedia.org/wiki/Windows_95#System_requirements

        [2] https://goliath32.com/hw/machines.html#pc386

      • weinzierl 7 hours ago
        Good question. I ran Slackware Linux and DOS 5.0 on mine. I think Win95 was my Pentium 100 MHz already so it sounds a bit sus, but the FAQ section of OP had items about Win95, that is where I got the idea from.
      • lightedman 4 hours ago
        We had Win95 running on a 25MHz 4MB FPRAM 286 back in high school. Poor teacher, half of first period was roughly how long it took to boot up, only for them to exit into DOS mode because the grading software and report card software was DOS-native and would hang if you tried running it under the GUI.
        • vardump 3 hours ago
          You certainly did not, as Win95 requires 32-bit, 80386 or better. 286 was a 16-bit CPU.
          • lightedman 3 hours ago
            Windows 95 had a beta build for 286 systems, which is what this system 'ran.'

            Bet you don't even know about Windows 97.

            • Narishma 21 minutes ago
              It did not and it wouldn't have made any sense. By the time Windows 95 came out 286 systems were obsolete. They could barely run Windows 3.
    • fifilura 8 hours ago
      (slackware) Just need to find where you stored all 20 floppy disks...
      • weinzierl 8 hours ago
        I think it came with two 3.5" disks, a bootdisk and a rootdisk, as well as two CDs. One was the actual distro, the other a sunsite mirror.

        At least that is what I remember and while that memory might be hazy I know exactly where my precious is.

        • rwmj 7 hours ago
          I definitely remember installing it off 20+ floppies onto a 386 back in the day. Most of the disks contained packages and you didn't need to install all of them though.
          • jalk 6 hours ago
            IIRC Emacs took up a significant number of disks
            • tosti 5 hours ago
              To be fair, that's pretty much an entire operating system. Just one that lacks its own kernel. It even takes a while to boot up!
              • my123 4 hours ago
                Eight Megabytes And Constantly Swapping
                • soneil 3 hours ago
                  Eight Megabytes would be a feature, these days.
        • gamedna 3 hours ago
          Early releases of Slackware were only floppy. The boot/root CD release came later. I fondly recall wasting hours in a computer lab @ university using 20 Sun Sparcstation 2 floppy drives to write the slackware floppies for me and my friend. Walking out with a brick of floppies was pure bliss (achievement unlocked).
  • nickcw 4 hours ago
    Was the performance mentioned anywhere - I couldn't find it on the page?
    • dingdingdang 34 minutes ago
      Should be on the fast end of the 386 spectrum since it tentatively supports 486 and 586 architectures too.
      • LeFantome 25 minutes ago
        I don’t know how fast it is but that does not really follow. They added those instructions so that Linux would boot. Linux assumes Pentium and no longer boots on 386 or even 486 for the latest kernels.

        The presence of instructions first added in the Pentium really does not tell you anything about performance.

  • burstmode 7 hours ago
    Does it emulate RS232 ports and printer ports as well ? I did'nt find anything. Then it would be possible to reuse old embedded equipment.
    • kees99 6 hours ago
      No, it doesn't.

      Also this doesn't emulate ISA bus, where one could plug one of those "multi-io" cards to get rs232/printer ports.

      Which is a shame. There are plenty of GPIO pins to fit full ISA on RP2350 (at least on "B" variant), and those GPIO are supposedly 5V-tolerant (with sufficiently recent silicon revision). So hardware-wise, it's just a matter of wiring up an ISA slot directly to the RP chip.

      • jasomill 1 hour ago
        This could be useful on its own to create an ISA-over-USB bridge in conjunction with either a kernel driver or a user-mode PC emulator.
    • st_goliath 6 hours ago
      > Then it would be possible to reuse old embedded equipment.

      Unlikely, virtualization/emulation has been a thing well before this project and you can just buy USB to RS232 adapters. There are GPIO solutions for industrial PCs other than the parallel port. Or you can simply buy new industrial PCs which have those ports.

      If you find an industrial appliance controlled by genuine old PC hardware that hasn't been replaced, the RS232 ports are the least of your concerns.

      In my experience, such machines usually have something insanely proprietary plugging into a custom ISA card, and whatever is connected to it usually doesn't take too kindly if the bus timings are off. And neither does the accompanying bare metal software that relies heavily on timing loops and hardware peculiarities.

      • HeyLaughingBoy 27 minutes ago
        I've been holding on to a couple of fanless industrial PCs as much for their cases (I could drive my truck over one, and it wouldn't even make a dent) as for any possible future uses. As time moves on, being able to use them looks less and less likely.
  • shrubble 3 hours ago
    Technically you could run OS/2 on it, I think.

    Or Plan9 for i386.

    • astrodust 27 minutes ago
      With 8MB it'll be snug.
  • joshmarinacci 4 hours ago
    Wow. How can it do this without an MMU?
    • iberator 3 hours ago
      MMU can be emulated as part of emulated architecture. Its totally possible to have software only mmu.
  • jwrallie 8 hours ago
    Really cool, wondering if it can be ported to the PicoCalc.
  • Tepix 8 hours ago
    Time to dig up 386bsd
  • momocowcow 8 hours ago
    yes, but those screenshots are EGA
  • patrick_rtk 8 hours ago
    nice job