Modeling and Generation for Embedded Software with eTrice

Modelling gets products to market faster

The open source project Eclipse eTrice provides a modeling tool for embedded software. Model editors, code generators and runtime libraries for the target languages C, C++ and Java enable model-driven development of embedded systems. The modeling language used is Real-Time Object-Oriented Modeling (ROOM). PROTOS leads this Eclipse project and provides the majority of the developers.

Read more

Why model software?

A large part of new software is still written by hand in the respective target language. This approach allows implementing very specific solutions for programming tasks at hand.

On the other hand, there is for several decades the approach to model software and generate the source code from these models. As an example of this, the family of Matlab tools can be mentioned.

A prerequisite for the meaningful use of modeling and code generation in software development is that one is dealing with a class of similar problems. Examples of this are the programming of controllers or the creation and design of user interfaces from a library of widgets and layout components.

Under the aforementioned conditions, modeling and code generation in the area of software development generally offer the following advantages:

  • Support of standardized procedures and thus better predictability.
  • Largely error-free with a well-validated code generator
  • Concentration on the essentials
  • The developer does not have to program down repetitive text modules.
  • Automatic use of proven methods
  • Increased development speed
  • Documentation can be generated by the model itself and also as a document

Abstraction and automation

The advantages of modeling and code generation ultimately go back to a principle that we can call "abstraction and automation" and which is shown schematically in the following diagram.

Abstraktion und Automation

Features of eTrice

Textual editor for model files

The models are stored in a purely textual and easily readable form. The textual notation is based on ROOM. There is a rich editor with keyword highlighting, content wizard, overview view and a library of text modules.

Models can import other models, allowing libraries to be created at any granularity.

Another advantage of textual models is that when working with a version control system, any merge conflicts that may arise can be easily resolved.

Graphical editor for the structure

This editor can be used to conveniently edit the structure in a diagram as an alternative to the textual representation. The diagram is based on the textual model and modifies it, but the layout is saved separately. The graphical notation is part of ROOM.

Graphical editor for state machines

State machines, especially hierarchical ones, are much clearer in a diagram representation than in pure text. This makes it easy to create and arrange all the elements. The diagram is based on the textual model and modifies it, but the layout is stored separately. The graphical notation is part of ROOM.

Code Generators

eTrice has code generators in the target languages C, C++ and Java. The generation in C is designed for target hardware with scarce resources.

Runtime libraries

The runtime libraries include infrastructure such as messaging and debug support, such as generating sequence diagrams from the running application. Since eTrice integrates perfectly with JDT or CDT within the Eclipse IDE, very short development cycles are possible.

Mastering Software Complexity

Benefits of eTrice: Mastering Complexity

The great challenge in developing real-time software is its considerable complexity, which manifests itself in a whole range of different aspects. The Eclipse open source project eTrice helps you to master this complexity by its limitation to the essentials as well as by its simple, clear and at the same time powerful concepts.

  • Structural Complexity
    • Modeling of the system architecture as a hierarchical, static structure.
  • Behavioral complexity
    • Use of hierarchical state machines (FSM).
  • Collaboration
    • Separation of interface and implementation facilitates the division of work in the project.
    • Textual notation is excellent for use with a version control system.
  • Complexity of concurrent and distributed systems.
    • Weakly coupled, asynchronously communicating components (actuators in ROOM) can be easily partitioned among threads, processes, and nodes.
  • Variations and Reuse, Product Lines.
    • Actuators are predestined for their reuse in new systems and structures.
    • Actuators become interchangeable through the use of protocols and ports.
    • Variant creation through model-level inheritance: protocols, actuators, state machines.
    • Creation of model libraries.
  • Troubleshooting
    • Debugging at model level: animation of state machines, display and manipulation of data, injection of messages, generated sequence diagrams.
    • Automated model checking helps to find errors before they occur.

Integration and extensibility

A key feature of eTrice is its design for and openness to integration. This includes quite different aspects, which will be discussed in the following.

Integration with Matlab

eTrice is not only suitable for event-driven systems. In addition to the message-based communication from ROOM, eTrice also offers the possibility of data-oriented communication. Thus, eTrice allows the encapsulation of control elements in actuators and their integration into an otherwise event-driven system. For example, models from the Matlab family can be easily integrated into systems modeled with eTrice,

Integration with manual code

By default, the behavior of eTrice actuators is modeled using finite state machines. However, it is equally possible to implement the behavior manually. A simple annotation in the model instructs the code generator to generate the code accordingly.

Integration with other Eclipse-based tools

Last but not least, the Eclipse IDE is a platform for integrating tools. Thus, eTrice can be conveniently used in association with CDT or JDT (depending on the target language). But since e.g. chip manufacturers also often offer an Eclipse-based IDE, eTrice can also be integrated there.

Basis for other tools

Of course, eTrice also integrates with other modeling tools. For example, CaGe, the modeling tool for tests from the Protos miniHIL product, builds on eTrice. Test sequences are generated by it as a ROOM model, from which eTrice then generates the target code.

The open source project Eclipse Franca allows generating eTrice actuators from specified interfaces, which implement these interfaces as mock-up. At the same time, an actuator is generated as a test driver.

But also on source code level, eTrice can be integrated into other tools, e.g. the graphical and textual editors for finite state machines.

How to use eTrice for embedded software modeling

eTrice Consulting and Engineering

PROTOS offers professional services for model-driven development of embedded systems with the open source tool eTrice. If you want to know more, please contact us!