‹ BackHN Continuity

Thread

The newest ESP32 can run Linux and it's getting close to a Raspberry Pi

237 points · 123 comments · adunk

  1. dsign · · focus · HN ↗
    I’ve been developing a guitar pedal firmware in an ESP32-P4, and the flash image size is still under 1 MB and the PSRAM sits unused. It has not only a bunch of sound filters, control code for ADC, DAC a couple of USB devices, SDIO and LittleFS, but also a full-blown serial terminal TUI to control all sorts of details and to monitor performance. Said performance is good, but what blows me away is that there’s no jitter in the number that measures the number of cycles the processor executes while processing a sound frame, i.e. no preemption by the kernel to go and take care of its business.

    There’s no way a multi-user OS such as Linux can be as efficient as a firmware blob that does one thing. Tell me if I’m wrong, but in my mental model, one can get about the same mileage with 16 MB of PSRAM in an MCU running FreeRTOS as one can get in a 512 MB SBC running Linux. For my use case, the winner combination would, of course, be a 512 MB SBC running FreeRTOS, but I’ve so far been unable to find such a wondrous thing.

    1. ValdikSS · · focus · HN ↗
      The benefit of running Linux on a what used to be an MCU is that you're getting the best network stack, Bluetooth/Wi-Fi stack, one of the best device drivers (say for USB Host), stock and very well tested software, etc.

      For your use case, you need raw performance and low-level control, and you have it. But for IoT device which is all about network more or less, there's usually no need to go low-level.

      ESP32 for Wi-Fi handling uses wpa_supplicant port from Linux for example.

      You can run a real, multi-user Linux with as low RAM as 8 MB. You get the benefit of running any Linux-supported programming languages (and combine any amount of them without extra effort, just on a real machine), established portable abstractions, established memory protection model, ease of debugging.

      You can run both though. Both FreeRTOS and Linux simultaneously, where Linux is a FreeRTOS task on a dedicated core. That's how several Linux ports work, haven't checked if Espressif's works this way as well.

      1. Rohansi · · focus · HN ↗
        Nobody is going to build an IoT device with this MCU running Linux. It's only able to access 64 MB of RAM from its slow cores. There's also limited support for 32-bit RISC-V in distros so anyone looking to run Linux on this will need to build everything themselves. Easier to just get a cheap ARM SoC that can probably run Android.

        Or you could just use it as a microcontroller. Networking support is already good. Programming language support is better than you think (C++, Rust, Python, JavaScript). Debugging just works on newer boards.

        1. ValdikSS · · focus · HN ↗
          Of course people will, I'm looking forward to!

          >There's also limited support for 32-bit RISC-V in distros so anyone looking to run Linux on this will need to build everything themselves.

          For this kind of a device, "everything" is a kernel + your application/libraries + maybe busybox/toybox with some applets, all with XIP.

          >Easier to just get a cheap ARM SoC that can probably run Android

          It's at least twice as expensive for the features S31 provides. See my other messages here.

          1. Rohansi · · focus · HN ↗
            > For this kind of a device, "everything" is a kernel + your application/libraries + maybe busybox/toybox with some applets, all with XIP.

            But what does Linux actually give you in a MCU? It's a lot of overhead so it has to really be worth it.

            1. ValdikSS · · focus · HN ↗
              Full operating system with all the compatibility and device drivers. Ease of development: you program on Linux, testing on desktop Linux, and then run on a small Linux. Need additional software? Just compile and use it, without porting or adaptation/integration. I've described everything above, don't know what could I add.

              ESP32-S31 is no longer an MCU anymore if it has an MMU I guess. It's a full-blown "computer chip".

Open on Hacker News to reply ↗

Unofficial Hacker News client; not affiliated with Y Combinator.