CURRENT ISSUE Contests
Feature Article
|
|
Issue #212 March 2008
Robotics with Ada95
by Daniel Ramirez
Start | Why Use Ada95 For Robotics? | GNAT Ada95 Tools | Debugging Ada95 Applications | Ada95 Coding Style |Wireless Sensor Controller | Wireless Messages | The Glove In Action | XYZ Accelerometers | XBee-PRO Wireless UART | Controller Range | USB 2.0 Interface | Ethernet | The Kernel | Ada95 vs. Other Languages | Future Applications | Sources & PDF
THE KERNEL
The Windows runtime kernel evolved from a cooperative multitasking operating system to the sophisticated preemptive multitasking and multiprocessing operating system that it is today. Windows is quite an amazing system that can automatically schedule daily, weekly, and monthly tasks such as maintenance, disk defragmentation, space compression, and more. Like the human body, Windows can also repair itself from damage caused by hard disk bad sectors, viruses, worms, and other electronic maladies (e.g., controller failures, SRAM parity errors, bus errors, and voltage spikes). Antivirus software from Norton and MacAfee act in a similar manner to medicines and vaccines used to treat and cure diseases.
Even Unix, Linux, embedded Windows CE, and the Mac operating system are susceptible to these problems, although not to the same extent because hackers do not target them as often. But for Windows, this is a major problem. Windows is an excellent system for current-generation laptops and PCs (over 1 billion copies used worldwide), in part because of the conveniences it affords, including Word, Excel, PowerPoint, Microsoft Schedule, Visual Basic, Visual C++, and many other excellent tools that have been continuously improved over the years following Bill Gates’s vision.
While all of this sounds scary, the free version of GNAT Ada95 runs on Windows, Unix, and Linux. (A commercial version sold by Aonix runs under LynxOS.) It is a good platform for non-life-critical applications, but don’t try to develop a yacht navigation system with it. Instead, purchase the commercial versions of Ada95 for that purpose. Versions of GNAT Ada95 are also available for LynxOS, Linux, Unix, Red Hat Unix, and other operating systems.
The solution for developing life-critical embedded software is to use an embedded real-time runtime operating system (e.g., IBM Rational, LynxOS, Wind River VxWorks, and Aonix) or use a software development language that includes a runtime as part of the language (e.g., Rational APEX Ada95). Today’s option is to use Ada95 with one of the POSIX-compliant runtimes mentioned above. The runtime is tailored to the language and hardware platform (e.g., Intel Pentium, PowerPC, MIPS, SPARK, ARM, or any popular computer architecture).
A problem that could arise with a Java or C++ medical application is if the Windows kernel decides that it is time to schedule a high-priority internal Windows task. In order to do so, it has to preempt the user’s application, which could be a life-critical application used to read a patient’s heart rate or EKG during a critical operation. That would make the application miss a scheduled system call inside a real-time task or thread while reading the transducers. The scenario is less likely to occur with a dedicated real-time operating system such as Rational APEX, LynxOS, and VxWorks. The operating systems will also work for other languages such as C++ and Java. Real-time operating systems and runtime kernels have been around for many years and have been continuously improved and optimized to the highest commercial standards for use in embedded enterprise, military, space, and medical applications using a set of standard POSIX-compliant system calls. Commercial variants of Ada95 from IBM Rational, Aonix, and Green Hills have been tailored to POSIX-compliant Ada95 runtimes that work with the Ada95 rendezvous and tasking models to provide robust fault-tolerant performance over a wide variety of life-critical embedded applications.
New applications are being developed for parallel processors and supercomputers used by astronomers and physicists as a replacement for the venerable FORTRAN language that has served the scientific community since the mid-1950s. Ada95 maps well to these applications, including common statements, global memory, and parallelizing expressions.
Ada95 shares many of the features found in other languages including C++ and Java: data abstraction, type checking, range checking, records (C++ structs), object-oriented programming, tagged types (C++ classes), inheritance, generics (C++ templates), multithreading, tasks (multithreading and multitasking), interrupt handling, error handling, exception statements (catch, throw, and try), and raise statements. Although the free version of GNAT Ada95 is not POSIX-compliant and does not have all the optimizations that the commercial variants provide, it may be used for non-life-critical applications and for learning the safety features of the language.