News Archive (1999-2012) | 2013-current at LinuxGizmos | Current Tech News Portal |    About   

Tutorial explores GNU ARM toolchain for Android

Jun 11, 2009 — by Eric Brown — from the LinuxDevices Archive — views

IBM DeveloperWorks has published an introductory tutorial on using the GNU ARM toolchain under Linux, using Android as the example. Author Bill Zimmerly provides an overview of the ARM architecture and toolchain, shows how to install the toolchain, and then describes how to write and test a simple ARM/Android program.

The GNU ARM toolchain is one of the most commonly used development toolkits for embedded Linux developers, writes Zimmerly. Describing the basics of the ARM architecture, he explains that recent ARM cores, such as the ARM11 core used in most current smartphones such as the Android-based HTC G1, or the more advanced ARM Cortex-A8 core, support two operational states. In the “ARM state,” the core executes 32-bit, word-aligned instructions, and in the “Thumb state”, which applies to ARM's older “Thumb” architecture, the core executes 16-bit, halfword-aligned instructions.

ARM mode leverages the maximum power and addressing range of the core, whereas Thumb mode can be more memory efficient, says Zimmerly. “Switching between the modes is a trivial exercise, and for many algorithms, the size of the code required can be reduced significantly,” he writes.

Zimmerly also discusses other aspects of ARM, including its “modified Harvard” architecture, in which the processor uses separate data and instruction caches, but with both feeding off of the same bus to access external memory. This architecture is said to improve performance, and also provides five-stage pipeline parallel processing for further performance improvements.

The tutorial goes on to discuss the GNU ARM toolchain, which allows developers to use their “favorite workstation environments and tools for designing, developing, and even testing on ARM simulators.” For his sample code, Zimmerly uses the “Lite” version of the CodeSourcery Sourcery G++ toolkit. He then walks through installation of the toolchain, and configuring it for Linux.

(Click for details)

Next, Zimmerly shows how to write a sample ARM program, and unlike most tutorials, he uses pure assembler. As intimidating as that may sound to an “introductory” audience, the program is quite simple — a basic “Hello World” program designed to run on the HTC/T-Mobile G1 phone (pictured) running Android Linux. The program, which he says is also applicable to other ARM-based Linux platforms, uses two standard Linux system calls: sys_write and sys_exit. The tutorial then shows how to test the program with the GDB debugger.

Zimmerly concludes with a call to ARM arms, so to speak: “There is a crying demand among mobile phone vendors for talented programmers. With ARM as prevalent as it is, there's plenty of work to be done–and it's fun work, too!”


Bill Zimmerly's IBM DeveloperWorks tutorial, “Install the GNU ARM toolchain under Linux,” may be found here.

For a good introductory look at the ARM family of processors, targeted at developers interested in the new ARM Cortex-A8-based iPhone 3G, but generally applicable, see the AppleInsider story, here.

This article was originally published on and has been donated to the open source community by QuinStreet Inc. Please visit for up-to-date news and articles about Linux and open source.

Comments are closed.