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.

9 comments:

  1. Replies
    1. I used the AMD64 term since that is what many Linux distribution use for their x86-64 bit build. And AMD's 64-bit specifications is also what Intel and VIA based their 64-bit specs on. Microsoft refers to x64, but internally they also use the AMD64 term. Here is some history: https://en.wikipedia.org/wiki/X86-64.

      Delete
  2. Thank you for the aeti le. Are you sure Intel based Linux will not be supported?

    ReplyDelete
    Replies
    1. Oops, sorry, large fingers with small buttons on the phone :) Thank you for the article*

      Delete
    2. It seems my use of the term AMD64 id confusing some - also see reply above. Only 64-bit Intel/AMD will be support (first time around?) according to the roadmap - and EMBT will probably also name a few specific distributions they officially support - as normally is custom when you build software for Linux. Thanks - and it seems we have the same kind of fingers :D

      Delete
  3. I test it, five minutes to boot and waiting, my third try. Can please tell me how much time take on you RPI3 to boot?

    You show a little screen (up right) inside a bigger screen running Delphi (?) Im lost, do you really run this android on a real RPI3?

    I try 3 times, 15 minutes, never pass the RTAndroid init screen. Don't boot.

    ReplyDelete
    Replies
    1. If you follow the instructions on https://git.embedded.rwth-aachen.de/rtandroid/downloads/raspberry-pi/ , use an UHS Class 4 or above microSD card then you should be all good - first boot takes a bit. New build are up frequently - maybe this with the build from 7th December - that was when I did the blog post. You can then upgrade from with the OS. ANd yes it does run on a real RPI3 :)

      Delete