Weblog
Ada for Embedded Programming
As progress moves forward the embedded processors gain more power, their functions and complexity of embedded software increase. The Ada programming language provides abstract and high-level constructs, that aid software engineers write large-volume, readable, robust, and maintainable programs. Coding in Ada propagates the utilization of modern software engineering techniques in embedded software. Moreover, ADA provides the high-level abstraction and expressive power required to make software easy to design and test.
The language’s high-level features efficiently reduce the scope of support code needed to be written by developers. The high-level constructs provide the expressive power which assists developers create readable code, and avoid error-prone cases when it comes to low-level operating system primitives.
Restricting the language
Developers have been successfully using Ada for several decades to create embedded real-time systems demanding high reliability and performance. Specifically, Ada allows embedded-system programmers constrain the language features to a clearly defined subset through limiting language constructs, that aids to reduce memory footprint and simplifies analysis.
The bulk of general-purpose languages utilize this subset approach, however, there are two aspects that make Ada unique. One is that the notion of such subsets programmers get as a part of the language standard, but not as an external feature. And another one is that programmers can choose the features in the subset, that gives them great flexibility while determining their particular coding norms.
Ada determines configuration directives, that can limit individual features or determine the complete set of cohesive restrictions.
Safe and efficient tasking
A significant area of enhanced flexibility in Ada 2005 is task dispatching policies. In Ada 95, the single predefined policy is the fixed-priority preemptive scheduling, though other policies are allowed. Ada 2005 offers further pragmas, policies, and packages, which simplify lots of different mechanisms like non-preemption within priorities and earliest deadline first policy. Besides, one can mix various policies by priority levels within a partition.
Ada 2005 supports monitoring and control of execution time, which is crucial for many real-time systems. The above functionalities allow detection at run time of an excessive consumption of computational resources. These problems are usually caused by either program or design errors made in the computation of worst-case execution times.
Low-level programming
For the largest part of embedded software development projects, a developer needs to access hardware-specific features. Ada language supports the interposition of machine operations, like vector processing instructions or direct operations on I/O ports. Also, ADA 2005 allows close mapping of data structures to the hardware (one can specify the needed location, size, alignment, and data layout in physical memory).
Utilization of representation clauses to map software data structures to memory-mapped devices. Ada enables the specification of the needed location, size, and data layout in physical memory. Strong typing and validations provide additional robustness, granting that data exchanged with the device correspond to the system specification.
The usage of Ada high-level constructions simplifies the development, reviews and analysis of code. Besides, lots of embedded applications require high integrity or availability, and here is a language designed for maximum reliability really shines.
Ada effectively interfaces with subsystems implemented in other languages, including board support packages and kernels, moreover it can call subprograms written in other languages, and conversely.
Conclusions
Ada is a well designed and powerful programming language, that allows an efficient use of high-level abstract development methods in embedded environments. Using Ada for low-level programming one can generate readable, robust, and supportable code, while keeping resource utilization under control.
Ada’s unique functionalities and built-in robustness make it the right language for implementation of elaborated embedded software, boosting the utilization of up to date and sound software engineering techniques in embedded systems with scarce resources.