Puparium - Kaleidoscope Firmware Builder

A bit over five years ago, I announced Chrysalis on these forums. We’ve come a long way since, and there’s a tremendous amount of work ahead still. However, my brain decided to go on an adventure today, and came up with something that I believe will be as useful as Chrysalis turned out to be, something that would complement it quite well: a Kaleidoscope Firmware Builder.

An application that lets you build custom firmware easily. Not a firmware editor, not an IDE. A very simple tool: drop a sketch onto it, press a button, wait a bit, and get a built firmware back. No additional setup necessary, the tool does everything else. Cross-platform and all that.

The working title - and probably the final title too, because I liked it a lot - is Puparium (thanks @liw!).

There is no code yet, nothing to try, and it will be a while until I get to a stage where there’s something even worth trying, because this is a low priority task, something I do on the side to satisfy my curiosity, and calm my brain’s desire to do it. But there is a roadmap!

The short version of it is this:

  • Initially, the app will only support local building, and will require Docker to do so. But it will set up everything nicely, including the container it uses for the build, so as long as Docker is installed, the app will Just Work™.
  • At first, you’ll need to give it a single-file sketch (an .ino file), and it will spew out compiled firmware which you can flash with Chrysalis.
  • Later on, I’ll teach it to be able to enable/disable a selected subset of plugins, so you can customise the firmware to some extent.
  • Once those things are working reasonably well, I’ll build a little service that can compile firmware online. Puparium will then be able to send your sketch over, have it compiled there, and download the result. This makes Docker an optional dependency.
  • Once that works reasonably well too, I’ll decouple the UI from the app, and make it possible to host the UI on any webserver.
  • Every part is free software and self-hostable. (AGPL-3.0-only)

Non-goals:

  • It will not become a complete firmware builder/customiser like ZSA’s Oryx.
  • It will not be a part of Chrysalis, and will not replicate features that exist there (such as flashing). It complements Chrysalis, and does not replace it.

I’ll be writing the whole thing in Rust, the frontend, the backend, and the compile service too - all of it. The application itself will use Tauri to bundle things together into a neat little app.

Feedback on the roadmap, ideas, wishes are most welcomed.

4 Likes

Neat! So is the high-level aim to provide a user friendly tool that avoids the need for people to install and configure the Arduino IDE+toolchain themselves?

1 Like

Something along those lines, yes. It’s not a complete replacement for either, so power users will still want the real stuff. But it should cover a whole lot of bases.

While I’m here, a little progress report:

The basic functionality is there, it creates the docker container it uses to build at start (if it doesn’t exist), and can compile single-file firmware for any of the three Keyboardio devices. Now, error handling and progress reporting is virtually nonexistent, and the code is quite horrible. But for a ~2 day hack, I’m pretty happy!

(Also, there’s like 50 lines of JS and rapidly decreasing, rest is Rust, and I’m very happy about that!)

4 Likes

Another bit of progress report:

Anyone brave enough, and willing to compile it themselves can try it, there are some very rudimentary build instructions over on my forge.

However, the build server - which is live at puparium.mad-scientist.club - is usable without the desktop app! It has a reasonably simple API:

$ curl -i https://puparium.mad-scientist.club/api/1/compile \
       --data-urlencode "board=keyboardio:model100" \
       --data-urlencode "sketch=Model100.ino" \
       --data-urlencode "source=$(cat /path/to/your/sketch.ino)"

This results in a redirect:

HTTP/2 303 
server: nginx
date: Sun, 06 Nov 2022 01:47:15 GMT
content-length: 0
location: /api/1/download/<some-uuid>

You can then keep hitting that redirect URL, which will return either a 202 Accepted if the build is still in progress, a 400 if the build failed, and a 308 Permanently Moved when it is done compiling. Follow that redirect, and you have your firmware!

The server supports compiling firmware for the Keyboardio Model 100 (board=keyboardio:model100), the Model 01 (board=keyboardio:model01), and the Atreus (board=keyboardio:atreus).

Of course, the Puparium UI does this automatically behind the screen, and can even save the file with a more sensible filename than “firmware” or the uuid of the build.

The next step is to make the UI available on the web, without having to download anything, and also start building binaries of the desktop app, too.