Ada Watch: Bringing Ada onto the battlefield

Blog

The growth in smartphones and tablets is radically changing the face of military technology. As in civilian life, the power of commercial off-the-shelf (COTS) handheld devices is enabling fast, frontline access to systems that previously required larger, bulkier computers. For example, ruggedized phones and tablets now have the processing power to access mission-critical command and control and communication systems, while being portable enough to fit into a pocket. In these systems the original operating system (OS) and consumer-oriented applications are replaced by customized versions that include domain-specific software using proprietary and/or confidential algorithms.

However, as with every new technology introduced into the military, handheld devices need to meet stringent security and reliability requirements, and, in an era of straitened budgets, have to re-use existing software and skills as much as possible.

Ada on the frontline

As a language originally sponsored by the Department of Defense (DoD), Ada has always been heavily used within the military and aerospace domains. Designed for long-lived applications, its combination of safety, security, and reliability make it a natural choice for mission-critical systems. However, in the past Ada programming has tended to focus on large software systems, with thousands or millions of lines of code. In a changing world, how can the benefits of Ada be brought to handheld devices, without compromising safety, security, or reliability?

At AdaCore we recently had the chance to find out. We were approached by the U.S. Army, which was looking to take existing Ada applications that were run on larger systems and deploy them on ruggedized Android tablets that could be used on the battlefield. We provided our GNAT Pro 7.2 cross-development environment for ARM Cortex processors running Android as the tool to port the software.

Bringing Ada and Java together

Hosted on Windows and Linux, this GNAT Pro release is an Ada toolsuite for developing and maintaining Android applications using a mixture of Ada and Java. Developers can leverage the benefits of the Ada language, while also taking advantage of the Java libraries and services provided by the Android platform for implementing the user interface. Applications can also be written solely in Ada, or in a combination of Ada and other native languages.

For this application, developers could therefore take advantage of Ada and its safety-critical properties and high performance, while using a GUI written in Java for ease of use in the field. Portions of the existing Ada application were ported to Android with minimal modifications.

GNAT Pro 7.2 includes a new version of GNATbench, the AdaCore plug-in extending Eclipse into an Ada IDE. Along with general enhancements, this new version includes a dedicated plug-in providing end-to-end support for mixed Ada-Java development on Android. Starting with a specific wizard that handles all the project setup details, users need only specify the Ada packages to be called from the Java application.

Building the project automatically invokes AJIS (the Ada-Java Interfacing Suite) to generate all Java code required to call the Ada code, compiles the Ada code into a shared library referenced from the Java side, and makes both available to the Java project. Any changes to the set of Ada interface packages, or to the Ada code in those packages, are automatically detected and handled by the builder. To improve performance, the tool doesn’t regenerate Java code if it is already present. The generated Java is high-level and thus avoids the error-prone direct use of JNI. Furthermore, the Ada and Java code are fully integrated within the IDE, allowing – for example – navigation within the editors. Finally, debugging the Ada code is supported via the normal Eclipse/CDT debugger GUI.

The development of the handheld application is ongoing, but the team is already seeing real benefits from this best-of-both-worlds approach. From a business case they can re-use existing Ada applications and components, and development and training costs are minimized, reducing the investment needed while maximizing the results.

With the cost of handheld COTS hardware falling and its processing power increasing rapidly, the military world is looking at how handheld devices can improve operations. As our experience shows, the combination of Ada for creating safety-critical, reliable code and Java for graphical functionality provides the opportunity to extend existing systems to the frontline on smaller, more portable devices – without compromising security or usability.