in , , , ,

rePalm

- Werbung -
Reading Time: 4 minutes

With an ongoing fascination with PalmOS – “it was the first mobile OS with any sort of success and it gave the world the term ‘smartphone” – Dmitry says he wanted to see if he could put the operating system on another device with minimal changes. He looked into emulating the hardware with success (check it out here). “But that was cheating,” he continues. “The goal was to port it to new hardware, which is usually hard without source code, but I figured I’d try.

“I knew that, in theory, most of the drivers were contained in the Device Abstraction Layer (DAL) module, with a few others being separate (SD card, serial port, DMA). I figured that if I managed to replace those modules with some I wrote myself, that the OS should, again in theory, run on any ARM device with a compatible processor – any processor supporting ARMv4T or ARMv5T architecture.” This tech adventure spanned multiple years, but the effort has certainly been worthwhile.

- Werbung -
- Werbung -

Raspberry Pi Pico connected to the CortextProg (cortexprog.com), a Cortex-M debugger Dmitry created to read and write data from and to a microcontroller

“It culminated in the release of the source earlier this year, and now one can bring up PalmOS even on processors that it never actually supported, like tiny Cortex-M0 cores,” Dmitry continues. Having tried numerous other boards from STMicroelectronics’ STM32F429 to the STM32H7, RP2040 showed the most promise. “I had never encountered a Cortex-M0 microcontroller that had enough RAM for PalmOS,” he says. “RP2040 does – barely – so I wanted to try.”

Screen time

The idea was to get PalmOS 5 running on a Raspberry Pi Pico or other RP2040-based development board and connect the device to a suitable touchscreen. Dmitry says the only one that fit his requirements was a low-cost $15.99, 2.8-inch touchscreen display from Waveshare offering a resolution of 320 × 240px.

“It is a resolution that PalmOS supports well and really this is about the applications – the OS itself does not care about screen resolution,” he says. “Applications work best at resolutions that are integer multiples of 160 × 160, and extra space can be used for the dynamic input area. A 320 × 240 resolution is not super common but is supported relatively well.”

The rePalm device looks very much at home here. It can force-pause threats, disable task switching, and supports local thread storage

Dmitry says it helped that the screen was easy to purchase. “It is a pet peeve of mine when people publish a project and their parts list includes ‘that one thing I bought at a garage sale once’ or ‘an old tube my grandpa left me in his will’,” he explains. But it was also important to have a resistive touchscreen.

“Devices today are designed for capacitive touch, hence the large touch targets,” he says. “PalmOS predates cheap capacitive touch so it is designed for resistive touch screens which needed quite a bit of pressure to work, hence the fact that styluses had a fine tip. The fine tip also allowed the thing being tapped to be seen, while fingers are relatively large and obscure what you tap.”

Ramming in RAM

The more Dmitry used RP2040, the more he realised it was a good fit for the project. “First, the PIO system is very versatile, allowing me to pretend to be a RAM and a ROM to the host 68k processor (in the case of PalmCard) while also driving my display with no CPU cycles needed. No other micro out there has anything quite like it,” he says.

- Werbung -

“Second, the performance is good. Cortex-M0 may not be a very performant core per-cycles, but the fact that I can easily run it at 200MHz+ surely papers over a lot of that! Third, the documentation does not suck, and this cannot be overstated. Whoever wrote the RP2040 docs needs a medal, a bonus or a hug because it is clear and accurate.” [That would be Alasdair Allan – Ed].

Raspberry Pi Pico is mounted on the back of the touchscreen display. As Dmitry says, a $1 microcontroller is being used to replicate what was once a $400 device

But that’s not to say Pico is perfect. “There is barely enough RAM to turn around in, so it’s not a practical PalmOS device,” he laments. “PalmOS 5 needs at least 64KB of RAM for the storage heap where the databases are stored and at least 128KB of dynamic heap, where temporary allocations come from, to boot.

“My kernel and DAL need about 30KB for itself and we also need to fit at least one full frame buffer [screen image] into the RAM. At 320 × 240 × 2 bits per pixel, the framebuffer is almost 19KB. Adding that up gives us 241KB. Now, RP2040 has 256KB of RAM – the other pieces are not easily usable for various reasons. This is tight, but it fits. That 30KB was after a lot of extra work I put in to shrink that footprint. Initially, it was closer to 100KB.”

Looking ahead

This all means PalmOS 5 just about barely fits on Raspberry Pi Pico and, once it boots, only basic programs run with a few KB of RAM left over for a memo pad note or two. There’s not enough RAM to load a game, and Dmitry would love an RP2040 with more RAM. “It would work better,” he says.

Still, rePalm is a huge feat that deserves a lot of applause. Hours and hours of disassembly went into its creation and using it shows how well created PalmOS was. “The rules were simple: any common activity should be no more than two device interactions away,” Dmitry says. “People who want a modern PalmOS device don’t seek to replace their phone. They seek to escape the constant advertisements and distractions.”

With rePalm, he is showing once more what is possible. “Current plans include making a PalmOS-based smartwatch as well as a new PalmOS-based device,” he adds.

Why? “Just because.”

- Werbung -

Report

- Werbung -

What do you think?

Schreibe einen Kommentar