How do you run an obsolete OS on modern hardware?
Figure 1: Palm TX (Source: Brusselsshrek/Wikipedia)
Remember the PalmPilot? PalmPilots came out in the 90's and were one of the earliest PDAs (personal digital assistants). They were basically a pocket computer with a big screen and very few physical buttons. Sound familiar? PalmPilots were without a doubt a big reason why we have the smartphones of today.
PalmPilots ran on their own operating system, called PalmOS. Despite having 74% market share for PDAs in 2000, PalmOS started disappearing as PDAs started adopting the Pocket PC platform from Microsoft. Soon, even the next generation of Palm devices ran on Windows Mobile.
Is PalmOS obsolete?
Maybe not, thanks to a talented young engineer by the name of Dmitry Grinberg. Dmitry recently ported PalmOS 5.2.8 to the RP2040, the first microcontroller from Raspberry Pi.
What does porting an OS mean?
PalmOS was originally designed to run on Motorola 68k processors. When the speedier ARM processors were released, PalmOS was ported over so Palm devices could use them. This was done through PACE - the Palm Application Compatibility Extension. When something designed for the 68k processor made an OsCall, PACE would intercept it, and translate it to use the ARM Native OsCall. In effect, Palm had created a 68k emulator for ARM processors. It worked, and it was fast! Palm eventually created Native ARM applications, although this was never documented.
How do you port an OS?
The native API of PalmOS 5.x was never documented, so porting it over to new hardware meant a lot of reverse engineering. Dmitry started by writing a basic DAL (Data Access Layer), which handles the kernel, memory management, and most of the low-level functions of the CPU. It took months, with every function and feature being a new problem to solve. These included audio, memory management, drawing, screen resolution, SD card, serial ports, stylus, and more. Every function was reverse engineered and meticulously recreated. "rePalm" was working perfectly on Dmitry's PC.
Why Raspberry Pi's RP2040?
Because rePalm had support for the Arm Cortex-M0, Dmitry decided on the RP2040, because it was the only Cortex-M0-based chip with enough RAM. Dmitry chose a Raspberry Pi Pico with a touch screen display. After some tweaking and experimentation, Dmitry was able to get the world's most modern PalmOS device working, the results of which are shown in the video below.
#rp2040 runs unmodified PalmOS 5.2.8 (showing off world’s only ARM-to-thumb1 JIT) pic.twitter.com/b9n5OG4a1l
To learn more about Dmitry's project, check out the rePalm project on Dmitry's website.