An MP3 player that is among the first designs based on Cirrus Logic's Maveric EP7212 processor has been built by Red Hat Software, Mojo Designs and Cirrus Logic. The three teamed up to use a combination of open-source operating system and graphical-user-interface tools with a proprietary graphical-interface library. They gave the player a small-footprint LCD touch screen as well as familiar icons for stopping, rewinding, fast-forwarding and playing music, and a simple address book and to-do list manager as well as an "About" screen that describes its various software and hardware components.
The player was built using the Red Hat GNUPro development kit, DSP library and eCos real-time operating system (RTOS). It employs the latest version of Mojo Designs' Eyele GUI, a graphical-interface library developed from the ground up for low-cost, high-performance embedded systems.
Red Hat's products were the obvious choice for the player's core software components. The first reason was that Red Hat was one of only a handful of vendors ready to support the sophisticated Cirrus EP7212 chip when the project began.
Though they were still being developed at the beginning of the project, it was found that GNUPro, the DSP library and eCos RTOS already were the answer. In particular, eCos' extensive list of configuration points allows it to be precisely tailored to the target application without source code modification.
Using these configuration points, Mojo developers tuned and retuned the RTOS features they needed most and completely removed features they didn't need at all. The results speak for themselves: The eCos kernel and device drivers occupy only 50 kbytes of RAM in the application's 400-kbyte footprint.
Because it is so similar to the approach used in popular desktop operating systems like Linux, eCos' driver interface makes it possible for code that needs device I/O to be tested on the desktop, using simulated driver stubs or PC versions of the devices, before target hardware is available. Likewise, the "synthetic" target included with eCos allows an entire application, including the eCos kernel, to run as a Linux executable. As a result, tests involving interthread communications and other kernel features work exactly the same in simulation under Linux-except for the real-time aspects, because Linux lacks these capabilities-as they will on the target system. Mojo made the most of these features by using them to develop and test the bulk of the MP3 system earlier in the development cycle than previously possible.
Meanwhile, eCos' adherence to a conventional driver interface also improves opportunities for code reuse across development efforts. As proof, Mojo's engineers were able to use Red Hat-supplied audio and flash memory drivers, two examples of the kinds of software that is notoriously difficult to reuse across projects, without modification.
In many systems, conventional device interfaces like the one found in eCos reduce interrupt performance. To address this concern, eCos implements a split interrupt-handling scheme that significantly reduces interrupt latency, to the point that the approach can still be employed in even the most time-critical embedded systems.
The split interrupt process works like this: An interrupt service routine invokes an eCos function that queues a specialized second function, called a deferred service routine (DSR). The interrupt service routine then exits as quickly as possible, leaving the bulk of the interrupt's work for the DSR. A few instructions later, the eCos scheduler initiates the DSR, which finishes servicing the interrupt. The work involved in servicing the interrupt is thus split in two.
Despite the apparent overhead, this level of cooperation between interrupts and the eCos kernel provides multiple benefits. First, it eliminates or reduces the size of critical sections in the kernel itself, which improves interrupt latency. Second, DSRs run under scheduler supervision, which means they can use many OS services that aren't available to interrupt service routines. And third, DSRs run with interrupts enabled, which means that additional interrupts can be serviced.
Almost all embedded-system developers encounter unexpected difficulties when trying to run code on prototype hardware for the first time. Even after seemingly endless testing and preparation, the process of moving an embedded application from a simulation environment to the real target platform is never easy. In this case, the MP3 player application was running on the real hardware less than 24 hours after the boards arrived. The reason designers cited was the portability of eCos and Eyelet.
HAL enables portability
Essentially, the portability came from eCos' three-tiered hardware abstraction layer (HAL), which carefully encapsulates the platform, architecture and implementation portions of the code for each supported target.
As a result, ports between related processors are almost trivial: You simply copy and modify the source code for a similar platform and make minor adjustments to match the features of the new board.
Porting to an entirely new processor is a bit more involved, but still straightforward, because the eCos HAL is both clearly documented and intuitively designed. In fact, because the HAL design is so successful, several of eCos' supported platforms are actually contributions from members of the embedded-systems community, including members who lacked prior RTOS porting experience.
With migration to the target hardware successfully behind them, the MP3 player's developers turned to the power and flexibility of the GNUPro cross-development tools to get the project finished and ready for demonstration.
A GNUPro release isn't just a snapshot of the latest and greatest code from the Internet; before release, Red Hat runs several thousand automated test cases on actual target hardware to make sure that everything works properly before the GNUPro CD goes gold. Unlike the open-source GNU debugger, the GNUPro version includes eCos thread awareness and replaces gdb's command-line interface with a Tk-based graphical user interface more commonly known as Insight.
The only GUI that is completely integrated with gdb itself, Insight provides better performance and control over gdb functionality than any other GUI available today. In addition, Insight is the only GUI that runs equally well on both Microsoft Win32 and non-Microsoft hosts, in both hosted and cross-remote debugging environments.
Insight's portability was an essential feature for Mojo developers once they started running code on the real MP3 player hardware, because they tested code on both their NT workstations and on the actual player hardware whenever possible-sometimes switching back and forth several times a day.
Very few commercial debuggers support this diversity of operating conditions and even fewer accomplish it without making incompatible changes to support the two configurations. Insight, however, works the same in both hosted and cross-target environments. In fact, Insight's freely available source code is almost identical in both cases.The Red Hat developers used Linux hosts when assisting Mojo with debugging and other activities. However, because Insight and the other GNU tools are so portable, the incompatibility among the three different setups (NT, Linux and the EP7212) was never an issue.
One question developers often ask is, "Why buy a GNU distribution when I can download the tools for free?" The most obvious reason is support. The price of a GNUPro distribution includes assistance from developers with proven skills in GNU tool installation and use.
The second reason is quality assurance. Each GNUPro distribution undergoes a thorough automated test procedure before release, a process that involves thousands of individual test cases executed on real hardware (not simulations). This approach eliminates compatibility problems that often crop up when mixing and matching the latest releases downloaded from the Internet and makes sure that the tools will work as advertised immediately upon installation.
Then there is productivity. Building a complete GNU cross-development environment is a challenging task and isn't something that a new GNU user will accomplish overnight. In contrast, a GNUPro distribution comes ready for use for a fraction of the cost of the down time required to duplicate its contents. In short, GNUPro distributions are the cheapest, fastest way for serious developers to get GNU.