Developing Android™ Applications for ARM® Cortex™-A8 Cores
By Darren Etheridge, Android Multimedia Engineering Manager, DSP and ARM Texas Instruments
The flexibility, power, versatility and ubiquity of the Android operating system (OS) and associated ecosystem have been a boon to developers of applications for ARM processor cores. Historically, Android has been widely deployed in mobile devices such as smartphones and tablets. Now though, as each new version of the environment adds more powerful features and support for new form factors, as well as more robust multimedia processing, Android is expanding beyond its origins and migrating into a wider array of applications and products. As a consequence, an increasing number of developers are educating themselves on Android, its many benefits and the challenges it may present. This paper discusses these issues and, in particular, focuses on developing Android-based systems for ARM Cortex-A8 processing cores.
The original developers of Android had it squarely targeted for mobile handsets. Two years after development began in 2003, the entire effort was acquired by Google, Inc. Android is based on the open-source Linux™ kernel and to this day retains many of the characteristics of open-source software, although Google’s acquisition of Android transformed it into a hybrid, somewhere between a commercial OS and an open-source OS. Like open-source software, Android is license-free. Unlike open-source software such as the Linux General Public License (GPL) and its so-called "copyleft" provision, proprietary code developed for Android is protected from claims by the open-source community.
Android is similar to commercial OSs as its specification is controlled by one company, namely Google. As a result, Google is able to define the middleware, multimedia frameworks and key system firmware associated with the OS. This differs from open-source OSs like Linux where developers must integrate these capabilities into the open-source kernel. Avoiding this integration process certainly saves development time and effort, but it comes with a price in terms of flexibility. Android is essentially pre-configured with a powerful set of capabilities defined by Google.
In 2007, the Open Handset Alliance was formed to foster the development of open standards for mobile devices. Its first standard was Android. The Alliance is an industry consortium of many companies, including Google, Texas Instruments Incorporated (TI) and others. The Android Open Source Project (AOSP) was also formed and is led by Google. AOSP is responsible for the maintenance and development of Android, as well as making Android available to the development community through its repositories.
Since its introduction, the growth of the Android ecosystem has been explosive. The number of Android applications for smartphones has exceeded 400,000 (as of October 2011), surpassing that of the closest competing smartphone OSs. In addition, Google has committed to relatively frequent major releases of Android and a roadmap for the future. Android 4.0 (Ice Cream Sandwich) was the latest release of the operating system, which merged the smartphone and tablet forks of the operating system into a single version.
Android™ and ARM®
Android has been developed and specifically optimized for ARM microprocessor cores. In particular, Android systems function well on ARM Cortex™-Ax cores, including ARM Cortex-A8 offerings, which incorporate the functionality of a netbook class CPU for embedded systems. Low power consumption also makes ARM cores a natural fit for mobile embedded systems, where Android is deployed extensively. ARMv7 devices such as the ARM Cortex-A8 include an ARM Advanced SIMD technology known as Neon, which can be used to accelerate many operations such as codecs or graphics pixel manipulations and can typically improve performance over straight ARM or THUMB® code significantly. All TI devices include the Neon Advanced SIMD engine.
Another ARM core, the ARM9, has been deployed in many embedded systems, but Android has not been optimized for the ARM9. Although Android can be ported to and function on an ARM9 core, performance will lag that of the ARM Cortex-A8 cores.
With the extensive market share it has achieved in the mobile market as a launching pad, Android has begun to migrate to other related markets where many of its strengths can be applied, as well. From the perspective of end-user devices, those closely related to smartphones would seem to be a logical next step for Android and, indeed, this migration is happening. Android has attracted the interest of developers working on tablets, thin-client PCs, wireless video conferencing systems and even Internet television sets for Google TV. Beyond these applications, the Android environment is flexible enough that it can be evaluated or is already being applied to several more unusual types of applications such as rugged personal digital assistants (PDA), smart home appliances, medical diagnostic user interfaces and even industrial systems.
Figure 1. The migration of Android across TI’s processor platforms.
From a functional perspective, most of these applications share several basic aspects:
- They all place particular importance on multimedia content
- They typically feature a robust, graphically-oriented and intuitive touch-based user interface
- There is usually a communications component related to the application
Not coincidentally, these are some of the strengths of the Android™ environment.
Developers who are contemplating migrating an existing application to the Android environment should be aware of the differences between the Linux™ and Android. There are functional equivalents between Linux and Android for all of the underlying capabilities like multimedia processing, file system calls, codecs, driver patches and other software modules, but these modules are not the same. Despite the fact that Android is built around a modified Linux kernel, some re-coding will be required when moving an application from Linux to Android.
For developers, Android offers two programming language options, Java and C/C++. Java development utilizes the Android software development kit (SDK) and the Dalvik virtual machine optimized for mobile devices. Developing in C/C++ makes use of the Android Native Development Kit (NDK). Java has the advantage that the same code will run anywhere that supports Java. Coding in C/C++ with the NDK will limit the code to a particular CPU architecture, but since Android devices are by and large ARM-based, this is not a severe limitation. This is a much bigger problem for x86 vendors that want to take advantage of Android. The Java-only apps run without modification, but if an app requires some NDK code that was developed for the ARM (i.e., some Neon optimizations), it will need manually porting to the x86 device.
A complete emulation environment for Android is available to assist developers in evaluating the OS, its capabilities and whether it would be appropriate for a certain application. The emulation environment even enables the developer to build their app even before they have physical hardware. The emulation environment can be downloaded from http://developer.android.com/sdk and run on a standard personal computer (Apple MAC, Linux and Windows®).
The popular Eclipse integrated development environment (IDE) features an Android Development Tools (ADT) plug-in from Google. Eclipse is a powerful development environment with a host of tools for quickly setting up a project, developing an application user interface (UI), adding components based on the Android Framework Application Programming Interface (API), debugging code with tools from the Android SDK and exporting completed code.
Code Composer Studio™ IDE from TI is based on and extends Eclipse with advanced embedded debug capabilities such as Linux Aware Debug, hardware debugging, simulation, profiling and others. By implementing Code Composer Studio IDE and the ADT plug-in, developers are able to debug Android Java and C/C++ Developing code, the Linux kernel, code for a digital signal processor (DSP) and other aspects of an application all within the same IDE environment. The Code Composer Studio™ IDE/ADT environment will also debug code running on the Android™ emulator.
Figure 2. Debugging Android with TI’s Code Composer Studio IDE v. 5
Other development aids are also available. For example, TI has established an Android community at www.arowboat.org for users of its Sitara™ ARM® processor, DaVinci™ video processor, C6000™ DSP+ARM processor platforms and TI-based development boards, such as BeagleBoard, PandaBoard and CraneBoard. The site features extensive resources, including free open-source projects such as drivers, bug fixes and patches, online forums, real-time chat capabilities or Internet Relay Chat (IRC), how-to documentation, informative links and much more. www.arowboat.org is a true open-source community with much of the risk removed. Users can submit their code modules for inclusion on the site but all submissions are verified before being committed to the repository and are formally tested by the TI quality assurance team before an Android Development Kit release is made available from www.ti.com. TI has a broad ecosystem of third-party software developers, such as Mentor Graphics, that also support www.arowboat.org.
Since most Android systems feature robust multimedia applications, developers typically pay particular attention to how video, audio and graphics are processed by the system. Many of the multimedia codecs (encoders/ decoders) that are pre-configured with Android are typically low-resolution/low-bit-rate codecs since many of them are targeted for ARM Cortex™-A8 general-purpose cores. Some platforms, such as TI’s OMAP™ mobile applications processors, DaVinci video processors and C6000 DSP+ARM processors, combine ARM Cortex-based cores and DSP processing cores. For multimedia processing, this can be particularly advantageous because the DSP core can offload processing tasks from the ARM® core and accelerate multimedia processing beyond the capabilities of the ARM core. For example, TI’s platforms can currently support the most advanced high-definition video codec, H.264, which is capable of the same 1080p HD resolution as seen on large-screen LCD displays.
Figure 3. AM/DM37x Android solution (Multimedia – Gingerbread)
Android™ Comes of Age
The momentum behind Android grows daily. According to the market research firm Gartner, sales of Androidbased smartphones grew to more than half of total industry sales during the third quarter of 2011. A market share study by Gartner found that Android smartphones accounted for 52.5 percent of smartphone sales to end users, more than doubling its market share from the third quarter of 2010 (“Market Share: Mobile Communication Devices by Region and Country, 3Q11). TI’s OMAP™ processors provide a best-in-class foundation for Android designs in the mobile market today. In fact, TI’s OMAP4460 processor was selected as the platform for Android 4.0 development. But the mobile market is not the only space in which Android is fast expanding, which is why all TI platforms – OMAP, Sitara™ ARM processors, DaVinci™ video processors and C6000™ DSP+ARM processors – are moving into many other spaces outside mobile devices.
As the smartphone effect becomes prevalent in everyday life, consumers desire a similar interface in products such as home automation, portable navigation, white goods and handheld education and gaming devices. Android lends itself to these non-smartphone applications and devices because of the flexibility that has been built into the system. In addition building it on top of a Linux™ kernel meant that it was not difficult for silicon vendors to enable Android on their platforms as Linux is a defacto standard.
If it meant porting a whole new operating system, it likely would not have found its way into so many different devices. Once you have the Linux kernel ported, it is a fairly quick task to get the rest of the Android system in place and then you can immediately take advantage of a huge percentage of the available Android apps that are available in the community. This is a huge benefit to many devices where in the past it would have meant that a complete suite of software would need to be created or at a minimum integrated/ported to the device. Now the job is done by the silicon vendor of porting Android™ to a device, and once this has been done it is simply a case of selecting which Android apps to include and possibly customizing the UI with desired branding.
This is why Android devices are starting to appear that go beyond the smartphone into areas such as e-readers, tablets, thin client devices, video conferencing solutions, televisions, media players, white goods, electronic point-of-sale solutions, digital still cameras and so much more. This list will just continue to grow as device manufacturers continue to dream up new ways to use the Android platform and its associated ecosystem. Now many of connected users are even receiving tweets on our wrist watches running on Android. Only the imagination knows what is next. The future is truly bright for this technology, and TI is working to deliver these new devices of the future.
For more information on TI’s ARM devices, click here. For Android support on TI devices, visit TI’s Android E2E forum: http://e2e.ti.com/support/embedded/android/default.aspx