This is the Beaglebone Black
It’s a single-board computer, about the size of a credit card. It’s powered by an ARM Cortex A8 and includes the NEON floating point accelerator. Happily that matches nicely with the Android device requirements for RAD Studio and AppMethod.
When I saw that, I wondered what it would take to deploy a FireMonkey app to it. Like most things, it’s pretty easy once you know how, but it took me a few false starts to get it all figured out. Further, much of the information online assumes you’ll be doing this from Linux. Given my aim of running FireMonkey apps on the Beaglebone, I really wanted to show the steps from Windows.
So here they are.
Step 1: Get an Android image on a MicroSD card
The Beaglebone Black ships with a Linux distribution called Angstrom. So the first step is to get Android running on it instead.
If you are really keen, there are steps for building Android from the source. However, initially I just want to see if I can make it work, so I’ll use a pre-built KitKat image available here
Once you’ve you unzipped that image, you should have a file called BBB-aosp-4.4.4_r1-sd.img. Next we need to get it onto a MicroSD Card that we can use to boot the Beaglebone Black. You need a card at least 4gb in size. 8gb cards seem to be the smallest I could easily find, so that’s what I used.
To do this, you’ll need a few things:
- a USB MicroSD Card Reader
- Win32 Disk Imager, a free piece of software you can download here
Put the MicroSD card into your Card Reader and plug it into your PC. Run Win32 Disk Imager and click the little blue button to browse to the BBB-aosp-4.4.4_r1-sd.img we just downloaded.
Then, select the drive letter of your Card Reader in the Devices groupbox. Make sure you get this right, as whatever is on the drive you select will be deleted.
Here’s what mine looked like at this point:
Press the Write button, at which point Disk Imager will check with you once again that you got the drive letter correct. Confirm you did and it’ll start writing the disk image to the MicroSD card. This took between 15 minutes in the best case I saw, and 45 in the worst case. I think this was down to the quality of the SD card.
Step 2: Boot the Beaglebone Black into Android
Once Disk Imager is done, power off your BeagleBone Black and insert the SD Card into it (click the above image for a larger version). Hold down the Boot switch then apply power to the Beaglebone. Keep holding down the Boot switch until you see the USB Client LEDs start to flash. This tells the Beaglebone that you want to boot from the MicroSD card, not from the internal flash.
If you’re not sure where the Boot switch, the USB Client LEDs and the SD Card slot are located, click on the image above. In that image, the Boot switch is down near the corner at the bottom centre of the image, the SD Card slot is to the left of it and the USB Client LEDs are at the opposite end, to the right of the Ethernet port.
The very first time you do this, it’ll take a little longer as it needs to do some setup on the SD Card. Subsequent times it boots much more quickly.
You don’t need to have a monitor plugged in, but it’ll help with testing if you do. If you do have a monitor plugged in, shortly afterward you should see the Android home screen.
If you have a USB mouse plugged in, you’ll be able to run apps, change settings, etc. If you have an Ethernet cable plugged in, you should also be able to use the web browser.
Step 3 : Get it talking to Windows.
The first time this happened, I got very excited. “From here on in it should be easy”.
If all you want to do is run a FireMonkey app on it, it basically is. Get the APK onto it, say by downloading it from the browser, and you’re away.
However, I want to deploy from the IDE, so to do that we need to get it talking to Windows via a USB driver.
If you try plugging the Beaglebone Black into the USB port at this point, you won’t get very far. Windows will go looking for a USB driver that matches the idVendor and idProduct that the device reports, and it won’t find one for the Beaglebone.
If you bring up Device Manager, you’ll see it showing up under Other Devices with a sad little warning icon on it.
Never fear, we won’t let this stop us. Download the generic Android USB Driver and unzip it. That will give you a folder called usb_driver_r03-windows. In that you’ll find a file called android_winusb.inf. This is a text file so open it up in notepad.
If you’re on Win32, then you need to add an entry for the Beaglebone Black under the [Google.NTx86] section. If you’re on Win64, you’ll need to add it under [Google.NTamd64] . The entry you need to add is:
;Beaglebone Black %SingleAdbInterface% = USB_Install, USB\VID_18D1&PID_D002 %CompositeAdbInterface% = USB_Install, USB\VID_18D1&PID_D002&MI_01
The key parts of this are the VID and PID sections. VID = Vendor ID and PID = Product ID. The Vendor ID for the Beaglebone is 18D1 and the Product ID is D002.
Adding these will mean that when windows checks to see if this driver works with this device, it’ll decide it does.
Save the file, then go back to the Device Manager. Right-click on the Beaglebone node and select Update Driver Software. Browse to the directory containing our modified USB Driver and click Next. You might get a warning about not being able to verify the publisher, don’t worry. Push on through and let it install the driver. Once done, you should see a screen like this:
If you now startup RAD Studio or AppMethod, create a new Multi Device Application, and go to the Project Manager, you should see Beaglebone Black showing up as a Target device.
Drop a TLabel on the form with some appropriate text and hit Run Without Debugging. It should build the project and then deploy it to the Beaglebone. Shortly afterward you should see your app running.
Unfortunately at this stage I haven’t managed to get Debugging working, but I think I know why. It seems to be related to this build of Android using an older kernel that doesn’t support the Secure USB Debugging that KitKat expects. I’m digging into this, but meantime I’ve used a mixture of debugging on other Android devices and also using a USB Serial Adapter to see debug messages.
Wrap-up
Hopefully that will get you up and started. Yes, we’ve ventured off the beaten track a little, but the Beaglebone Black is a board for experimenting, so that should be expected. When I get some time I want to explore accessing the GPIO ports on it to interact with external sensors and other components. I would love to hear what you end up doing with it.
9 Comments
Access to the bone’s GPIO could be a major triumph here.
Considering how much of the RTL seems to support Linux as an ongoing target (probably for the android stuff) – one wonders if a ARM/Linux target is possible in the future.
X11 support of Firemonkey could be the (on the intel/amd and arm processors) thing Kylix was missing.
Sadly, that is not the current reality. However, I think there are android versions that run on Raspberry Pi. Any idea how close that awesome little 35$ computer is to this type of build. (Access to the RPi’s GPIO would also be kind of awesome.)
In the mean time, I hope the arduino/bone (the Tre) hybrid makes it to market, because that might be an interesting deployment target.
I published trick for unsupported devices in ADB, maybe help.
Simple ADB try search adb_usb.ini in .android directory in your profile with USB vendor of
your devices. This help me to run obscure devices.
http://delphi.cz/post/Oprava-ADB-pro-spolupraci-a-Android-tablety.aspx
translated:
https://translate.google.com/translate?sl=cs&tl=en&js=y&prev=_t&hl=cs&ie=UTF-8&u=http%3A%2F%2Fdelphi.cz%2Fpost%2FOprava-ADB-pro-spolupraci-a-Android-tablety.aspx&edit-text=
This looks like a useful project. It would be great if you made an entry on http://beagleboard.org/project.
[…] Running FireMonkey apps on the Beaglebone Black […]
[…] now, but I thought I’d better pull them out of Evernote and polish them up a little. The article is here and covers loading Android onto the Beaglebone Black, how to get a Windows USB driver up and […]
As I understand it Raspberry PI is Arm 6 and is therefore NOT compatible with Firemonkey apps. The BeagleBoneBlack seems to me to be a much better bit of hardware than the RaspberryPI. It would be great to get the GPIO (and the serial ports) working under Android.
HI Roger,
Yes, it’s on my list, but my real job keeps getting in the way 🙂 If you explore it further yourself, let me know where you get to.
Cheers
Malcolm
I also weld badly and started writing Turbo Pascal using a CP/M-80 system with 8″ disks. Still have the original disk although I doubt it’s readable anymore.
I also have a couple of Beagle Bones and XE7. So needless to say I am really excited about this.
I won’t be able to do anything for a month or so but I’ve started downloading the img for the sd card.
Any more progress on accessing the I/O? I’m specifically interested in the CAN bus and Serial Ports.
Hi John,
I started down the path of trying a newer Android build (specifically, one with a newer linux kernel that enabled GPIO), however I managed to fry my Beaglebone and have yet to replace it.
So Short version, no, but let me know if get any further.
Cheers
Malcolm