Last week, I reported that I was slightly behind schedule. I’m happy to report that the emulator stack is back on track, and it’s been a fun challenge to get to this point.
I am very excited to report that it is now interactive, and performance is good on my laptop! PalmOS takes around 340 million instructions to initialize and check its internal state and all peripherals. To complete this process, we mimic the peripherals accurately enough that the software can’t tell it is sandboxed. Afterwards, the CPU sleeps (which we need to communicate up the stack to the host OS so it can sleep). Touch events are the first interrupt implemented, and the interrupt most critical to interactivity of the device. (NB: because PalmOS does not multitask, general interaction does not require timer interrupts, so they have not been high on my priority list.)
I ran into an emulator bug with PalmOS shutting down after interrupts. For simplicity earlier, I spoofed some GPIO reads to zero when the initialization process does not depend on realistic values. As it happens, GPIO Port D measures the battery level. PalmOS reads battery level during boot, but does not stop the boot process if the battery level is too low. However, it does check after the first interrupt, so the first touch caused the device to assume it had no battery left and shut down. Now we provide a fake charge level.
There are two more steps to take in the immediate future. One is to implement more interrupts, which has a very concrete “success” outcome. The other is more design-heavy: asynchronous delivery of interrupts. I’ve forgone this for now, because the most performant and power-aware design for my laptop is almost certainly not the right choice for our ESP32-P4 processor running FreeRTOS. (After all, targeting our specific package is a major advantage of writing our own components.) I’ve been sketching this out throughout the week; currently, I plan on sync points between every few instruction executions where we check a queue. I’m eager to play around with a properly async design with multiple tasks, I suspect it won’t be worth performing as an optimization (and could potentially hurt performance) and it would only be worth trying as a learning exercise. We will see!
Having seen comfortable performance margins (despite running on a much more capable core), my assessment of the risk of performance has gone down. I have confidence in my ability to achieve fully performant execution. By the end of Monday, I’ll have complete data about performance on the P4, and will adjust the emulator schedule appropriately. I think storage carries some risk – we are working with finite flash on the device, and I’m worried about the complexity of emulating an SD card to PalmOS – but our current forecasts look good, and we have back-up plans for these problems. On the emulator side, the risks I’m aware of are manageable!
I do not any adjustments to the schedule of emulator work at this time, but will reevaluate depending on performance data.










