Embedded Computer/Software

The embedded computer comprised of a 300 MHz PC/104 standard board and a digital i/o card based on the HC12. This was chosen due to its small size, low power requirements, no movable parts such as fans or hard drives, and greater temperature tolerance. These criteria are crucial when operating in a manufacturing type environment. After receiving the embedded computer the first thing that needed to be done was the installation of an Operating System. There are many choices for an Embedded Operating System, Microsoft Windows CE, GNU/Linux, QNX, VxWorks, and pSOS being the most commonly used today. Due to choice of hardware, a driver for the i/o card was needed, which was only available for GNU/Linux and Windows CE. Windows CE needs licenses, which costs money. Windows CE needs a development kit, which costs 1000 dollars. Windows CE is closed source, which hampers integration with our code. Windows CE also does not have a web-server application which is crucial to our project. Apache can be ported to Windows CE but the process is in its infancy and hence unreliable. GNU/Linux on the other hand is an OSS/FS ( Open Source Software / Free Software ) which allows users the freedom to run the program(s) for any purpose, to study and modify the program(s), and to redistribute copies of either the original or modified program(s) without having to pay royalties to previous developers. GNU/Linux also has one of the smallest footprints for an operating system which is perfect for embedded applications. GNU/Linux is one of the most reliable, best performing, and flexible Operating Systems available. The choice was simple, GNU/Linux was the perfect match with its reliability, supportability, speed, small footprint, flexibility, and cost. Now that the Operating System was chosen the next step was to decide on an GNU/Linux distribution which is a pretty tough choice considering that there are more GNU/Linux distributions then GNU/Linux users. After doing extensive research, the choices were reduced to Redhat GNU/Linux, SuSe GNU/Linux, LFS GNU/Linux ( Linux From Scratch ), Gentoo GNU/Linux, and Debian GNU/Linux. For the comparison of all these distributions some features will have to be explained beforehand. Package management is an important feature of a distribution because in the OSS/FS world developers usually provide only the source code of their software. This source code is what is used to make the executable binary(ies). There are two options, download the source code and use a compiler like gcc to compile and install the software or download a binary package that was pre-compiled by someone else as an installable package. This package is basically a compressed archive of all the files generated by the compilation of the software's source code, instructions on where to put each file, and what other packages this package depends on. Packages can be compiled for different processor architectures like i386, i686, RISC, etc. and with different compiler optimizations. Once there are packages on the system dependencies come into play. Dependencies are requirements/conflicts resulting from software package installations. For example the Apache web-server package needs the glibc package and that package needs other packages etc. Dependencies can be handled well or poorly depending on the distributions package manager. Redhat and SuSe are rpm binary distributions, which means that they use rpm ( Redhat Package Manager ) for their software packaging. This is a disadvantage because rpm does not handle package dependencies well. The packages are compiled for the i386 standard, hence not optimized, so that they are compatible with most x86 architectures. Both distributions are also very bloated and require a lot of storage space with the default install. On the plus side both distributions are commercially used, have a lot of support and have been extensively tested. The next distribution, LFS or Linux From Scratch, is really just a project that provides the user with the steps necessary to build their own custom GNU/Linux distribution. This will yield the most customized operating system for the embedded computer but it will also require extensive amount of time and testing. Gentoo GNU/Linux is related to LFS due to its package management system called portage which instead of using pre-compiled binary packages it downloads the source code of every program, compiles it while also resolving all the dependencies needed by that program and then records the details of the process in a world file which can then be used to uninstall and track software packages. Unfortunately this process takes a lot of processing power and is not the best idea when using an embedded computer unless the compilation is distributed to other machines on the network. In our project's case this requires the assumption that there will be a server farm with the proper software installed and configured each time an software/security update needs to be applied, and is therefore not feasible. Debian GNU/Linux combines the best of both worlds and therefore was chosen for the distribution on the embedded computer. Debian has a very good package manager called dpkg and has also the ability to make packages from source therefore optimizing performance for certain applications like Apache. Debian has a dedicated security updates server which can be used to upgrade packages with holes in them, enabling our system to stay current and secure. Debian base install is very small requiring only around 130 MB of space. The base install involves configuring hardware via kernel modules, partitioning storage device(s), formatting the partition(s), installing the kernel and base system packages and some other minor configurations like time zones, keyboard layout, and network settings. The partitioning scheme used was a small 24 MB boot partition to hold the kernel and boot loader ( lilo ), around 256MB for a swap partition, and the rest for the root file system. The file systems chosen for each partition also required some evaluation. EXT3 was chosen for the boot partition because the journal file which is used to keep track of writes is small in size. EXT3 is also widely used and recovery tools support it well. ReiserFS 3.6 was chosen for the root partition because it has a significant performance advantage over other file systems for small file sizes, which is very useful when using a disk on chip flash device or a slow laptop hard drive. After the file systems were formatted, the standard kernel and base system were installed. The embedded computer was now running Debian GNU/Linux. Next compiling and configuring of the custom Linux kernel was performed. After downloading the source code from kernel.org, two kernel source code patches were applied. The first being the preemptive patch which adds a far greater degree of real-time responsiveness to the standard Linux kernel, by reducing interrupt latencies while kernel functions are executing. The second was the low latency patch, which provides similar enhancements. Both of them ( figure 23/24 ) combined yield a maximum scheduler latency value of 1.5 ms compared to the stock kernel value of 232.6 ms. In the context of the Linux kernel, scheduler latency is the time between a wakeup (the stimulus) signaling that an event has occurred and the kernel scheduler getting an opportunity to schedule the thread that is waiting for the wakeup to occur (the response). For an embedded computer this is really important and was one of the priorities. The reduced latency means that interrupts from the 37e12 i/o controller can be serviced faster and faster system response. After the kernel patches were applied to the source code it was further optimized for the specific hardware of the embedded computer, compiled and installed on the boot partition. Now that the core of the GNU/Linux system was finished the next step was installing the necessary software packages. This includes Apache ( used for web-server ), dhcpd-server ( used for a DHCP server ), shorewall ( used for a firewall/router ), webcam ( used for webcam image capture ) and PHP ( used as a scripting language ). Apache and PHP are used to host the XHTML/CSS/PHP content which is the front end for the lighting toolbox. DHCPD ( Dynamic Host Configuration Protocol Daemon ) is used to provide the local network clients connected to the box with IP's in the same range as what the web server is running on. Shorewall is a very customizable firewall script and since security of the embedded computer is a priority a firewall is a must. Webcam was used to capture images from the camera via the USB device. All the above software required extensive configuration to meet the project's specific needs the most important being Apache, which had to be configured such that it only initially starts one process and gradually spawns more as requests to the web site increase until it reaches five and then refuses all request to prevent system crashes. Finally the embedded computer is ready for the web front end. The front end is coded in CSS ( Cascading Style Sheets ), XHTML ( Extensible Hypertext Markup Language ), PHP ( PHP Hypertext Preprocessor ), and C. XHTML is a reformulation of HTML 4.0 in XML 1.0. XHTML is a new language for building web pages that has recently been proposed as a W3C Recommendation. This was chosen because its a W3C standard and is therefore supported by virtually all web browsers. CSS style sheets when attached to documents describe how the document is displayed or printed therefore changing the style or look of a web page only requires to change the style sheet. This was also chosen because its a W3C standard and enables future revisions of the front end to be changed simply by modifying the CSS file. PHP is an open source, server-side, HTML embedded scripting language used to create dynamic web pages. This was chosen because its a very common and easy to learn scripting language. The C program was the medium used for the web front end to directly interface to the 37e12 digital i/o board. The front end combined all of the above to provide a modular and dynamic web site which controlled the three lighting systems ( Figure 22 ). All source code is attached at the end of this report.

figure 23

figure 24

2004-04-16T12:28:34