Production Code Generation for Automotive ECUs

Production code generation converts models into production code for electronic control units (ECUs) in seconds or minutes instead of weeks or months, which has enabled OEMs and suppliers to complete complex ECU projects in 18 months, achieve 90% code reuse, and start a vehicle on the first attempt.

With millions of lines of code automatically generated using MathWorks products running in ECUs today, The MathWorks continues to develop innovative technologies that production organizations need for software architecture and design, production code generation and integration, code verification, and ISO 26262 certification.

Automating Verification and Validation with Simulink

Software Architecture and Design

Simulink and Stateflow are used by OEMs and suppliers to develop powertrain, chassis, safety, body, infotainment, and other automotive system designs. Using executable specifications instead of static diagrams accelerates design, clearly expresses the algorithm’s intended behavior, and enables early verification and validation. Key architecture and design features supported include AUTOSAR software component modeling and floating- to fixed-point data conversion using Fixed-Point Designer™.

Code Generation and Integration

Embedded Coder® generates embedded code from design models. The code can be used for on-target rapid prototyping or production code deployment. With on-target rapid prototyping, algorithms are run on the actual or emulated production ECU, reducing hardware cost and improving execution fidelity. With production code generation, ANSI/ISO C or C++ is generated by default for any device. In addition, code is easily optimized for specific MCUs or DSPs using flexible APIs. Integrating hand-written code during simulation or code generation is supported using the legacy code tool, preserving your software investment and enabling incremental adoption of code generation technology.

SAE Congress 2009 paper

Production Code Verification

Software-in-the-loop (SIL) and processor-in-the-loop (PIL) testing form the cornerstone of production code verification by automating execution and comparison of code results with reference model behavior. Creating an environment to test your specific ECU is supported using PIL APIs. Bidirectional linking of model and code allows you to trace each line to every block and state in the model, aiding debugging and verification. You can author, execute, review, and organize tests and test suites using Simulink Test™. You can calculate structural coverage of the generated code using Simulink Coverage™ to measure testing completeness. Optional support for commonly used IDEs and processors is available using Embedded Coder. Finally, Polyspace® code verifiers let you examine generated or hand-written code for possible run-time errors and MISRA C®-2004 code compliance.

ISO 26262 Certification

ISO 26262 and IEC 61508 automotive safety standards are important for chassis and safety applications. TÜV SÜD has certified Embedded Coder and Polyspace code verifiers, including MISRA C-2004 code analysis, to ISO 26262 and IEC 61508. The TÜV SÜD certificates and certification reports are available in the IEC Certification Kit. TÜV SÜD certifications are based on application-specific verification and validation workflows that are also provided in the IEC Certification Kit.