The author of the rePalm project rewrote Palm OS from scratch and plans to turn it into a smart watch platform

    And, apparently, watches on Palm OS will find their buyer:


    image


    Palm OS is an operating system for handheld computers, which was at the peak of popularity from 1998 to the first half of the 2000s. It is very simple and not demanding on resources, carefully consumes battery power and is remarkably designed for use in handheld computers. But in 2004-2005, Palm OS devices gave way to Windows Mobile devices:


    image
    (source)


    This happened for various reasons, partly due to management errors, and partly due to the peculiarities of the operating system itself: in 2004, Palm OS dragged a long tail of backward compatibility, which prevented it from developing and moving forward. For example, the lack of memory protection cost: an error in the application could lead to the whole system freezing or crashing, as in the days of Windows 9x or Mac OS 9. Or file system implementation: files were stored as records in the database, and the size of one record could not exceed 64 kilobytes. Probably, in 1996 this was a good solution, but such a data storage system was not adapted for large multimedia files and memory cards that appeared later.


    Well, you can not ignore the change of architecture in Palm OS 5.0 from Motorola 68k to ARM. Then, for compatibility with older applications, a binary translator was added to the operating system, which transcoded instructions from M68k to ARM on the fly. In principle, even with such a layer, old applications worked on new processors no worse than on their native 68K, since Palm OS system calls were made natively on ARM, and the loss of performance from broadcasting was offset by a several-fold increase in the frequency of new processors compared to Motorola Dragonball. The real problem was that the developers did not get the tools to create native ARM applications. The code for Palm OS 5 was still compiled for 68k, and even standard applications worked through the translator layer.


    Nevertheless, despite the many architectural features of Palm OS, its strengths have not ceased to be strengths. It is still a simple, low-level, low-resource system. In 2015, I used the Palm Pilot with a 16 MHz processor as a daily planner, and I was completely comfortable! Moreover, many loved this system precisely for simplicity, and many had enough basic applications. Readers, players, diaries and planners, games - all of this exists in abundance under Palm OS. You can find application for this operating system today.


    Therefore, after so many years, the community of fans of this system has survived, which supports sites with applications, maintains its own subreddit and continues to use palm trees.


    image


    But one of the community members went further, deciding to transfer Palm OS to more modern hardware and find a useful application for this project.


    Dmitry Greenberg, a Google programmer, has been creating tweaks and hacks for Palm OS devices since 2003, including WarpSpeed, a program for overclocking PDAs, and PowerSDHC, a driver for SDHC memory cards.


    At Google, Dmitry dealt mainly with embedded systems. In particular, he participated in the development of the operating system for the Android Wear smartwatch, the Nexus Q media player and the Android TV platform.


    After retiring from Google, Dmitry decided to create a platform for smart watches based on Palm OS 5.x, the operating system that was last updated 15 years ago:


    image


    At first glance, the plan is excellent: it is unlikely that modern smart watch platforms can be compared with Palm OS in terms of resource consumption and battery life.


    The problem is that Palm OS source codes have never been published. Yes, some pieces of source codes appeared in the public domain in application development textbooks, but this is not enough. The source was for PalmSource and for licensees, mainly companies that released their devices on Palm OS - on NDA terms, of course. Therefore, it is not possible to find the source code of this operating system after so many years, and the legality of its use will be in question.


    There remains a difficult and thorny path for the most hardcore enthusiasts with reinforced concrete willpower: reverse engineering. It was this path that Dmitry chose, gradually, in several stages, implementing his plan.


    First you should write a tool for unpacking ROM images of Palm OS devices. Then it was necessary to disassemble the main components of the operating system obtained from the unpacked image. Then - the longest and most monotonous job - you should understand the logic of the system API functions and write your own implementations of these functions. And, the most difficult thing is to write the kernel of the operating system, since existing ones (for example, linux) do not support some Palm OS kernel functions (suspension of threads, turning on / off preemptive multitasking).


    You can read the full history of rewriting Palm OS from scratch on Dmitry's blog , I will only briefly review the implementation of the main stages. Dmitry took several months to implement system APIs, which would be enough to load the OS. A few more weeks - for reverse engineering of the graphics subsystem, and two months - for writing code to support drawing. At this point, the implemented functionality was enough to launch the operating system on top of the linux kernel in QEMU, and load an image of some Palm OS device in this environment.


    rePalm's * FIRST * boot (c) Dmitry Grinberg
    rePalm's FIRST boot (c) Dmitry Grinberg


    To move from an emulator to real hardware, it was still necessary to solve many problems: choose a well-documented and stable working hardware platform, write the OS kernel for the selected architecture, write an ARM translator in Thumb (the Cortex-M4 processor selected by Dmitry only supports double-byte Thumb instructions, at that while many Palm OS components use full-fledged 4-byte ARM instructions), and write a JIT compiler (!!!) so that the dual translation M68k -> ARM -> Thumb works at an adequate speed.


    After a year of active development, rePalm is launched on the STM32F429 debugging board, graphics, a touchscreen and an SD card work, synchronization via HotSync works, and most applications and games written under Palm OS 5.x also work great. The plans include support for Wi-Fi and Bluetooth, support for sound and connecting the device via USB in mass storage mode, and updating the SSL library. Dmitry supplements his blog post as it develops, and also regularly posts project updates to the r / Palm subreddit .


    image
    (c) Dmitry Grinberg




    It's nice to follow the work of a passionate person and watch how an interesting and ambitious project develops. But it is worth remembering that Dmitry is primarily an engineer and programmer. For him, the solution to an engineering problem (bringing Palm OS in line with the modern world) is higher than creating a commercial product, whether it be a smart watch or something else. I am sure that the project will have many interesting applications, but what will happen next, and whether we will see the modern version of Fossil WristPDA, is hard to say. It remains to wish Dmitry good luck and follow the development of rePalm.


    image
    (c) Dmitry Grinberg


    PS Thanks to Newbilius for the thought of reposting this article here from the blog. More people should know about such cool projects!


    Also popular now: