Tuesday, October 26, 2010

Working with Android on development boards

This will be the first of a set of post on a project we are doing where we will use an Android powered dev board to provide UI and user control features for an embedded system. I will get back to the setup in later posts but in brief it will consist of two boards, one running a traditional control system and one running a slightly adapted Android platform with extra API:s to interact with the control system. This part focuses on working with Android on dev boards in general and discusses a couple of boards in particular.

For platform level hacking the open source project provides a good start with the emulator and that is useful for things like working with the base applications and examining the framework. The emulator is however limited and for a lot of platform level work real hardware is the best way to go. For real hardware there are two routes, either use an existing phone or use some kind of development board. Existing phones are fun platforms for tinkering and enabling features in the way they to it at xda-developers and other forums. As a general lab environment they are limited since they often have very few hardware interfaces exposed and they are often locked down in ways that make interacting with them difficult.

Development boards on the other hand are often made especially for trying out new designs, connecting hardware and having easy debug access. These are often the best platform for working with low level stuff on Android. In fact most phone manufacturers start out with some kind of platform dev board to facilitate early development before they wrap everything in great looking metal and plastic.

So let us look at working with Android on embedded development boards. First you should decide on why you want to go this route. Dev boards are excellent for:

  • Low level work on the Android open source project, testing and debugging hardware interaction etc.
  • Hobby projects where you want to design a great Android based interface for your home-made toaster and need to hook up the android system to some outside electronics.
  • Professional projects where you are considering building an Android based product, be it a phone, a tablet, music player etc.
  • Anyone else who wants to explore the full capabilities of Android and understand the platform without the limitations of the emulator or set hardware design of a phone.

Dev boards are probably not the way to go for:

  • Getting a basic understanding of how to build and run the Android source code. The open source project and the emulator are more than sufficient for that.
  • Application development work. The SDK and existing phones are perfect for that and saves you a lot of hassle with jumpers, adb bridging and so on.

Factors to consider

Now let us say that you are still interested in working with Android on a development board. Then we get to the interesting part on deciding on which one to get. Here I would say there are a few important factors to consider:

  • Purpose - what to you plan to do with the board
  • Price
  • Performance
  • Existing Android ports for the board
  • Community
  • Debugging utilities
  • Expansion possibilities

All of these are important but do not underestimate the power of having an active community around your platform that can help you out if you run into problems. Start by looking at the above factors and note down your requirements in each aspect. And do not forget to take into account other things that I have left out in this bullet list. Once you have some idea of what you need we can start looking at what is available. And that is becoming quite a lot.

Let me start by grouping the different boards into a few categories. And here I will add in a limitation. I will mostly consider ARM-based dev boards since this is the architecture with the widest Android adoption so far and almost all commercial devices shipped so far are based on ARM. That said there is a very active community around Android on x86 and also MIPS ports. And probably a few more. The most prominent feature of any dev board is the applications processor and system on chip design that will run the actual Android system. Based on that I will use the following categories for ARM based designs:
  • State of the art - these are dev boards with high performance system on chips that are often prototypes of platforms that are not even available in commercial products yet.
  • High end, these are dev boards with an applications processor that matches the high end Android phones that are available today.
  • Mid and low end - these are either boards with performance that matches early or low end Android phones.

State of the art development boards

These platforms are based  on dual-core Arm Cortex A9, 1 GHz plus, system on chips with graphics acceleration and other features. In this category I am only aware of a couple of platforms that can be obtained as development boards for general purposes. Two are based on the TI Omap 4 system on chip and can be ordered either as the cheap panda board or as the more full featured Blaze kit which include touch screens and keyboard. If you are based in North America it is also possible to get the Tegra 250 dev kit from Nvidia with similar specs. These boards are interesting since they have more processing power available than anything else on the market but they are also fairly new designs with limited community track record. They may be perfect for experienced embedded hobbyists that want to build a HTPC setup or similar. If you have very little experience working with embedded development it may be better to start out with something with a longer track record and more information available on forums, blogs and wikis. For professionals you need to consider if you really need this kind of processing power in your design. Maybe advanced 3D graphics and full HD video is not part of your use case and then maybe these types of platforms will eat more power and cause more issues with advanced features than they provide benefits.

High end development boards.

These are ARM Cortex A8 based designs similar to what is powering most of the high end Android smarthphones that are available today. In this category we have a number of SoC and a large amount of development boards based on these SoCs. To mention a few of the families we have the Freescale i.Mx 515, evolution dev kit and android tool and the Texas Instruments OMAP3, most notable the Beagle board and the Zoom II dev kit. Since these run on the same CPU family (ARM Cortex A8) as most of the commercially available Android phones do and have been around for a while they are often well tested and relatively stable. This is especially true of the Omap based Beagle board which features a large developer community. The Omap on the Beagle board is also very similar to the Omap that powers the popular Motorola Droid phone. There are a number of derivatives from the Beagle with more peripherals and expansion possibilities.

