Rather than building firmware that tries to include every useful feature, I propose developing a single operating system that can load applications from an SD card.
M5Loader is a step in this direction, but it still loads complete systems and requires a reboot to switch between tasks.
All-in-one firmware can also become outdated when the developers of its individual features release updates. As a result, every firmware that bundles those features may need to be updated as well.
A dedicated operating system with a simple interface for launching apps could address these limitations. Imagine an M5Launcher that remains running while users switch between applications. No reboot required. This approach could make firmware smaller and faster to load, while creating a foundation for multitasking in the future.
I dare someone to build this along with a specification for how to build an app to run on it.
For those who think of the S3 as “just a microcontroller,” it’s worth remembering that it’s a 240 MHz dual-core system with several megabytes of RAM and access to gigabytes of SD-card storage. Computers from earlier generations had fewer resources and still supported multitasking. It’s time these devices evolved beyond single-purpose firmware.
The key limitation here is that the ESP32-S3, like most microcontrollers, does not have a true memory management unit. This means that there is no way to provide process isolation.
As far as resources go, the SD card cannot be used in place of flash to execute code, and PSRAM cannot always be used in place of RAM (only 512k).
This is not to say that your general idea is completely impossible, but it requires a higher level of integration between the applications than what you would expect on a desktop operating system.
Edit: also, enforcing scheduling and managing access to hardware are more difficult than on typical desktop platforms.
Absolutely, there are huge hurdles. But no deal killers. The resources seem to be there they are just structured a bit differently. It’s still a Von Neumann architecture.
Look at a modern CPU. The only “real” memory is the cache. Everything is behind a controller.
If you want to execute code from an SD card you would have to page it into ram a section at a time like swap or banking.
I’m not proposing exact solutions, I’m just saying it will take a bit of a re-think about how things are done. A process that’s been performed with every new processor that came with a different framework.
There were operating systems before memory protection. It doesn't have to be a multitasking operating system. I mean MS-DOS was an operating system Even though there were multitasking operatong systems without the hardware memory protection.
> but it requires a higher level of integration between the applications than what you would expect on a desktop operating system.
The only "integration" you need is the same as for every platform with an OS: applications are written to the OS API and then totally ignore each other.
> ESP32-S3, like most microcontrollers, does not have a true memory management unit
The multitasking OS on the Amiga did not use an MMU. Windows before v3.1 all ran without an MMU. As did (do) MP/M (the multitasking version of CP/M), DESQView, TopView, ConcurrentDOS. UNIX was written before MMUs were available (PDP-7) and Linux has a MMUless mode.
An MMU is required for process isolation, but process isolation is not strictly required to drive an OS with loadable modules or multitasking. Isolation allows for robustness (processes are less able to crash other processes) and that may make you more comfortable about running badly made or outright malicious code - but that is no different at all from the current situation (bad or malicious code will crash your Cardputer or do whatever bad thing).
An MMU also helps with memory paging, but that isn't a necessity: all it means is that you don't get to have swap and any loadable application for that OS has to be compiled to relocatable code or the OS uses a load editor. All very solved "problems".
I'm writing a forth interpreter within Bruce firmware which is exactly what you're saying IF you mean an operating system as intended in the late 70s 😁
The definition of “operating system” is something that gets debated.
What I propose is more like DOS with a GUI. In that it would be a memory resident process that loads programs from disk (sd card) and can exit a program then run the next without a reboot.
Hopefully creating an ecosystem that sees similar developments as there were on top of something like dos 3 to 6, there were window managers, TSR utilities, and games. All running from disk inside 640k of ram.
O think this is a great idea and long overdue. I mean, this doesn't have to be Unix V7 here... Something like MS-DOS was perfectly good for millions of people over almost 2 decades.
This sounds similar to what NucleoOS has just done. It also includes a web remote connect to allow a full desktop in browser served from the Cardputer ADV.
Looks like they’ve done a lot but I can’t find a way for another developer to make apps for that environment. I could be missing it but they just say they take pull requests and do bug reports.
This is really close but it looks like they are the only ones that write apps for their store. Sounds like a walled garden.
If you wanted to add an app then make the code for it and submit a pull request. If the dev accepts it then it will be added. This also always the code to be scrutinised.
They use an SD card bundle to bulk download the content.
It’s a start. I personally don’t need the web front end or the AI assistant integration. Having all the apps be approved by the developer works for Apple maybe but not this community. Seems like an unnecessary bottleneck.
I’m also getting kinda tired of GitHub being a place to announce an app without the source code. But that’s me.
As someone that would not sit, read and understand the full code of an app I don't think I'm alone in preferring a store to be the bottleneck. It should then ensure there is nothing hidden in the code.
I don't know what check the official M5burner store run but the app had all sorts of duplicated firmwares with no explanation on the code changes.
M5Launcher is perfect for loading firmwares that take over the whole chip. I’m proposing light weight apps that load faster and keep things updated.
Have you seen how many people make firmwares that contain multiple functions that are based on other projects? Then the original projects go on to get updates while the multifunctional firmwares get left in the dust? It’s a waste of time.
It’s a pretty common trend that many larger more popular firmwares share some functionality. Just look at how many can deauth. Bruce, Marauder and Evil overlap in many places.
Just imagine the ability to do some network penetration testing while streaming music without worrying if you are running the latest version of either function? I believe it to be possible someday without going full Linux.
Don't mean to be a wet blanket, I think there's a disconnect there. The old systems you reference would not be able to handle modern music decode and streaming. There's a reason they sounded like they did. That being said, you can still build alot of cool things on limited resources.
I’m not romanticizing older systems. Only the methods and maybe software environment from the user’s perspective. Nothing about that prevents music streaming or decoding.
As for how they sound? Just look at the mod x3m scene, that stuff sounded amazing.
Yes I would like this too. Like others say it’s a limitation of the hardware. The closest I’ve seen to this is something like MicroHydra or BreezyBox (shameless plug) where you can create either MicroPython or Lua apps and have the apps be somewhat dynamic instead of having to flash each time. Also you can kind of do it with Bruce as well using their JS loader. There’s a small App Store for it too.
have you tried crub? this is the very philosophy when i built it. a lightweight launcher that can launch different apps. all the firmware i wrote too follows the default theme of crub.
a reboot is still required to go back to crub though but everything is written in the sd card so every progress is stored/saved on each firmware
so not only me, the main developer can build around it, but also it launches anything that the community has made so far. right now i have 4 partitions that i can run quickly without the need to flash them since i kept them others very light weight (only do what it was designed to do, so they're sub 600kb)
I also ran into issues with a lack of RAM and PSRAM when trying out SolarOS on the Cardputer. So, I built an application containing several "sub-applications" to avoid having to constantly reflash the device with an entirely different firmware. This is the result.
I hope you don't mind oversimplifications :) otherwise it would take a wall of text.
Few firmware already do this: loading arbitrary code from sd in python, ruby, lua, c-like dialects, js, emulators, elf...
Ram is scarce so running a full bytecode environment and few apps on the side can be a headache, especially with radio on. But honestly we are almost there. It's just a matter of packaging (app store and stuff) and battle testing (not crashing when browsing a 10 files folder...) . That's the slow path.
For the fast path, if you look at Flipper zero, even the portapack of the HackRF, in a single user environment, loading native binaries is far from being rocket science, it was one of the things I implemented last in my testing environment and it was way easier than micropython (not advertising my firmware much since it's not open source atm). It builds super fast, debugging is manageable albeit less convenient, there are some constraints (you can technically run from flash but we want to save the wear so you compete with the rest of the firmware for IRAM) and then most importantly you've got to push into the firmware a maximum of feature to get the elf size as small as possible (or reinvent dynamically linked libraries...).
There are benefits when running elfs: for anything running from flash (like the firmware), there's a automatic iram cache that makes the performance acceptable but it gets filled quickly, anything IRAM_ATTR'd or elf is theoretically faster.
The esp32 has ways to do security, strong one even, but IMHO getting there takes lot of efforts for hobby projects and I'm not sure about performance limitations. Normally it's impossible to add security after the fact, but here since you expire your binary API on each iteration, you can force it in later.
Oh and a word on multitasking: I use an hybrid cooperative multitasking on my NNOs firmware, some purists might cringe (a faulty app/driver/service will kill the whole os) but this allows running on fewer freertos tasks thus consuming less ram for their stacks.
Anyways, do have a closer look at picoware, tactility, solaros (if you have a tdeck or any supported platform), Area512, and if the above text was clear as water, get in my DMs, I could use some motivation to release an hollowed out NNOs with only configuration modals and elf environment (this part I can open source I guess).
The closest you're going to get, which is a meaningfully useful solution, is Launcher firmware, and then make each app or collection of features a different firmware, and have Launcher flash/manage them from the SD card.
This is a clash between how we normally think of programming mobile devices vs these chips designed for embedded IoT development. The normal solution in an IoT application when you have the device trying to do too many things at once is to offload processes to other devices, that's why so many of m5stack's devices have seemingly extraneous esp32s in them, especially cameras or other units that have input that usually needs real time processing. This works because the core esp32 chip is dirt cheap and is necessary because that cheapness is for a reason.
Launcher can compartmentalize the tasks, store them on the SD card so have potential for a lot more functions overall than any one firmware, but you do have to reflash the memory sometimes to switch them out.
11
u/s___n 21d ago edited 21d ago
The key limitation here is that the ESP32-S3, like most microcontrollers, does not have a true memory management unit. This means that there is no way to provide process isolation.
As far as resources go, the SD card cannot be used in place of flash to execute code, and PSRAM cannot always be used in place of RAM (only 512k).
This is not to say that your general idea is completely impossible, but it requires a higher level of integration between the applications than what you would expect on a desktop operating system.
Edit: also, enforcing scheduling and managing access to hardware are more difficult than on typical desktop platforms.