This a post on my "Noframes" wiki.
Modern Palm OS Development with GCC 14 and C++: A Practical Guide for Beginners
Table of Contents
This is an LLM ass-isted document, as are all in the ass/ subdirectory.
Of these, here in the dump/ subdirectory I keep the sloppy & doubtful ones.
I keep these as learning materials for myself, yet to be went thru.
1. Welcome to Palm OS Development in the 2020s
Developing software for the Palm Computing Platform in the modern era is a uniquely rewarding exercise in systems archaeology, resource-conscious engineering, and retro-computing craftsmanship. Between 1996 and the mid-2000s, millions of PalmPilot, Palm III/V/m-series, Sony CLIÉ, and Handspring Visor handhelds ran Palm OS on Motorola 68000-family microprocessors (DragonBall 68328, EZ, VZ, SuperVZ) clocked between 16 MHz and 66 MHz, with RAM budgets measured between 512 KB and 16 MB.
Historically, developers were locked into commercial Metrowerks CodeWarrior or early open-source GCC 2.95.3 (prc-tools-2.3) running under strict C89 dialect constraints. Today, thanks to cross-compilation toolchains and modern GNU Binutils, we can write modern C++ (C++20 and C++23) using modern GCC 14 targeting classic Palm OS 68k hardware and emulators.
This textbook assumes no prior Palm OS knowledge. Whether you are an experienced systems programmer or a curious hobbyist, each chapter guides you step-by-step with concrete commands, architecture breakdowns, mental models, build automation recipes, and code snippets.
2. Textbook Structure
The textbook is organized into a sequential set of focused Org-mode chapters located in this directory:
- 01 — The Palm OS Mental Model and Architecture: Hardware constraints (DragonBall 68k, 160x160 mono/color, 3.3V battery), system architectures (single-tasking event loop, dynamic heap vs. storage heap, A5 world), the PRC resource container file format, and the classic trap dispatch mechanism (
trap #15). - 02 — Toolchain Setup: Modern GCC 14 & The Hybrid Pipeline: The GLIBC compatibility issue on modern Linux distros (Debian 12 vs sid), the sid
ld-linuxwrapper architecture, why GCC 14 emits ELF while Palm OS requires COFF, the assembly directive filter pass, the custom linker script (palmres.ld), and automated installation scripts. - 03 — C++20/C++23 Discipline on DragonBall m68k: Why
extern "C" PilotMainis strictly required (avoiding C++ name mangling), why-fno-exceptionsand-fno-rttiare mandatory on Palm OS, the critical rule against global/static constructors, memory allocators (overloadingnew~/~deleteonto Palm OSMemPtrNew), templates, and RAII stack resource management. - 04 — Building Your First Application from Zero: Step-by-step creation of a complete working C++ application, compiling to assembly, filtering modern directives, assembling with
m68k-palmos-as, linking withpalmres.ld, packaging withbuild-prc, and the essential 2-byte header flag patch (0x0009 launchable data attribute). - 05 — UI, Resources, and Event-Driven Programming: Palm OS event architecture (
SysEventLoop,EvtGetEvent,SysHandleEvent,MenuHandleEvent,FrmDispatchEvent), form event handlers in C++, resource compilers (PilRC syntax,.rcpfiles, form definitions, controls, alerts, and icons), and multi-form navigation. - 06 — Memory Management and Data Storage: The Storage Heap vs Dynamic Heap distinction, Data Manager API (
DmOpenDatabaseByTypeCreator,DmNewRecord,DmWrite), battery-backed non-volatile RAM records, handling chunk handles (MemHandle) vs raw pointers (MemPtr), and designing safe C++ RAII wrappers for records. - 07 — Emulation, Testing, and Verification: Survey of modern Palm OS emulators (CloudpilotEmu in browser/WASM, Mu native emulator, POSE historical reference), automated test harnesses, loading ROMs, injecting PRCs, and pixel-perfect screenshot verification via canvas capture or Xvfb.
- 08 — The Modern Palm OS Ecosystem & Alternative Technologies: When not to write C++: FreePascal (
ppcross68kwith SysLib loading), Plua 2 (Lua 5.0.3 with native Palm OSgui.*widget abstraction), OnBoardC (on-device standalone compilation), Wren bytecode VM embedding, Zig status (comptime assembly generator), and hardware interfacing (Palm Vx serial/BLE bridge). - 09 — Advanced GUI Programming, Controls, and Forms: Custom gadgets, UI object hierarchies (windows, forms, controls, lists, tables), drawing bevels and custom controls, modal dialog loops (
FrmDoDialog), and state machine multi-form navigation. - 10 — Communications: Infrared Beaming, Serial Ports, and HotSync: The Exchange Manager (
ExgMgr), beaming records over IrDA, Serial Manager UART programming for ESP32/BLE appliances, HotSync conduit architecture, and inter-application execution (SysAppLaunch). - 11 — The Palm OS Debugging Field Guide: From Bus Errors to Hard Resets: The hierarchy of resets (Soft Reset, Warm Reset / Safe Mode, Hard Reset / Factory Wipe), hardware fatal exceptions (Bus Errors, Odd-Address Alignment Errors, Line 1111 Traps, Dynamic Heap Leaks), and Gremlin stress testing.
- 12 — Automated Testing, CI/CD, and Verification: Headless CI architectures, driving CloudpilotEmu via Puppeteer/Playwright, driving Mu under headless Xvfb with scrot capture, and host unit testing of business logic before m68k compilation.
- Appendix A — Reproducibility Guide: Building the Pipeline from Scratch: Exhaustive one-shot reproduction shell script, step-by-step verification checklist, and benchmark artifact criteria.
3. Quick Reference & Conventions
- Target Platform: Palm OS 3.5 through 5.x on Motorola 68000-family hardware (DragonBall 68328, EZ, VZ, SuperVZ) and PACE emulation.
- Host Environment: Modern Linux (Debian 12 Bookworm, Ubuntu 22.04/24.04, or similar x86_64 distributions).
- Cross-Compiler: GCC 14.4.0 cross-ports (
m68k-linux-gnu-g++-14) via sid dynamic linker wrapper. - Assembler & Linker: Palm OS binutils 2.14 (
m68k-palmos-as,m68k-palmos-ld) fromprc-tools-remix. - PRC Packager:
/usr/bin/build-prc. - Linker Script:
palmres.ld(COFF output format,.textincoderesregion, discarding modern GNU notes/comments).