Mid and low end development boards.

This is a more unexplored area but with some interesting products. Android this far has been a lot about performance and most community boards have been higher end boards but as interest for using Android outside the smartphone space is increasing so is the number of low cost platforms with support for the system. These boards are generally based on ARM926 or ARM11 CPUs and have a limited set of accellerators and peripherals. Many dev boards in this category have too little memory to run Android (128 MB RAM is some kind of current minimum but more is even better). There are some Samsung boards, something from Renesas and once again probably a lot of others. The board that we have worked with in this category is from Atmel, the AT91SAM9M10-EKES borad. While their Android community is relatively young compared to the Beagle board Atmel has a tradition of having a thriving community around their at91 platforms in general.

Some practical details

Now that we are finally past the overview we can get to the practical details on working with development boards. If you are considering to get a develoment board for Android I would suggest that you try to download and build whatever Android distribution is availble for that board before you get the hardware. The state of the distribution will tell you a lot about how hard it will be to get the hardware working later on. If there is no Android distribution available for your hardware make sure that you are aware what the porting effort will be and also analyze that the hardware will even be capable of running Android in terms of performance and memory available.

Another thing to investigate is how you will boot and run Android on the dev board. Does it contain a NAND flash or SD card interface. Is it possible to set up a network file system and boot Android from that? Having working adb tools are also very nice when working on a dev board. It is much more convenient to update just your shared library through an adb sync instead of having to build, generate a system image and flash it to the board every time you need to test an update.
Regardless of what board you choose prepare to spend some time understanding how to boot it up with your Android build. Often they are delivered with some other software as default configuration. Prepare to spend a few hours up to a few days just to get familiar with boot and flash options. How to set the jumpers in the correct state to be able reflash the board etc.

Our experience

These are some impressions for three of the different boards that we have worked with so far.

Beagle board:
BeagleBoard in action
  • Very powerful board for the price tag.
  • Good community around Android and the Rowboat distribution on TI Omap
  • Well tested CPU for Android, very similar to the SoC powering the Motorola Droid and other devices
  • A lot of other Linux work happening on the Omap platform such as MeeGo
  • Decent debug support
  • Relatively easy to get started with and several boot options
  • No ethernet support in default configuration, has to be added via USB.
  • No touch screen or other peripherals included, not even power adapter
The Beagle board is a very powerful board for the price ($149) and if you connect to a regular monitor and keyboard it is a very capable development platform for low level work. We have run a number of projects on this platform ranging from initial demos and driver projects to advanced research stuff. The limitations made to keep the price down are a bit annoying and nowadays I would recommend getting the updated BeagleBoard xM version instead. That will add an ethernet port and more USB ports. There are also versions and derivatives that include screens etc.

Zoom II:
This is another OMAP based device but includes and the SoC is very similar to the BeagleBoard but it is packaged more like a real device with touch screen and keyboard.
  • Much more peripherals included compared to the Beagle
  • Portable device like package, good for demos
  • More expensive than the Beagle
This device is very similar to the Beagle board and shares the same attributes beyond the two things mentioned here.

Atmel AT91SAM9M10-EKES:
An Atmel boad with Android up and running
  • Includes touch screen directly on the board
  • Connection cables and power supply included
  • Good community around the at91 boards in general, emerging Android community
  • Based on relatively small and low cost ARM926 CPU
  • Good value for money for a relatively complete kit
  • Dev tools seem a bit Windows focused, it was a little bit tricky to get started from a Linux dev machine
  • Android support is relatively new for this platform, not as well tested as the Omap distributions
I think this is a really interesting dev kit. Especially when looking at developing things that do not have the high-end smartphone level of performance requirements. Since it includes a screen and decent amount of connections it can be used as a compact demo board. We got this relatively recently and will probably base our next demo on it. After some initial hickups with the tools it is straight forward to develop on and the support from Atmel and the community seems to be growing rapidly. We still need to do some benchmarking though and see how it handles Android compared to higher end alternatives.

I hope this article provides some insight on working with Android on development boards. With the amount of Android related news currently I am sure I have missed some capable platforms. Feel free to add whatever platform you are familiar with in the comments and I will update this post with more info. Once again I would like to remind you that I have skipped entire architectures such as x86, MIPS and PowerPC in this article.


Monday, October 4, 2010

Slides from the presentation on Security Concepts at Android Only

The slides from my presentation on Android Security Concepts held at the Android Only conference in Stockholm on September are now available. The video from the presentation will be available on the conference homepage in a couple of weeks.