Adventures in embedded software.
Now available under the GPL. As of September 12, 2004, "namespace hell" as my "friends" call it, is released and can be downloaded from here. For more information see OSCL.
The Open Source Class Library (OSCL) is a collection of source code designed with reuse as a primary goal. The components found in this library generally fall into one of these three catagories.
- Device Drivers
FrameworksFrameworks are collections of source code that solve common architectural problems in a general way. Important frameworks include:
The Multi-Threading (MT) framework promotes a specific message passing paradigm particularly useful in the implementation of the reactive (i.e. event-driven) systems common in the embedded software universe. The MT framework, originally developed for OOOS, has been implemented under eCos, VxWorks, and pthreads. Since it is based on a small set of abstractions, it is likely easily ported to any RTOS. The result is the ability to create complex multi-threaded components that are independent of operating environment.
- Inter-Thread Communications
- Dynamic Services
- Dynamic Bus Service
The Inter-Thread Communications (ITC) framework is built upon the MT framework. It supports the notion of an embedded application being built from layers of interacting clients and servers that communicate and synchronize through message passing. This allows components to be built that are independent from the temporal point-of-view as well as the procedural. This concept is similar the relationships between electronic components. Applications using this framework can scale well in symetric multi-processor (SMP) environments, when increased performance becomes necessary.
The Dynamic Services framework provides a consistent means for handling services that are created and destroyed during the operation of the system. Examples include dynamic bus enumeration like those used by the USB and PCI bus specifications. Dynamic services are particularly important in telecom and other modular embedded systems that must support "plug-and-play" operation as replaceable "circuit-packs" are inserted and removed from the system for maintenance and reconfiguration without affecting the overall operation of the system.
The Dyamic Bus Service frameworks are desgned to provide an architecture upon which custom device/function drivers can be implemented. The frameworks are layered such that various bus interface hardware (e.g. PCI Host-Bridge, USB-Host Controller) can be used without disrupting the upper level drivers.
Device DriversDevice drivers expose the functionality of a particular hardware device to applications that use the device. The device drivers contained in the OSCL are layered into two parts. The lowest layer part creates a software interface to the "registers" and data-structures defined by the device. Upper layer drivers use the multi-threading framework to create "servers" that are generally available to the larger application. Device drivers are currently available for the following devices at some level.
- MPC8xx PowerQuicc
- QSPAN PCI Host Bridge
- MC68168 Ethernet PHY
- USB OHCI Host Controller
BENV is a build environment for GNU/Linux, developed and organized to support two goals:
If you know the quest, then you'll understand the need for the first item. If you've ever spent a large part of your career maintaining the files needed to build your software rather than work on the software itself, then you'll understand the motivation for the second item.
BENV is not for every-one. It is an environment originally designed for developing statically linked applications in C/C++ using GNU tools. In more recent times, it has been used to produce dynamic/shared libraries and other artifacts as well, but generally that doesn't really "scratch my itch".
BENV prescribes an organizational structure that enables the source code components in the repository to be reused across multiple projects. Used in conjunction with a good configuration management tool (e.g. Perforce), BENV is designed to support development teams and scales well in a multi-user development environment.
BENV is designed to meet the following needs that are especially pertinent to embedded software development:
KRUX (formerly known as OOOS) was been designed to support my notions of proper layering for a Real Time Operating System (RTOS). With the exception of a small amount of processor specific assembly language, the kernel is written entirely in C++ using object oriented principles. KRUX has been ported to the CPU32, MPC8xx and H8/300 processor families.
Some years ago I found a freeware 68K instruction set simulator on the 'net that was someone's school project. I have since fixed many bugs and made some major enhancements. The enhancements include a framework for writting hardware device simulation , support for the CPU32 instruction set, and an interface that emulates the ESTC (WindRiver) command line interface so that GDB can be used to debug programs running on the simulator as with a BDM ICE. At one job I had several years ago, we ran VxWorks on this simulator to develop application software before the 68360 based hardware was completed. Although writing the hardware device simulations is not easy, when complete, the driver software is the same for the simulated hardware as it is for the real hardware.
Currently implemented are the hardware simulations for the M2681 Duart, a Siemens SAB82526 HDLC controller, and a simple periodic real-time interrupt source.
One of my goals is to express and justify my myriad opinions on the subject of embedded software design. I call this my Hypothesis project. It is at best incoherent and incomplete, but if you want to know what kind of lunatic I really am, this is the place to start ;-)