Image

Generate Qualifiable and Tunable Code Using Model-Based Tools

Oct. 31, 2016
Adacore’s QGen generates qualifiable and tuneable MISRA C or SPARK code based on Mathworks Simulink and Stateflow models.

The demand for qualified code is rising. It is already a requirement for applications such as avionics where the process is rigorous. A completely different process is needed for automotive and medical applications, but the need for using the proper process and tools is there, as well.

Many applications can be defined using model-based development tools like the Mathworks Simulink and Stateflow tools. There are other graphically oriented model-based tools like National Instruments' LabView. There is also the Object Management Group's (OMG) Unified Modeling Language (UML). UML is available from a number of vendors, and the open-source Eclipse project supports UML with its Model Development Tools (MDT).

Most of these model-based tools can be used to generate code using languages like C, C++, and Java. For example, The Eclipse UML to Java Generator uses the Acceleo code generator to transform UML code to Java code. This allows for the creation of applications directly from models without requiring manual translation. The challenge for developers requiring qualified code is that the process starts with the generated code. This can be challenging if changes need to be on the generated code side.

Adacore’s QGen generates qualifiable and tuneable MISRA C or SPARK, a subset of Ada 2012, code based on Mathworks Simulink and Stateflow models (Fig. 1). The keyword is qualifiable.

1. Adacore’s QGen generates qualifiable and tunable MISRA C or SPARK code based on Mathworks Simulink and Stateflow models like this.

Adacore provides DO-178B/C, EN 50128 and ISO 26262 qualification material for both the code generator and the model verification tools that are part of QGen. The QGen code generator also has a TQL1 qualification kit.

In addition, QGen uses static analysis to detect errors. This addresses safety and logic errors, and run time checking can be included, as well. Functional and safety properties are modeled using the Assertion block.

There are some restrictions, though, because QGen works on a safe subset of more than 120 Simulink block types. This allows the models to be provable, and is also why MISRA C and SPARK are the targets. Both are subsets of their respective languages, C and Ada, that target qualifiable applications. Part of the idea is to remove error prone code before it can be included in an application. QGen is integrated with Simulink to allow compatibility checking of models (Fig. 2).

2. QGen is integrated with Simulink to allow compatibility checking of models for compatibility with the code generator.

QGen is integrated with AdaCore’s GNATemulator and GNATcoverage tools. This allows streamlined Processor-In-the-Loop (PIL) testing. GNATcoverage structural coverage analysis is provided up to MC/DC without any code instrumentation during PIL testing.

Not all applications will require the level of qualification that QGen can deliver, but that does not mean it should not be considered for applications where qualification is not a requirement. One of the reasons for qualifying an application is to greatly reduce the number of or eliminate all errors. This is usually a goal for most applications, although attaining that level can be costly. Using a code generator like QGen can move towards that goal while reducing programming and debugging costs.

About the Author

William G. Wong | Senior Content Director - Electronic Design and Microwaves & RF

I am Editor of Electronic Design focusing on embedded, software, and systems. As Senior Content Director, I also manage Microwaves & RF and I work with a great team of editors to provide engineers, programmers, developers and technical managers with interesting and useful articles and videos on a regular basis. Check out our free newsletters to see the latest content.

You can send press releases for new products for possible coverage on the website. I am also interested in receiving contributed articles for publishing on our website. Use our template and send to me along with a signed release form. 

Check out my blog, AltEmbedded on Electronic Design, as well as his latest articles on this site that are listed below. 

You can visit my social media via these links:

I earned a Bachelor of Electrical Engineering at the Georgia Institute of Technology and a Masters in Computer Science from Rutgers University. I still do a bit of programming using everything from C and C++ to Rust and Ada/SPARK. I do a bit of PHP programming for Drupal websites. I have posted a few Drupal modules.  

I still get a hand on software and electronic hardware. Some of this can be found on our Kit Close-Up video series. You can also see me on many of our TechXchange Talk videos. I am interested in a range of projects from robotics to artificial intelligence. 

Sponsored Recommendations

Comments

To join the conversation, and become an exclusive member of Electronic Design, create an account today!