3.1 Processor Architectures
Linux runs on a large number of architectures, but not all these architectures are actually used in embedded configurations, as I said above. The following discussion looks at each architecture in terms of the support provided by Linux to the CPUs belonging to that architecture and the boards built around those CPUs. It also covers the intricacies of Linux's support and any possible caveats. I will not cover the MMU-less architectures supported by uClinux, however. Though the code maintained by this project has been integrated late in the 2.5 development series, it remains that the development of the uClinux branch and the surrounding software has its own particularities. If you are interested in an MMU-less architecture to run Linux, you are invited to take a closer look at the uClinux project web site at http://www.uclinux.org/. uClinux currently supports Motorola MMU-less 68K processors, MMU-less ARM, Intel's i960, Axis' Etrax, and other such processors.
The x86 family starts with the 386 introduced by Intel in 1985 and goes on to include all the descendants of this processor, including the 486 and the Pentium family, along with compatible processors by other vendors such as AMD and National Semiconductor. Intel remains, though, the main reference in regards to the x86 family and is still the largest distributor of processors of this family. Lately, a new trend is to group traditional PC functionality with a CPU core from one of the 386 family processors to form a System-on-Chip (SoC). National Semiconductor's Geode family and ZF Micro Devices' ZFx86 are part of this SoC trend.
Although the x86 is the most popular and most publicized platform to run Linux, it represents a small fraction of the traditional embedded systems market. In most cases, designers prefer ARM, MIPS, and PowerPC processors to the i386 for reasons of complexity and overall cost.
That said, the i386 remains the most widely used and tested Linux platform. Thus, it profits from the largest base of software available for Linux. Many applications and add-ons start their lives on the i386 before being ported to the other architectures supported by Linux. The kernel itself was in fact written for the i386 first before being ported to any other architecture.
Since most, if not all, i386 embedded systems are very similar, or identical to the workstation and server counterparts in terms of functionality and programmability, the kernel makes little or no difference between the various x86 CPUs and related boards. When needed, a few #ifdef statements are used to accommodate the peculiarities of a certain CPU or board, but these are rare.
The i386-based PC architecture is the most widely documented architecture around. There are many different books and online documents in many languages discussing the intricacies of this architecture. This is in addition to the documents available from the various processor vendors, some of which are very complete. To get an idea of the scope of the existing documentation, try searching for "pc architecture" in the book section of Amazon.com. It would be hard to recommend a single source of information regarding the i386 and PC architecture. Intel Architecture Software Developer's Manual, Volume 1: Basic Architecture, Volume 2: Instruction Set Reference, and Volume 3: System Programming Guide published by Intel are traditionally rich sources of information about how to program the i386s, albeit limited to Intel's products. The availability of these documents may vary. At some point, hardcopies were not available from Intel's literature center. During that time, however, the documents were available in PDF format online. At the time of this writing, the manuals are available in hardcopy from Intel's literature center.
Regarding the PC architecture itself, a source I've found useful over time is a package of DOS shareware called HelpPC, which contains a number of documents describing the intricacies and operations of various components of the PC architecture. Another useful manual with similar information is The PC Handbook by John Choisser and John Foster (Annabooks). Note that your particular setup's technical configuration may differ slightly from the information provided by the various sources. Refer to your hardware's documentation for exact information.
The ARM, which stands for Advanced RISC Machine, is a family of processors maintained and promoted by ARM Holdings Ltd. Contrary to other chip manufacturers such as IBM, Motorola, and Intel, ARM Holdings does not manufacture its own processors. Instead, ARM designs the CPU cores for its customers based on the ARM core, charges customers licensing fees on the design, and lets them manufacture the chip wherever they see fit. This offers various advantages to the parties involved, but it does create a certain confusion to the developer approaching this architecture for the first time, as there does not seem to be a central producer of ARM chips on the market. There is, though, one unifying characteristic that is important to remember: all ARM processors share the same ARM instruction set, which makes all variants fully software compatible. This doesn't mean that all ARM CPUs and boards can be programmed and set up in the same way, only that the assembly language and resulting binary codes are identical for all ARM processors. Currently, ARM CPUs are manufactured by Intel, Toshiba, Samsung, and many others. The ARM architecture is very popular in many fields of application and there are hundreds of vendors providing products and services around it.
At the time of this writing, Linux supports 10 distinct ARM CPUs, 16 different platforms, and more than 200 related boards. Given the quantity and variety of information involved, I refer you to the complete and up-to-date list of ARM systems supported and their details at http://www.arm.linux.org.uk/developer/machines/. Suffice it to say that Linux supports most mainstream CPUs and boards, such as Intel's SA1110 StrongARM CPUs and Assabet development boards. In case you need it, there is a method to add support for new hardware. Generally, for any information regarding the Linux ARM port, consult the project's web site at http://www.arm.linux.org.uk/.
In addition to the kernel port to the ARM, many projects have geared up for ARM support. First, hard real-time support is available from the RTAI project and a StrongARM RTLinux port is available at http://www.imec.be/rtlinux/. In addition, Java support is available from the Blackdown project. There is however no kernel debugger, since most developers who need to debug the kernel on an ARM system use a JTAG debugger.
For any information regarding the ARM architecture and its instruction set, consult the ARM Architecture Reference Manual edited by David Seal (Addison Wesley), and Steve Furber's ARM System-on-Chip Architecture (Addison Wesley). Contrary to other vendors, ARM does not provide free manuals for its chips. These are the only reference manuals currently available for the ARM. Although the ARM Architecture Reference Manual isn't as mature as technical documentation provided by other processor vendors, it is sufficient for the task. Because individual chip manufacturers are responsible for developing the chips, they provide specific information such as timing and mechanical data regarding their own products. Intel, for example, provides online access to manuals for its StrongARM implementation.
3.1.3 IBM/Motorola PowerPC
The PowerPC architecture is the result of a collaboration between IBM, Motorola, and Apple. It inherited ideas from work done by the three firms, especially IBM's Performance Optimization With Enhanced RISC (POWER) architecture, which still exists. The PowerPC is mostly known for its use in Apple's Macs, but there are other PowerPC-based workstations from IBM and other vendors as well as PowerPC-based embedded systems. The popular TiVo system, for instance, is based on an embedded PowerPC processor.
Along with the i386 and the ARM, the PowerPC (PPC) is a very well supported architecture in Linux. This level of support can be partly seen by looking at the large number of PPC CPUs and systems on which Linux runs.
To provide compatibility with the various PPC hardware, each type of PPC architecture has its own low-level functions grouped in files designated by architecture. There are such files, for example, for CHRP, Gemini, and PReP machines. Their names reflect the architectures, such as chrp_pci.c or gemini_pci.c. In a similar fashion, the kernel accounts for the embedded versions of the PPC, such as IBM's 4xx series and Motorola's 8xx series.
In addition, a great number of applications that run on the i386 are available for the PPC. Both RTLinux and RTAI, for instance, support the PPC. There is also support for Java, and OpenOffice has been ported to the PPC. The PPC Linux community is active in many areas of development ranging from workstation to embedded systems. The main PPC Linux site is http://penguinppc.org/. This site is maintained by community members and is not affiliated with any particular vendor. It contains valuable documentation and links and should be considered the starting point for any Linux development on the PPC. There is also http://www.linuxppc.org/, which is affiliated with the LinuxPPC distribution. This site was the initial home of the efforts to port Linux to to the PPC. While I'm discussing distributions, it is worth noting that there are a number that support the PPC, some exclusively. LinuxPPC and Yellow Dog Linux, for example, provide Linux only for PPC machines. There are also traditional mainstream distributions that provide support for the PPC as part of their support for other architectures. These include Mandrake, Debian, and SuSE.
If you intend to use the PPC in your embedded application and want to be in touch with other folks using this architecture in their systems, be sure to subscribe to the very active linuxppc-embedded list. Most problems are recurring, so there is probably someone on that list that has had your problem before. If not, many people will be interested to see your problem solved, as they may encounter it, too. The list is hosted on linuxppc.org, which hosts many other PPC-related lists.
Early on, the companies behind the PPC agreed upon a standard system architecture for developing boards based on the chip. This was initially provided through the PowerPC Reference Platform (PReP), which was eventually replaced by the Common Hardware Reference Platform (CHRP). Documentation on CHRP is available in the book entitled PowerPC Microprocessor Common Hardware Reference Platform: A System Architecture guide (Morgan Kaufmann Publishers), available online at http://www.rs6000.ibm.com/resource/technology/chrp/. Documentation on the 32-bit versions of the PowerPC is available from both IBM and Motorola through a manual entitled PowerPC Microprocessor Family: Programming Environments for 32-bit Microprocessors. This manual is available online in the technical documentation sections of both companies' web sites and in hardcopy for free from Motorola through the literature center section of its web site.
The MIPS is the brain child of John Hennessey, mostly known by computer science students all over the world for his books on computer architecture written with David Patterson, and is the result of the Stanford Microprocessor without Interlocked Pipeline Stages project (MIPS). MIPS is famed for having been the basis of the workstations and servers sold by SGI and of gaming consoles such as Nintendo's 64-bit system and Sony Playstations 1 and 2. But it is also found in many embedded systems. Much like the ARM, the company steering MIPS, MIPS Technologies Inc., licenses CPU cores to third parties. Unlike the ARM, however, there are many instruction set implementations, which differ from each other to various degrees. 32-bit MIPS implementations are available from IDT, Toshiba, Alchemy, and LSI. 64-bit implementations are available from IDT, LSI, NEC, QED, SandCraft, and Toshiba.
The initial port of Linux to MIPS was mainly done to support MIPS-based workstations. Eventually, the port also came to include development boards and embedded systems based on MIPS. To accommodate the various CPUs and systems built around them, the layout of the MIPS portion of the kernel is divided into directories based on the type of system the kernel will run on. Similarly, kernel configuration for a given MIPS system is mainly influenced by the type of board being used. The actual type of MIPS chip on the board is much less important.
Looking around, you will find that support for Linux on MIPS is limited when compared to other architectures such as the i386 or the PowerPC. In fact, few of the main distributions have actually been ported to MIPS. When available, commercial vendor support for MIPS is mostly limited to embedded architectures. Nevertheless, there is a Debian port to both big endian and little endian MIPS, and a port of Red Hat 7.1 is also available. Also, many PDA and development board manufacturers actively support Linux ports on their MIPS-based hardware. As with some other ports, MIPS lacks proper Java support. Hard real-time support is however available for some MIPS boards from the RTAI project.
In addition to conventional MIPS-based machines, an entirely different set of processors is based on NEC's VR chips for the purpose of running WindowsCE. A number of developers were interested in having Linux running on these devices, and hence started new projects for the purpose. These projects have advanced rapidly and have come to occupy a large portion of the Linux-on-MIPS development.
For more information regarding the MIPS port of Linux in general, take a look at the official home of the Linux MIPS port at http://www.linux-mips.org/. The web site contains a list of supported systems, documentation, links, and other useful resources. For information on the VR and other PDA-related efforts on MIPS, check out the Linux VR page at http://linux-vr.org/. If you're looking into working with Linux on MIPS, I suggest you take a look at both sites. There are also commercial embedded distributions that provide extensive support for some MIPS boards. Depending on the board you choose and your development model, that may be a practical way to get Linux up and running on a MIPS system.
Because MIPS is divided into multiple platforms, you will need to refer to the data provided by your system's manufacturer to evaluate and/or implement Linux support. One general resource that is recommended on MIPS Technologies Inc.'s own web site is See MIPS run by Dominic Sweetman (Morgan Kaufmann Publishers). You can also get PDFs on MIPS's web site. MIPS provides 32- and 64-bit editions of their MIPS Architecture for Programmers three volume series, made up of Volume I: Introduction to the MIPS Architecture, Volume II: The MIPS instruction set, and Volume III: The MIPS Privileged Resource Architecture.
3.1.5 Hitachi SuperH
In an effort to enhance its 8- and 16-bit H8 line of microcontrollers, Hitachi introduced the SuperH line of processors. These manipulate 32-bit data internally and offer various external bus widths. Later, Hitachi formed SuperH Inc. with STMicroelectronics (formerly SGS-Thomson Microelectronics). SuperH Inc. licenses and heads the SuperH much the same way ARM Holdings Ltd. steers the ARM and MIPS Technologies Inc. steers the MIPS. The early implementations of the SuperH, such as the SH-1, SH-2, and their variants, did not have an MMU. Starting with the SH-3, however, all SuperH processors include an MMU. The SuperH is used within Hitachi's own products, in many consumer-oriented embedded systems such as PDAs, and the Sega Saturn and Dreamcast game consoles.
As the early SuperH (SH) processors did not include MMUs, they are not supported by Linux. Currently, both the SH-3 and SH-4 are supported by Linux. However, not all SH-3 and SH-4 systems are supported by Linux, as there are many variations with various capabilities. Linux supports the 7707, 7708, and 7709 SH-3 processors and the 7750, 7751, and ST40 SH-4 processors. Accordingly, Linux supports a number of systems that use these processors, including the Sega Dreamcast. Although discontinued, this system is a great platform to practice with to become familiar with non-i386 embedded Linux systems. An SH-5 port is also in the works, though it is not yet part of the main kernel tree. For more information on this port, visit the project's web site at http://www.superh-software.com/linux/.
Support for the SH outside the kernel is rather limited for the moment. There is no support for Java, for instance, although the architecture has a kernel debugger. There is also an RTLinux port to the SH-4 created by Masahiro Abe of A&D Co. Ltd., but this port is not part of the main Open RTLinux distributed by FSMLabs. The port can be found at ftp://ftp.aandd.co.jp/pub/linuxsh/rtlinux/current/. There are no SH distributions either. There are, however, many developers actively working to increase the level of support provided for this architecture by Linux, including a Debian port. Accordingly, there are a number of web sites that host Linux SH-related documentation, resources, and software. The two main ones are http://linuxsh.sourceforge.net/ and http://www.m17n.org/linux-sh/.
As there is no standard SH architecture, you will need to refer to your hardware's documentation for details about the layout and functionality of the hardware. There are, nonetheless, manuals that describe the operations and instruction set of the various processors. The SH-3's operation is described in Hitachi SuperH RISC engine SH-3/SH-3E/SH3-DSP Programming Manual, and the SH-4's operation is described in SuperH RISC engine SH-4 Programming Manual. Both resources are available through Hitachi's web site.
3.1.6 Motorola 68000
The Motorola 68000 family is known in Linux jargon as m68k and has been supported in its MMU-equipped varieties for quite some time, and in its MMU-less varieties starting with the 2.5 development series. The m68k came in second only to the x86 as a popular 1980s architecture. Apart from being used in many popular mainstream systems by Atari, Apple, and Amiga, and in popular workstation systems by HP, Sun, and Apollo, the m68k was also a platform of choice for embedded systems development. Recently, though, interest has drifted away from the m68k to newer architectures such as ARM, MIPS, SH, and PowerPC for embedded systems design.
Linux supports many systems based on the m68k, starting with the mainstream and workstation systems already mentioned and including VME systems from Motorola and BVM. Because these systems are completely different from each other, the kernel tree is built to accommodate the variations and facilitate the addition of other m68k-based systems. Each system has its own set of specific modules to interface with the hardware. An example of this is the interrupt vector tables and related handling functions. Each system has a different way of dealing with these, and the kernel source reflects this difference by having a different set of functions to deal with interrupt setup and handling for each type of system.
Since the MMU versions of the m68k are seldom used nowadays in new, cutting-edge designs, they lag behind in terms of software support. There is, for instance, no hard real-time support and no Java support. Nor is the processor architecture listed among supported architectures for other user-level applications such as OpenOffice. For up-to-date information regarding the port, the supported hardware, and related resources, refer to the m68k Linux port homepage at http://www.linux-m68k.org/. One distribution that has done a lot work for the m68k is Debian. Check out their documentation and mailing lists if you plan to deploy an m68k-based embedded Linux system.
Since there is no standard m68k-based platform such as the PC for the i386, there is no single reference covering all m68k-based systems. There are, however, many textbooks and online resources that discuss the traditional use of the m68k and its programming. Motorola provides the 68000 Family Programmer's Reference Manual and the M68000 8-/16-/32-Bit Microprocessors User's Manual free through its literature center. Other, more elaborate, texts that include examples and applications can be found by looking for "68000" on any online bookstore.