Why Use Polyspace Static Code Analysis with Embedded Coder in Model-Based Design?

Model-Based Design with Embedded Coder is a powerful approach for developing embedded software, especially in high-integrity applications across automotive, aerospace, and industrial automation industries. The approach enables engineers to automatically generate production-quality C/C++ code directly from Simulink models, reducing manual coding effort and minimizing human error.

But even with automated code generation, ensuring software correctness, safety, and compliance remains essential. This is where Polyspace static code analysis plays a critical role.


Embedded Coder: Automating Production Code Generation

Embedded Coder:

  • Generates optimized, deterministic C/C++ code from models
  • Supports integration with embedded targets, real-time operating systems (RTOS) environments, and hardware interfaces
  • Is widely used in compliant workflows such as ISO 26262, DO-178C, and IEC 61508

While the generated code is highly reliable, it’s still possible for issues to arise from external influences such as:

  • Modeling errors
  • Incorrect configuration settings
  • Edge cases not handled in the model

Polyspace: Formal Verification Without Code Execution

Polyspace is a static code analysis tool that:

  • Detects run-time errors—such as divide-by-zero, overflows, out-of-bounds access, and uninitialized variables—without executing the code
  • Uses formal methods to prove the absence of certain classes of coding bugs
  • Checks MISRA™ compliance and other coding standards
  • Generates metrics to understand code quality

Why Use Polyspace with Embedded Coder?

 

1. Independent Verification

Polyspace provides a formal, independent check of the generated code, increasing confidence in its correctness.

2. Detect Model or Configuration Issues

If the model or code generation settings introduce potential run-time errors, Polyspace flags them early in the development process.

3. Mixed Code Scenarios

Most real-world projects combine generated code with manually written code, such as:

  • Device drivers for sensors and actuators
  • RTOS services and hardware abstraction layers

These manually written components can introduce issues like null pointer dereferences, buffer overflows, and MISRA violations.

Polyspace analyzes the entire integrated codebase (generated and manually written), ensuring:

  • Interface consistency between modules
  • Absence of certain run-time errors across boundaries
  • Compliance with functional safety standards for the full system

4. Certification Readiness

Safety standards like ISO 26262, DO-178C, and IEC 61508 require evidence of code verification. Polyspace results can serve as certification artifacts.

5. Coding Standards Compliance

Polyspace checks compliance for both generated and manually written code, ensuring uniform quality.

6. Continuous Quality Assurance

Integrating Polyspace into CI/CD pipelines ensures ongoing verification as models and code evolve.

Learn more about Polyspace static code analysis products, including Polyspace Test, which helps you develop, manage, and execute tests for C/C++.