You are here: Home / RTLWS 1999-2017 / RTLWS Submitted Papers / 
2024-04-25 - 18:05

Real Time Linux Workshops

1999 - 2000 - 2001 - 2002 - 2003 - 2004 - 2005 - 2006 - 2007 - 2008 - 2009 - 2010 - 2011 - 2012 - 2013 - 2014 - 2015

15th Real Time Linux Workshop, October 28 to 31, 2013 at the Dipartimento Tecnologie Innovative, Scuola Universitaria Professionale della Svizzera Italiana in Lugano-Manno, Switzerland

Announcement - Call for participation (ASCII)Hotels - Directions - AgendaPaper Abstracts - Presentations - Registration - Abstract Submission - Sponsors - Gallery

Automatic generation of controls code from models for real-time Linux platforms

Bruno Morelli, Evidence Srl, Italy
Riccardo Schiavii, Evidence Srl, Italy
Claudio Scordinoi, Evidence Srl, Italy
Paolo Gaii, Evidence Srl, Italy
Marco Di Natale, Scuola Superiore Sant'Anna, Italy

The Model-Based Design (MBD) development methodology is today widely used in several application domains like automotive, aerospace and controls (e.g., for the design/development of engine control units). MBD can provide a significant reduction of development time and costs for embedded software by leveraging the possibility of early verification and validation of functionality.

In MBD, a model of the control functions is developed together with a model of the controlled system (or plant) and the behavior (within and possibly also outside the specification range) is verified by simulation and, in safety critical systems, by model checking. Automatic code generation techniques are then used to generate a software implementation of the model that is equivalent to the model, without the possibility of adding errors in a manual coding stage.

Commercial MBD tools offer an implementation path that is mostly oriented to single-core machines, with limited support for multithreading and use of OS and device driver functionality. Free or open source tools for MBD have been historically limited by the lack of efficient code generation methods and the absence of integrated support for both the dataflow and finite state machine formalisms.

In this paper, we present our experience in the design and realization of an industrial tool for the automatic code generation from ScicosLab models with full support for Linux and RTAI. ScicosLab, a free system modeler and simulator has been extended with add-ons for the modeling of hierarchical Finite State Machines (FSMs) and a GUI prototyper based on the Qt graphical libraries.

The thread model and the integration with IO and data acquisition in the Linux and RTAI environments are supported by our code generator tool and custom blocksets based on the Comedi libraries.

The code generator can support multiple periodic functionality mapped into a set of concurrent linux threads, guaranteeing the preservation of the model semantics in interthread communication by leveraging wait-free buffers.

We describe the design decisions, the challenges and issues that we have encountered during the design and development of our toolset, including the realization of the thread generation on Linux, the communication mechanisms, the access to I/O and the methods used to abstract from the architecture-specific I/O details and the concurrent usage of PCI and video.

We also show an example of generated code and a set of performance measurements on a real hardware equipped with a professional data acquisition peripheral.