Wednesday, 7 December 2016

Running Delphi applications on Raspberry Pi 3

..using RTAndroid 7.1 on RPi3 using ADB over network.

Update: RTAndroid has now become emteria.OS at https://emteria.com/.

Embarcadero has Linux (console) applications on their roadmap - but that is for AMD64 (x64 - see comments) only - read more about the product roadmap here.

Despite the above I did get my Delphi application running on the RPi 3 B hardware - read below:


And even if a glimpse of a preliminary Delphi compiler for Linux ARM, did appear in Allan Bauer's blog post - who knows if it will be happen - showing is one thing - supporting and selling is a different thing - but back in September units sold of the Raspberry Pi did pass 10 million.

I had an old first batch Raspberry Pi B lying around - and thought maybe I should buy a couple of new model 3 B's, to upgrade my original Kickstarter Picade, but also to have some Delphi fun.

So as Francis Bacon said: "If the mountain won't come to Muhammad then Muhammad must go to the mountain." - I started to install RTAndroid 7.1 on my RPi 3 - and to make it more fun and to make a tribute to Microsoft, now that they over recent years in many ways had come to their senses - even Steve Balmer's accusations of Linux being like cancer and communism, seems all forgotten and forgiven - lets hope this also happens for a specific comparable person in higher politics - anyway..

Enter Windows 10 Anniversary Edition and WSL - or Bash on Ubuntu on Windows - how perfect would that be installing RTAndroid on the RPi3 using WSL?

I enabled WSL in Windows, in Bash I installed unzip, wget (or should that be "wgot" 😁) the image from the site, unzipped the image and inserted my SD card...aarrrggghh WSL still being beta, did not yet support mounting of removable drives - vote for it here - the hottest item on their uservoice.

Then I briefly tried Microsoft's other new adaption from the world of "communism":  "Windows Containers" - being Docker - why do they not call things by their original name - very Danish attitude - we take something that is working, modify it, break it and call it something differently. But here only same architecture is supported - unless you walk another mile.

So actually starting to sidetrack, I just used a Ubuntu Server VM I had running - you might need to install lzip and phablet-tool but the install script is very helpful in telling you what you need.

Well long raving short, here is a picture of my monitor with Delphi 10.1 Berlin upd. 2 and RTAndroid 7.1 running on Raspberry Pi 3 - showing my "Hello World" application.

Sorry about the quality, but I ended up just using the PIP function of the monitor - since various mirror and casting option failed - probably due to the high resolution I kept on the RPi3/RTAndroid.

But as you can see does the RPi3 show nicely up in the IDE - and I did use ADB over network, since connecting the RPi3 as an Android device over USB - might have been another failure for me - being on a roll.

Since the RTAndroid image is already rooted and adb is listening on port 5555 - it is very easy to connect ADB over network - just enable debugging on the Android device - click 7 tímes on the build number to enable developer mode. Then open a command prompt in Windows, go to the Android SDK platform-tools folder and run:

adb connect <IPAddress>:5555

Refresh the devices in the IDE and the Raspberry Pi 3 appears.

The other nice thing is actually that I can try out my stuff on newer versions of Android without spending nights breaking my phones.

And remember - do yourself a favor if you are using a very old version of Delphi or for a while stopped using it - either upgrade your old version using the amnesty offer or download and start playing around with the free Starter Edition.

Enjoy.