Psellos
Life So Short, the Craft So Long to Learn

OCaml 4.00.0 for iOS ARMv6

October 3, 2012

After testing all the apps I can, I’m ready to release my port of OCaml 4.00.0 for the earliest iOS devices, the iPhones and iPod Touches with ARMv6 processors. Since Apple has dropped support for ARMv6 from the latest Xcode, this port now has mostly nostalgic value I guess.

On the other hand, I have a couple of first-generation iPhones around my house, and they’re still extremely nice little devices. You often hear about people who even today have racks of outdated PowerPC Macs in their basement, running market analysis algorithms and making profitable stock trades. Or maybe I’m the only one who’s ever heard of people like that. At any rate, the point is that there are lots of ways to use outdated equipment creatively.

After this pep talk, perhaps you’d like to try OCamlXARMv6, which is what I’m calling this compiler. You can download a prebuilt binary of OCamlXARMv6. You can also build OCamlXARMv6 from sources—instructions are on the Compile OCaml for Early iOS page.

OCamlXARMv6 runs on OS X and generates apps using the toolchain that comes with Xcode. Since these are now nostalgia devices, you need to use a classic release of Xcode. The Compile OCaml for Early iOS page tells how to get an old Xcode release.

This project was just a small change to OCamlXARM (which compiles OCaml 4.00.0 for current iOS devices):

Once again, the majority of the work had already been done by Benedikt Meurer, who wrote the new ARM code generator for OCaml 4.00.0. His code generator already supports the ARMv6 architecture. I just had to add a new target system/model and set the defaults properly.

However, I did have to add support for the VFPv2 floating point instruction set, as Meurer’s generator supports only VFPv3. This was a small change, but it was fun to get it working. I’ve already written about this change in OCaml 4.00.0 Patches for VFPv2.

I spend a lot of time “monitoring” this website, Psellos.com. Something I’ve always wanted is a little display that lets me see a summary of the status—how many people are reading this blog vs. the Tompa blog, how many new visitors we’ve had today, whether the mailer is being attacked by a Portuguese password guesser, and so on. It strikes me that an old iPhone would be great for this. I can write a quick app in OCaml and just leave it running on the iPhone a lot of the time. Even without a cell contract, it can access the website over WiFi. There are lots of cool things you could do with an old iPhone, it seems to me.

If you have comments or questions, please leave them below, or email me at jeffsco@psellos.com.

Posted by: Jeffrey

Comments

blog comments powered by Disqus