Linux on an ARM based Single Board Computer
GNU/Linux is fast becoming the de facto Operating System for embedded devices - mainly due to the efficient and portable design of the Linux kernel. The ARM Linux port effort, headed by Russell M. King, also makes life a bit easier for people who run (or want to run) Linux on their embedded devices.
The Armadillo 9 board is a small Single Board Computer the size of an floppy disk, marketed by Atmark Techno, Inc. Though it is small, it provides Compact Flash support, USB 2.0, LAN, and video output interfaces. Above all, the GNU cross development toolchain, Kernel (2.4 and 2.6 series) and Filesystem are already provided by the board vendors to reduce "product development time". Low power consumption and a small form factor (90.2 x 95.9 mm) makes it ideal for observation and monitoring devices, kiosk terminals, or, with a GPS module and proper software like 'gpsdrive', a Linux-based car navigation system.
Armadillo 9 specifications
The Armadillo 9 SBC contains:
- Cirrus Logic EP9315 200 MHz Processor
- 64 MB SDRAM
- 8 MB FLASH memory
- 10/100 Ethernet Controller
- RS232 Serial Interface
- JTAG interface for debugging and flash programming
- USB 2.0 type A connector
- Compact Flash interface
- 12 bit GPIO
- Video Output.Connector type: D-sub15 pin (mini)
- IDE Interface
Development Setup
The standard development setup should be similar to the one shown in this picture. The Linux box that I'm using runs a
Fedora Core 6 distro with all the standard hardware bells and whistles,
like a 1.6 GHz processor, 256 MB RAM, and an 80 GB HDD. The serial port
connector can be made by soldering two DB9 male connectors and some
commonly available wire.
(pin to pin connection) DB9 -1 DB9 - 2 2 <-> 3 3 <-> 2 5 <-> 5We'll use a serial communication program, 'minicom', to connect to the board. Let's connect the serial port of Armadillo board to our development machine using the serial cable. At the Bash prompt, enter
minicom -m -s /dev/ttyS0If you are using the first serial port in your machine (i.e., 'COM1:' in Windows), configure the minicom serial port setup as follows:
A - Serial Device : /dev/ttyS0 B - Lockfile Location : /var/lock C - Callin Program : D - Callout Program : E - Bps/Par/Bits : 115200 8N1 F - Hardware Flow Control : No G - Software Flow Control : NoNow, let's logon to the Armadillo board using the default username and password:
username: root password: root
Installing the GNU/Linux Toolchain and related software
One of the attractive features of the Armadillo 9 board is its support for the
GNU/Linux operating system: the GNU cross development environment for Armadillo is
available on the CD provided with the board. The latest version of the
toolchain is available at the atmark-techno website.
The Armadillo 9 gives us the choice of using RPM, DEB, or tar.gz packages
as sources for the toolchain. The following software is required for a
minimal development system for Armadillo 9:
binutils-arm-linux gcc-arm-linux libc6-arm-crosThese can be installed in the Linux box by issuing the following commands:
# For RPM based systems: "rpm -ivh software_name". E.g.: rpm -ivh binutils-arm-linux.rpm # For Debian/Ubuntu like systems: "dpkg -i software_name". E.g.: dpkg -i binutils-arm-linux.deb # For distro-independent installation from source: tar zxvf binutils-arm-linux.tar.gz cd binutils-arm-linux ./configure make make installOther software required for the Armadillo 9 development - e.g., shoehorn, hermit, etc. - will be installed in the development system using the same method.
Hello, Armadillo!
Once we have an Armadillo 9 board with "Linux inside", let's say "hello" to it by running the famous "Hello, world!" program (we'll call it "hello.c"):
#include <stdio.h> int main(){ printf("hello, world\n"); return 0; }We'll compile it using the cross compiler for Armadillo board:
arm-linux-gcc hello.c -o helloNow, let's run the 'file' command to see what the it has to say about 'hello':
file hello hello: ELF 32-bit LSB executable, ARM, version 1 (ARM), for GNU/Linux 2.2.0, dynamically linked (uses shared libs), for GNU/Linux 2.2.0, not strippedThe executable 'hello' can run on the Armadillo board as it is cross-compiled for the ARM architecture - so we need to upload the binary to the Armadillo board to run it. A number of methods - FTP, NFS, etc. - are available for this, but here I am going to use HTTP (via the 'wget' program).
First, start the Apache server on the host machine.
/etc/init.d/httpd startNow, copy the 'hello' binary to the DocumentRoot of Apache webserver.
cp hello /var/www/htmlNext, invoke minicom and log on to the Armadillo board. From the board, invoke the following command (192.168.0.1 is the IP address of my web server):
wget https://192.168.0.1/hello Connecting to 192.168.0.1[192.168.0.1]:80 hello 100% |*****************************| 9475 00:00 ETA # Give executable permission to 'hello' chmod +x hello # Now run it ./hello hello, worldIt works!
A Simple kernel module for Armadillo9
The latest kernel source can be obtained from the Armadillo site.
wget https://download.atmark-techno.com/armadillo-9/source/linux-2.6.12.3-a9-10.tar.gz #untar the source for compiling the kernel module tar zxvf linux-2.6.12.3-a9-10.tar.gz cd linux-2.6.12.3-a9-10 #now create a .config preconfigured for the armadillo 9 make armadillo9_defconfigNext, let's explore the kernel space with the help of a simple module, 'simple.c'.
#include <linux/kernel.h> #include <linux/module.h> int init_module(void){ printk("hello, armadillo!\n"); return 0; } void cleanup_module(void){ printk("bye, armadillo\n"); }and compile the module using this Makefile.
# On my machine, I keep the uncompressed Linux source at # /root/arm/linux-2.6.12.3-a9-10. Modify this for your setup. obj-m:=test.o all: make -C /root/arm/linux-2.6.12.3-a9-10 M=`pwd` modules clean: make -C /root/arm/linux-2.6.12.3-a9-10 M=`pwd` cleanAfter running make, we will have a "simple.ko" module in the directory. Now, let's follow the previous method to copy the module to the Armadillo board.
cp simple.ko /var/www/htmlUse 'minicom' to connect to the development board, and upload the module.
wget https://192.168.0.1/simple.ko # Insert the module using insmod insmod simple.ko # This will show 'simple' as one of the loaded modules lsmod # Unload the module rmmod simpleWe will see the "armadillo" messages at the end if we run the 'dmesg' command.
Moving further...
The possibilities are infinite in the ARM Linux world. One of the new trends in the Embedded Application Development is "Debootstrap". The Debootstrap lets a developer install a Debian-based distribution on the ARM board. If we have a Compact Flash disk with enough memory to run a minimal Debian distribution (a 256 MB or 512 MB CF Card is more than enough), then the application develpment for the Armadillo9 board becomes as easy as:
apt-get install applicationWe will explore more details of Debootstrapping the Armadillo 9 in the next part of this article.
References
Bootloader, kernel, and filesystem installation on the Armadillo 9 board is discussed in the Armadillo9 Software Manual.Armadillo9-specific information is available at the atmark-techno website.
The main source of information regarding ARM Linux is the ARM linux website.
Talkback: Discuss this article with The Answer Gang
I am an ardent fan of GNU/Linux from India. I admire the power,
stability and flexibility offered by Linux. I must thank my guru, Mr.
Pramode C. E., for introducing me to the fascinating world of Linux.
I have completed my Masters in Computer Applications from Govt.
Engineering College, Thrissur (Kerala, India) and am presently working at
Ushus Technologies, Thiruvananthapuram, India, as a Software Engineer.
In my spare time, you can find me fiddling with Free Software, free
diving into the depths of Ashtamudi Lake, and practicing Yoga. My other
areas of interest include Python, device drivers, and embedded
systems.