Model driven development has become state of the art in embedded systems software design. To take the resulting models to the designated hard- ware platform, automated code generation is sought for. The code obtained thereby must match the se- mantics of the model as closely as possible. In this paper we present an approach to translate Component Language (COLA) models to C code in an automated manner. This process involves handling of target specific sensors and actuators, and distribution of software across multiple nodes. We therefore also describe our middleware layer, which is configured in an unattended manner. Using a prototypical implementation of the tool- chain, we validated our approach on a case study using LEGO R MindstormsTM, which shows all characteris- tics of embedded systems. This case study includes benchmarks comparing the automatically generated code to a hand-written version providing the same functionality. (COLA) (3) was built to tackle the complexity of such large scale systems in a framework consistent across all layers of abstraction. COLA has a slender syntax, which caters for easy understanding, and it is defined by a rig- orous formal semantics. At higher levels of abstraction then formal verification, e.g., using model checking, can be applied to guarantee conformance with requirements. These characteristics make COLA well-suited for devel- opment of mission-critical real-time systems. The complexity of the modeled system not only necessi- tates proper abstractions, but also calls for automation to take a model to an executable object, and later to a func- tional integrated system. An automated translation re- duces errors and further guarantees reproducible results, and thus improves overall quality. The process of trans- lation is best compared to that of a software compiler. Given a functional model, usually as a piece of source code, a runnable entity is produced. A simple model of the system will comprise three layers: the software, an operating system, and the (single piece of) hardware. Compiler and linker will be given all constraints imposed by the operating system and the target hardware plat- form to obtain an appropriate piece of software. Apart from the straightforward translation, a fundamental job of today's compilers is optimization in terms of size and execution speed. Therefore, a set of rules is built into the compiler to obtain runnable entities optimized for a given platform and operation system. In embedded systems, we will call this process systems compilation, since the compilation must be accomplished for the overall system model, where the involved software and hardware components may be of various types. The target platform to operate on likely invalidates several assumptions made at model level, or exposes properties that are not captured by functional/behavioral model- ing. Furthermore, the distributed nature of the target hardware must be accounted for. Here, both translation and optimization are by no means straightforward. As per translation, often a heteroge- neous heap of models and requirements must be consid- ered to obtain a valid runnable entity (cf. (4)). Further, in general a certain level of black magic performed by engineers is required to fit the software and hardware components onto the target platform.
更多